@zombie-mermaid/svg-renderer 5.14.0 → 5.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,24 +1,24 @@
1
- import{DEFAULTS as e,applyThemeVariables as t,buildStyleBlock as n,checkGraphSize as r,checkLimit as i,checkLineLength as a,detectDiagramType as o,dropInvalidColors as s,escapeAttr as c,escapeXml as l,extractAccessibility as u,f as d,findBackEdgeIndexes as f,findBackEdges as p,formatCssColor as m,getReadableTextColor as h,isMonospaceFont as g,measureMultilineText as _,measureTextWidth as v,mixSrgb as y,niceTickValues as b,niceTickValues as x,parseCssColor as S,renderMultilineText as C,renderMultilineTextWithBackground as w,resolveNodeStyle as T,safeHref as E,sanitizeClassName as D,setMonospaceMetrics as O,splitStatements as k,styleOpenTag as A,subgraphDirectionIsHonored as ee,subgraphFeedbackEdges as j,subgraphsTied as te,svgOpenTag as M,themeStyleDeclarations as N,withDirectionOverride as P,withoutOwnClusterEdges as ne}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as F,architectureToGraph as re,c4BoundaryTypeLine as ie,c4RelLabelLines as ae,c4TypeLine as oe,formatClassMember as se,getSeriesColor as ce,parseArchitecture as le,parseC4Diagram as ue,parseClassDiagram as de,parseErDiagram as fe,parseMermaid as pe,parsePieChart as me,parseQuadrantChart as he,parseSequenceDiagram as ge,parseXYChart as _e}from"@zombie-mermaid/mermaid-parser";import{decodeXML as ve}from"entities";var ye;async function be(){if(ye)return;let e=await import(`./inter-font-subset-DT2grXy3.js`);ye={family:e.INTER_FONT_FAMILY,faceCss:e.INTER_FONT_FACE_CSS}}function xe(e){if(e.embedFont===`subset`){if(!ye)throw Error("embedFont: 'subset' needs its font data loaded first: use renderMermaidSVGAsync(), or `await loadEmbeddedFont()` before renderMermaidSVG().");return ye}}function Se(e){return d`M ${e.x} ${e.y}`}function Ce(e){return Se(e[0])+e.slice(1).map(e=>d` L ${e.x} ${e.y}`).join(``)}function we(e){if(e.length<3)return Ce(e);let t=e[e.length-1],n=[Se(e[0])],r=(e,t,n)=>d` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+d` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+d` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(d` L ${(5*e[0].x+e[1].x)/6}`+d` ${(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(d` L ${t.x} ${t.y}`),n.join(``)}function Te(e){if(e.length<3)return Ce(e);let t=[Se(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(d` L ${i.x} ${i.y}`);continue}let c=Math.min(12,o/2,s/2),l=i.x-(i.x-r.x)/o*c,u=i.y-(i.y-r.y)/o*c,f=i.x+(a.x-i.x)/s*c,p=i.y+(a.y-i.y)/s*c;t.push(d` L ${l} ${u}`),t.push(d` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(d` L ${n.x} ${n.y}`),t.join(``)}function Ee(e,t){let n=[Se(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(d` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(d` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(d` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(d` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function De(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return Se(e[0]);switch(t){case`basis`:return we(e);case`natural`:return Te(e);case`step`:return Ee(e,`mid`);case`stepBefore`:return Ee(e,`before`);case`stepAfter`:return Ee(e,`after`);default:return Ce(e)}}function Oe(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var ke=null,Ae=null,je=null,Me=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function Ne(e){ke=e,Ae=null,je=null}function Pe(){let e=globalThis.process;if(!e?.versions?.node||typeof e.getBuiltinModule!=`function`)return null;let t=e.getBuiltinModule(`node:module`);if(!t)return null;let n=[`elkjs`,`lib`,`elk.bundled.js`].join(`/`),r=[typeof __filename==`string`?__filename:import.meta.url,new URL(`file://${Fe(e)}/`).href];for(let e of r)try{let r=t.createRequire(e)(n),i=typeof r==`function`?r:r.default;if(typeof i==`function`)return i}catch{}return null}function Fe(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var Ie=20;function Le(e=Ie){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function Re(e){if(Array.isArray(e))return`[${e.map(Re).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Re(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function ze(){if(Ae&&je)return je;let e=ke??=Pe();if(!e)throw new Me;let t=[],n=globalThis.setTimeout;globalThis.setTimeout=(e,r)=>r===0?(t.push(e),0):n(e,r);let r=globalThis,i=Object.getOwnPropertyDescriptor(r,`self`),a=`self`in r&&r.document===void 0&&i?.configurable!==!1,o=a&&r.global===void 0;a&&(Object.defineProperty(r,"self",{value:void 0,configurable:!0,writable:!0}),o&&(r.global=globalThis));let s;try{s=new e}finally{a&&(i?Object.defineProperty(r,"self",i):delete r.self,o&&delete r.global),globalThis.setTimeout=n}if(!Oe(s))throw Error(`zombie-mermaid: registerElk() needs the ELK class from 'elkjs/lib/elk.bundled.js' (or 'elkjs/lib/main.js'), whose synchronous worker this renderer drives directly.`);return Ae=s,t.forEach(e=>e()),je=Ae.worker.worker,je}function Be(e,t){let n=t,r=n?Re(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=ze(),a=e=>{let t,n,r=i.onmessage;return i.onmessage=e=>{e.data.error?n=e.data.error:t=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=r,{result:t,error:n}},{result:o,error:s}=a(e);if(String(s?.message??s).includes(`Invalid hitboxes`)&&({result:o,error:s}=a({...e,layoutOptions:{...e.layoutOptions,"elk.layered.compaction.postCompaction.strategy":`NONE`}})),s)throw s;if(!o)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,o),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return o}var Ve=`JetBrains Mono NL`,He=`@font-face {
1
+ import{DEFAULTS as e,LINE_HEIGHT_RATIO as t,applyThemeVariables as n,buildStyleBlock as r,checkGraphSize as i,checkLimit as a,checkLineLength as o,detectDiagramType as s,dropInvalidColors as c,escapeAttr as l,escapeXml as u,extractAccessibility as d,f,findBackEdgeIndexes as p,findBackEdges as m,formatCssColor as h,getReadableTextColor as g,isMonospaceFont as _,measureMultilineText as v,measureTextWidth as y,mixSrgb as b,niceTickValues as x,niceTickValues as S,parseCssColor as C,renderMultilineText as w,renderMultilineTextWithBackground as T,resolveNodeStyle as E,safeHref as D,sanitizeClassName as O,setMonospaceMetrics as k,splitStatements as ee,styleOpenTag as A,subgraphDirectionIsHonored as j,subgraphFeedbackEdges as te,subgraphsTied as ne,svgOpenTag as M,themeStyleDeclarations as re,withDirectionOverride as N,withoutOwnClusterEdges as ie}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as ae,architectureToGraph as oe,c4BoundaryTypeLine as se,c4RelLabelLines as P,c4TypeLine as F,formatClassMember as ce,getSeriesColor as le,parseArchitecture as ue,parseC4Diagram as de,parseClassDiagram as fe,parseErDiagram as pe,parseMermaid as me,parsePieChart as he,parseQuadrantChart as ge,parseSequenceDiagram as _e,parseXYChart as ve}from"@zombie-mermaid/mermaid-parser";import{decodeXML as ye}from"entities";var be;async function xe(){if(be)return;let e=await import(`./inter-font-subset-DT2grXy3.js`);be={family:e.INTER_FONT_FAMILY,faceCss:e.INTER_FONT_FACE_CSS}}function Se(e){if(e.embedFont===`subset`){if(!be)throw Error("embedFont: 'subset' needs its font data loaded first: use renderMermaidSVGAsync(), or `await loadEmbeddedFont()` before renderMermaidSVG().");return be}}function Ce(e){return f`M ${e.x} ${e.y}`}function we(e){return Ce(e[0])+e.slice(1).map(e=>f` L ${e.x} ${e.y}`).join(``)}function Te(e){if(e.length<3)return we(e);let t=e[e.length-1],n=[Ce(e[0])],r=(e,t,n)=>f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(f` L ${(5*e[0].x+e[1].x)/6}`+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(f` L ${t.x} ${t.y}`),n.join(``)}function Ee(e){if(e.length<3)return we(e);let t=[Ce(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(f` L ${i.x} ${i.y}`);continue}let c=Math.min(12,o/2,s/2),l=i.x-(i.x-r.x)/o*c,u=i.y-(i.y-r.y)/o*c,d=i.x+(a.x-i.x)/s*c,p=i.y+(a.y-i.y)/s*c;t.push(f` L ${l} ${u}`),t.push(f` Q ${i.x} ${i.y}, ${d} ${p}`)}let n=e[e.length-1];return t.push(f` L ${n.x} ${n.y}`),t.join(``)}function De(e,t){let n=[Ce(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(f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function Oe(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return Ce(e[0]);switch(t){case`basis`:return Te(e);case`natural`:return Ee(e);case`step`:return De(e,`mid`);case`stepBefore`:return De(e,`before`);case`stepAfter`:return De(e,`after`);default:return we(e)}}function ke(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var Ae=null,je=null,Me=null,Ne=class extends Error{constructor(){super("zombie-mermaid: rendering a flowchart, state, class, ER or architecture diagram needs the optional peer dependency \"elkjs\". Install it (npm i elkjs) and call registerElk(ELK) once at startup with `import ELK from 'elkjs/lib/elk.bundled.js'`. Sequence, pie, xychart, C4 and ASCII output do not need it. A flowchart can also pass `layout: 'simple'` to skip elkjs."),this.name=`ElkNotRegisteredError`}};function Pe(e){Ae=e,je=null,Me=null}function Fe(){let e=globalThis.process;if(!e?.versions?.node||typeof e.getBuiltinModule!=`function`)return null;let t=e.getBuiltinModule(`node:module`);if(!t)return null;let n=[`elkjs`,`lib`,`elk.bundled.js`].join(`/`),r=[typeof __filename==`string`?__filename:import.meta.url,new URL(`file://${Ie(e)}/`).href];for(let e of r)try{let r=t.createRequire(e)(n),i=typeof r==`function`?r:r.default;if(typeof i==`function`)return i}catch{}return null}function Ie(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var Le=20;function Re(e=Le){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function ze(e){if(Array.isArray(e))return`[${e.map(ze).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${ze(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function Be(){if(je&&Me)return Me;let e=Ae??=Fe();if(!e)throw new Ne;let t=[],n=globalThis.setTimeout;globalThis.setTimeout=(e,r)=>r===0?(t.push(e),0):n(e,r);let r=globalThis,i=Object.getOwnPropertyDescriptor(r,`self`),a=`self`in r&&r.document===void 0&&i?.configurable!==!1,o=a&&r.global===void 0;a&&(Object.defineProperty(r,"self",{value:void 0,configurable:!0,writable:!0}),o&&(r.global=globalThis));let s;try{s=new e}finally{a&&(i?Object.defineProperty(r,"self",i):delete r.self,o&&delete r.global),globalThis.setTimeout=n}if(!ke(s))throw Error(`zombie-mermaid: registerElk() needs the ELK class from 'elkjs/lib/elk.bundled.js' (or 'elkjs/lib/main.js'), whose synchronous worker this renderer drives directly.`);return je=s,t.forEach(e=>e()),Me=je.worker.worker,Me}function Ve(e,t){let n=t,r=n?ze(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=Be(),a=e=>{let t,n,r=i.onmessage;return i.onmessage=e=>{e.data.error?n=e.data.error:t=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=r,{result:t,error:n}},{result:o,error:s}=a(e);if(String(s?.message??s).includes(`Invalid hitboxes`)&&({result:o,error:s}=a({...e,layoutOptions:{...e.layoutOptions,"elk.layered.compaction.postCompaction.strategy":`NONE`}})),s)throw s;if(!o)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,o),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return o}var He=`JetBrains Mono NL`,Ue=`@font-face {
2
2
  font-family: 'JetBrains Mono NL';
3
3
  font-style: normal;
4
4
  font-weight: 400;
5
5
  font-display: swap;
6
6
  src: url(data:font/woff2;base64,d09GMgABAAAAABZoAAwAAAAAMiwAABYWAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGjQGYACCfhEICtBIv3MLgmIAATYCJAOFNgQgBYREByAboCdFBDYOABG0i4mo4AwURYmYtNn/ZQI3hkD/MDOMAipCbeSAiA/e0E7k5P52NehVqIa1Ws5wnlXDxHfybGfD5bMhLn7xIYDX23j/Rz5CY5/kwkd/mG/3/6sFK7YCklopc4CZmEawA6YLdIro3fC0zX8HFmsX7m9GgjYleXDcEQeS59FHSSpYlHP+r/7NWDn/XLX7We5Hh/zcflRIYLtfFFHgaQRdxolEHFjGyf5+bqOug4dK5jpHFM9JLar//W2oPbmphNegKjf6hSubuicHd6XOxFTSwetPRm4TfrdSCA2AYZje1KaqotJySXs/aDjvWFNNY64WjJjzP5fan2JuSKqb2ptR+PyMnJA//yfZT3J3zcG6XMtJiXI3Kv9y2iHosZoE+jcCUkRqc3NErkLJGaEGz9fS2XtXZk5GIks1Mp9kfJRGbeib8Gmud13rHnRVHZZBeAZlqsIoJIOwipc5DyJWp2JEaq8NYpKrDGTj3jo1VvT022N4TQ/5qiHx95wgkAcAliRdkD41yC4zyDkbyIUYyKUsSCyLmCMf3l4AHE32rYkX64CRMZkgoM/hwHrSsUT/dwmozlotHaDzx3DzJ+goAC6l1EFTt29eXB04L82iCYlx85Y6bA9xSFnsozV3gNWvoFviuv853gNcm7TfDoedMe+A3faYdsQ2+1xup+0mnHTcCVPOgmRk5RXVrLdBiVJlylWoVK1Bk2YtWrXhaycgJDZrlyucNucGEhglNZyBkYmZjYOTi5tHSERUTI+4AYOSUrJmnLPXKfksSImS0nKqVisrttlGl9hkpQ6mGrXq1TmKhYeNg0ukUTc5KZiCDAKloqel08GK0ImkQQnw8gnyO6ZLv4RefdLCMiDKJSUAjwBoAdwA2YtiB/hDDwA4FV+0osA5WQmaaByUu1TZ7oKozVvRvimvwYFHN3aWx63vcmq+Kx0dIRNrY9cg08wcCxqIZZ3B0HmijHjBDgceRM2UYyWTaUzz2XIxn+3k82XEkroE2jQVAtVw9M5K23rHs/xJGrw7aINDe6oWNAzDrTE60YTmZv361HJAsIPKsOjcKq2qyGsUQhTd67852KOyvD2yzJjXNNMUqLPNZrsl6FKfuBmBklR4x+2lDhW1UQtK5JrkAvk+gXBqcwCCgCbYOTqEV6jTC6FBNbxG9oUb8jBLwiid8LObmCdblBBhTwBreN2c6CkvGOiu4g2Xp1PIKqn+y9fPoNgWVMQUPNTFN9Ubz5YHqdmPIRDe51TYgcCoW8sYulQGBQuok8lVwsNEdcEKLAKJW0jw1lPmti0ZTjSVELsq/GtNVJh8FmWUhF9CC/9+QjxB+A8vX6jWEcUeORZZSC9RO5+L41XEt3/BxhbhbTZ9ENQWWMpqW+n5GOZyFlIFRhwkYv2zdGexrYXUi5GkUiGLRaCIZEHRvZErT6U/mXySxKxm5AgsWTloiKRCF1EP5JzHgEmO0uQ6dWuZni+s7XyKLmydocAXEOwibZJ42fd5PgxS6mTIiYHvk54/J69SH+fLWp9GkN6zjfiws4p+Bwg3PbXFVN2PYDwTzgrGpyTU1gfaF4IrosGwHWAGQmaBhUBYYnVLOyun0CnQKMQoIGKg80bHHiIRsBM4LZIgg434M+YPAPGtsVFL4AK9wTJYIYqOrbyFADqnmtlIBElGhRt/0khQoEPSxSk8A+jZJFVypiRVKODi+wRDJQPRbOWeAOztcWGTTcd3HD5YPQRaUwJc+F8k2rpLnAOkRZAoxPFcph4HgOevdtmm/GKNEdUEwYKRTE8IDwNF3aYiOFxSjbeWIIL16u+38z9DjlJdYODsnRGg6ZZk7mStNGIsvUAd5JHhKuL7CvhSWLmy7Hrjp7YGFniM9XSt+Dcy9ooClHk3JC4SeNGJrZplh7Ka0BvNfAGQWWWrPQnIO0nPyD/WCm+TInDihZEPaCFxoshODj8Uc9XfFYSU4ICjxLenSJaox9rE8sUpx6NIh87YO/nplqsThu5iXoIguRCwjznR7t/0N/inpR4VP/5ZeSJFby5UK+mX3IVHdxMJrqlBJeXesPEtmGuwVuk1Z8YUyXzi9oh+yZvhtxU4d6RdkU912UGAn+jhgzo45YW6gSgDlXmFfa4vyWfsWZoMn8o903SYmPSwQyTz9MP8immCVnfsidOEd3DiFm59sxf81gh9xXTDyxOJJoHctABrJzQZfY9O4yZ9Egc+dL0q72olF1/G9DsorYtULawavt9xqSb3SSunWKnE8jVmos2YYDX9V+9xSvClQ/S6ESC4nDADX+j+pJDtuhPvDsijUnS2trhOVzqu0dWOFGYp+AUOH3FSI9gZqzr/VLITOVtKLWp05cpIeRpZ9vwIEfPATzCcTz0pLez2HSoXuO4PRanZFyL6EZgTM9cuwn+MXhfAPleGW1u/ZQ4IOlqfSUYHOyVJ1rfGK1ZbuyOcoMDxXy4IJlE5tFqYw159Wv7+VUGur2I+8X5QTUo2C9XIRYPUg8oti37ktNJOl6NY1+rS79kitpN1wFgn64L2pZn303lMhwr2mtfPd+vksTFFB/P25X4jmR5Aa3KiOVH3fVL1N7TuH8UWhAd2Y4j6tUcC0LidLnru4hgHTvm5zwvRQYcTFWX4awD1N19HMD37xoKGgPhVqnSk3hv8wO6ofqGIC5Tln0B6gkqmp3XFReoPgjvxNsagXZIYVMTJECgd7mXFcM1o8sjWIyzR6t5sqICgB/+U9bp8FudzrYXtcU2SuKaIX6t1/K4xMj9bVz9ZOs34YGBgjneBf0uFCPapx+6/ijnLc2iRd386TZ4Gd5MrXpitf16w4fK0GPhyr0SSYbcYd++hX41y64xt/nRfZPrKLVKlXCDA5NJh8ahCp5TKdHrFKOAzIpnBkD6kSAQOkgxSCKqEYaUS0SPKFaA6Fcx9R8Brz4vwkmtXFsd5G1HdajJOgi8gRId2HchYN9dgHCHw5h7SxgTioKpWJQ5hFG3IElbqO5S12LhNw8BrIQ0k+vMv/7HP0AciuatJw8UGoiHPQIJA7lbS8bOMlKoBm/Y+GGLgVOEqJHKI/P5u+tm+HCX+WkzlKOJrAuiSw8LD5I4DG6xkxIeHYpQK16GofpxURVRRbOsQ8OYoad85Seh84OGR7huIeCeYyJm79CTQ5aa9cBc8nVNuLm08fzt/aKs5OVjYkX9b2A2o3NYPk5fk6WhE3QnnMfSD5EY6i3kCNDNCqVRCmAhKqHHFRWaQgBGVAcQvVeRQnBKoN0z3yfWh1GDIm1xm04wWCQx30eyJBp1UIv9o78d1z/wjRVjsxsXtfwBv7pvY1mwoRA8mtr9lbD+M6+QIroX3AypHHTmu7OIK3DLPUF/4+Pm841IMFYmVCslxcM1C7Ma8ufzolqCjoaBFzyegkoR12Ucv/AXjHXIUwXUwLAwElbM3FvhyF7Bgu8Cn0Bvinx5CwlcIRoQ7d4lVuBRWacS7AJuRGBsMUXKTGkU6tNKWNvSBgQr1OnMMl/KdPo4c8XMEDgnFUyECAYbwGq5PpCp164gBY9dICiztujR9TT67CzQzYr3J4FpqrUyqkctgjczewFBiEHz/wKJr9Mcn1jiFwrWuJ4Z/8D24CL2ORau4lEPH89YX4BxtaRAzSYX4+vV5D15aanEtpjAml44WF9NRDGeChtdST3f3JN/ZxqL0rG3pd8JPB18b7h79YhvLYGBuG/sSLBW/92zXbPO9r/ttvHhvQ3yiajGwU7pWNXm2+udaSfAPwx72m/iths4mwY3NvUPtvxVTeeiAzRtJBByXuiO0tF3KMShNCpFpviXS0vYkuIOBdfoMeiul6jQ0yqoqHVUWTE/IuCqOVoty2jCLSzv34WCDsapKW2XDLJ1YM8odHtZws6Y9xnpTVaWv/qi5ur8+Yam0tjRPAgMDsciiUJzKUfPQKJQl5Ig12B845w/2J02Sf1Tz6r8lIlSDHEFQTTiD4T5HQsPMQDZKc1J1mFgM4+qjjyK4ChZjklqK5sxGwasDYG8dfLkAnba41OUMMtTvPxcI9lsRQp6FoNF5KkfFoahFVmkSKyiB44MWS/5Wz6v+AU0MdbdIHFWp2kN+oaLlmnOrJL+eR6krDcSwSBvqeeSgmohzTMlH2mdRXNITk2gsqNGCYTKIIqeZQTMjuCXbPdGNT3sQ6+ILfGjI1S7X4FIeyuqiitQZ4m0DKMOUuFyuxDHwzu55cj6Ddep158hzqDRzgbywG8wvkCfZtlYe5KYnTe2wPdjrz/qD/XbYJErSAm6WNdblXlNHd2y8EMHEY2JAaeCNLIdiBlhhDUZdaSqMIEqhGNWgfmAnn5i4jWS8eR8J3AvkKKJWye/KI/2FweFUFARz1NH48Yt9t+ffXxk/+2vvb2C0w2HDv3uYvERR46i6kQQylrmDpl7Jqtt0FRRmsASIWXGl7arq38tKf6u+Wr+6SsvWBV4WFe+6d0jBbC4MZzM94/FMOhIhIz7ew2YKWWAlhh5AQyosVZ0hhINWInW76kgSqW7kfuSxDl3QHr27SsK+m/1ZcesLlb9zZEoVMr5RplTLj2zgvVL3N/AsmLEUsQb7AgYeapFH6Asd/sPZVu64YcolNauzrnTd8HdA37kFPZAeseQHQn2kZc/32h8u89r+hd6I/gWSLCpOixjkqMMbC7Ap9tYhWK5C/WBDoTdCGikWxW3h9TZo0aKjG4blRoUu1OlsISJmhaeM2djSJqmTamfXzaybM0VsXuAtkbd7/XyFwtfW3imCUbeMnjN162QiT4ivlJIcxKiVSrU0qoRoEygxwc0VKjXiEhBWd5qVqjPkmZPUyQtNF1RltNJ5EjQxAqlk0E/5ZQpcJEZx2Y56GeZP9zODw6n5fzno+3MNCbADghE30yyaZNrAGrVAPUkNuiDSXLKNKZnU+5hh5DJ4YA0YN2CXAd7jm+9elui7IfGcqP65kn338sc2JYYWEi/qxN9eunQN4I4F4q0X6cHt1sx7bPZ74a3WQPEioCj+SAu5n5KMaEjQzEjoDEzQFWpXGmU6o9TlOpQHVeCfS1eWla4oHR552Upgkk9LnzrYffWll+26kgQO6890bbOzSabGYTmuQyhaaDgTjm5JhdrFGbX2yZeMJKhiRIeSQUqm0cgGKq/oEizmOx9qIQ/YbrvfXdA94OEFtyTB3Lx+lnFzbMOj9T/eSV0NmDin0CpTaaTPhKdJLvTwlmj/QLR1fKNaGHhCCvdoOLWRz69viyyIqx/lVmJdYmFYicOJHhi3YIRdoxEe7HSrwMP0nSVbqGdftUHToJmhiQukXQqNOYwto+9VuaQSgaOLo0ADPRCRcn0vvQTLukZxP3OPQHObWIUJBBQSi9QLhJGFftSil8kVFHi57BOBJxbE1WfJKoVfLAgrtXA8Dmu0cdo69bNRpZnBfKGW+RJzOJ3aF8BrZ4XcPg0XNJ9sPFpTc7RxMn/DNXchUH28z6m6sWq9EbZgjwS5kPb2clpiGC56b3PxZqOi/OP5j1u7Gbz09o08VI/DsB7HxuxjeKxdHFBK2JRNkA7I0G7C7TE1B/U+9gR/4SPfRH2pubc+f6S/A183Zhtb5+gYi2/ozcBslZKPFvhv3o56H56I7/bS++7bfAewsl5zYqHqhSDWtxHcqfOHpp8N7tp5XmUe6PtL+DcHaAq45TLzp8NXVJ56YeL8iQA9y/m/38obtZw388bWmf8H6WEnuspnPRnm85YcRIjJTuCJwAv9rm5HgXnVVepxLENksHF1Bc8wruxqJVrZUmlVqMdwfUFvYKYODzlh50LA359nJhKXXLVLYm6ol2h2bZAJ2cqtsIvV0pGFKtlbsTFiDH3YGpkWfeYwMHix/+bfiJMrThLgcP/yHfntZjBTTaAEgMOGjw0A3BU2xwqawdqZSV9hogeyU9xbHAXX6UuI3g4i1G0tnJJNkoXhbtBJsZc9/eeorsTSryd7ep1Fk8fuamVjL312d/6xFYUeTksb+tACWPK/PkI88oQxLISTO2v3dpVna2b3zs3VGjgT/okFml9gvltT8y6T9azf5LPfXW2YMzzzw0sVYDtO3Erc8oM/OWBDnYKjDStS28sLBceoW97uBjQUoZXe8WVFJwA0/+OwFpcyN5Vcu+jNFuH2IwvXwpMLAhbrndO226c7B6HMk42SNyfTEHixD9XrVmIrRw09A6TwhX0/Leqr2tgbFbWVWGVtxdyHvXtHkEexhhjEVKgrahauynL0P7aqBqgX7GO4esJl27nvxHh6YiK92myn9B0Opzar1xBoY2CGhtttboIKZ3pskUTaN2CoaWXNNQ+1nGGxzrZkm+fA20WuaMwlIdwBA31BgIu0AadJRLLbbBIXz9zC/I5V/+Tj/1CpyBW3zT0Y7rr8mk1kA5OQpPnY6NkKdoIv4d8I/u+/mboZPLirvLq8oqa8vKZiPf7PZAY076ruNCVkdTX5Rp1AOZWeifTPgMGp+ExwYAZ8PLVnxjozE+40WUygOSDEED6fVHhabisFZWVQaSmkfw/A/+4K28lscUVtBVbRWtxw9yQI0BvcrgfW85vaG9hIbxrcqljXNMj6vwcWw+zBz2wsAAEgBbZoIaAdyN2mueRG7ibN7O4k6y66qr6gL1p1PITcMBC43JLLkCWyRJa4lc5udQ2yWlbLalkt22SbbJNtrpBAcnOZ1h3IXaH55ELuEs3qribrGorXF4Qi/LgLuWAgMAcWXbwMtdQQpCLLjmR3IaBLqnYNrnfdFyU90iM90qMeApeMy7iMy7ibKnMsZfKIDxxpS07tCavnmlmDLnz8UGXcKxf/ZKMyDgCsD3qYl7yOfvc26Y5g58UkIhTtlO148ev1A513AGX/56Wupd8NdpPkO/CoWP/vwvaksloALEB117+hmCQGkTq1AvDYebvRyWDGDoCbeZO0sKeOLhn1BBRct9RYZ/Tnjm0SQ3WFJhVLJ0OWhEtG15AvfeV96FboOVoOXEmbhrL0YgABwKY3lrUQ+wOrZb8VraZ/CQD8fRkb4YXMPf9M/J+k/Re7oCwJbAAGBKAtR5ddN/GSvg0EZo2/S5aibHlU4Ev3sixThIC6rCfF0dayTKBTikwuatWlUBDqKxOJdhV4rKchqsWerYpKvJELJ3gm23HR5ZzFDkEqkEXeTDZq1ZalTkiqPQp7z9tESKXyji3a8pigMCoOBlBIVSo5XmeRl7jABHXUqgHu0wwasHGEvcjYx18KBB0YcSLpdnAIVtHKprIlYMlkFj1zVOK17VC4MssUjTbaaKP/CEAAeITuBQPAAvI+aA3/1QVzvyGPAYAPqK5bxUAkRKuyKazyaxUd6nxVHp6Jqnw2bbYAvg9wKCpLKS0obkCGyaABg8yMWpGiug3pE5TmEJWWEc8eV4XXKslyjIWZzfYbY4KGZA22OFqZVaXBFtxXKbG2PNUWaSUQeUxIo3tnVbdY1a2jaqfjc+opwTewM3BQb6uC3qSR2/m4bj2308YTjUsjrC0heuBb6CWkYT4hKlxDEXtMRpcPSss01myETbJeKXbf1y2emX8zG9ImbO7rx/Y5C/v2xxvRzeq3iuIBCAAA) format('woff2');
7
7
  unicode-range: U+0020-007E, U+00A0, U+00C0-00FF;
8
- }`;function I(e,t,n){return v(e,t,n)}function Ue(e,t){return e.length*t*.6}var We=`'JetBrains Mono'`,Ge=`${We}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,Ke={nodeLabel:13,edgeLabel:11,groupHeader:12};function qe(e){return{nodeLabel:e?.nodeLabel??Ke.nodeLabel,edgeLabel:e?.edgeLabel??Ke.edgeLabel,groupHeader:e?.groupHeader??Ke.groupHeader}}var L={nodeLabel:500,edgeLabel:400,groupHeader:600},Je=12,Ye=12,Xe={horizontal:20,vertical:10,diamondExtra:24},R={outerBox:1,innerBox:.75,connector:1},z=`0.35em`,Ze={width:8,height:5};function Qe(e,t,r,i){return n(e,t?{family:Ve,faceCss:He}:!1,r,i)}var B={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:Ke},$e={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function et(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 tt(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 nt(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":tt(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function rt(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var it={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function at(e,t){let n=_(e,t.fontSize,L.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function ot(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[at(e.label,e.labelStyle)]),t}var st={"state-start":`FIRST`},ct={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function lt(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var V={top:44,left:16,bottom:16,right:16},ut={top:16,left:16,bottom:16,right:16};function dt(e){let t=new Map;for(let n of e.edges){if(!n.label)continue;let e=`${n.source}\0${n.target}`,r=(t.get(e)??0)+1;if(r>=3)return!0;t.set(e,r)}return!1}var ft=new WeakMap;function pt(e,t){let n=ft.get(e);return n||(n=lt(e)||bt(e.subgraphs)?new Set:f(e,t?.walkOrder,t?.feedbackEdges??j(e)),ft.set(e,n)),n}function mt(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 ht(e){return et(e,$e.flowchart)}function gt(e){return{...nt(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 _t(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:it}}function vt(e,t,n,r){let i=_(t,r,L.nodeLabel),a=i.width+Xe.horizontal*2,o=i.height+Xe.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+Xe.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+=Xe.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=Xe.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`||t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var yt=` root`;function bt(e){for(let t of e)if(t.direction!==void 0||bt(t.children))return!0;return!1}function xt(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)xt(n,t)}function St(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 Ct(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function wt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),Et(t,i,a);let o=Dt(e.subgraphs),s=St(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=bt(e.subgraphs),f=[],p=[],m={...gt({direction:ht(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(B.thoroughness),"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":(e.subgraphs.length===0||dt(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...dt(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...lt(e)?ct:{},"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=Ct(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]:yt,ot({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:_t(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=vt(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=rt(t,i,o.label),c=lt(e)?st[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=lt(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(Tt(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return mt(e,new Set([t.id]));let r=e.subgraphs[n-b],i=mt(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return xt(r,a),mt(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=pt(e,n),C=n?.feedbackEdges,w=l.get(null),T=C?.size?[...w.filter(e=>C.has(e.index)),...w.filter(e=>!C.has(e.index))]:w;for(let{index:e,edge:t}of T){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=ot({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_t(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(yt)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(ot({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_t(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Tt(e,t,n,r,i,a,o){let s=e.direction!==void 0&&ee(e,t)?e.direction:o,c=gt({direction:ht(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?ut:V}),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=vt(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(rt(r,t,e.label))}}let f=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of f)d.push(Tt(e,t,n,r,i,a,s));let p=[],m=r.get(e.id)??[],h=pt(t);for(let{index:e,edge:t}of m)t.source!==t.target&&p.push(ot({id:`e${e}`,source:h.has(e)?t.target:t.source,target:h.has(e)?t.source:t.target,label:t.label,labelStyle:_t(n)}));for(let t of a.get(e.id)??[])p.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:p}}function Et(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),Et(r,t,n)}function Dt(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 Ot(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]=kt(e[0],e[1],t);else{let n=e.length-1;r[n]=kt(e[n],e[n-1],t)}}if(t.shape===`asymmetric`){let i=n?0:e.length-1,a=e[i],o=t.height/2,s=Math.abs(a.y-(t.y+o));Math.abs(a.x-t.x)<.5&&s<o&&(r[i]={x:t.x+12*(1-s/o),y:a.y})}return r}function kt(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?jt(t,c,a)??a:jt(t,a,o)??a:t<=r?jt(t,s,c)??s:jt(t,o,s)??s}{let t=e.y;return l>0?t<=i?At(t,a,c)??c:At(t,c,s)??c:t<=i?At(t,a,o)??o:At(t,o,s)??o}}function At(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 jt(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)}}var Mt=12;function Nt(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=B.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)return;let u=r?`x`:`y`,d=(e,t,n,r)=>{let i=e[t],a=i[u];i[u]+=r;let[o,s,c]=[1,2,3].map(r=>e[t+r*n]);if(o[u]===a)o[u]+=r;else if(s&&c&&s[u]===o[u]){let e=Math.sign(o[u]-a),t=o[u]+e*Math.max(0,Mt-e*(o[u]-i[u]));e*(c[u]-t)>0&&(o[u]=s[u]=t)}};for(let e of t){let{points:t}=e;if(t.length<2)continue;let n=l.get(e.source),r=l.get(e.target);n!=null&&d(t,0,1,n),r!=null&&d(t,t.length-1,-1,r)}}var Pt=.5;function Ft(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+Pt,r=e.x+e.width-Pt,i=e.y+Pt,a=e.y+e.height-Pt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function It(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(...It(e,t,i.children)));return r}function Lt(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(It(t,n,r).map(e=>e.id)),u=It(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}var Rt=2;function zt(e,t,n,r,i){for(let a of e){if(t.has(a)||a.source===a.target)continue;let e=a.source===n?a.points[0]:a.target===n?a.points[a.points.length-1]:void 0;if(e&&Math.abs((i?e.x:e.y)-r)<=Rt)return!0}return!1}function Bt(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=new Map,s=e=>`${e.source}\0${e.target}`;for(let t of e)o.set(s(t),(o.get(s(t))??0)+1);let c=e=>o.get(s(e))>1,l=r===`LR`,u=r===`RL`,d=r===`BT`,f=l||u,p=new Map;for(let t of e){if(t.source===t.target||c(t))continue;let e=p.get(t.source)??[];p.set(t.source,e),e.push(t)}for(let[o,s]of p){if(s.length<2)continue;let c=s[0].style;if(s.some(e=>e.label||e.style!==c))continue;let p=i.get(o);if(!p)continue;let m=[];for(let e of s){let t=i.get(e.target);t&&(l?t.x>p.x+p.width:u?t.x+t.width<p.x:d?t.y+t.height<p.y:t.y>p.y+p.height)&&m.push({edge:e,node:t})}if(m.length<2)continue;let h=p.x+p.width/2,g=p.y+p.height/2;if(f){let i=l?p.x+p.width:p.x,s=g;if(zt(e,new Set(m.map(e=>e.edge)),o,i,!0))continue;let c=i+((l?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=Lt(c,h,g,n,r);let u=[];for(let{edge:e,node:n}of m){let r=l?n.x:n.x+n.width,a=n.y+n.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];Ft(d,t,new Set([o,n.id]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t,a.add(e)}else{let i=h,s=d?p.y:p.y+p.height;if(zt(e,new Set(m.map(e=>e.edge)),o,s,!1))continue;let c=s+((d?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-s)/2;c=Lt(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=d?n.y+n.height:n.y,u=[{x:i,y:s},{x:i,y:c},{x:r,y:c},{x:r,y:a}];Ft(u,t,new Set([o,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let m=new Map;for(let t of e){if(a.has(t)||t.source===t.target||c(t))continue;let e=m.get(t.target)??[];m.set(t.target,e),e.push(t)}for(let[a,o]of m){if(o.length<2)continue;let s=o[0].style;if(o.some(e=>e.label||e.style!==s))continue;let c=i.get(a);if(!c)continue;let p=[];for(let e of o){let t=i.get(e.source);t&&(l?t.x+t.width<c.x:u?t.x>c.x+c.width:d?t.y>c.y+c.height:t.y+t.height<c.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=c.x+c.width/2,h=c.y+c.height/2;if(f){let i=l?c.x:c.x+c.width,o=h;if(zt(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let s=l?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),u=s+(i-s)/2;u=Lt(u,m,h,n,r);let d=[];for(let{edge:e,node:n}of p){let r=l?n.x+n.width:n.x,s=n.y+n.height/2,c=[{x:r,y:s},{x:u,y:s},{x:u,y:o},{x:i,y:o}];Ft(c,t,new Set([n.id,a]))&&d.push({edge:e,points:c})}if(d.length<2)continue;for(let{edge:e,points:t}of d)e.points=t}else{let i=m,o=d?c.y+c.height:c.y;if(zt(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=d?Math.min(...p.map(e=>e.node.y)):Math.max(...p.map(e=>e.node.y+e.node.height)),l=s+(o-s)/2;l=Lt(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=n.x+n.width/2,s=[{x:r,y:d?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];Ft(s,t,new Set([n.id,a]))&&u.push({edge:e,points:s})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}}}var Vt=1.5,Ht=.01;function Ut(e){let t=e.map(e=>({...e})),n=0;for(;n+3<t.length;){let[e,r,i,a]=[t[n],t[n+1],t[n+2],t[n+3]],o=Math.abs(e.x-r.x)<Ht&&Math.abs(i.x-a.x)<Ht&&Math.abs(r.y-i.y)<Ht&&Math.abs(r.x-i.x)<=Vt&&Math.abs(r.x-i.x)>=Ht,s=Math.abs(e.y-r.y)<Ht&&Math.abs(i.y-a.y)<Ht&&Math.abs(r.x-i.x)<Ht&&Math.abs(r.y-i.y)<=Vt&&Math.abs(r.y-i.y)>=Ht;if(o){let r=(e.x+a.x)/2;t.splice(n,4,{x:r,y:e.y},{x:r,y:a.y})}else if(s){let r=(e.y+a.y)/2;t.splice(n,4,{x:e.x,y:r},{x:a.x,y:r})}else n++}return t}function Wt(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 Gt(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 Kt=16,qt=28,Jt=18,Yt=28,Xt=10;function Zt(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Yt,e.height*.6)/2,a=qt+t*Jt,o=[];for(let e=0;e<=Kt;e++){let t=Math.PI*e/Kt;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Xt,y:r}}}function Qt(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}=Zt(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:dn(i,e),id:a.id,animate:a.animate})}}function $t(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(...$t(n.children));return t}function en(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)un(e,o);tn(e,t,o,r,a,0,0);let s=$t(a);an(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),Nt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));Qt(t,c,i),n&&Bt(i,r,a,t.direction);for(let e of i){e.points=Ut(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=Ot(e.points,t,!0)),n&&(e.points=Ot(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=Ze.width,f=B.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 tn(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,c=(s.y??0)+o,l=s.width??0,u=s.height??0;if(n.has(s.id)){let a=[];tn(s,t,n,r,a,e,c);let o=ln(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:c,width:l,height:u,children:a,...o?.region?{region:!0}:{}})}else{let a=t.nodes.get(s.id);if(a){let n=T(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:c,width:l,height:u,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&tn(s,t,n,r,i,e,c)}}}function nn(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 rn(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 an(e,t,n,r,i,a){let o=new Map;on(e,o,0,0);let s=new Map;cn(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??rn(o));let f=sn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=rn(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:pt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:dn(e,t),id:i.id,animate:i.animate})}}function on(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;on(i,t,n+e,r+a)}}function sn(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 cn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=nn(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=Wt(a,l,u),f=Gt(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)cn(a,t,n+(a.x??0),r+(a.y??0),i)}function ln(e,t){for(let n of e){if(n.id===t)return n;let e=ln(n.children,t);if(e)return e}}function un(e,t){t.add(e.id);for(let n of e.children)un(n,t)}function dn(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&&s(n)}var fn=10,pn=14,mn=14,hn=10,gn=24,_n=400,vn=new Set([`rectangle`,`rounded`,`subroutine`]);function yn(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 bn(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 xn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function Sn(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function Cn(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<pn&&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<pn&&r>0)return!0}}}return!1}function wn(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 Tn=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 En(e,t,n,r,i,a=[]){let o=yn(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+hn,a1:d.a1-hn,c0:d.c0+hn,c1:d.c1-hn},p=a.map(e=>e.map(e=>Sn(o,e))),m=n.map(e=>xn(o.span(e),fn)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>vn.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=>bn(n,r,e))||bn(n,r,s)||bn(n,r,c)||p.some(e=>Cn(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-fn),y.add(e.c1+fn);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(mn,n),i=c.a0-Math.min(mn,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=wn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?_n:0,i=Tn(n)+gn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Dn(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 On=`__zm_spine__`,kn=8,An=6,jn=12,Mn=4,Nn=4,Pn=.25,Fn=.02,In=40,Ln=e=>e===`TD`||e===`TB`||e===`BT`,Rn=e=>e.startsWith(On);function zn(e){return e.flatMap(e=>[e,...zn(e.children)])}function H(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of H(n))t.add(e);return t}function Bn(e){if(e.subgraphs.length===0||lt(e)||bt(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Rn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=zn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function Vn(e,t){let n=Ln(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 Hn(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...H(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=`${On}${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);!Rn(t)&&!Rn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Un(e,t,n,r=()=>!1,i=()=>!1){let a=e=>{let n=[...H(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},o=e=>{let t=[...H(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},s=e.map(e=>({sg:e,at:a(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),c=[],l=-1/0;for(let{sg:e,at:t}of s){let n=c[c.length-1];n&&t[0]<=l?(n.push(e),l=Math.max(l,t[1])):(c.push([e]),l=t[1])}for(let t of c){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let a=t.some(e=>e.region)||t.some((e,n)=>t.slice(n+1).some(t=>i(e,t)))?-1:1,s=[...t].sort((t,n)=>a*(e.indexOf(n)-e.indexOf(t))),c=t.map(o).sort((e,t)=>e-t),l=s.map((e,t)=>c[t]-o(e));s.forEach((e,t)=>{for(let r of H(e))n.has(r)&&n.set(r,n.get(r)+l[t])})}for(let a of e)Un(a.children,t,n,r,i)}function Wn(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=H(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)||Rn(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 Gn=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function Kn(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...H(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=e.region?ut:V,s=Math.min(...a.map(e=>e.x))-o.left,c=Math.min(...a.map(e=>e.y))-o.top,l=Math.max(...a.map(e=>e.x+e.width))+o.right,u=Math.max(...a.map(e=>e.y+e.height))+o.bottom,d=e.region?0:_(e.label,n.groupHeader,L.groupHeader).width+24;return{id:e.id,label:e.label,x:s,y:c,width:Math.max(l-s,d),height:u-c,children:i,...e.region?{region:!0}:{}}};return e.map(r)}var qn=e=>e.flatMap(e=>[e,...qn(e.children)]);function Jn(e,t,n,r,i,a){let o=Ln(r),s=new Map(zn(t).map(e=>[e.id,H(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-In,y:e.y-In,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=qn(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))||!Gn(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)=>qn(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 Yn(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=j(e),o=t(i,{feedbackEdges:a}),s=Vn(o.nodes,e.direction),c=Ln(e.direction),l=new Map(o.nodes.map(e=>[e.id,e])),u=e=>{let t=l.get(e);return c?t.x:t.y},d=zn(e.subgraphs),f=Hn(d,s,u),p=new Map;for(let e of f.ghosts)p.set(e.subgraph,[...p.get(e.subgraph)??[],e.id]);let m=new Map(o.nodes.map(e=>[e.id,u(e.id)]));Un(e.subgraphs,s,m,(t,n)=>{let r=H(t),i=H(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)},(t,n)=>te(e,t,n));for(let e of f.ghosts){let t=[...H(d.find(t=>t.id===e.subgraph))].filter(e=>m.has(e)).map(e=>m.get(e));m.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let h=new Map(e.nodes);for(let e of f.ghosts)h.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let g=Wn([...h.keys()],m,s,d,p),_={...i,nodes:new Map(g.map(e=>[e,h.get(e)])),edges:[...e.edges,...f.edges]},v=new Set(f.edges.map((t,n)=>e.edges.length+n)),y=i=>{let o=new Map,c=new Map;for(let l=0;;l++){let u=new Map(f.ghosts.map(e=>[e.id,kn+(o.get(e.subgraph)??0)])),m=t(_,{fixedWidths:u,looseEdges:v,detachedEdges:i,walkOrder:r,feedbackEdges:a,forceNodeOrder:!0}),h=new Map(m.nodes.filter(e=>!Rn(e.id)).map(e=>[e.id,e])),g=Kn(e.subgraphs,h,n),y=Jn(g,e.subgraphs,h,e.direction,new Set(p.keys()),s),{penetration:b,stuck:x}=y;if(x)return;if(b.size===0){for(let t=0;y.requests.length>0;t++){if(t===jn)return;Qn(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=Kn(e.subgraphs,h,n),y=Jn(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=Zn(e,i,h,g,d);return t&&tr(m,[...h.values()],g,t,e.direction)}if(l===An)return;for(let[e,t]of b){let n=o.get(e)??0,r=c.get(e),i=r?(r.overlap-t)/(n-r.width):0,a=i>Fn?i:Pn;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Nn)}}},b=Xn(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function Xn(e,t,n,r){let i=r.map(e=>{let t=H(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 Zn(e,t,n,r,i){let a=new Map(qn(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=H(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>H(e).size-H(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=En(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?Dn(d):void 0,inlineStyle:dn(r,e),id:t.id,animate:t.animate})}return o}function Qn(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Mn,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)}var $n=8;function er(e,t,n,r){let i=Ln(r)?`y`:`x`,a=i===`x`?`y`:`x`,o=i===`x`?`width`:`height`,s=i===`x`?`height`:`width`;for(let{points:r}of e)for(let e=1;e<r.length-1;){let c=e;for(;c+1<r.length-1&&r[c+1][i]===r[e][i];)c++;let l=r.slice(e,c+1),u=l[0],d=Math.min(...l.map(e=>e[a])),f=Math.max(...l.map(e=>e[a])),p=r[e-1][i],m=r[c+1][i],h=n.flatMap(e=>[e[i],e[i]+e[o]].map(t=>({g:e,s:t}))).find(({g:e,s:t})=>Math.abs(u[i]-t)<$n&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?$n:-8),n=(e-p)*(m-e)>0,r=t.every(t=>t[i]+t[o]<=e||t[i]>=e||t[a]+t[s]<=d||t[a]>=f);if(n&&r)for(let t of l)t[i]=e}e=c+1}}function tr(e,t,n,r,i){let a=[...e.edges.filter(e=>!Rn(e.source)&&!Rn(e.target)),...r],o=qn(n);er(a,t,o,i);let s=[...t.map(e=>e.x),...o.map(e=>e.x),...a.flatMap(e=>e.points.map(e=>e.x))],c=[...t.map(e=>e.y),...o.map(e=>e.y),...a.flatMap(e=>e.points.map(e=>e.y))],l=B.padding-Math.min(...s),u=B.padding-Math.min(...c);for(let e of t)e.x+=l,e.y+=u;for(let e of o)e.x+=l,e.y+=u;for(let e of a){for(let t of e.points)t.x+=l,t.y+=u;e.labelPosition&&(e.labelPosition.x+=l,e.labelPosition.y+=u)}let d=0,f=0;for(let e of t)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of o)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of a){for(let t of e.points)d=Math.max(d,t.x+Ze.width+B.padding),f=Math.max(f,t.y+Ze.width+B.padding);e.labelPosition&&(d=Math.max(d,e.labelPosition.x+60+B.padding),f=Math.max(f,e.labelPosition.y+20+B.padding))}return{...e,nodes:t,edges:a,groups:n,width:d,height:f}}var nr=12,rr=8,ir=4;function ar(e,t,n){let r=e.map(e=>({axis:e.axis,cross:e.cross,after:e.after??0,rank:0,real:!0})),i=e.map(()=>[]),a=e.map(()=>[]),o=t.flatMap((e,t)=>e.from===e.to?[]:[t]),s=p(o.map(e=>({source:String(t[e].from),target:String(t[e].to)})),e.map((e,t)=>String(t))),c=o.map((e,n)=>{let r=t[e];return s.has(n)?{index:e,u:r.to,v:r.from,reversed:!0}:{index:e,u:r.from,v:r.to,reversed:!1}}),l=e.map(()=>[]),u=e.map(()=>0);for(let e of c)l[e.u].push(e.v),u[e.v]++;let d=u.flatMap((e,t)=>e===0?[t]:[]);for(let e=0;e<d.length;e++){let t=d[e];for(let e of l[t])r[e].rank=Math.max(r[e].rank,r[t].rank+2),--u[e]===0&&d.push(e)}let f=c.map(e=>{let n=(r[e.v].rank-r[e.u].rank)/2,o=r[e.u].rank+2*Math.floor(n/2)+1,s=t[e.index].label,c=[e.u];for(let t=r[e.u].rank+1;t<r[e.v].rank;t++){let e=r.length,n=t===o&&s!==void 0;r.push({axis:n?s.axis:0,cross:n?s.cross:0,after:0,rank:t,real:!1}),i.push([]),a.push([]),c.push(e)}c.push(e.v);for(let e=1;e<c.length;e++)a[c[e-1]].push(c[e]),i[c[e]].push(c[e-1]);return{chain:c,labelRank:o}}),m=r.map((e,t)=>t),h=e=>{let t=e;for(;m[t]!==t;)t=m[t]=m[m[t]];return t};for(let{chain:e}of f)for(let t of e)m[h(t)]=h(e[0]);let g=new Map;r.forEach((e,t)=>{let n=h(t);g.set(n,[...g.get(n)??[],t])});let _=r.map(()=>0),v=[],y=[];for(let e of g.values()){let t=or(e,r,i,a,n),o=1/0,s=-1/0;for(let n of e)_[n]=t.get(n),o=Math.min(o,_[n]-r[n].cross/2),s=Math.max(s,_[n]+r[n].cross/2+r[n].after);v.push({min:o,max:s}),y.push(e)}let b=0;y.forEach((e,t)=>{let r=b-v[t].min;for(let t of e)_[t]=_[t]+r;b+=v[t].max-v[t].min+n.nodeSep});let x=Math.max(0,b-n.nodeSep),S=r.reduce((e,t)=>Math.max(e,t.rank),0),C=Array(S+1).fill(0);for(let e of r)C[e.rank]=Math.max(C[e.rank],e.axis);let w=Array(S+1).fill(0);for(let e=1;e<=S;e++)w[e]=w[e-1]+C[e-1]+n.rankSep/2;let T=e=>w[r[e].rank]+C[r[e].rank]/2,E=t.map(()=>[]),D=t.map(()=>void 0);return c.forEach((e,n)=>{let{chain:i,labelRank:a}=f[n],o=i.slice(1,-1),s=o.map(e=>({axis:T(e),cross:_[e]}));if(E[e.index]=e.reversed?s.reverse():s,t[e.index].label){let t=o.find(e=>r[e].rank===a);D[e.index]={axis:T(t),cross:_[t]}}}),{nodes:e.map((e,t)=>({axis:w[r[t].rank]+(C[r[t].rank]-e.axis)/2,cross:_[t]-e.cross/2})),paths:E,labels:D,axisSize:w[S]+C[S],crossSize:x}}function or(e,t,n,r,i){let a=[],o=new Set,s=[...e].sort((e,n)=>t[e].rank-t[n].rank||e-n);for(let e of s){if(o.has(e))continue;let n=[{s:e,next:0}];for(o.add(e),(a[t[e].rank]??=[]).push(e);n.length>0;){let e=n[n.length-1],i=r[e.s][e.next++];i===void 0?n.pop():o.has(i)||(o.add(i),(a[t[i].rank]??=[]).push(i),n.push({s:i,next:0}))}}let c=a.filter(e=>e!==void 0),l=new Map,u=()=>c.forEach(e=>e.forEach((e,t)=>l.set(e,t))),d=()=>{let e=0;for(let t=0;t+1<c.length;t++){let n=c[t].flatMap(e=>r[e].map(t=>[l.get(e),l.get(t)]));for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let[i,a]=n[t],[o,s]=n[r];(i-o)*(a-s)<0&&e++}}return e};u();let f=c.map(e=>[...e]),p=d();for(let e=0;e<rr&&p>0;e++){let t=e%2==0,i=c.map((e,t)=>t);t||i.reverse();for(let e of i){let i=t?n:r,a=e=>{let t=i[e];return t.length===0?l.get(e):t.reduce((e,t)=>e+l.get(t),0)/t.length},o=new Map(c[e].map(e=>[e,a(e)]));c[e].sort((e,t)=>o.get(e)-o.get(t)||l.get(e)-l.get(t)),c[e].forEach((e,t)=>l.set(e,t))}let a=d();a<p&&(p=a,f=c.map(e=>[...e]))}f.forEach((e,t)=>c[t]=e);let m=new Map,h=(e,n)=>(t[e].cross+t[n].cross)/2+t[e].after+(t[e].real&&t[n].real?i.nodeSep:Math.min(i.nodeSep,nr)),g=(e,t)=>{let n=e.slice(1).map((t,n)=>h(e[n],t)),r=[0];n.forEach((e,t)=>r.push(r[t]+e)),sr(e.map((e,n)=>{let i=(t[e]??[]).filter(e=>m.has(e));return(i.length===0?m.get(e)??0:i.reduce((e,t)=>e+m.get(t),0)/i.length)-r[n]})).forEach((t,n)=>m.set(e[n],t+r[n]))};for(let e of c)g(e,[]);for(let e=0;e<ir;e++){for(let e=1;e<c.length;e++)g(c[e],n);for(let e=c.length-2;e>=0;e--)g(c[e],r)}return m}function sr(e){let t=[];for(let n of e)for(t.push({sum:n,count:1});t.length>1;){let e=t[t.length-1],n=t[t.length-2];if(n.sum/n.count<=e.sum/e.count)break;t.splice(-2,2,{sum:n.sum+e.sum,count:n.count+e.count})}return t.flatMap(e=>Array(e.count).fill(e.sum/e.count))}var cr=28,lr=18,ur=10,dr=32;function fr(e,t={}){let n={...B,...t,fontSizes:qe(t.fontSizes)},r=e.direction===`TB`||e.direction===`TD`||e.direction===`BT`,i=e.direction===`BT`||e.direction===`RL`,a=new Map,o=new Map,s=(e,t)=>{a.set(e.id,e),t!==void 0&&o.set(e.id,t);for(let t of e.nodeIds)o.has(t)||o.set(t,e.id);for(let t of e.children)s(t,e.id)};e.subgraphs.forEach(e=>s(e));let c=[...e.nodes.keys()].filter(e=>!a.has(e)),l=new Map(c.map((e,t)=>[e,t])),u=e=>Math.min(...e.nodeIds.map(e=>l.get(e)??1/0),...e.children.map(u)),d=e=>{let t=a.get(e);return t?u(t):l.get(e)??1/0},f=t=>[...c.filter(e=>o.get(e)===t),...(t===void 0?e.subgraphs:a.get(t).children).map(e=>e.id)].map((e,t)=>({id:e,i:t})).sort((e,t)=>d(e.id)-d(t.id)||e.i-t.i).map(e=>e.id),p=e=>{let t=[e];for(let n=o.get(e);n!==void 0;n=o.get(n))t.unshift(n);return t},m=t=>{let i=e.edges[t].label;if(!i)return;let a=_(i,n.fontSizes.edgeLabel,L.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,g=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){g.set(e.source,[...g.get(e.source)??[],t]);return}let n=p(e.source),r=p(e.target),i=0;for(;n[i]!==void 0&&n[i]===r[i];)i++;if(i>=n.length||i>=r.length)return;let a=i===0?``:n[i-1];h.set(a,[...h.get(a)??[],{index:t,from:n[i],to:r[i]}])});let v=r?i?{axisStart:V.bottom,axisEnd:V.top,crossStart:V.left,crossEnd:V.right}:{axisStart:V.top,axisEnd:V.bottom,crossStart:V.left,crossEnd:V.right}:{axisStart:i?V.right:V.left,axisEnd:i?V.left:V.right,crossStart:V.top,crossEnd:V.bottom},y=(e,t)=>r?{aSize:t,cSize:e}:{aSize:e,cSize:t},b=new Map;for(let t of c){let r=e.nodes.get(t),i=vt(t,r.label,r.shape,n.fontSizes.nodeLabel);b.set(t,y(i.width,i.height))}let x=e=>{let t=g.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+ur));return cr+(t.length-1)*lr+n},S=e=>{let t=f(e),i=new Map,o=new Map,s=new Map;for(let e of t){let t=a.get(e);if(!t){o.set(e,b.get(e));continue}let c=S(e);i.set(e,c);let l=_(t.label,n.fontSizes.groupHeader,L.groupHeader).width,u=c.axisSize+v.axisStart+v.axisEnd,d=c.crossSize+v.crossStart+v.crossEnd,f=r?0:l+dr,p=r?l+dr:0,m=Math.max(0,f-u),h=Math.max(0,p-d);u+=m,d+=h,o.set(e,{aSize:u,cSize:d}),s.set(e,{axis:v.axisStart+m/2,cross:v.crossStart+h/2})}let c=new Map(t.map((e,t)=>[e,t])),l=h.get(e??``)??[],u=ar(t.map(e=>({axis:o.get(e).aSize,cross:o.get(e).cSize,after:x(e)})),l.map(e=>({from:c.get(e.from),to:c.get(e.to),label:m(e.index)})),{nodeSep:n.nodeSpacing,rankSep:n.layerSpacing}),d=new Map;return l.forEach((e,t)=>d.set(e.index,{mids:u.paths[t],label:u.labels[t]})),{members:t,at:new Map(t.map((e,t)=>[e,u.nodes[t]])),sizes:o,inset:{axis:0,cross:0},axisSize:u.axisSize,crossSize:u.crossSize,routes:d,inner:new Map([...i].map(([e,t])=>[e,{...t,inset:s.get(e)}]))}},C=S(void 0),w=new Map,E=new Map,D=(e,t,n)=>{for(let[r,i]of e.routes)E.set(r,{mids:i.mids.map(e=>({axis:e.axis+t,cross:e.cross+n})),label:i.label&&{axis:i.label.axis+t,cross:i.label.cross+n}});let r=[];for(let i of e.members){let o=e.at.get(i),s=e.sizes.get(i),c={axis:t+o.axis,cross:n+o.cross,...s};w.set(i,c);let l=e.inner.get(i);if(l){let e=a.get(i),t=D(l,c.axis+l.inset.axis,c.cross+l.inset.cross);r.push({id:i,label:e.label,x:0,y:0,width:0,height:0,children:t,...e.region?{region:!0}:{}})}}return r},O=D(C,0,0),k=n.padding,A=C.axisSize,ee=e=>{let t=i?A-e.axis:e.axis;return r?{x:e.cross+k,y:t+k}:{x:t+k,y:e.cross+k}},j=e=>{let t=i?A-e.axis-e.aSize:e.axis;return r?{x:e.cross+k,y:t+k,width:e.cSize,height:e.aSize}:{x:t+k,y:e.cross+k,width:e.aSize,height:e.cSize}},te=e=>{for(let t of e)Object.assign(t,j(w.get(t.id))),te(t.children)};te(O);let M=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.shape,...j(w.get(t)),inlineStyle:T(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),N=new Map(M.map(e=>[e.id,e])),P=[];e.edges.forEach((t,n)=>{let r=E.get(n);if(!r)return;let i=w.get(t.source),a=w.get(t.target),o=i.axis>a.axis,[s,c]=o?[a,i]:[i,a],l=[{axis:s.axis+s.aSize,cross:s.cross+s.cSize/2},...o?[...r.mids].reverse():r.mids,{axis:c.axis,cross:c.cross+c.cSize/2}],u=[l[0]];for(let e of l.slice(1)){let t=u[u.length-1];if(t.cross!==e.cross){let n=(t.axis+e.axis)/2;u.push({axis:n,cross:t.cross},{axis:n,cross:e.cross})}u.push(e)}let d=Ut(pr(u.map(ee)));o&&d.reverse();let f=N.get(t.source),p=N.get(t.target);f&&(d=Ot(d,f,!0)),p&&(d=Ot(d,p,!1)),P.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:r.label&&ee(r.label),inlineStyle:dn(n,e),id:t.id,animate:t.animate})}),Qt(e,N,P);let ne=(r?C.crossSize:C.axisSize)+k*2,F=(r?C.axisSize:C.crossSize)+k*2;for(let e of P){for(let t of e.points)ne=Math.max(ne,t.x+Ze.width+k),F=Math.max(F,t.y+Ze.width+k);e.labelPosition&&(ne=Math.max(ne,e.labelPosition.x+60+k),F=Math.max(F,e.labelPosition.y+20+k))}return{width:ne,height:F,nodes:M,edges:P,groups:O}}function pr(e){return e.filter((t,n)=>{let r=e[n-1],i=e[n+1];return!r||!i||!(r.x===t.x&&t.x===i.x||r.y===t.y&&t.y===i.y)})}function mr(e,t={}){return hr(e,t)}function hr(e,t,n){let r={...B,...t,fontSizes:qe(t.fontSizes)};return en(Be(wt(e,r,n),t.layoutCache),e,r.mergeEdges)}function gr(e,t={}){let n=ne(e);if(t.layout===`simple`&&!lt(n))return fr(n,t);if(t.layout!==void 0&&t.layout!==`elk`&&t.layout!==`simple`)throw Error(`zombie-mermaid: unknown layout ${JSON.stringify(t.layout)}; use 'elk' or 'simple'.`);if(Bn(n)){let e=Yn(n,(e,n)=>hr(e,t,n),qe(t.fontSizes));if(e)return e}return mr(n,t)}function _r(e,t={}){return wt(e,{...B,...t,fontSizes:qe(t.fontSizes)})}var vr=12,yr=2;function br(e){return e.flatMap(e=>[e,...br(e.children)])}function xr(e,t){let n=t.groupHeader+16;return br(e).filter(e=>e.label!==``).map(e=>{let r=_(e.label,t.groupHeader,L.groupHeader);return{x:e.x+vr-yr,y:e.y+n/2-r.height/2-yr,width:r.width+4,height:r.height+4}})}function Sr(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 Cr(e){return{x:e.x+yr,y:e.y+yr,width:e.width-4,height:e.height-4}}function wr(e,t){let n=e.points,r=t.map(Cr);for(let e=0;e+1<n.length;e++)if(r.some(t=>Sr(n[e],n[e+1],t)))return!0;return!1}function Tr(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 Er(e,t,n){let r=`zm-title-gap-${Tr(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(`
9
- `)}\n </mask>`}}function Dr(e,t,r=`Inter`,i=!1,a=Ke,o=`linear`,s,c=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!E(e.interaction?.href));p.push(wi(M(e.width,e.height,t,i,u,d,m,f.styleAttribute,f.description),s)),p.push(n(r,!1,f.nonce,f.bodyFont)),c&&e.edges.some(e=>e.animate)&&p.push(Or(f.nonce)),p.push(`<defs>`),p.push(kr());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(Ar(e));let g=xr(e.groups,a),_=new Set(e.edges.filter(e=>wr(e,g))),v;if(_.size>0){let t=Er(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(Nr(t,r,a));for(let t of e.edges)p.push(Pr(t,o,c,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(Ir(t,r,a));for(let t of e.nodes)p.push(Br(t,r,a,l));return p.push(`</svg>`),p.join(`
10
- `)}function Or(e){return[A(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(`
11
- `)}function kr(){return jr(`var(--_arrow)`,``)}function Ar(e){return jr(c(e),d`-${Mr(e)}`)}function jr(e,t){let n=Ze.width,r=Ze.height,i=n-1,a=d`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=d`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${a} />`,s=(e,t)=>d` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r/2}" orient="${t}">`+d`\n ${o}`+`
12
- </marker>`;return s(d`arrowhead${t}`,`auto`)+`
13
- `+s(d`arrowhead-start${t}`,`auto-start-reverse`)}function Mr(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function Nr(e,t,n){let r=n.groupHeader+16,i=[];if(e.region){i.push(d`<g class="subgraph subgraph-region" data-id="${c(e.id)}">`,d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+d`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(Nr(r,t,n));return i.push(`</g>`),i.join(`
14
- `)}i.push(d`<g class="subgraph" data-id="${c(e.id)}" data-label="${c(e.label)}">`),i.push(d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+d`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+d`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(` `+C(e.label,e.x+12,e.y+r/2,n.groupHeader,d`font-size="${n.groupHeader}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(Nr(r,t,n));return i.push(`</g>`),i.join(`
15
- `)}function Pr(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`?R.connector*2:R.connector,u=o?`none`:c(e.inlineStyle?.stroke??`var(--_line)`),f=c(e.inlineStyle?.[`stroke-width`]??String(l)),p=e.inlineStyle?.stroke?d`-${Mr(e.inlineStyle.stroke)}`:``,m=``;o||(e.hasArrowEnd&&(m+=d` marker-end="url(#arrowhead${p})"`),e.hasArrowStart&&(m+=d` marker-start="url(#arrowhead-start${p})"`));let h=[d`class="edge${i?` edge-animated`:``}"`,d`data-from="${c(e.source)}"`,d`data-to="${c(e.target)}"`,d`data-style="${e.style}"`,d`data-arrow-start="${e.hasArrowStart}"`,d`data-arrow-end="${e.hasArrowEnd}"`];e.label&&h.push(d`data-label="${c(e.label)}"`),e.id&&h.push(d`data-id="${c(e.id)}"`);let g=i&&!s?` stroke-dasharray="8 6"`:``,_=a?d`d="${De(e.points,t)}"`:d`points="${Fr(e.points)}"`;return d`<${a?`path`:`polyline`} ${h.join(` `)} ${_} `+d`fill="none" stroke="${u}" `+d`stroke-width="${f}"${s}${g}${m}`+(r?d` mask="url(#${r})"`:``)+` />`}function Fr(e){return e.map(e=>d`${e.x},${e.y}`).join(` `)}function Ir(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??Rr(e.points),a=_(r,n.edgeLabel,L.edgeLabel),o=w(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,d`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return d`<g class="edge-label" data-from="${c(e.source)}" data-to="${c(e.target)}" data-label="${c(r)}">\n`+d` ${o.replace(/\n/g,`
16
- `)}\n`+`</g>`}function Lr(e,t){let n=e[t];if(!n)throw Error(d`edgeMidpoint: missing point at index ${t}`);return n}function Rr(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+=zr(Lr(e,n-1),Lr(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=Lr(e,t-1),i=Lr(e,t),a=zr(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 zr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Br(e,t,n,r=!0){let i=Vr(e),a=Si(e,t,n),o=[],s=D(e.className),u=s?d`node ${s}`:`node`,f=e.interaction,p=[d`class="${u}"`,d`data-id="${c(e.id)}"`,d`data-label="${c(e.label)}"`,d`data-shape="${e.shape}"`];o.push(d`<g ${p.join(` `)}>`);let m=r?E(f?.href):void 0,h=m?` `:` `;if(m){let e=f?.target?d` target="${c(f.target)}"`:``;o.push(d` <a href="${c(m)}"${e}>`)}return r&&f?.tooltip&&o.push(d`${h}<title>${l(f.tooltip)}</title>`),o.push(d`${h}${i.replace(/\n/g,d`\n${h}`)}`),a&&o.push(d`${h}${a.replace(/\n/g,d`\n${h}`)}`),m&&o.push(` </a>`),o.push(`</g>`),o.join(`
17
- `)}function Vr(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,s=c(o?.fill??`var(--_node-fill)`),l=c(o?.stroke??`var(--_node-stroke)`),u=c(o?.[`stroke-width`]??String(R.innerBox));switch(a){case`diamond`:return Kr(t,n,r,i,s,l,u);case`rounded`:return Ur(t,n,r,i,s,l,u);case`stadium`:return Wr(t,n,r,i,s,l,u);case`circle`:return Gr(t,n,r,i,s,l,u);case`subroutine`:return qr(t,n,r,i,s,l,u);case`doublecircle`:return Jr(t,n,r,i,s,l,u);case`hexagon`:return Yr(t,n,r,i,s,l,u);case`cylinder`:return Xr(t,n,r,i,s,l,u);case`asymmetric`:return Zr(t,n,r,i,s,l,u);case`trapezoid`:return Qr(t,n,r,i,s,l,u);case`trapezoid-alt`:return $r(t,n,r,i,s,l,u);case`parallelogram`:return ei(t,n,r,i,s,l,u);case`parallelogram-alt`:return ti(t,n,r,i,s,l,u);case`state-start`:return bi(t,n,r,i);case`state-end`:return xi(t,n,r,i);case`document`:return ni(t,n,r,i,s,l,u);case`stacked-document`:return ri(t,n,r,i,s,l,u,!0);case`stacked-process`:return ri(t,n,r,i,s,l,u,!1);case`card`:return ii(t,n,r,i,s,l,u);case`lined-process`:return ai(t,n,r,i,s,l,u);case`divided-process`:return oi(t,n,r,i,s,l,u);case`window-pane`:return si(t,n,r,i,s,l,u);case`triangle`:return ci(t,n,r,i,s,l,u,!1);case`flipped-triangle`:return ci(t,n,r,i,s,l,u,!0);case`filled-circle`:return li(t,n,r,i,l);case`crossed-circle`:return ui(t,n,r,i,s,l,u);case`fork-join`:return di(t,n,r,i,l);case`note`:return fi(t,n,r,i,c(o?.fill??`var(--bg)`),l,u);case`notched-pentagon`:return pi(t,n,r,i,s,l,u);case`sloped-rectangle`:return mi(t,n,r,i,s,l,u);case`flag`:return hi(t,n,r,i,s,l,u);case`bow-tie-rectangle`:return gi(t,n,r,i,s,l,u);case`half-rounded-rectangle`:return _i(t,n,r,i,s,l,u);case`brace`:return vi(t,n,r,i,s,l,u,`left`);case`brace-right`:return vi(t,n,r,i,s,l,u,`right`);case`braces`:return vi(t,n,r,i,s,l,u,`both`);case`bolt`:return yi(t,n,r,i,s,l,u);case`text`:case`anchor`:return``;default:return Hr(t,n,r,i,s,l,u)}}function Hr(e,t,n,r,i,a,o){return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+d`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ur(e,t,n,r,i,a,o){return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+d`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Wr(e,t,n,r,i,a,o){let s=r/2;return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+d`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Gr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2;return d`<circle cx="${s}" cy="${c}" r="${l}" `+d`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Kr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=n/2,u=r/2,f=[d`${s},${c-u}`,d`${s+l},${c}`,d`${s},${c+u}`,d`${s-l},${c}`].join(` `);return d`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function qr(e,t,n,r,i,a,o){return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+d`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+d`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+d`stroke="${a}" stroke-width="${o}" />`+d`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+d`stroke="${a}" stroke-width="${o}" />`}function Jr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2,u=l-5;return d`<circle cx="${s}" cy="${c}" r="${l}" `+d`fill="${i}" stroke="${a}" stroke-width="${o}" />`+d`\n<circle cx="${s}" cy="${c}" r="${u}" `+d`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Yr(e,t,n,r,i,a,o){let s=r/4,c=[d`${e+s},${t}`,d`${e+n-s},${t}`,d`${e+n},${t+r/2}`,d`${e+n-s},${t+r}`,d`${e+s},${t+r}`,d`${e},${t+r/2}`].join(` `);return d`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Xr(e,t,n,r,i,a,o){let s=e+n/2,c=t+7,l=r-14;return d`<rect x="${e}" y="${c}" width="${n}" height="${l}" `+d`fill="${i}" stroke="none" />`+d`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+d`\n<line x1="${e+n}" y1="${c}" x2="${e+n}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+d`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+d`fill="${i}" stroke="${a}" stroke-width="${o}" />`+d`\n<ellipse cx="${s}" cy="${c}" rx="${n/2}" ry="${7}" `+d`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Zr(e,t,n,r,i,a,o){let s=[d`${e},${t}`,d`${e+n},${t}`,d`${e+n},${t+r}`,d`${e},${t+r}`,d`${e+12},${t+r/2}`].join(` `);return d`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Qr(e,t,n,r,i,a,o){let s=n*.15,c=[d`${e+s},${t}`,d`${e+n-s},${t}`,d`${e+n},${t+r}`,d`${e},${t+r}`].join(` `);return d`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function $r(e,t,n,r,i,a,o){let s=n*.15,c=[d`${e},${t}`,d`${e+n},${t}`,d`${e+n-s},${t+r}`,d`${e+s},${t+r}`].join(` `);return d`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ei(e,t,n,r,i,a,o){let s=n*.15,c=[d`${e+s},${t}`,d`${e+n},${t}`,d`${e+n-s},${t+r}`,d`${e},${t+r}`].join(` `);return d`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ti(e,t,n,r,i,a,o){let s=n*.15,c=[d`${e},${t}`,d`${e+n-s},${t}`,d`${e+n},${t+r}`,d`${e+s},${t+r}`].join(` `);return d`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function U(e,t,n){return d`fill="${e}" stroke="${t}" stroke-width="${n}"`}function ni(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),c=t+r-s,l=d`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${c} `+d`C ${e+n*.75} ${c+s*1.8} ${e+n*.25} ${c-s*.8} ${e} ${c} Z`;return d`<path d="${l}" ${U(i,a,o)} />`}function ri(e,t,n,r,i,a,o,s){let c=n-10,l=r-10,u=[];for(let n=2;n>=1;n--)u.push(d`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${c}" height="${l}" `+d`${U(i,a,o)} />`);return u.push(s?ni(e,t+10,c,l,i,a,o):d`<rect x="${e}" y="${t+10}" width="${c}" height="${l}" ${U(i,a,o)} />`),u.join(`
18
- `)}function ii(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[d`${e+s},${t}`,d`${e+n},${t}`,d`${e+n},${t+r}`,d`${e},${t+r}`,d`${e},${t+s}`].join(` `);return d`<polygon points="${c}" ${U(i,a,o)} />`}function ai(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+d`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function oi(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+d`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function si(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),c=t+Math.min(14,r*.28);return d`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+d`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+d`<line x1="${e}" y1="${c}" x2="${e+n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`}function ci(e,t,n,r,i,a,o,s){let c=s?[d`${e},${t}`,d`${e+n},${t}`,d`${e+n/2},${t+r}`]:[d`${e+n/2},${t}`,d`${e+n},${t+r}`,d`${e},${t+r}`];return d`<polygon points="${c.join(` `)}" ${U(i,a,o)} />`}function li(e,t,n,r,i){let a=Math.min(n,r)/2-2;return d`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function ui(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2-2,u=l/Math.SQRT2;return d`<circle cx="${s}" cy="${c}" r="${l}" ${U(i,a,o)} />\n`+d`<line x1="${s-u}" y1="${c-u}" x2="${s+u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />\n`+d`<line x1="${s+u}" y1="${c-u}" x2="${s-u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />`}function di(e,t,n,r,i){let a=Math.min(8,r);return d`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function fi(e,t,n,r,i,a,o){let s=[d`${e},${t}`,d`${e+n-6},${t}`,d`${e+n},${t+6}`,d`${e+n},${t+r}`,d`${e},${t+r}`].join(` `);return d`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n`+d`<polygon points="${e+n-6},${t} ${e+n},${t+6} ${e+n-6},${t+6}" fill="var(--_inner-stroke)" stroke="${a}" stroke-width="${o}" />`}function pi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[d`${e+s},${t}`,d`${e+n-s},${t}`,d`${e+n},${t+s}`,d`${e+n},${t+r}`,d`${e},${t+r}`,d`${e},${t+s}`].join(` `);return d`<polygon points="${c}" ${U(i,a,o)} />`}function mi(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),c=[d`${e},${t+s}`,d`${e+n},${t}`,d`${e+n},${t+r}`,d`${e},${t+r}`].join(` `);return d`<polygon points="${c}" ${U(i,a,o)} />`}function hi(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),c=d`M ${e} ${t+s} `+d`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+d`L ${e+n} ${t+r-s} `+d`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return d`<path d="${c}" ${U(i,a,o)} />`}function gi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),c=d`M ${e+s} ${t} L ${e+n} ${t} `+d`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+d`L ${e+s} ${t+r} `+d`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return d`<path d="${c}" ${U(i,a,o)} />`}function _i(e,t,n,r,i,a,o){let s=r/2,c=Math.max(0,n-s),l=d`M ${e} ${t} L ${e+c} ${t} `+d`A ${s} ${s} 0 0 1 ${e+c} ${t+r} `+d`L ${e} ${t+r} Z`;return d`<path d="${l}" ${U(i,a,o)} />`}function vi(e,t,n,r,i,a,o,s){let c=Math.min(10,n*.12),l=[d`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],u=d`M ${e+c} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+d`Q ${e} ${t+r/2} ${e-c*.4} ${t+r/2} `+d`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+d`Q ${e} ${t+r} ${e+c} ${t+r}`,f=d`M ${e+n-c} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+d`Q ${e+n} ${t+r/2} ${e+n+c*.4} ${t+r/2} `+d`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+d`Q ${e+n} ${t+r} ${e+n-c} ${t+r}`;return(s===`left`||s===`both`)&&l.push(d`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&l.push(d`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`),l.join(`
19
- `)}function yi(e,t,n,r,i,a,o){let s=[d`${e+n*.42},${t}`,d`${e+n},${t}`,d`${e+n*.62},${t+r*.42}`,d`${e+n},${t+r*.42}`,d`${e+n*.3},${t+r}`,d`${e+n*.5},${t+r*.55}`,d`${e},${t+r*.55}`].join(` `);return d`<polygon points="${s}" ${U(i,a,o)} />`}function bi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return d`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function xi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return d`<circle cx="${i}" cy="${a}" r="${o}" `+d`fill="none" stroke="var(--_text)" stroke-width="${R.innerBox*2}" />`+d`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function Si(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2+(e.shape===`asymmetric`?6:0),i=e.y+e.height/2,a=c(e.inlineStyle?.color??h(e.inlineStyle?.fill,`var(--_text)`)),o=d`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${L.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=d` style="font-family: ${c(s)};"`),C(e.label,r,i,n.nodeLabel,o)}function Ci(e){return c(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function wi(e,t){return t===void 0?e:e.replace(`<svg `,d`<svg data-src="${Ci(t)}" `)}var Ti=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=Mi(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 Ei(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 Di(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 Oi=`(?<![\\w-])(var|color-mix)\\(`;function ki(e,t){let[n,...r]=Di(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Ai(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 ji(e){let t=Di(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=Ai(r),o=Ai(i);if(!a||!o)return null;let s=S(a.color),c=S(o.color);if(!s||!c)return null;let l=y(s,c,a.pct,o.pct);return l?m(l):null}function Mi(e,t){let n=``,r=0,i=new RegExp(Oi,`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=Ei(e,c);if(l===-1)break;let u=Mi(e.slice(c+1,l),t),d=o===`var`?ki(u,t):ji(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Ni(e,t){let n=new Ti;for(let[e,r]of Object.entries(t))n.declare(e,r);return Mi(e,n)}var Pi=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Fi=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,Ii=new Set([`data-src`]);function Li(e,t){Pi.lastIndex=0;let n;for(;(n=Pi.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Ri(e,t){return e.replace(Fi,(e,n,r,i,a)=>{if(Ii.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Mi(a.slice(1,-1),t)}${o}`})}function zi(e,t){let n=new Ti;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&&Li(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&Li(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+=Mi(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:Ri(s,n),i=a+1}return r+e.slice(i)}var Bi=[.3013,.3672,.3247,.5244,.5244,.6001,.7061,.1597,.3672,.3672,.3672,.5244,.3672,.3672,.3672,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.3672,.3672,.5244,.5244,.5244,.3672,.7705,.5898,.5659,.5981,.6133,.5356,.5249,.6763,.6543,.2783,.4766,.5757,.5063,.7095,.6382,.6738,.5576,.6758,.582,.481,.5806,.6484,.5874,.8521,.5566,.5703,.5503,.3672,.3555,.3672,.5244,.5244,.5244,.5254,.5571,.4951,.5571,.5454,.3696,.502,.5464,.2852,.3667,.5044,.2949,.8301,.5464,.5366,.5571,.5571,.3887,.4048,.3965,.5464,.4897,.7441,.501,.4932,.4746,.3672,.5244,.3672,.5244],Vi=[.3013,.3672,.3667,.5859,.5859,.6841,.7061,.2295,.3672,.3672,.4321,.5859,.3672,.3672,.3672,.3901,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.3672,.3672,.5859,.5859,.5859,.438,.7705,.6333,.5952,.6118,.6426,.5688,.5835,.6714,.6836,.2783,.5327,.6172,.5527,.7451,.6675,.7031,.5869,.709,.6108,.5112,.6118,.6777,.6216,.8838,.6006,.6133,.5601,.4019,.3555,.4019,.5859,.5859,.5859,.5327,.5815,.5117,.5806,.5747,.3696,.502,.5928,.2983,.3667,.5479,.2949,.8594,.5903,.5659,.5825,.584,.4272,.4307,.3965,.5908,.5273,.7837,.5522,.5337,.5283,.4336,.5859,.4336,.5859];function Hi(e){return e>=4352?1:.6}function Ui(e,t){let n=t?Vi:Bi,r=t?.5859:.5244,i=0;for(let t of e){let e=t.codePointAt(0);i+=e>=32&&e<=126?n[e-32]:e===171||e===187?r:Hi(e)}return i*16}var W={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,mermaidPad:12,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12,lollipopLabelHeight:32,lollipopLabelPadX:8};function Wi(e){return`note ${e}`}function Gi(e){return`${e} link`}function Ki(e){return`namespace ${e}`}function qi(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:Ki(i),name:a.name,classIds:e})}return r}function Ji(e){let t=new Map,n=new Set,r=[],i=new Map,a=e.relationships.map((a,o)=>{if(a.type!==`lollipop`||a.markerAt===`both`)return a;let s=a.markerAt===`from`,c=s?a.from:a.to,l=`lollipop ${r.length}`;return t.set(o,l),i.set(l,s?a.to:a.from),n.add(c),r.push({id:l,label:e.classes.find(e=>e.id===c)?.label??c,attributes:[],methods:[]}),s?{...a,from:l}:{...a,to:l}}),o=new Map(r.map(e=>[e.id,e.label]));if(r.length===0)return{diagram:e,labels:o,byRelationship:t};let s=new Set(a.flatMap(e=>[e.from,e.to]));for(let t of e.notes)t.forClass&&s.add(t.forClass);for(let t of e.namespaces)for(let e of t.classIds)s.add(e);let c=e=>n.has(e.id)&&!s.has(e.id)&&!e.annotation&&e.attributes.length===0&&e.methods.length===0,l=[...e.classes.filter(e=>!c(e)),...r],u=e.namespaces.map(e=>({...e,classIds:[...e.classIds,...r.filter(t=>e.classIds.includes(i.get(t.id)??``)).map(e=>e.id)]}));return{diagram:{...e,classes:l,relationships:a,namespaces:u},labels:o,byRelationship:t}}function Yi(e){return p(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function Xi(e,t,n){let r=new Map,i=new Map,a=qe(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:I(t.label,a.nodeLabel,L.edgeLabel)+W.lollipopLabelPadX*2,height:W.lollipopLabelHeight,headerHeight:W.lollipopLabelHeight,attrHeight:0,methodHeight:0});continue}let e=t.annotation?W.headerBaseHeight+W.annotationHeight:W.headerBaseHeight,i=t.attributes.length>0?t.attributes.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,o=t.methods.length>0?t.methods.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,s=I(t.label,a.nodeLabel,L.nodeLabel),c=na(t.attributes),l=na(t.methods),u=Math.max(ta(t),s+W.boxPadX*2,c+W.boxPadX*2,l+W.boxPadX*2),d=e+i+o;r.set(t.id,{width:u,height:d,headerHeight:e,attrHeight:i,methodHeight:o})}let o=qi(e),s=new Map;for(let e of o)for(let t of e.classIds)s.set(t,e.id);let c=new Map,l=[];for(let e of o){let t=I(e.name,W.namespaceTitleFontSize,L.groupHeader)+W.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":tt({top:W.namespaceTitleHeight+W.namespacePad/2,left:W.namespacePad,bottom:W.namespacePad,right:W.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};c.set(e.id,n),l.push(n)}for(let[e,t]of r){let n=rt(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=Yi(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(ot({id:`e${t}`,source:e?n.to:n.from,target:e?n.from:n.to,label:n.label,labelStyle:u}))}let p=new Set(r.keys());for(let[t,n]of e.notes.entries()){let e=Wi(t),r=_(n.text,a.edgeLabel,L.edgeLabel),o={width:r.width+W.notePadX*2,height:r.height+W.notePadY*2};i.set(e,o),l.push(rt(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(ot({id:Gi(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...nt({direction:et(e.direction,$e.class),nodeSpacing:W.nodeSpacing,layerSpacing:W.layerSpacing,padding:W.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:l,edges:f},classSizes:r,noteSizes:i,namespaces:o}}function Zi(e,t,n,r,i,a){let o=new Map;for(let e of t.classes)o.set(e.id,e);let s=new Set(i.map(e=>e.id)),c=new Map,l=[];for(let t of e.children??[])if(s.has(t.id)){let e=t.x??0,n=t.y??0;c.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&&c.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.filter(e=>!a.labels.has(e)),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=o.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:T(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=Yi(a.diagram),h=new Map;for(let e of l)h.set(e.id,e);let g=new Map;for(let[e,t]of a.labels){let n=h.get(e);g.set(e,{text:t,x:n?.x??0,y:n?.y??0,width:n?.width??0,height:n?.height??0})}let _=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=_[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=Wt(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=Gt(t,r.x,r.y),c=g.get(a.byRelationship.get(e)??``);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:o,labelPosition:s,...c?{interfaceLabel:c}:{}})}let v=new Map;for(let e of _.slice(t.relationships.length))v.set(e.id,e);let y=[];for(let[e,n]of t.notes.entries()){let t=Wi(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(Gi(t));y.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:Wt(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:y,namespaces:d}}function Qi(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=Ji(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=Xi(n.diagram,t,n.labels);return Zi(Be(r,t.layoutCache),e,i,a,o,n)}function $i(e){return e.length*Math.ceil(Ue(`M`,W.memberFontSize))}function ea(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function ta(e){let t=Ui(e.label,!0),n=e.annotation?Ui(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>Ui(ea(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function na(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=$i(se(n));e>t&&(t=e)}return t}var ra={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function ia(e,t,n=`Inter`,r=!1,i=Ke,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!E(e.interaction?.href));u.push(wi(M(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push(Qe(n,!0,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(oa(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(aa(t));for(let t of e.relationships)u.push(pa(t));for(let t of e.notes)u.push(fa(t));for(let t of e.classes)u.push(sa(t,i,c));for(let t of e.relationships){let e=ma(t,i);e&&u.push(e)}for(let t of e.notes)u.push(da(t,i));for(let t of e.relationships)u.push(_a(t,i));return u.push(`</svg>`),u.join(`
20
- `)}function aa(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=R.outerBox;return[d`<g class="class-namespace" data-id="${c(e.name)}" data-label="${c(e.name)}">`,d` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,d` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,d` <text x="${t+W.namespacePad}" y="${n+a/2}" dy="${z}" font-size="${W.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${xa(e.name)}</text>`,`</g>`].join(`
21
- `)}function oa(e){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
8
+ }`;function I(e,t,n){return y(e,t,n)}function We(e,t){return e.length*t*.6}var Ge=`'JetBrains Mono'`,Ke=`${Ge}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,qe={nodeLabel:13,edgeLabel:11,groupHeader:12};function Je(e){return{nodeLabel:e?.nodeLabel??qe.nodeLabel,edgeLabel:e?.edgeLabel??qe.edgeLabel,groupHeader:e?.groupHeader??qe.groupHeader}}var L={nodeLabel:500,edgeLabel:400,groupHeader:600},Ye=12,Xe=12,Ze={horizontal:20,vertical:10,diamondExtra:24},R={outerBox:1,innerBox:.75,connector:1},z=`0.35em`,Qe={width:8,height:5};function $e(e,t,n,i){return r(e,t?{family:He,faceCss:Ue}:!1,n,i)}var B={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:qe},et=`#087ebf`,tt={blank:``,database:`<path d="m20,57.86c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m20,45.95c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m20,34.05c0,3.94,8.95,7.14,20,7.14s20-3.2,20-7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><ellipse cx="40" cy="22.14" rx="20" ry="7.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><line x1="20" y1="57.86" x2="20" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="60" y1="57.86" x2="60" y2="22.14" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line>`,disk:`<rect x="20" y="15" width="40" height="50" rx="1" ry="1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></rect><ellipse cx="24" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="56" cy="19.17" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="24" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="56" cy="60.83" rx=".8" ry=".83" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="40" cy="33.75" rx="14" ry="14.58" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><ellipse cx="40" cy="33.75" rx="4" ry="4.17" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></ellipse><path d="m37.51,42.52l-4.83,13.22c-.26.71-1.1,1.02-1.76.64l-4.18-2.42c-.66-.38-.81-1.26-.33-1.84l9.01-10.8c.88-1.05,2.56-.08,2.09,1.2Z" style="fill: #fff; stroke-width: 0px;"></path>`,server:`<rect x="17.5" y="17.5" width="45" height="45" rx="2" ry="2" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></rect><line x1="17.5" y1="32.5" x2="62.5" y2="32.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="17.5" y1="47.5" x2="62.5" y2="47.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><g><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,25c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,40c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: #fff; stroke-width: 0px;"></path><path d="m56.25,55c0,.27-.45.5-1,.5h-10.5c-.55,0-1-.23-1-.5s.45-.5,1-.5h10.5c.55,0,1,.23,1,.5Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10;"></path></g><g><circle cx="32.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="25" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g><g><circle cx="32.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="40" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g><g><circle cx="32.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="27.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle><circle cx="22.5" cy="55" r=".75" style="fill: #fff; stroke: #fff; stroke-miterlimit: 10;"></circle></g>`,cloud:`<path d="m65,47.5c0,2.76-2.24,5-5,5H20c-2.76,0-5-2.24-5-5,0-1.87,1.03-3.51,2.56-4.36-.04-.21-.06-.42-.06-.64,0-2.6,2.48-4.74,5.65-4.97,1.65-4.51,6.34-7.76,11.85-7.76.86,0,1.69.08,2.5.23,2.09-1.57,4.69-2.5,7.5-2.5,6.1,0,11.19,4.38,12.28,10.17,2.14.56,3.72,2.51,3.72,4.83,0,.03,0,.07-.01.1,2.29.46,4.01,2.48,4.01,4.9Z" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path>`,internet:`<circle cx="40" cy="40" r="22.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></circle><line x1="40" y1="17.5" x2="40" y2="62.5" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="17.5" y1="40" x2="62.5" y2="40" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><path d="m39.99,17.51c-15.28,11.1-15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><path d="m40.01,17.51c15.28,11.1,15.28,33.88,0,44.98" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></path><line x1="19.75" y1="30.1" x2="60.25" y2="30.1" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line><line x1="19.75" y1="49.9" x2="60.25" y2="49.9" style="fill: none; stroke: #fff; stroke-miterlimit: 10; stroke-width: 2px;"></line>`},nt={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function rt(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 it(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 at(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":it(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function ot(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var st={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function ct(e,t){let n=v(e,t.fontSize,L.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function lt(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[ct(e.label,e.labelStyle)]),t}var ut={"state-start":`FIRST`},dt={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function ft(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var V={top:44,left:16,bottom:16,right:16},pt={top:16,left:16,bottom:16,right:16};function mt(e){let t=new Map;for(let n of e.edges){if(!n.label)continue;let e=`${n.source}\0${n.target}`,r=(t.get(e)??0)+1;if(r>=3)return!0;t.set(e,r)}return!1}var ht=new WeakMap;function gt(e,t){let n=ht.get(e);return n||(n=ft(e)||Ct(e.subgraphs)?new Set:p(e,t?.walkOrder,t?.feedbackEdges??te(e)),ht.set(e,n)),n}function _t(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 vt(e){return rt(e,nt.flowchart)}function yt(e){return{...at(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 bt(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:st}}function xt(e,t,n,r,i){if(i!==void 0)return{width:80,height:80};let a=v(t,r,L.nodeLabel),o=a.width+Ze.horizontal*2,s=a.height+Ze.vertical*2;if(n===`diamond`){let e=Math.max(o,s)+Ze.diamondExtra;o=e,s=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(o*o+s*s))+8;o=n===`doublecircle`?e+12:e,s=o}return n===`hexagon`&&(o+=Ze.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(o+=Ze.horizontal),n===`asymmetric`&&(o+=12),n===`cylinder`&&(s+=14),n===`state-start`||n===`state-end`||t===``&&n===`diamond`?{width:28,height:28}:t===``&&n===`fork-join`?{width:70,height:10}:(o=Math.max(o,60),s=Math.max(s,36),{width:o,height:s})}var St=` root`;function Ct(e){for(let t of e)if(t.direction!==void 0||Ct(t.children))return!0;return!1}function wt(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)wt(n,t)}function Tt(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 Et(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Dt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),Mt(t,i,a);let o=Nt(e.subgraphs),s=Tt(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];if(n.acrossFlow)continue;let 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=Ct(e.subgraphs),f=[],p=[],m={...yt({direction:vt(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(B.thoroughness),"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":(e.subgraphs.length===0||mt(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...mt(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder||At(e)?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...ft(e)?dt:{},"elk.layered.wrapping.strategy":`OFF`,...At(e)?{"elk.partitioning.activate":`true`,"elk.layered.crossingMinimization.semiInteractive":`true`,"elk.layered.nodePlacement.bk.fixedAlignment":`LEFTUP`}:{},"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=Et(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]:St,lt({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:bt(r)}))}let y=At(e)?[...e.nodes].sort((e,t)=>(e[1].gridOrder??0)-(t[1].gridOrder??0)):e.nodes;for(let[t,o]of y)if(!i.has(t)&&!a.has(t)){let i=xt(t,o.label,o.shape,r.fontSizes.nodeLabel,o.icon),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=ot(t,i,o.label),c=ft(e)?ut[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),o.gridLayer!==void 0&&(s.layoutOptions={...s.layoutOptions,...kt(o,e.direction)}),f.push(s)}let b=ft(e),x=f.length,S=b?e.subgraphs:[...e.subgraphs].reverse();for(let t of S)f.push(Ot(t,e,r,l,h,g,e.direction));if(b&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<x)return _t(e,new Set([t.id]));let r=e.subgraphs[n-x],i=_t(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return wt(r,a),_t(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 C=gt(e,n),w=n?.feedbackEdges,T=l.get(null),E=w?.size?[...T.filter(e=>w.has(e.index)),...T.filter(e=>!w.has(e.index))]:T;for(let{index:e,edge:t}of E){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=lt({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:bt(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(St)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(lt({id:`e${e}`,source:C.has(e)?t.target:t.source,target:C.has(e)?t.source:t.target,label:t.label,labelStyle:bt(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Ot(e,t,n,r,i,a,o){let s=e.direction!==void 0&&j(e,t)?e.direction:o,c=yt({direction:vt(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?pt:V}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[],f=e=>t.nodes.get(e)?.gridOrder??0;for(let r of[...e.nodeIds].sort((e,t)=>f(e)-f(t))){let e=t.nodes.get(r);if(e){let i=ot(r,xt(r,e.label,e.shape,n.fontSizes.nodeLabel,e.icon),e.label);e.gridLayer!==void 0&&(i.layoutOptions=kt(e,t.direction)),d.push(i)}}let p=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of p)d.push(Ot(e,t,n,r,i,a,s));let m=[],h=r.get(e.id)??[],g=gt(t);for(let{index:e,edge:t}of h)t.source!==t.target&&m.push(lt({id:`e${e}`,source:g.has(e)?t.target:t.source,target:g.has(e)?t.source:t.target,label:t.label,labelStyle:bt(n)}));for(let t of a.get(e.id)??[])m.push(t);if(At(t)){c[`elk.partitioning.activate`]=`true`;let n=jt(e,t);n!==void 0&&(c[`elk.partitioning.partition`]=String(n))}return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:m}}function kt(e,t){let n=String((e.gridOrder??0)*100),r=t===`LR`||t===`RL`;return{"elk.partitioning.partition":String(e.gridLayer),"elk.position":r?`(0, ${n})`:`(${n}, 0)`}}function At(e){for(let t of e.nodes.values())if(t.gridLayer!==void 0)return!0;return!1}function jt(e,t){let n=[...e.nodeIds.map(e=>t.nodes.get(e)?.gridLayer),...e.children.map(e=>jt(e,t))].filter(e=>e!==void 0);return n.length>0?Math.min(...n):void 0}function Mt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),Mt(r,t,n)}function Nt(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 Pt(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]=Ft(e[0],e[1],t);else{let n=e.length-1;r[n]=Ft(e[n],e[n-1],t)}}if(t.shape===`asymmetric`){let i=n?0:e.length-1,a=e[i],o=t.height/2,s=Math.abs(a.y-(t.y+o));Math.abs(a.x-t.x)<.5&&s<o&&(r[i]={x:t.x+12*(1-s/o),y:a.y})}return r}function Ft(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?Lt(t,c,a)??a:Lt(t,a,o)??a:t<=r?Lt(t,s,c)??s:Lt(t,o,s)??s}{let t=e.y;return l>0?t<=i?It(t,a,c)??c:It(t,c,s)??c:t<=i?It(t,a,o)??o:It(t,o,s)??o}}function It(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 Lt(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)}}var Rt=12;function zt(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=B.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)return;let u=r?`x`:`y`,d=(e,t,n,r)=>{let i=e[t],a=i[u];i[u]+=r;let[o,s,c]=[1,2,3].map(r=>e[t+r*n]);if(o[u]===a)o[u]+=r;else if(s&&c&&s[u]===o[u]){let e=Math.sign(o[u]-a),t=o[u]+e*Math.max(0,Rt-e*(o[u]-i[u]));e*(c[u]-t)>0&&(o[u]=s[u]=t)}};for(let e of t){let{points:t}=e;if(t.length<2)continue;let n=l.get(e.source),r=l.get(e.target);n!=null&&d(t,0,1,n),r!=null&&d(t,t.length-1,-1,r)}}var Bt=.5;function Vt(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+Bt,r=e.x+e.width-Bt,i=e.y+Bt,a=e.y+e.height-Bt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Ht(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(...Ht(e,t,i.children)));return r}function Ut(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Ht(t,n,r).map(e=>e.id)),u=Ht(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}var Wt=2;function Gt(e,t,n,r,i){for(let a of e){if(t.has(a)||a.source===a.target)continue;let e=a.source===n?a.points[0]:a.target===n?a.points[a.points.length-1]:void 0;if(e&&Math.abs((i?e.x:e.y)-r)<=Wt)return!0}return!1}function Kt(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=new Map,s=e=>`${e.source}\0${e.target}`;for(let t of e)o.set(s(t),(o.get(s(t))??0)+1);let c=e=>o.get(s(e))>1,l=r===`LR`,u=r===`RL`,d=r===`BT`,f=l||u,p=new Map;for(let t of e){if(t.source===t.target||c(t))continue;let e=p.get(t.source)??[];p.set(t.source,e),e.push(t)}for(let[o,s]of p){if(s.length<2)continue;let c=s[0].style;if(s.some(e=>e.label||e.style!==c))continue;let p=i.get(o);if(!p)continue;let m=[];for(let e of s){let t=i.get(e.target);t&&(l?t.x>p.x+p.width:u?t.x+t.width<p.x:d?t.y+t.height<p.y:t.y>p.y+p.height)&&m.push({edge:e,node:t})}if(m.length<2)continue;let h=p.x+p.width/2,g=p.y+p.height/2;if(f){let i=l?p.x+p.width:p.x,s=g;if(Gt(e,new Set(m.map(e=>e.edge)),o,i,!0))continue;let c=i+((l?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=Ut(c,h,g,n,r);let u=[];for(let{edge:e,node:n}of m){let r=l?n.x:n.x+n.width,a=n.y+n.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];Vt(d,t,new Set([o,n.id]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t,a.add(e)}else{let i=h,s=d?p.y:p.y+p.height;if(Gt(e,new Set(m.map(e=>e.edge)),o,s,!1))continue;let c=s+((d?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-s)/2;c=Ut(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=d?n.y+n.height:n.y,u=[{x:i,y:s},{x:i,y:c},{x:r,y:c},{x:r,y:a}];Vt(u,t,new Set([o,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let m=new Map;for(let t of e){if(a.has(t)||t.source===t.target||c(t))continue;let e=m.get(t.target)??[];m.set(t.target,e),e.push(t)}for(let[a,o]of m){if(o.length<2)continue;let s=o[0].style;if(o.some(e=>e.label||e.style!==s))continue;let c=i.get(a);if(!c)continue;let p=[];for(let e of o){let t=i.get(e.source);t&&(l?t.x+t.width<c.x:u?t.x>c.x+c.width:d?t.y>c.y+c.height:t.y+t.height<c.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=c.x+c.width/2,h=c.y+c.height/2;if(f){let i=l?c.x:c.x+c.width,o=h;if(Gt(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let s=l?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),u=s+(i-s)/2;u=Ut(u,m,h,n,r);let d=[];for(let{edge:e,node:n}of p){let r=l?n.x+n.width:n.x,s=n.y+n.height/2,c=[{x:r,y:s},{x:u,y:s},{x:u,y:o},{x:i,y:o}];Vt(c,t,new Set([n.id,a]))&&d.push({edge:e,points:c})}if(d.length<2)continue;for(let{edge:e,points:t}of d)e.points=t}else{let i=m,o=d?c.y+c.height:c.y;if(Gt(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=d?Math.min(...p.map(e=>e.node.y)):Math.max(...p.map(e=>e.node.y+e.node.height)),l=s+(o-s)/2;l=Ut(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=n.x+n.width/2,s=[{x:r,y:d?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];Vt(s,t,new Set([n.id,a]))&&u.push({edge:e,points:s})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}}}var qt=1.5,Jt=.01;function Yt(e){let t=e.map(e=>({...e})),n=0;for(;n+3<t.length;){let[e,r,i,a]=[t[n],t[n+1],t[n+2],t[n+3]],o=Math.abs(e.x-r.x)<Jt&&Math.abs(i.x-a.x)<Jt&&Math.abs(r.y-i.y)<Jt&&Math.abs(r.x-i.x)<=qt&&Math.abs(r.x-i.x)>=Jt,s=Math.abs(e.y-r.y)<Jt&&Math.abs(i.y-a.y)<Jt&&Math.abs(r.x-i.x)<Jt&&Math.abs(r.y-i.y)<=qt&&Math.abs(r.y-i.y)>=Jt;if(o){let r=(e.x+a.x)/2;t.splice(n,4,{x:r,y:e.y},{x:r,y:a.y})}else if(s){let r=(e.y+a.y)/2;t.splice(n,4,{x:e.x,y:r},{x:a.x,y:r})}else n++}return t}function Xt(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 Zt(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 Qt=16,$t=28,en=18,tn=28,nn=10;function rn(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(tn,e.height*.6)/2,a=$t+t*en,o=[];for(let e=0;e<=Qt;e++){let t=Math.PI*e/Qt;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+nn,y:r}}}function an(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}=rn(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:yn(i,e),headColor:vn(e),id:a.id,animate:a.animate})}}function on(e,t,n){let r=e.direction===`LR`||e.direction===`RL`;e.edges.forEach((i,a)=>{let o=t.get(i.source),s=t.get(i.target);if(!i.acrossFlow||!o||!s)return;let[c,l,u,d]=r?[`y`,`height`,`x`,`width`]:[`x`,`width`,`y`,`height`],f=o[c]<=s[c]?o:s,p=f===o?s:o,m=e=>e[u]+e[d]/2,h=(m(o)+m(s))/2,g=f[c]+f[l],_=p[c],v=e=>r?{x:h,y:e}:{x:e,y:h},y=f===o?[v(g),v(_)]:[v(_),v(g)];n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:y,inlineStyle:yn(a,e),headColor:vn(e),id:i.id,animate:i.animate})})}function sn(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(...sn(n.children));return t}function cn(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)_n(e,o);ln(e,t,o,r,a,0,0);let s=sn(a);fn(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),zt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));an(t,c,i),on(t,c,i),n&&Kt(i,r,a,t.direction);for(let e of i){e.points=Yt(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=Pt(e.points,t,!0)),n&&(e.points=Pt(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=Qe.width,f=B.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 ln(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,c=(s.y??0)+o,l=s.width??0,u=s.height??0;if(n.has(s.id)){let a=[];ln(s,t,n,r,a,e,c);let o=gn(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:c,width:l,height:u,children:a,...o?.region?{region:!0}:{}})}else{let a=t.nodes.get(s.id);if(a){let n=E(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.icon===void 0?a.shape:`rectangle`,icon:a.icon,x:e,y:c,width:l,height:u,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&ln(s,t,n,r,i,e,c)}}}function un(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 dn(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 fn(e,t,n,r,i,a){let o=new Map;pn(e,o,0,0);let s=new Map;hn(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??dn(o));let f=mn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=dn(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:gt(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:yn(e,t),headColor:vn(t),id:i.id,animate:i.animate})}}function pn(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;pn(i,t,n+e,r+a)}}function mn(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 hn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=un(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=Xt(a,l,u),f=Zt(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)hn(a,t,n+(a.x??0),r+(a.y??0),i)}function gn(e,t){for(let n of e){if(n.id===t)return n;let e=gn(n.children,t);if(e)return e}}function _n(e,t){t.add(e.id);for(let n of e.children)_n(n,t)}function vn(e){return yn(-1,e)?.stroke}function yn(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&&c(n)}var bn=10,xn=14,Sn=14,Cn=10,wn=24,Tn=400,En=new Set([`rectangle`,`rounded`,`subroutine`]);function Dn(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 On(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 kn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function An(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function jn(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<xn&&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<xn&&r>0)return!0}}}return!1}function Mn(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 Nn=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 Pn(e,t,n,r,i,a=[]){let o=Dn(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+Cn,a1:d.a1-Cn,c0:d.c0+Cn,c1:d.c1-Cn},p=a.map(e=>e.map(e=>An(o,e))),m=n.map(e=>kn(o.span(e),bn)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>En.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=>On(n,r,e))||On(n,r,s)||On(n,r,c)||p.some(e=>jn(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-bn),y.add(e.c1+bn);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(Sn,n),i=c.a0-Math.min(Sn,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=Mn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?Tn:0,i=Nn(n)+wn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Fn(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 In=`__zm_spine__`,Ln=8,Rn=6,zn=12,Bn=4,Vn=4,Hn=.25,Un=.02,Wn=40,Gn=e=>e===`TD`||e===`TB`||e===`BT`,Kn=e=>e.startsWith(In);function qn(e){return e.flatMap(e=>[e,...qn(e.children)])}function H(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of H(n))t.add(e);return t}function Jn(e){if(e.subgraphs.length===0||ft(e)||Ct(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Kn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=qn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function Yn(e,t){let n=Gn(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 Xn(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...H(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=`${In}${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);!Kn(t)&&!Kn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Zn(e,t,n,r=()=>!1,i=()=>!1){let a=e=>{let n=[...H(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},o=e=>{let t=[...H(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},s=e.map(e=>({sg:e,at:a(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),c=[],l=-1/0;for(let{sg:e,at:t}of s){let n=c[c.length-1];n&&t[0]<=l?(n.push(e),l=Math.max(l,t[1])):(c.push([e]),l=t[1])}for(let t of c){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let a=t.some(e=>e.region)||t.some((e,n)=>t.slice(n+1).some(t=>i(e,t)))?-1:1,s=[...t].sort((t,n)=>a*(e.indexOf(n)-e.indexOf(t))),c=t.map(o).sort((e,t)=>e-t),l=s.map((e,t)=>c[t]-o(e));s.forEach((e,t)=>{for(let r of H(e))n.has(r)&&n.set(r,n.get(r)+l[t])})}for(let a of e)Zn(a.children,t,n,r,i)}function Qn(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=H(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)||Kn(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 $n=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function er(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...H(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=e.region?pt:V,s=Math.min(...a.map(e=>e.x))-o.left,c=Math.min(...a.map(e=>e.y))-o.top,l=Math.max(...a.map(e=>e.x+e.width))+o.right,u=Math.max(...a.map(e=>e.y+e.height))+o.bottom,d=e.region?0:v(e.label,n.groupHeader,L.groupHeader).width+24;return{id:e.id,label:e.label,x:s,y:c,width:Math.max(l-s,d),height:u-c,children:i,...e.region?{region:!0}:{}}};return e.map(r)}var tr=e=>e.flatMap(e=>[e,...tr(e.children)]);function nr(e,t,n,r,i,a){let o=Gn(r),s=new Map(qn(t).map(e=>[e.id,H(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-Wn,y:e.y-Wn,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=tr(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))||!$n(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)=>tr(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 rr(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=te(e),o=t(i,{feedbackEdges:a}),s=Yn(o.nodes,e.direction),c=Gn(e.direction),l=new Map(o.nodes.map(e=>[e.id,e])),u=e=>{let t=l.get(e);return c?t.x:t.y},d=qn(e.subgraphs),f=Xn(d,s,u),p=new Map;for(let e of f.ghosts)p.set(e.subgraph,[...p.get(e.subgraph)??[],e.id]);let m=new Map(o.nodes.map(e=>[e.id,u(e.id)]));Zn(e.subgraphs,s,m,(t,n)=>{let r=H(t),i=H(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)},(t,n)=>ne(e,t,n));for(let e of f.ghosts){let t=[...H(d.find(t=>t.id===e.subgraph))].filter(e=>m.has(e)).map(e=>m.get(e));m.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let h=new Map(e.nodes);for(let e of f.ghosts)h.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let g=Qn([...h.keys()],m,s,d,p),_={...i,nodes:new Map(g.map(e=>[e,h.get(e)])),edges:[...e.edges,...f.edges]},v=new Set(f.edges.map((t,n)=>e.edges.length+n)),y=i=>{let o=new Map,c=new Map;for(let l=0;;l++){let u=new Map(f.ghosts.map(e=>[e.id,Ln+(o.get(e.subgraph)??0)])),m=t(_,{fixedWidths:u,looseEdges:v,detachedEdges:i,walkOrder:r,feedbackEdges:a,forceNodeOrder:!0}),h=new Map(m.nodes.filter(e=>!Kn(e.id)).map(e=>[e.id,e])),g=er(e.subgraphs,h,n),y=nr(g,e.subgraphs,h,e.direction,new Set(p.keys()),s),{penetration:b,stuck:x}=y;if(x)return;if(b.size===0){for(let t=0;y.requests.length>0;t++){if(t===zn)return;or(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=er(e.subgraphs,h,n),y=nr(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=ar(e,i,h,g,d);return t&&lr(m,[...h.values()],g,t,e.direction)}if(l===Rn)return;for(let[e,t]of b){let n=o.get(e)??0,r=c.get(e),i=r?(r.overlap-t)/(n-r.width):0,a=i>Un?i:Hn;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Vn)}}},b=ir(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function ir(e,t,n,r){let i=r.map(e=>{let t=H(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 ar(e,t,n,r,i){let a=new Map(tr(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=H(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>H(e).size-H(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=Pn(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?Fn(d):void 0,inlineStyle:yn(r,e),headColor:vn(e),id:t.id,animate:t.animate})}return o}function or(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Bn,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)}var sr=8;function cr(e,t,n,r){let i=Gn(r)?`y`:`x`,a=i===`x`?`y`:`x`,o=i===`x`?`width`:`height`,s=i===`x`?`height`:`width`;for(let{points:r}of e)for(let e=1;e<r.length-1;){let c=e;for(;c+1<r.length-1&&r[c+1][i]===r[e][i];)c++;let l=r.slice(e,c+1),u=l[0],d=Math.min(...l.map(e=>e[a])),f=Math.max(...l.map(e=>e[a])),p=r[e-1][i],m=r[c+1][i],h=n.flatMap(e=>[e[i],e[i]+e[o]].map(t=>({g:e,s:t}))).find(({g:e,s:t})=>Math.abs(u[i]-t)<sr&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?sr:-8),n=(e-p)*(m-e)>0,r=t.every(t=>t[i]+t[o]<=e||t[i]>=e||t[a]+t[s]<=d||t[a]>=f);if(n&&r)for(let t of l)t[i]=e}e=c+1}}function lr(e,t,n,r,i){let a=[...e.edges.filter(e=>!Kn(e.source)&&!Kn(e.target)),...r],o=tr(n);cr(a,t,o,i);let s=[...t.map(e=>e.x),...o.map(e=>e.x),...a.flatMap(e=>e.points.map(e=>e.x))],c=[...t.map(e=>e.y),...o.map(e=>e.y),...a.flatMap(e=>e.points.map(e=>e.y))],l=B.padding-Math.min(...s),u=B.padding-Math.min(...c);for(let e of t)e.x+=l,e.y+=u;for(let e of o)e.x+=l,e.y+=u;for(let e of a){for(let t of e.points)t.x+=l,t.y+=u;e.labelPosition&&(e.labelPosition.x+=l,e.labelPosition.y+=u)}let d=0,f=0;for(let e of t)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of o)d=Math.max(d,e.x+e.width+B.padding),f=Math.max(f,e.y+e.height+B.padding);for(let e of a){for(let t of e.points)d=Math.max(d,t.x+Qe.width+B.padding),f=Math.max(f,t.y+Qe.width+B.padding);e.labelPosition&&(d=Math.max(d,e.labelPosition.x+60+B.padding),f=Math.max(f,e.labelPosition.y+20+B.padding))}return{...e,nodes:t,edges:a,groups:n,width:d,height:f}}var ur=12,dr=8,fr=4;function pr(e,t,n){let r=e.map(e=>({axis:e.axis,cross:e.cross,after:e.after??0,rank:0,real:!0})),i=e.map(()=>[]),a=e.map(()=>[]),o=t.flatMap((e,t)=>e.from===e.to?[]:[t]),s=m(o.map(e=>({source:String(t[e].from),target:String(t[e].to)})),e.map((e,t)=>String(t))),c=o.map((e,n)=>{let r=t[e];return s.has(n)?{index:e,u:r.to,v:r.from,reversed:!0}:{index:e,u:r.from,v:r.to,reversed:!1}}),l=e.map(()=>[]),u=e.map(()=>0);for(let e of c)l[e.u].push(e.v),u[e.v]++;let d=u.flatMap((e,t)=>e===0?[t]:[]);for(let e=0;e<d.length;e++){let t=d[e];for(let e of l[t])r[e].rank=Math.max(r[e].rank,r[t].rank+2),--u[e]===0&&d.push(e)}let f=c.map(e=>{let n=(r[e.v].rank-r[e.u].rank)/2,o=r[e.u].rank+2*Math.floor(n/2)+1,s=t[e.index].label,c=[e.u];for(let t=r[e.u].rank+1;t<r[e.v].rank;t++){let e=r.length,n=t===o&&s!==void 0;r.push({axis:n?s.axis:0,cross:n?s.cross:0,after:0,rank:t,real:!1}),i.push([]),a.push([]),c.push(e)}c.push(e.v);for(let e=1;e<c.length;e++)a[c[e-1]].push(c[e]),i[c[e]].push(c[e-1]);return{chain:c,labelRank:o}}),p=r.map((e,t)=>t),h=e=>{let t=e;for(;p[t]!==t;)t=p[t]=p[p[t]];return t};for(let{chain:e}of f)for(let t of e)p[h(t)]=h(e[0]);let g=new Map;r.forEach((e,t)=>{let n=h(t);g.set(n,[...g.get(n)??[],t])});let _=r.map(()=>0),v=[],y=[];for(let e of g.values()){let t=mr(e,r,i,a,n),o=1/0,s=-1/0;for(let n of e)_[n]=t.get(n),o=Math.min(o,_[n]-r[n].cross/2),s=Math.max(s,_[n]+r[n].cross/2+r[n].after);v.push({min:o,max:s}),y.push(e)}let b=0;y.forEach((e,t)=>{let r=b-v[t].min;for(let t of e)_[t]=_[t]+r;b+=v[t].max-v[t].min+n.nodeSep});let x=Math.max(0,b-n.nodeSep),S=r.reduce((e,t)=>Math.max(e,t.rank),0),C=Array(S+1).fill(0);for(let e of r)C[e.rank]=Math.max(C[e.rank],e.axis);let w=Array(S+1).fill(0);for(let e=1;e<=S;e++)w[e]=w[e-1]+C[e-1]+n.rankSep/2;let T=e=>w[r[e].rank]+C[r[e].rank]/2,E=t.map(()=>[]),D=t.map(()=>void 0);return c.forEach((e,n)=>{let{chain:i,labelRank:a}=f[n],o=i.slice(1,-1),s=o.map(e=>({axis:T(e),cross:_[e]}));if(E[e.index]=e.reversed?s.reverse():s,t[e.index].label){let t=o.find(e=>r[e].rank===a);D[e.index]={axis:T(t),cross:_[t]}}}),{nodes:e.map((e,t)=>({axis:w[r[t].rank]+(C[r[t].rank]-e.axis)/2,cross:_[t]-e.cross/2})),paths:E,labels:D,axisSize:w[S]+C[S],crossSize:x}}function mr(e,t,n,r,i){let a=[],o=new Set,s=[...e].sort((e,n)=>t[e].rank-t[n].rank||e-n);for(let e of s){if(o.has(e))continue;let n=[{s:e,next:0}];for(o.add(e),(a[t[e].rank]??=[]).push(e);n.length>0;){let e=n[n.length-1],i=r[e.s][e.next++];i===void 0?n.pop():o.has(i)||(o.add(i),(a[t[i].rank]??=[]).push(i),n.push({s:i,next:0}))}}let c=a.filter(e=>e!==void 0),l=new Map,u=()=>c.forEach(e=>e.forEach((e,t)=>l.set(e,t))),d=()=>{let e=0;for(let t=0;t+1<c.length;t++){let n=c[t].flatMap(e=>r[e].map(t=>[l.get(e),l.get(t)]));for(let t=0;t<n.length;t++)for(let r=t+1;r<n.length;r++){let[i,a]=n[t],[o,s]=n[r];(i-o)*(a-s)<0&&e++}}return e};u();let f=c.map(e=>[...e]),p=d();for(let e=0;e<dr&&p>0;e++){let t=e%2==0,i=c.map((e,t)=>t);t||i.reverse();for(let e of i){let i=t?n:r,a=e=>{let t=i[e];return t.length===0?l.get(e):t.reduce((e,t)=>e+l.get(t),0)/t.length},o=new Map(c[e].map(e=>[e,a(e)]));c[e].sort((e,t)=>o.get(e)-o.get(t)||l.get(e)-l.get(t)),c[e].forEach((e,t)=>l.set(e,t))}let a=d();a<p&&(p=a,f=c.map(e=>[...e]))}f.forEach((e,t)=>c[t]=e);let m=new Map,h=(e,n)=>(t[e].cross+t[n].cross)/2+t[e].after+(t[e].real&&t[n].real?i.nodeSep:Math.min(i.nodeSep,ur)),g=(e,t)=>{let n=e.slice(1).map((t,n)=>h(e[n],t)),r=[0];n.forEach((e,t)=>r.push(r[t]+e)),hr(e.map((e,n)=>{let i=(t[e]??[]).filter(e=>m.has(e));return(i.length===0?m.get(e)??0:i.reduce((e,t)=>e+m.get(t),0)/i.length)-r[n]})).forEach((t,n)=>m.set(e[n],t+r[n]))};for(let e of c)g(e,[]);for(let e=0;e<fr;e++){for(let e=1;e<c.length;e++)g(c[e],n);for(let e=c.length-2;e>=0;e--)g(c[e],r)}return m}function hr(e){let t=[];for(let n of e)for(t.push({sum:n,count:1});t.length>1;){let e=t[t.length-1],n=t[t.length-2];if(n.sum/n.count<=e.sum/e.count)break;t.splice(-2,2,{sum:n.sum+e.sum,count:n.count+e.count})}return t.flatMap(e=>Array(e.count).fill(e.sum/e.count))}var gr=28,_r=18,vr=10,yr=32;function br(e,t={}){let n={...B,...t,fontSizes:Je(t.fontSizes)},r=e.direction===`TB`||e.direction===`TD`||e.direction===`BT`,i=e.direction===`BT`||e.direction===`RL`,a=new Map,o=new Map,s=(e,t)=>{a.set(e.id,e),t!==void 0&&o.set(e.id,t);for(let t of e.nodeIds)o.has(t)||o.set(t,e.id);for(let t of e.children)s(t,e.id)};e.subgraphs.forEach(e=>s(e));let c=[...e.nodes.keys()].filter(e=>!a.has(e)),l=new Map(c.map((e,t)=>[e,t])),u=e=>Math.min(...e.nodeIds.map(e=>l.get(e)??1/0),...e.children.map(u)),d=e=>{let t=a.get(e);return t?u(t):l.get(e)??1/0},f=t=>[...c.filter(e=>o.get(e)===t),...(t===void 0?e.subgraphs:a.get(t).children).map(e=>e.id)].map((e,t)=>({id:e,i:t})).sort((e,t)=>d(e.id)-d(t.id)||e.i-t.i).map(e=>e.id),p=e=>{let t=[e];for(let n=o.get(e);n!==void 0;n=o.get(n))t.unshift(n);return t},m=t=>{let i=e.edges[t].label;if(!i)return;let a=v(i,n.fontSizes.edgeLabel,L.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,g=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){g.set(e.source,[...g.get(e.source)??[],t]);return}let n=p(e.source),r=p(e.target),i=0;for(;n[i]!==void 0&&n[i]===r[i];)i++;if(i>=n.length||i>=r.length)return;let a=i===0?``:n[i-1];h.set(a,[...h.get(a)??[],{index:t,from:n[i],to:r[i]}])});let _=r?i?{axisStart:V.bottom,axisEnd:V.top,crossStart:V.left,crossEnd:V.right}:{axisStart:V.top,axisEnd:V.bottom,crossStart:V.left,crossEnd:V.right}:{axisStart:i?V.right:V.left,axisEnd:i?V.left:V.right,crossStart:V.top,crossEnd:V.bottom},y=(e,t)=>r?{aSize:t,cSize:e}:{aSize:e,cSize:t},b=new Map;for(let t of c){let r=e.nodes.get(t),i=xt(t,r.label,r.shape,n.fontSizes.nodeLabel,r.icon);b.set(t,y(i.width,i.height))}let x=e=>{let t=g.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+vr));return gr+(t.length-1)*_r+n},S=e=>{let t=f(e),i=new Map,o=new Map,s=new Map;for(let e of t){let t=a.get(e);if(!t){o.set(e,b.get(e));continue}let c=S(e);i.set(e,c);let l=v(t.label,n.fontSizes.groupHeader,L.groupHeader).width,u=c.axisSize+_.axisStart+_.axisEnd,d=c.crossSize+_.crossStart+_.crossEnd,f=r?0:l+yr,p=r?l+yr:0,m=Math.max(0,f-u),h=Math.max(0,p-d);u+=m,d+=h,o.set(e,{aSize:u,cSize:d}),s.set(e,{axis:_.axisStart+m/2,cross:_.crossStart+h/2})}let c=new Map(t.map((e,t)=>[e,t])),l=h.get(e??``)??[],u=pr(t.map(e=>({axis:o.get(e).aSize,cross:o.get(e).cSize,after:x(e)})),l.map(e=>({from:c.get(e.from),to:c.get(e.to),label:m(e.index)})),{nodeSep:n.nodeSpacing,rankSep:n.layerSpacing}),d=new Map;return l.forEach((e,t)=>d.set(e.index,{mids:u.paths[t],label:u.labels[t]})),{members:t,at:new Map(t.map((e,t)=>[e,u.nodes[t]])),sizes:o,inset:{axis:0,cross:0},axisSize:u.axisSize,crossSize:u.crossSize,routes:d,inner:new Map([...i].map(([e,t])=>[e,{...t,inset:s.get(e)}]))}},C=S(void 0),w=new Map,T=new Map,D=(e,t,n)=>{for(let[r,i]of e.routes)T.set(r,{mids:i.mids.map(e=>({axis:e.axis+t,cross:e.cross+n})),label:i.label&&{axis:i.label.axis+t,cross:i.label.cross+n}});let r=[];for(let i of e.members){let o=e.at.get(i),s=e.sizes.get(i),c={axis:t+o.axis,cross:n+o.cross,...s};w.set(i,c);let l=e.inner.get(i);if(l){let e=a.get(i),t=D(l,c.axis+l.inset.axis,c.cross+l.inset.cross);r.push({id:i,label:e.label,x:0,y:0,width:0,height:0,children:t,...e.region?{region:!0}:{}})}}return r},O=D(C,0,0),k=n.padding,ee=C.axisSize,A=e=>{let t=i?ee-e.axis:e.axis;return r?{x:e.cross+k,y:t+k}:{x:t+k,y:e.cross+k}},j=e=>{let t=i?ee-e.axis-e.aSize:e.axis;return r?{x:e.cross+k,y:t+k,width:e.cSize,height:e.aSize}:{x:t+k,y:e.cross+k,width:e.aSize,height:e.cSize}},te=e=>{for(let t of e)Object.assign(t,j(w.get(t.id))),te(t.children)};te(O);let ne=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.icon===void 0?n.shape:`rectangle`,icon:n.icon,...j(w.get(t)),inlineStyle:E(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),M=new Map(ne.map(e=>[e.id,e])),re=[];e.edges.forEach((t,n)=>{let r=T.get(n);if(!r)return;let i=w.get(t.source),a=w.get(t.target),o=i.axis>a.axis,[s,c]=o?[a,i]:[i,a],l=[{axis:s.axis+s.aSize,cross:s.cross+s.cSize/2},...o?[...r.mids].reverse():r.mids,{axis:c.axis,cross:c.cross+c.cSize/2}],u=[l[0]];for(let e of l.slice(1)){let t=u[u.length-1];if(t.cross!==e.cross){let n=(t.axis+e.axis)/2;u.push({axis:n,cross:t.cross},{axis:n,cross:e.cross})}u.push(e)}let d=Yt(xr(u.map(A)));o&&d.reverse();let f=M.get(t.source),p=M.get(t.target);f&&(d=Pt(d,f,!0)),p&&(d=Pt(d,p,!1)),re.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:r.label&&A(r.label),inlineStyle:yn(n,e),headColor:vn(e),id:t.id,animate:t.animate})}),an(e,M,re);let N=(r?C.crossSize:C.axisSize)+k*2,ie=(r?C.axisSize:C.crossSize)+k*2;for(let e of re){for(let t of e.points)N=Math.max(N,t.x+Qe.width+k),ie=Math.max(ie,t.y+Qe.width+k);e.labelPosition&&(N=Math.max(N,e.labelPosition.x+60+k),ie=Math.max(ie,e.labelPosition.y+20+k))}return{width:N,height:ie,nodes:ne,edges:re,groups:O}}function xr(e){return e.filter((t,n)=>{let r=e[n-1],i=e[n+1];return!r||!i||!(r.x===t.x&&t.x===i.x||r.y===t.y&&t.y===i.y)})}function Sr(e,t={}){return Cr(e,t)}function Cr(e,t,n){let r={...B,...t,fontSizes:Je(t.fontSizes)};return cn(Ve(Dt(e,r,n),t.layoutCache),e,r.mergeEdges)}function wr(e,t={}){let n=ie(e);if(t.layout===`simple`&&!ft(n))return br(n,t);if(t.layout!==void 0&&t.layout!==`elk`&&t.layout!==`simple`)throw Error(`zombie-mermaid: unknown layout ${JSON.stringify(t.layout)}; use 'elk' or 'simple'.`);if(Jn(n)){let e=rr(n,(e,n)=>Cr(e,t,n),Je(t.fontSizes));if(e)return e}return Sr(n,t)}function Tr(e,t={}){return Dt(e,{...B,...t,fontSizes:Je(t.fontSizes)})}var Er=12,Dr=2;function Or(e){return e.flatMap(e=>[e,...Or(e.children)])}function kr(e,t){let n=t.groupHeader+16;return Or(e).filter(e=>e.label!==``).map(e=>{let r=v(e.label,t.groupHeader,L.groupHeader);return{x:e.x+Er-Dr,y:e.y+n/2-r.height/2-Dr,width:r.width+4,height:r.height+4}})}function Ar(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 jr(e){return{x:e.x+Dr,y:e.y+Dr,width:e.width-4,height:e.height-4}}function Mr(e,t){let n=e.points,r=t.map(jr);for(let e=0;e+1<n.length;e++)if(r.some(t=>Ar(n[e],n[e+1],t)))return!0;return!1}function Nr(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 Pr(e,t,n){let r=`zm-title-gap-${Nr(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(`
9
+ `)}\n </mask>`}}function Fr(e,t,n=`Inter`,i=!1,a=qe,o=`linear`,s,c=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!D(e.interaction?.href));p.push(Fi(M(e.width,e.height,t,i,u,d,m,f.styleAttribute,f.description),s)),p.push(r(n,!1,f.nonce,f.bodyFont)),c&&e.edges.some(e=>e.animate)&&p.push(Ir(f.nonce)),p.push(`<defs>`),p.push(Lr());let h=new Set;for(let t of e.edges)t.headColor&&h.add(t.headColor);for(let e of h)p.push(Rr(e));let g=kr(e.groups,a),_=new Set(e.edges.filter(e=>Mr(e,g))),v;if(_.size>0){let t=Pr(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(Hr(t,n,a));for(let t of e.edges)p.push(Ur(t,o,c,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(Gr(t,n,a));for(let t of e.nodes)p.push(Yr(t,n,a,l));return p.push(`</svg>`),p.join(`
10
+ `)}function Ir(e){return[A(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(`
11
+ `)}function Lr(){return Br(`var(--_arrow)`,``)}function Rr(e){return Br(l(e),f`-${Vr(e)}`)}var zr=3.5;function Br(e,t){let n=10.5,r=12.8,i=f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,a=f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${i} />`,o=(e,t)=>f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${9.5}" refY="${r/2}" markerUnits="userSpaceOnUse" orient="${t}">`+f`\n ${a}`+`
12
+ </marker>`;return o(f`arrowhead${t}`,`auto`)+`
13
+ `+o(f`arrowhead-start${t}`,`auto-start-reverse`)}function Vr(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function Hr(e,t,n){let r=n.groupHeader+16,i=[];if(e.region){i.push(f`<g class="subgraph subgraph-region" data-id="${l(e.id)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(Hr(r,t,n));return i.push(`</g>`),i.join(`
14
+ `)}i.push(f`<g class="subgraph" data-id="${l(e.id)}" data-label="${l(e.label)}">`),i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),i.push(` `+w(e.label,e.x+12,e.y+r/2,n.groupHeader,f`font-size="${n.groupHeader}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(Hr(r,t,n));return i.push(`</g>`),i.join(`
15
+ `)}function Ur(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="2 2"`:``,c=e.style===`thick`?zr:R.connector,u=o?`none`:l(e.inlineStyle?.stroke??`var(--_line)`),d=l(e.inlineStyle?.[`stroke-width`]??String(c)),p=e.headColor?f`-${Vr(e.headColor)}`:``,m=``;o||(e.hasArrowEnd&&(m+=f` marker-end="url(#arrowhead${p})"`),e.hasArrowStart&&(m+=f` marker-start="url(#arrowhead-start${p})"`));let h=[f`class="edge${i?` edge-animated`:``}"`,f`data-from="${l(e.source)}"`,f`data-to="${l(e.target)}"`,f`data-style="${e.style}"`,f`data-arrow-start="${e.hasArrowStart}"`,f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&h.push(f`data-label="${l(e.label)}"`),e.id&&h.push(f`data-id="${l(e.id)}"`);let g=i&&!s?` stroke-dasharray="8 6"`:``,_=a?f`d="${Oe(e.points,t)}"`:f`points="${Wr(e.points)}"`;return f`<${a?`path`:`polyline`} ${h.join(` `)} ${_} `+f`fill="none" stroke="${u}" `+f`stroke-width="${d}"${s}${g}${m}`+(r?f` mask="url(#${r})"`:``)+` />`}function Wr(e){return e.map(e=>f`${e.x},${e.y}`).join(` `)}function Gr(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??qr(e.points),a=v(r,n.edgeLabel,L.edgeLabel),o=T(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return f`<g class="edge-label" data-from="${l(e.source)}" data-to="${l(e.target)}" data-label="${l(r)}">\n`+f` ${o.replace(/\n/g,`
16
+ `)}\n`+`</g>`}function Kr(e,t){let n=e[t];if(!n)throw Error(f`edgeMidpoint: missing point at index ${t}`);return n}function qr(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+=Jr(Kr(e,n-1),Kr(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=Kr(e,t-1),i=Kr(e,t),a=Jr(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 Jr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Yr(e,t,n,r=!0){let i=Qr(e),a=Ni(e,t,n),o=[],s=O(e.className),c=s?f`node ${s}`:`node`,d=e.interaction,p=[f`class="${c}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`,f`data-shape="${e.shape}"`];o.push(f`<g ${p.join(` `)}>`);let m=r?D(d?.href):void 0,h=m?` `:` `;if(m){let e=d?.target?f` target="${l(d.target)}"`:``;o.push(f` <a href="${l(m)}"${e}>`)}return r&&d?.tooltip&&o.push(f`${h}<title>${u(d.tooltip)}</title>`),o.push(f`${h}${i.replace(/\n/g,f`\n${h}`)}`),a&&o.push(f`${h}${a.replace(/\n/g,f`\n${h}`)}`),m&&o.push(` </a>`),o.push(`</g>`),o.join(`
17
+ `)}var Xr=13;function Zr(e,t,n){let r=f`transform="translate(${e} ${t})"`;if(n===``)return f`<path ${r} d="M0,80 V5 Q0,0 5,0 H75 Q80,0 80,5 V80 Z" fill="none" stroke="hsl(240, 60%, 86.3%)" stroke-width="2" stroke-dasharray="8" />`;let i=tt[n]??`<text transform="translate(21.16 64.67)" style="fill: #fff; font-family: ArialMT, Arial; font-size: 67.75px;">?</text>`;return f`<g ${r}><rect width="${80}" height="${80}" fill="${et}" />${i}</g>`}function Qr(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e;if(e.icon!==void 0)return Zr(t,n,e.icon);let s=l(o?.fill??`var(--_node-fill)`),c=l(o?.stroke??`var(--_node-stroke)`),u=l(o?.[`stroke-width`]??String(R.innerBox));switch(a){case`diamond`:return ri(t,n,r,i,s,c,u);case`rounded`:return ei(t,n,r,i,s,c,u);case`stadium`:return ti(t,n,r,i,s,c,u);case`circle`:return ni(t,n,r,i,s,c,u);case`subroutine`:return ii(t,n,r,i,s,c,u);case`doublecircle`:return ai(t,n,r,i,s,c,u);case`hexagon`:return oi(t,n,r,i,s,c,u);case`cylinder`:return si(t,n,r,i,s,c,u);case`asymmetric`:return ci(t,n,r,i,s,c,u);case`trapezoid`:return li(t,n,r,i,s,c,u);case`trapezoid-alt`:return ui(t,n,r,i,s,c,u);case`parallelogram`:return di(t,n,r,i,s,c,u);case`parallelogram-alt`:return fi(t,n,r,i,s,c,u);case`state-start`:return ji(t,n,r,i);case`state-end`:return Mi(t,n,r,i);case`document`:return pi(t,n,r,i,s,c,u);case`stacked-document`:return mi(t,n,r,i,s,c,u,!0);case`stacked-process`:return mi(t,n,r,i,s,c,u,!1);case`card`:return hi(t,n,r,i,s,c,u);case`lined-process`:return gi(t,n,r,i,s,c,u);case`divided-process`:return _i(t,n,r,i,s,c,u);case`window-pane`:return vi(t,n,r,i,s,c,u);case`triangle`:return yi(t,n,r,i,s,c,u,!1);case`flipped-triangle`:return yi(t,n,r,i,s,c,u,!0);case`filled-circle`:return bi(t,n,r,i,c);case`crossed-circle`:return xi(t,n,r,i,s,c,u);case`fork-join`:return Si(t,n,r,i,c);case`note`:return Ci(t,n,r,i,l(o?.fill??`var(--bg)`),c,u);case`notched-pentagon`:return wi(t,n,r,i,s,c,u);case`sloped-rectangle`:return Ti(t,n,r,i,s,c,u);case`flag`:return Ei(t,n,r,i,s,c,u);case`bow-tie-rectangle`:return Di(t,n,r,i,s,c,u);case`half-rounded-rectangle`:return Oi(t,n,r,i,s,c,u);case`brace`:return ki(t,n,r,i,s,c,u,`left`);case`brace-right`:return ki(t,n,r,i,s,c,u,`right`);case`braces`:return ki(t,n,r,i,s,c,u,`both`);case`bolt`:return Ai(t,n,r,i,s,c,u);case`text`:case`anchor`:return``;default:return $r(t,n,r,i,s,c,u)}}function $r(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ei(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ti(e,t,n,r,i,a,o){let s=r/2;return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ni(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ri(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=n/2,u=r/2,d=[f`${s},${c-u}`,f`${s+l},${c}`,f`${s},${c+u}`,f`${s-l},${c}`].join(` `);return f`<polygon points="${d}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ii(e,t,n,r,i,a,o){return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+f`stroke="${a}" stroke-width="${o}" />`}function ai(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2,u=l-5;return f`<circle cx="${s}" cy="${c}" r="${l}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<circle cx="${s}" cy="${c}" r="${u}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function oi(e,t,n,r,i,a,o){let s=r/4,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r/2}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`,f`${e},${t+r/2}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function si(e,t,n,r,i,a,o){let s=e+n/2,c=t+7,l=r-14;return f`<rect x="${e}" y="${c}" width="${n}" height="${l}" `+f`fill="${i}" stroke="none" />`+f`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<line x1="${e+n}" y1="${c}" x2="${e+n}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+f`\n<ellipse cx="${s}" cy="${c}" rx="${n/2}" ry="${7}" `+f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ci(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e+12},${t+r/2}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function li(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function ui(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function di(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n-s},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function fi(e,t,n,r,i,a,o){let s=n*.15,c=[f`${e},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+r}`,f`${e+s},${t+r}`].join(` `);return f`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function U(e,t,n){return f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function pi(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),c=t+r-s,l=f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${c} `+f`C ${e+n*.75} ${c+s*1.8} ${e+n*.25} ${c-s*.8} ${e} ${c} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function mi(e,t,n,r,i,a,o,s){let c=n-10,l=r-10,u=[];for(let n=2;n>=1;n--)u.push(f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${c}" height="${l}" `+f`${U(i,a,o)} />`);return u.push(s?pi(e,t+10,c,l,i,a,o):f`<rect x="${e}" y="${t+10}" width="${c}" height="${l}" ${U(i,a,o)} />`),u.join(`
18
+ `)}function hi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function gi(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function _i(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function vi(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),c=t+Math.min(14,r*.28);return f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${e}" y1="${c}" x2="${e+n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`}function yi(e,t,n,r,i,a,o,s){let c=s?[f`${e},${t}`,f`${e+n},${t}`,f`${e+n/2},${t+r}`]:[f`${e+n/2},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`];return f`<polygon points="${c.join(` `)}" ${U(i,a,o)} />`}function bi(e,t,n,r,i){let a=Math.min(n,r)/2-2;return f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function xi(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2-2,u=l/Math.SQRT2;return f`<circle cx="${s}" cy="${c}" r="${l}" ${U(i,a,o)} />\n`+f`<line x1="${s-u}" y1="${c-u}" x2="${s+u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />\n`+f`<line x1="${s+u}" y1="${c-u}" x2="${s-u}" y2="${c+u}" stroke="${a}" stroke-width="${o}" />`}function Si(e,t,n,r,i){let a=Math.min(8,r);return f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function Ci(e,t,n,r,i,a,o){let s=[f`${e},${t}`,f`${e+n-6},${t}`,f`${e+n},${t+6}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n`+f`<polygon points="${e+n-6},${t} ${e+n},${t+6} ${e+n-6},${t+6}" fill="var(--_inner-stroke)" stroke="${a}" stroke-width="${o}" />`}function wi(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[f`${e+s},${t}`,f`${e+n-s},${t}`,f`${e+n},${t+s}`,f`${e+n},${t+r}`,f`${e},${t+r}`,f`${e},${t+s}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function Ti(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),c=[f`${e},${t+s}`,f`${e+n},${t}`,f`${e+n},${t+r}`,f`${e},${t+r}`].join(` `);return f`<polygon points="${c}" ${U(i,a,o)} />`}function Ei(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),c=f`M ${e} ${t+s} `+f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+f`L ${e+n} ${t+r-s} `+f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function Di(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),c=f`M ${e+s} ${t} L ${e+n} ${t} `+f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+f`L ${e+s} ${t+r} `+f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return f`<path d="${c}" ${U(i,a,o)} />`}function Oi(e,t,n,r,i,a,o){let s=r/2,c=Math.max(0,n-s),l=f`M ${e} ${t} L ${e+c} ${t} `+f`A ${s} ${s} 0 0 1 ${e+c} ${t+r} `+f`L ${e} ${t+r} Z`;return f`<path d="${l}" ${U(i,a,o)} />`}function ki(e,t,n,r,i,a,o,s){let c=Math.min(10,n*.12),l=[f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],u=f`M ${e+c} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+f`Q ${e} ${t+r/2} ${e-c*.4} ${t+r/2} `+f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+f`Q ${e} ${t+r} ${e+c} ${t+r}`,d=f`M ${e+n-c} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+f`Q ${e+n} ${t+r/2} ${e+n+c*.4} ${t+r/2} `+f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+f`Q ${e+n} ${t+r} ${e+n-c} ${t+r}`;return(s===`left`||s===`both`)&&l.push(f`<path d="${u}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&l.push(f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),l.join(`
19
+ `)}function Ai(e,t,n,r,i,a,o){let s=[f`${e+n*.42},${t}`,f`${e+n},${t}`,f`${e+n*.62},${t+r*.42}`,f`${e+n},${t+r*.42}`,f`${e+n*.3},${t+r}`,f`${e+n*.5},${t+r*.55}`,f`${e},${t+r*.55}`].join(` `);return f`<polygon points="${s}" ${U(i,a,o)} />`}function ji(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function Mi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return f`<circle cx="${i}" cy="${a}" r="${o}" `+f`fill="none" stroke="var(--_text)" stroke-width="${R.innerBox*2}" />`+f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function Ni(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2+(e.shape===`asymmetric`?6:0),i=e.icon===void 0?e.y+e.height/2:e.y+e.height+Xr,a=l(e.inlineStyle?.color??g(e.inlineStyle?.fill,`var(--_text)`)),o=f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${L.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=f` style="font-family: ${l(s)};"`),w(e.label,r,i,n.nodeLabel,o)}function Pi(e){return l(e).replace(/\r/g,`&#13;`).replace(/\n/g,`&#10;`).replace(/\t/g,`&#9;`)}function Fi(e,t){return t===void 0?e:e.replace(`<svg `,f`<svg data-src="${Pi(t)}" `)}var Ii=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=Ui(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 Li(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 Ri(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 zi=`(?<![\\w-])(var|color-mix)\\(`;function Bi(e,t){let[n,...r]=Ri(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Vi(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 Hi(e){let t=Ri(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=Vi(r),o=Vi(i);if(!a||!o)return null;let s=C(a.color),c=C(o.color);if(!s||!c)return null;let l=b(s,c,a.pct,o.pct);return l?h(l):null}function Ui(e,t){let n=``,r=0,i=new RegExp(zi,`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=Li(e,c);if(l===-1)break;let u=Ui(e.slice(c+1,l),t),d=o===`var`?Bi(u,t):Hi(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Wi(e,t){let n=new Ii;for(let[e,r]of Object.entries(t))n.declare(e,r);return Ui(e,n)}var Gi=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Ki=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,qi=new Set([`data-src`]);function Ji(e,t){Gi.lastIndex=0;let n;for(;(n=Gi.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Yi(e,t){return e.replace(Ki,(e,n,r,i,a)=>{if(qi.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Ui(a.slice(1,-1),t)}${o}`})}function Xi(e,t){let n=new Ii;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&&Ji(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&Ji(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+=Ui(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:Yi(s,n),i=a+1}return r+e.slice(i)}var Zi=[.3013,.3672,.3247,.5244,.5244,.6001,.7061,.1597,.3672,.3672,.3672,.5244,.3672,.3672,.3672,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.5244,.3672,.3672,.5244,.5244,.5244,.3672,.7705,.5898,.5659,.5981,.6133,.5356,.5249,.6763,.6543,.2783,.4766,.5757,.5063,.7095,.6382,.6738,.5576,.6758,.582,.481,.5806,.6484,.5874,.8521,.5566,.5703,.5503,.3672,.3555,.3672,.5244,.5244,.5244,.5254,.5571,.4951,.5571,.5454,.3696,.502,.5464,.2852,.3667,.5044,.2949,.8301,.5464,.5366,.5571,.5571,.3887,.4048,.3965,.5464,.4897,.7441,.501,.4932,.4746,.3672,.5244,.3672,.5244],Qi=[.3013,.3672,.3667,.5859,.5859,.6841,.7061,.2295,.3672,.3672,.4321,.5859,.3672,.3672,.3672,.3901,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.5859,.3672,.3672,.5859,.5859,.5859,.438,.7705,.6333,.5952,.6118,.6426,.5688,.5835,.6714,.6836,.2783,.5327,.6172,.5527,.7451,.6675,.7031,.5869,.709,.6108,.5112,.6118,.6777,.6216,.8838,.6006,.6133,.5601,.4019,.3555,.4019,.5859,.5859,.5859,.5327,.5815,.5117,.5806,.5747,.3696,.502,.5928,.2983,.3667,.5479,.2949,.8594,.5903,.5659,.5825,.584,.4272,.4307,.3965,.5908,.5273,.7837,.5522,.5337,.5283,.4336,.5859,.4336,.5859];function $i(e){return e>=4352?1:.6}function ea(e,t){let n=t?Qi:Zi,r=t?.5859:.5244,i=0;for(let t of e){let e=t.codePointAt(0);i+=e>=32&&e<=126?n[e-32]:e===171||e===187?r:$i(e)}return i*16}var W={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,mermaidPad:12,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12,lollipopLabelHeight:32,lollipopLabelPadX:8};function ta(e){return`note ${e}`}function na(e){return`${e} link`}function ra(e){return`namespace ${e}`}function ia(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:ra(i),name:a.name,classIds:e})}return r}function aa(e){let t=new Map,n=new Set,r=[],i=new Map,a=e.relationships.map((a,o)=>{if(a.type!==`lollipop`||a.markerAt===`both`)return a;let s=a.markerAt===`from`,c=s?a.from:a.to,l=`lollipop ${r.length}`;return t.set(o,l),i.set(l,s?a.to:a.from),n.add(c),r.push({id:l,label:e.classes.find(e=>e.id===c)?.label??c,attributes:[],methods:[]}),s?{...a,from:l}:{...a,to:l}}),o=new Map(r.map(e=>[e.id,e.label]));if(r.length===0)return{diagram:e,labels:o,byRelationship:t};let s=new Set(a.flatMap(e=>[e.from,e.to]));for(let t of e.notes)t.forClass&&s.add(t.forClass);for(let t of e.namespaces)for(let e of t.classIds)s.add(e);let c=e=>n.has(e.id)&&!s.has(e.id)&&!e.annotation&&e.attributes.length===0&&e.methods.length===0,l=[...e.classes.filter(e=>!c(e)),...r],u=e.namespaces.map(e=>({...e,classIds:[...e.classIds,...r.filter(t=>e.classIds.includes(i.get(t.id)??``)).map(e=>e.id)]}));return{diagram:{...e,classes:l,relationships:a,namespaces:u},labels:o,byRelationship:t}}function oa(e){return m(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function sa(e,t,n){let r=new Map,i=new Map,a=Je(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:I(t.label,a.nodeLabel,L.edgeLabel)+W.lollipopLabelPadX*2,height:W.lollipopLabelHeight,headerHeight:W.lollipopLabelHeight,attrHeight:0,methodHeight:0});continue}let e=t.annotation?W.headerBaseHeight+W.annotationHeight:W.headerBaseHeight,i=t.attributes.length>0?t.attributes.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,o=t.methods.length>0?t.methods.length*W.memberRowHeight+W.sectionPadY:W.emptySectionHeight,s=I(t.label,a.nodeLabel,L.nodeLabel),c=pa(t.attributes),l=pa(t.methods),u=Math.max(fa(t),s+W.boxPadX*2,c+W.boxPadX*2,l+W.boxPadX*2),d=e+i+o;r.set(t.id,{width:u,height:d,headerHeight:e,attrHeight:i,methodHeight:o})}let o=ia(e),s=new Map;for(let e of o)for(let t of e.classIds)s.set(t,e.id);let c=new Map,l=[];for(let e of o){let t=I(e.name,W.namespaceTitleFontSize,L.groupHeader)+W.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":it({top:W.namespaceTitleHeight+W.namespacePad/2,left:W.namespacePad,bottom:W.namespacePad,right:W.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};c.set(e.id,n),l.push(n)}for(let[e,t]of r){let n=ot(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=oa(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(lt({id:`e${t}`,source:e?n.to:n.from,target:e?n.from:n.to,label:n.label,labelStyle:u}))}let p=new Set(r.keys());for(let[t,n]of e.notes.entries()){let e=ta(t),r=v(n.text,a.edgeLabel,L.edgeLabel),o={width:r.width+W.notePadX*2,height:r.height+W.notePadY*2};i.set(e,o),l.push(ot(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(lt({id:na(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...at({direction:rt(e.direction,nt.class),nodeSpacing:W.nodeSpacing,layerSpacing:W.layerSpacing,padding:W.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:l,edges:f},classSizes:r,noteSizes:i,namespaces:o}}function ca(e,t,n,r,i,a){let o=new Map;for(let e of t.classes)o.set(e.id,e);let s=new Set(i.map(e=>e.id)),c=new Map,l=[];for(let t of e.children??[])if(s.has(t.id)){let e=t.x??0,n=t.y??0;c.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&&c.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.filter(e=>!a.labels.has(e)),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=o.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:E(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=oa(a.diagram),h=new Map;for(let e of l)h.set(e.id,e);let g=new Map;for(let[e,t]of a.labels){let n=h.get(e);g.set(e,{text:t,x:n?.x??0,y:n?.y??0,width:n?.width??0,height:n?.height??0})}let _=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=_[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=Xt(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=Zt(t,r.x,r.y),c=g.get(a.byRelationship.get(e)??``);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:o,labelPosition:s,...c?{interfaceLabel:c}:{}})}let v=new Map;for(let e of _.slice(t.relationships.length))v.set(e.id,e);let y=[];for(let[e,n]of t.notes.entries()){let t=ta(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(na(t));y.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:Xt(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:y,namespaces:d}}function la(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=aa(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=sa(n.diagram,t,n.labels);return ca(Ve(r,t.layoutCache),e,i,a,o,n)}function ua(e){return e.length*Math.ceil(We(`M`,W.memberFontSize))}function da(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function fa(e){let t=ea(e.label,!0),n=e.annotation?ea(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>ea(da(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function pa(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=ua(ce(n));e>t&&(t=e)}return t}var ma={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function ha(e,t,n=`Inter`,r=!1,i=qe,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!D(e.interaction?.href));u.push(Fi(M(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push($e(n,!0,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(_a(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(ga(t));for(let t of e.relationships)u.push(wa(t));for(let t of e.notes)u.push(Ca(t));for(let t of e.classes)u.push(va(t,i,c));for(let t of e.relationships){let e=Ta(t,i);e&&u.push(e)}for(let t of e.notes)u.push(Sa(t,i));for(let t of e.relationships)u.push(Oa(t,i));return u.push(`</svg>`),u.join(`
20
+ `)}function ga(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=R.outerBox;return[f`<g class="class-namespace" data-id="${l(e.name)}" data-label="${l(e.name)}">`,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}" />`,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}" />`,f` <text x="${t+W.namespacePad}" y="${n+a/2}" dy="${z}" font-size="${W.namespaceTitleFontSize}" font-weight="${L.groupHeader}" fill="var(--_text-sec)">${Ma(e.name)}</text>`,`</g>`].join(`
21
+ `)}function _a(e){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
22
22
  <polygon points="0 0, 12 5, 0 10" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
23
23
  </marker>
24
24
  <marker id="cls-composition" markerWidth="18" markerHeight="14" refX="16.5" refY="7" orient="auto-start-reverse">
@@ -32,32 +32,34 @@ import{DEFAULTS as e,applyThemeVariables as t,buildStyleBlock as n,checkGraphSiz
32
32
  </marker>`+(e?`
33
33
  <marker id="cls-lollipop" markerWidth="12" markerHeight="12" refX="11" refY="6" orient="auto-start-reverse">
34
34
  <circle cx="6" cy="6" r="5" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
35
- </marker>`:``)}function sa(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:l,inlineStyle:u}=e,f=[],p=e.interaction,m=c(u?.fill??`var(--_node-fill)`),g=c(u?.stroke??`var(--_node-stroke)`),_=c(u?.[`stroke-width`]??String(R.outerBox)),v=u?.fill?m:`var(--_group-hdr)`,y=u?.color?c(u.color):u?.fill?c(h(u.fill,`var(--_text)`)):void 0,b=e.annotation?d` data-annotation="${c(e.annotation)}"`:``,x=D(e.className),S=[d`class="${x?d`class-node ${x}`:`class-node`}"`,d`data-id="${c(e.id)}"`,d`data-label="${c(e.label)}"`];f.push(d`<g ${S.join(` `)}${b}>`);let w=n?E(p?.href):void 0;if(w){let e=p?.target?d` target="${c(p.target)}"`:``;f.push(d` <a href="${c(w)}"${e}>`)}n&&p?.tooltip&&f.push(d` <title>${xa(p.tooltip)}</title>`),f.push(d` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+d`rx="0" ry="0" fill="${m}" stroke="${g}" stroke-width="${_}" />`),f.push(d` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+d`rx="0" ry="0" fill="${v}" stroke="${g}" stroke-width="${_}" />`);let T=i+s/2;if(e.annotation){let t=i+12;f.push(d` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${z}" `+d`font-size="${ra.annotationSize}" font-weight="${ra.annotationWeight}" `+d`font-style="italic" fill="${y??`var(--_text-muted)`}">&lt;&lt;${xa(e.annotation)}&gt;&gt;</text>`),T=i+s/2+6}f.push(` `+C(e.label,r+a/2,T,t.nodeLabel,d`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let O=i+s;f.push(d` <line x1="${r}" y1="${O}" x2="${r+a}" y2="${O}" `+d`stroke="${g}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=O+4+t*20+10;f.push(` `+la(n,r+W.boxPadX,i,y))}let k=O+l;f.push(d` <line x1="${r}" y1="${k}" x2="${r+a}" y2="${k}" `+d`stroke="${g}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=k+4+t*20+10;f.push(` `+la(n,r+W.boxPadX,i,y))}return w&&f.push(` </a>`),f.push(`</g>`),f.join(`
36
- `)}var ca=700;function la(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)`,c=r??`var(--_text-muted)`,l=[];e.visibility&&l.push(d`<tspan fill="${s}" font-weight="${ca}">${xa(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let u=e.isMethod?d`${e.name}(${e.params||``})`:e.name;return l.push(d`<tspan fill="${s}">${xa(u)}</tspan>`),e.type&&(l.push(d`<tspan fill="${o}">: </tspan>`),l.push(d`<tspan fill="${c}">${xa(e.type)}</tspan>`)),d`<text x="${t}" y="${n}" class="mono" dy="${z}" `+d`font-size="${ra.memberSize}" font-weight="${ra.memberWeight}"${i}${a}>`+d`${l.join(``)}</text>`}var ua=6;function da(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:d` data-for="${c(e.forClass)}"`,s=[d`${n},${r}`,d`${n+i-ua},${r}`,d`${n+i},${r+ua}`,d`${n+i},${r+a}`,d`${n},${r+a}`].join(` `),l=d`${n+i-ua},${r} ${n+i},${r+ua} `+d`${n+i-ua},${r+ua}`;return d`<g class="class-note"${o}>`+d`\n <polygon points="${s}" `+d`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+d`\n <polygon points="${l}" `+d`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+d`\n ${C(e.text,n+i/2,r+a/2,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
37
- </g>`}function fa(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>d`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:d` data-for="${c(e.forClass)}"`;return d`<polyline class="class-note-link"${n} points="${t}" `+d`fill="none" stroke="var(--_line)" stroke-width="${R.connector}" stroke-dasharray="2 3" />`}function pa(e){if(e.points.length<2)return``;let t=e.points.map(e=>d`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=ha(e.type,e.markerAt),i=[`class="class-relationship"`,d`data-from="${c(e.from)}"`,d`data-to="${c(e.to)}"`,d`data-type="${e.type}"`,d`data-marker-at="${e.markerAt}"`];return e.label&&i.push(d`data-label="${c(e.label)}"`),e.fromCardinality&&i.push(d`data-from-cardinality="${c(e.fromCardinality)}"`),e.toCardinality&&i.push(d`data-to-cardinality="${c(e.toCardinality)}"`),d`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+d`stroke-width="${R.connector}"${n}${r} />`}function ma(e,t){let n=e.interfaceLabel;if(!n)return``;let r=e.markerAt===`from`?e.from:e.to;return d`<g class="class-interface" data-id="${c(r)}" data-label="${c(n.text)}">\n `+C(n.text,n.x+n.width/2,n.y+n.height/2,t.nodeLabel,d`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text)"`)+`
38
- </g>`}function ha(e,t){let n=ga(e);return n?(t===`to`?``:d` marker-start="url(#${n})"`)+(t===`from`?``:d` marker-end="url(#${n})"`):``}function ga(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`;case`lollipop`:return`cls-lollipop`;default:return null}}function _a(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=va(e.points,e.labelPosition??ya(e.points)),i=_(e.label,t.edgeLabel,L.edgeLabel);n.push(w(e.label,r.x,r.y,i.width,i.height,t.edgeLabel,4,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`,`class="class-relationship-label-bg" fill="var(--bg)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=ba(r,i);n.push(C(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.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=ba(r,i);n.push(C(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
39
- `)}function va(e,t){let n=e[0],r=1/0;for(let i=1;i<e.length;i++){let a=e[i-1],o=e[i],s=o.x-a.x,c=o.y-a.y,l=s*s+c*c,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)),d={x:a.x+u*s,y:a.y+u*c},f=(d.x-t.x)**2+(d.y-t.y)**2;f<r&&(r=f,n=d)}return n}function ya(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function ba(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 xa=l,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90,loopOut:20,loopHalf:10,loopLabelGap:4,loopNestGap:16,loopMargin:12};function Sa(e,t,n){let r=qe(n.fontSizes).edgeLabel,i=[];for(let[n,a]of e.relationships.entries()){if(a.entity1!==t||a.entity2!==t)continue;let e=i[i.length-1],o=a.label?_(a.label,r,L.edgeLabel).width+8:0;i.push({index:n,nest:i.length,out:e?e.out+G.loopLabelGap+e.labelW+G.loopNestGap:G.loopOut,labelW:o})}return i}function Ca(e){return e.length*Math.ceil(Ue(`M`,G.attrFontSize))}function wa(e,t){let n=new Map,r=qe(t.fontSizes);for(let t of e.entities){let e=I(t.label,r.nodeLabel,L.nodeLabel),i=0;for(let e of t.attributes){let t=Ca(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(G.minWidth,e+G.boxPadX*2,i+G.boxPadX*2),o=G.headerHeight+Math.max(t.attributes.length,1)*G.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(rt(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())n.entity1!==n.entity2&&o.push(ot({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));let s=0;for(let n of e.entities){let r=Sa(e,n.id,t),i=r[r.length-1];i&&(s=Math.max(s,i.out+i.labelW))}return{elkGraph:{id:`root`,layoutOptions:{...nt({direction:et(e.direction,$e.er),nodeSpacing:Math.max(G.nodeSpacing,s+20),layerSpacing:Math.max(G.layerSpacing,s+20),padding:G.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.separateConnectedComponents":`false`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function Ta(e,t,n,r){let i=new Map;for(let e of t.entities)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 entity "${e.id}"`);a.push({id:e.id,label:e.label,attributes:e.attributes,x:r.x??0,y:r.y??0,width:r.width??i.width,height:r.height??i.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:T(e.id,t),className:t.classAssignments.get(e.id)})}}let o=new Map((e.edges??[]).map(e=>[e.id,e])),s=[],c=1/0;for(let[e,n]of t.relationships.entries()){let i={entity1:n.entity1,entity2:n.entity2,cardinality1:n.cardinality1,cardinality2:n.cardinality2,label:n.label,identifying:n.identifying};if(n.entity1!==n.entity2){s.push({...i,points:Wt(o.get(`e${e}`))});continue}let l=a.find(e=>e.id===n.entity1),u=Sa(t,n.entity1,r).find(t=>t.index===e),d=l.y+l.height/2,f=Math.max(G.loopHalf,l.height/8)+10*u.nest,p=l.x-u.out;s.push({...i,points:[{x:l.x,y:d-f},{x:p,y:d-f},{x:p,y:d+f},{x:l.x,y:d+f}],labelPoint:{x:p-G.loopLabelGap-u.labelW/2,y:d}}),c=Math.min(c,p-G.loopLabelGap-u.labelW)}let l=Math.max(0,G.loopMargin-c);if(l>0){for(let e of a)e.x+=l;for(let e of s){for(let t of e.points)t.x+=l;e.labelPoint&&(e.labelPoint.x+=l)}}return{width:(e.width??600)+l,height:e.height??400,entities:a,relationships:s}}function Ea(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=wa(e,t);return Ta(Be(n,t.layoutCache),e,r,t)}var Da=70,Oa={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function ka(e,t,n=`Inter`,r=!1,i=Ke,a,o,s,c={}){let l=[];l.push(wi(M(e.width,e.height,t,r,o,s,void 0,c.styleAttribute,c.description),a)),l.push(Qe(n,!0,c.nonce,c.bodyFont)),l.push(`<defs>`),l.push(`</defs>`);for(let t of e.relationships)l.push(Ma(t));for(let t of e.entities)l.push(Aa(t,i));for(let t of e.relationships)l.push(Pa(t));for(let t of e.relationships)l.push(Na(t,i));return l.push(`</svg>`),l.join(`
40
- `)}function Aa(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:l,label:u,attributes:f,inlineStyle:p}=e,m=[],g=c(p?.fill??`var(--_node-fill)`),_=c(p?.stroke??`var(--_node-stroke)`),v=c(p?.[`stroke-width`]??String(R.outerBox)),y=c(p?.[`stroke-width`]??String(R.innerBox)),b=p?.fill?g:`var(--_group-hdr)`,x=p?.color?c(p.color):p?.fill?c(h(p.fill,`var(--_text)`)):void 0,S=D(e.className);m.push(d`<g class="${S?d`entity ${S}`:`entity`}" data-id="${c(n)}" data-label="${c(u)}">`),m.push(d` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+d`rx="0" ry="0" fill="${g}" stroke="${_}" stroke-width="${v}" />`),m.push(d` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+d`rx="0" ry="0" fill="${b}" stroke="${_}" stroke-width="${v}" />`),m.push(` `+C(u,r+a/2,i+s/2,t.nodeLabel,d`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x??`var(--_text)`}"`));let w=i+s;m.push(d` <line x1="${r}" y1="${w}" x2="${r+a}" y2="${w}" `+d`stroke="${_}" stroke-width="${y}" />`);for(let e=0;e<f.length;e++){let t=f[e],n=w+e*l+l/2;m.push(` `+ja(t,r,n,a,x).replace(/\n/g,`
41
- `))}return f.length===0&&m.push(d` <text x="${r+a/2}" y="${w+l/2}" text-anchor="middle" dy="${z}" `+d`font-size="${Oa.attrSize}" fill="${x??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),m.push(`</g>`),m.join(`
42
- `)}function ja(e,t,n,r,i){let a=[],o=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
43
- `);a.push(d`<g><title>${La(t)}</title>`)}let s=0;e.keys.length>0&&(s=I(e.keys.join(`,`),Oa.keySize,Oa.keyWeight)+8,a.push(d`<rect x="${t+6}" y="${n-7}" width="${s}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),a.push(d`<text x="${t+6+s/2}" y="${n}" text-anchor="middle" dy="${z}" `+d`font-size="${Oa.keySize}" font-weight="${Oa.keyWeight}" fill="${i??`var(--_text-sec)`}">${e.keys.join(`,`)}</text>`));let c=t+8+(s>0?s+6:0);a.push(d`<text x="${c}" y="${n}" class="mono" dy="${z}" `+d`font-size="${Oa.attrSize}" font-weight="${Oa.attrWeight}">`+d`<tspan fill="${i??`var(--_text-muted)`}">${La(e.type)}</tspan></text>`);let l=t+r-8;return a.push(d`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${z}" `+d`font-size="${Oa.attrSize}" font-weight="${Oa.attrWeight}">`+d`<tspan fill="${i??`var(--_text-sec)`}">${La(e.name)}</tspan></text>`),o&&a.push(`</g>`),a.join(`
44
- `)}function Ma(e){if(e.points.length<2)return``;let t=e.points.map(e=>d`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?d` data-label="${c(e.label)}"`:``,i=[`class="er-relationship"`,d`data-entity1="${c(e.entity1)}"`,d`data-entity2="${c(e.entity2)}"`,d`data-cardinality1="${e.cardinality1}"`,d`data-cardinality2="${e.cardinality2}"`,d`data-identifying="${e.identifying}"`];return d`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+d`stroke-width="${R.connector}"${n} />`}function Na(e,t){if(!e.label||e.points.length<2)return``;let n=e.labelPoint??Ia(e.points),r=_(e.label,t.edgeLabel,L.edgeLabel),i=r.width+8,a=r.height+6;return d`<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" />`+d`\n${C(e.label,n.x,n.y,t.edgeLabel,d`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${Da}%, var(--bg))"`)}`}function Pa(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Fa(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Fa(i,a,e.cardinality2)),t.join(`
45
- `)}function Fa(e,t,n){let r=[],i=R.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let c=a/s,l=o/s,u=-l,f=c,p=e.x-c*4,m=e.y-l*4,h=e.x-c*16,g=e.y-l*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(d`<line x1="${p+u*6}" y1="${m+f*6}" `+d`x2="${p-u*6}" y2="${m-f*6}" `+d`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-c*4,t=m-l*4;r.push(d`<line x1="${e+u*6}" y1="${t+f*6}" `+d`x2="${e-u*6}" y2="${t-f*6}" `+d`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(d`<line x1="${e+u*7}" y1="${t+f*7}" `+d`x2="${h}" y2="${g}" `+d`stroke="var(--_line)" stroke-width="${i}" />`),r.push(d`<line x1="${e}" y1="${t}" `+d`x2="${h}" y2="${g}" `+d`stroke="var(--_line)" stroke-width="${i}" />`),r.push(d`<line x1="${e-u*7}" y1="${t-f*7}" `+d`x2="${h}" y2="${g}" `+d`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-c*20,n=e.y-l*20;r.push(d`<line x1="${t+u*6}" y1="${n+f*6}" `+d`x2="${t-u*6}" y2="${n-f*6}" `+d`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-c*t,a=e.y-l*t;r.push(d`<circle cx="${n}" cy="${a}" r="4" `+d`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
46
- `)}function Ia(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 La=l,Ra={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 za(e){return e+8}var Ba=14,Va=new Set([`boundary`,`control`,`entity`,`database`]);function Ha(e){return e.type===`actor`||Va.has(e.participantType)}var Ua=4;function Wa(e,t,n){return 14+_(e,t,n).height/2}function Ga(e){return{...Ra,actorHeight:e?.actorHeight??Ra.actorHeight,headerGap:e?.headerGap??Ra.headerGap,messageRowHeight:e?.messageRowHeight??Ra.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Ra.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Ra.noteStackGap}}var Ka=16;function qa(e,t,n){let r=new Map(e.actors.map((e,t)=>[e.id,t]));for(let i of e.messages){if(!i.label)continue;let e=r.get(i.from),a=r.get(i.to),o=_(i.label,n,L.edgeLabel).width,s=e===a?[[e-1,e],[e,e+1]]:[[Math.min(e,a),Math.max(e,a)]],c=e===a?o/2+Ka:o+32;for(let[e,n]of s){if(e<0||n>=t.length)continue;let r=0;for(let i=e+1;i<=n;i++)r+=t[i];if(r>=c)continue;let i=(c-r)/(n-e);for(let r=e+1;r<=n;r++)t[r]+=i}}}function Ja(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=Ga(t.sequence),r=qe(t.fontSizes),i=e.actors.map(e=>{let t=I(e.label,r.nodeLabel,L.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=i.map((e,t)=>t===0?0:Math.max(n.actorGap,(i[t-1]+e)/2+40));qa(e,a,r.edgeLabel);let o=[],s=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++)s+=a[t],o.push(s);let c=new Map;for(let t=0;t<e.actors.length;t++)c.set(e.actors[t].id,t);let l=e.boxes.filter(e=>e.actorIds.length>0),u=l.some(e=>e.label!==``),d=l.length===0?0:n.boxPad+(u?za(r.edgeLabel):0),f=n.padding+d,p=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:o[t],y:f,width:i[t],height:n.actorHeight})),m=l.map(e=>{let t=e.actorIds.map(e=>c.get(e)??0),r=Math.min(...t),a=Math.max(...t),s=o[r]-i[r]/2-n.boxPad,l=o[a]+i[a]/2+n.boxPad,u={label:e.label,x:s,y:n.padding,width:l-s,height:0};return e.color!==void 0&&(u.color=e.color),u}),h=e.actors.map(e=>Ha(e)?Wa(e.label,r.nodeLabel,L.nodeLabel):0),g=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?h[t]:0)),_=r.edgeLabel+12,v=f+n.actorHeight+Math.max(n.headerGap,g>0?g+Ua+_:0),y=[],b=new Map;for(let t of e.blocks){let e=b.get(t.startIndex)??0;b.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=b.get(e.index)??0;b.set(e.index,Math.max(t,n.dividerExtra))}}let x=new Map;for(let t of e.notes){let e=x.get(t.afterIndex)??[];e.push(t),x.set(t.afterIndex,e)}let S=[],C=x.get(-1);if(C&&C.length>0){let e=v;for(let t of C){let a=Math.max(n.noteWidth,I(t.text,r.edgeLabel,L.edgeLabel)+n.notePadX*2),s=r.edgeLabel+n.notePadY*2,l=c.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=o[l]-i[l]/2-a-n.noteGap;else if(t.position===`right`)u=o[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=c.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(o[l]+o[e])/2-a/2}else u=o[l]-a/2;S.push({text:t.text,x:u,y:e,width:a,height:s,position:t.position,actors:t.actorIds}),e+=s+n.noteStackGap}v=Math.max(v,e+n.messageRowHeight/2)}let w=new Map,T=[],E=n.activationWidth/2;function D(e,t){let n=w.get(e)??[];w.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function O(e,t){let r=w.get(e);if(!r||r.length===0)return;let{startY:i,depth:a}=r.pop(),s=c.get(e)??0,l=a*E;T.push({actorId:e,x:o[s]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:a})}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 A(e,t){for(let n of k.get(e)??[])n.kind===`start`?D(n.actorId,t):O(n.actorId,t)}A(-1,v);for(let t=0;t<e.messages.length;t++){let a=e.messages[t],s=c.get(a.from)??0,l=c.get(a.to)??0,u=a.from===a.to,d=b.get(t)??0;d>0&&(v+=d);let f=o[s],p=o[l],m=!u&&e.actors[l].createdAt===t;if(m){let e=i[l]/2;p+=f<p?-e:e}y.push({from:a.from,to:a.to,label:a.label,lineStyle:a.lineStyle,arrowHead:a.arrowHead,x1:f,x2:p,y:v,isSelf:u,bidirectional:a.bidirectional??!1,seqNumber:a.seqNumber}),a.activate&&D(a.to,v),a.deactivate&&O(a.from,v),A(t,v),v+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,m&&(v+=n.actorHeight/2);let h=x.get(t);if(h&&h.length>0){let e=u?n.selfMessageHeight:0,a=y[t].y+e+n.noteOffsetAfterMessage;for(let e of h){let t=Math.max(n.noteWidth,I(e.text,r.edgeLabel,L.edgeLabel)+n.notePadX*2),s=r.edgeLabel+n.notePadY*2,l=c.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=o[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=o[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=c.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(o[l]+o[n])/2-t/2}else u=o[l]-t/2;S.push({text:e.text,x:u,y:a,width:t,height:s,position:e.position,actors:e.actorIds}),a+=s+n.noteStackGap}v=Math.max(v,a+n.messageRowHeight/2)}}for(let[e,t]of w)for(let{startY:r,depth:i}of t){let t=c.get(e)??0,a=i*E;T.push({actorId:e,x:o[t]-n.activationWidth/2+a,topY:r,bottomY:v-n.messageRowHeight/2,width:n.activationWidth,depth:i})}T.sort((e,t)=>e.depth-t.depth);let ee=e.blocks.map(t=>{let a=y[t.startIndex],s=y[t.endIndex],l=(a?.y??v)-n.blockPadTop,u=(s?.y??v)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(c.get(t.from)??0),d.add(c.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=o[f]-i[f]/2-n.blockPadX,h=o[p]+i[p]/2+n.blockPadX,g=t.dividers.map(e=>{let t=y[e.index],n=t?.y??v,i=28;if(e.label&&t?.label){let n=I(`[${e.label}]`,r.edgeLabel,L.edgeLabel),a=m+8,o=a+n,s=I(t.label,r.edgeLabel,L.edgeLabel),c=(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,...t.color===void 0?{}:{color:t.color},x:m,y:l,width:h-m,height:u-l,dividers:g}}),j=S,te=v+n.padding,M=n.padding,N=0;for(let e of p)M=Math.min(M,e.x-e.width/2),N=Math.max(N,e.x+e.width/2);for(let e of ee)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of j)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of m)M=Math.min(M,e.x),N=Math.max(N,e.x+e.width);for(let e of y)if(e.isSelf&&(N=Math.max(N,e.x1+30+8),e.label)){let t=I(e.label,r.edgeLabel,L.edgeLabel)/2+8;N=Math.max(N,e.x1+t),M=Math.min(M,e.x1-t)}let P=M<n.padding?n.padding-M:0;if(P>0){for(let e of p)e.x+=P;for(let e of y)e.x1+=P,e.x2+=P;for(let e of T)e.x+=P;for(let e of ee)e.x+=P;for(let e of j)e.x+=P;for(let e of m)e.x+=P;for(let e=0;e<o.length;e++)o[e]+=P}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(p[t].y=(y[r]?.y??v)-n.actorHeight/2)}let ne=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:o[t],topY:p[t].y+n.actorHeight+(h[t]>0?h[t]+Ua:0),bottomY:r===void 0?te-n.padding:y[r]?.y??v};return r!==void 0&&(i.destroyed=!0),i});for(let e of m)e.height=te-n.padding+n.boxPad-e.y;let F=N+P+n.padding;return{width:Math.max(F,200),height:Math.max(te,100),actors:p,lifelines:ne,messages:y,activations:T,blocks:ee,notes:j,boxes:m}}function Ya(e,t,r=`Inter`,i=!1,a=Ke,o,s,c,l={}){let u=[];u.push(wi(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(n(r,!1,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(Xa()),u.push(`</defs>`);for(let t of e.boxes)u.push(ho(t,a));for(let t of e.blocks)u.push(_o(t,a));let d=oo(e,a);for(let t of e.lifelines)u.push(co(t,d));for(let t of e.activations)u.push(uo(t));for(let t of e.messages)u.push(fo(t,a));for(let t of e.notes)u.push(vo(t,a));for(let t of e.actors)u.push(Qa(t,a));return u.push(`</svg>`),u.join(`
47
- `)}function Xa(){let e=Ze.width,t=Ze.height;return d` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+d`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
48
- </marker>`+d`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+d`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
49
- </marker>`}var Za={boundary:(e,t)=>`\n <circle cx="15" cy="12" r="8" ${e} />\n <path d="M1 6V18M1 12H7" ${t} />`,control:(e,t)=>`\n <circle cx="12" cy="13" r="9" ${e} />\n <path d="M13 1L10 4L13 7" ${t} />`,entity:(e,t)=>`\n <circle cx="12" cy="11" r="9" ${e} />\n <path d="M3 22H21" ${t} />`,database:(e,t)=>`\n <path d="M2 5A10 3.5 0 0 1 22 5V19A10 3.5 0 0 1 2 19Z" ${e} />\n <path d="M2 5A10 3.5 0 0 0 22 5" ${t} />`};function Qa(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:l,participantType:u}=e,f=[],p=d`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`;if(f.push(d`<g class="actor" data-id="${c(n)}" data-label="${c(s)}" data-type="${l}">`),l===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,c=R.outerBox/e,l=`var(--_line)`;f.push(d` <g transform="translate(${n},${a}) scale(${e})">`+d`\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="${l}" stroke-width="${c}" />`+d`\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="${l}" stroke-width="${c}" />`+d`\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="${l}" stroke-width="${c}" />`+`
50
- </g>`),f.push(` `+C(s,r,i+o+14,t.nodeLabel,p))}else if(Ha(e)){let e=o/24*.9,n=R.outerBox/e,a=d`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`,c=d`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`,l=Za[u](a,c);f.push(d` <g transform="translate(${r-12*e},${i+(o-24*e)/2}) scale(${e})">${l}\n </g>`),f.push(` `+C(s,r,i+o+14,t.nodeLabel,p))}else{let e=r-a/2,n=d`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}"`,c=r,l=i+o/2;if(u===`queue`){let t=o/2,r=e+8,s=e+a-8;f.push(d` <path d="M${r},${i}H${s}A${8},${t} 0 0 1 ${s},${i+o}H${r}A${8},${t} 0 0 1 ${r},${i}Z" ${n} />`,d` <path d="M${s},${i}A${8},${t} 0 0 0 ${s},${i+o}" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`)}else u===`collections`?(f.push(d` <rect x="${e+4}" y="${i}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`,d` <rect x="${e}" y="${i+4}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`),c=r-2,l=i+2+(o-4)/2):f.push(d` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" ${n} />`);f.push(` `+C(s,c,l,t.nodeLabel,p))}return f.push(`</g>`),f.join(`
51
- `)}var $a=30,eo=20,to=10,no=18,ro=3,io=2,ao=3;function oo(e,t){let n=[],r=e=>_(e,t.edgeLabel,L.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&&i(t.label,(t.x1+t.x2)/2,t.y-to);for(let r of e.blocks){if(go(r))continue;let e=I(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
52
- `)[0]??``,t.edgeLabel,L.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+no});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function so(e,t){let n=t.filter(t=>e.x>t.x0-ro&&e.x<t.x1+ro&&t.y1+io>e.topY&&t.y0-io<e.bottomY).map(e=>[e.y0-io,e.y1+io]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=ao&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=ao&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function co(e,t){let n=so(e,t).map(([t,n])=>d`<line class="lifeline" data-actor="${c(e.actorId)}" `+d`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
53
- `);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=lo;return n+d`\n<path class="destroy" data-actor="${c(e.actorId)}" `+d`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+d`fill="none" stroke="var(--_line)" stroke-width="${R.outerBox}" stroke-linecap="round" />`}var lo=8;function uo(e){return d`<rect class="activation" data-actor="${c(e.actorId)}" `+d`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+d`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`}function fo(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?d` marker-start="url(#${i})"`:``;if(n.push(d`<g class="message" data-from="${c(e.from)}" data-to="${c(e.to)}" `+d`data-label="${c(e.label)}" data-line-style="${e.lineStyle}" `+d`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf){let t=$a,o=eo;n.push(d` <polyline points="${e.x1},${e.y} ${e.x1+t},${e.y} ${e.x1+t},${e.y+o} ${e.x2},${e.y+o}" `+d`fill="none" stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`)}else n.push(d` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+d`stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`);return n.push(` `+C(e.label,(e.x1+e.x2)/2,e.y-to,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)),e.seqNumber!==void 0&&n.push(` `+po(e,t)),n.push(`</g>`),n.join(`
54
- `)}function po(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+Ze.width):e.x1;return`<g class="seq-number">`+d`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${R.innerBox}" />`+C(String(e.seqNumber),r,e.y,n,d`font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var mo=35;function ho(e,t){let n=e.label?d` data-label="${c(e.label)}"`:``,r=e.color===void 0?``:d` data-color="${c(e.color)}"`,i=e.color===void 0?`none`:d`color-mix(in srgb, ${c(e.color)} ${mo}%, var(--bg))`,a=[d`<g class="participant-box"${n}${r}>`,d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+d`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];return e.label&&a.push(` `+C(e.label,e.x+e.width/2,e.y+za(t.edgeLabel)/2,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
55
- `)}function go(e){return e.type===`rect`&&e.color!==void 0}function _o(e,t){let n=[];if(go(e))return[d`<g class="block" data-type="rect" data-color="${c(e.color)}">`,d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+d`fill="${c(e.color)}" />`,`</g>`].join(`
56
- `);let r=e.label?d` data-label="${c(e.label)}"`:``;n.push(d`<g class="block" data-type="${c(e.type)}"${r}>`),n.push(d` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+d`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`);let i=d`${e.type}${e.label?d` [${e.label}]`:``}`,a=i.split(`
57
- `)[0],o=I(a,t.edgeLabel,L.groupHeader)+16,s=no;n.push(d` <rect x="${e.x}" y="${e.y}" width="${o}" height="${s}" `+d`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),n.push(` `+C(i,e.x+6,e.y+s/2,t.edgeLabel,d`font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(d` <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(` `+C(d`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
58
- `)}function vo(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?d` data-actors="${e.actors.map(c).join(`,`)}"`:``,s=e.position?d` data-position="${c(e.position)}"`:``,l=[d`${n},${r}`,d`${n+i-6},${r}`,d`${n+i},${r+6}`,d`${n+i},${r+a}`,d`${n},${r+a}`].join(` `);return d`<g class="note"${s}${o}>`+d`\n <polygon points="${l}" `+d`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+d`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+d`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+d`\n ${C(e.text,n+i/2,r+a/2,t.edgeLabel,d`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
59
- </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 yo(e,t={}){return e.horizontal?xo(e):bo(e)}function bo(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=x(a.min,a.max),s=ko(o),c=Math.max(...s.map(e=>I(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=So(e),y=e=>d+(e+.5)*(p/v),b=p/v,S=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},C=Eo(e,y,l+m,b),w=o.map((e,t)=>({label:s[t],x:d,y:S(e),tx:d-K.tickLength,ty:S(e),labelX:d-K.yLabelGap,labelY:S(e),textAnchor:`end`})),T=o.map(e=>({x1:d,y1:S(e),x2:d+p,y2:S(e)})),E=Co(e,v),D=e.series.map((e,t)=>t),O=Do(e,y,S,b,a.min,E,D),k=Oo(e,y,S,E,D),A=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,ee=i?jo(e,h/2,A,D):[],j={x1:d,y1:l+m,x2:d+p,y2:l+m},te={x1:d,y1:l,x2:d,y2:l+m},M={ticks:C,line:j,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},N={ticks:w,line:te,...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:M,yAxis:N,plotArea:_,bars:O,lines:k,gridLines:T,legend:ee}}function xo(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=x(a.min,a.max),s=ko(o),c=So(e),l=Co(e,c),u=Math.max(...l.map(e=>I(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=Math.max(K.padding,I(s[s.length-1],K.axisLabelFontSize,K.axisLabelFontWeight)/2+4),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},S=g/c,C=e=>d+(e+.5)*S,w=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`})),T=l.map((e,t)=>({label:e,x:p,y:C(t),tx:p-K.tickLength,ty:C(t),labelX:p-K.yLabelGap,labelY:C(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=S*(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=C(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=[],ee=0,j=0;for(let t of e.series){if(t.type!==`line`){j++;continue}let e=t.data.map((e,t)=>({x:b(e),y:C(t),value:e,label:l[t]}));A.push({points:e,seriesIndex:ee,colorIndex:D[j]}),ee++,j++}let te={x1:p,y1:d+g,x2:p+h,y2:d+g},M={x1:p,y1:d,x2:p,y2:d+g},N={ticks:w,line:te,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},P={ticks:T,line:M,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},ne=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,F=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:ne,xAxis:N,yAxis:P,plotArea:y,bars:k,lines:A,gridLines:E,legend:i?jo(e,_/2,F,D):[]}}function So(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 Co(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)=>Ao(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var wo=8;function To(e,t){let n=e.map(e=>I(e,K.axisLabelFontSize,K.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<wo){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Eo(e,t,n,r){let i=Co(e,So(e)),a=To(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+K.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function Do(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 Oo(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 ko(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 Ao(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function jo(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=I(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 Mo(e,t,r=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=wi(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push(n(r,!1,l.nonce,l.bodyFont));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=No(e,a,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?Fo(t.x,t.y,t.width,t.height,q.barRadius):Po(t.x,t.y,t.width,t.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let e=Bo(t.value),n=t.label?`${t.label}: ${e}`:e,r=zo(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 n=e.horizontal?Io(t.points):Lo(t.points);u.push(`<path d="${n}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${n}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(a||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(a&&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:Bo(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Ro(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(a){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,i=Bo(t.value),a=t.label?`${t.label}: ${i}`:i,o=zo(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)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" 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="${z}" 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="${z}" 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="${z}" 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="${z}" 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="${z}" 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(`
60
- `)}function No(e,t,n,r,i,a){let o=r??F,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let c=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${F})`:ce(e,o,i);c.push(` --xychart-color-${e}: ${t};`),c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;l.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),l.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),l.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let u=t?`
35
+ </marker>`:``)}function va(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:c,inlineStyle:u}=e,d=[],p=e.interaction,m=l(u?.fill??`var(--_node-fill)`),h=l(u?.stroke??`var(--_node-stroke)`),_=l(u?.[`stroke-width`]??String(R.outerBox)),v=u?.fill?m:`var(--_group-hdr)`,y=u?.color?l(u.color):u?.fill?l(g(u.fill,`var(--_text)`)):void 0,b=e.annotation?f` data-annotation="${l(e.annotation)}"`:``,x=O(e.className),S=[f`class="${x?f`class-node ${x}`:`class-node`}"`,f`data-id="${l(e.id)}"`,f`data-label="${l(e.label)}"`];d.push(f`<g ${S.join(` `)}${b}>`);let C=n?D(p?.href):void 0;if(C){let e=p?.target?f` target="${l(p.target)}"`:``;d.push(f` <a href="${l(C)}"${e}>`)}n&&p?.tooltip&&d.push(f` <title>${Ma(p.tooltip)}</title>`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${m}" stroke="${h}" stroke-width="${_}" />`),d.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${v}" stroke="${h}" stroke-width="${_}" />`);let T=i+s/2;if(e.annotation){let t=i+12;d.push(f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${z}" `+f`font-size="${ma.annotationSize}" font-weight="${ma.annotationWeight}" `+f`font-style="italic" fill="${y??`var(--_text-muted)`}">&lt;&lt;${Ma(e.annotation)}&gt;&gt;</text>`),T=i+s/2+6}d.push(` `+w(e.label,r+a/2,T,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let E=i+s;d.push(f` <line x1="${r}" y1="${E}" x2="${r+a}" y2="${E}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=E+4+t*20+10;d.push(` `+ba(n,r+W.boxPadX,i,y))}let k=E+c;d.push(f` <line x1="${r}" y1="${k}" x2="${r+a}" y2="${k}" `+f`stroke="${h}" stroke-width="${R.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=k+4+t*20+10;d.push(` `+ba(n,r+W.boxPadX,i,y))}return C&&d.push(` </a>`),d.push(`</g>`),d.join(`
36
+ `)}var ya=700;function ba(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)`,c=r??`var(--_text-muted)`,l=[];e.visibility&&l.push(f`<tspan fill="${s}" font-weight="${ya}">${Ma(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let u=e.isMethod?f`${e.name}(${e.params||``})`:e.name;return l.push(f`<tspan fill="${s}">${Ma(u)}</tspan>`),e.type&&(l.push(f`<tspan fill="${o}">: </tspan>`),l.push(f`<tspan fill="${c}">${Ma(e.type)}</tspan>`)),f`<text x="${t}" y="${n}" class="mono" dy="${z}" `+f`font-size="${ma.memberSize}" font-weight="${ma.memberWeight}"${i}${a}>`+f`${l.join(``)}</text>`}var xa=6;function Sa(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`,s=[f`${n},${r}`,f`${n+i-xa},${r}`,f`${n+i},${r+xa}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `),c=f`${n+i-xa},${r} ${n+i},${r+xa} `+f`${n+i-xa},${r+xa}`;return f`<g class="class-note"${o}>`+f`\n <polygon points="${s}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${c}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
37
+ </g>`}function Ca(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:f` data-for="${l(e.forClass)}"`;return f`<polyline class="class-note-link"${n} points="${t}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}" stroke-dasharray="2 3" />`}function wa(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=Ea(e.type,e.markerAt),i=[`class="class-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`,f`data-type="${e.type}"`,f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(f`data-label="${l(e.label)}"`),e.fromCardinality&&i.push(f`data-from-cardinality="${l(e.fromCardinality)}"`),e.toCardinality&&i.push(f`data-to-cardinality="${l(e.toCardinality)}"`),f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n}${r} />`}function Ta(e,t){let n=e.interfaceLabel;if(!n)return``;let r=e.markerAt===`from`?e.from:e.to;return f`<g class="class-interface" data-id="${l(r)}" data-label="${l(n.text)}">\n `+w(n.text,n.x+n.width/2,n.y+n.height/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="${L.edgeLabel}" fill="var(--_text)"`)+`
38
+ </g>`}function Ea(e,t){let n=Da(e);return n?(t===`to`?``:f` marker-start="url(#${n})"`)+(t===`from`?``:f` marker-end="url(#${n})"`):``}function Da(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`;case`lollipop`:return`cls-lollipop`;default:return null}}function Oa(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=ka(e.points,e.labelPosition??Aa(e.points)),i=v(e.label,t.edgeLabel,L.edgeLabel);n.push(T(e.label,r.x,r.y,i.width,i.height,t.edgeLabel,4,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`,`class="class-relationship-label-bg" fill="var(--bg)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=ja(r,i);n.push(w(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.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=ja(r,i);n.push(w(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
39
+ `)}function ka(e,t){let n=e[0],r=1/0;for(let i=1;i<e.length;i++){let a=e[i-1],o=e[i],s=o.x-a.x,c=o.y-a.y,l=s*s+c*c,u=Math.max(0,Math.min(1,((t.x-a.x)*s+(t.y-a.y)*c)/l)),d={x:a.x+u*s,y:a.y+u*c},f=(d.x-t.x)**2+(d.y-t.y)**2;f<r&&(r=f,n=d)}return n}function Aa(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function ja(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 Ma=u,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90,loopOut:20,loopHalf:10,loopLabelGap:4,loopNestGap:16,loopMargin:12};function Na(e,t,n){let r=Je(n.fontSizes).edgeLabel,i=[];for(let[n,a]of e.relationships.entries()){if(a.entity1!==t||a.entity2!==t)continue;let e=i[i.length-1],o=a.label?v(a.label,r,L.edgeLabel).width+8:0;i.push({index:n,nest:i.length,out:e?e.out+G.loopLabelGap+e.labelW+G.loopNestGap:G.loopOut,labelW:o})}return i}function Pa(e){return e.length*Math.ceil(We(`M`,G.attrFontSize))}function Fa(e,t){let n=new Map,r=Je(t.fontSizes);for(let t of e.entities){let e=I(t.label,r.nodeLabel,L.nodeLabel),i=0;for(let e of t.attributes){let t=Pa(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(G.minWidth,e+G.boxPadX*2,i+G.boxPadX*2),o=G.headerHeight+Math.max(t.attributes.length,1)*G.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(ot(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())n.entity1!==n.entity2&&o.push(lt({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));let s=0;for(let n of e.entities){let r=Na(e,n.id,t),i=r[r.length-1];i&&(s=Math.max(s,i.out+i.labelW))}return{elkGraph:{id:`root`,layoutOptions:{...at({direction:rt(e.direction,nt.er),nodeSpacing:Math.max(G.nodeSpacing,s+20),layerSpacing:Math.max(G.layerSpacing,s+20),padding:G.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.separateConnectedComponents":`false`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function Ia(e,t,n,r){let i=new Map;for(let e of t.entities)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 entity "${e.id}"`);a.push({id:e.id,label:e.label,attributes:e.attributes,x:r.x??0,y:r.y??0,width:r.width??i.width,height:r.height??i.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:E(e.id,t),className:t.classAssignments.get(e.id)})}}let o=new Map((e.edges??[]).map(e=>[e.id,e])),s=[],c=1/0;for(let[e,n]of t.relationships.entries()){let i={entity1:n.entity1,entity2:n.entity2,cardinality1:n.cardinality1,cardinality2:n.cardinality2,label:n.label,identifying:n.identifying};if(n.entity1!==n.entity2){s.push({...i,points:Xt(o.get(`e${e}`))});continue}let l=a.find(e=>e.id===n.entity1),u=Na(t,n.entity1,r).find(t=>t.index===e),d=l.y+l.height/2,f=Math.max(G.loopHalf,l.height/8)+10*u.nest,p=l.x-u.out;s.push({...i,points:[{x:l.x,y:d-f},{x:p,y:d-f},{x:p,y:d+f},{x:l.x,y:d+f}],labelPoint:{x:p-G.loopLabelGap-u.labelW/2,y:d}}),c=Math.min(c,p-G.loopLabelGap-u.labelW)}let l=Math.max(0,G.loopMargin-c);if(l>0){for(let e of a)e.x+=l;for(let e of s){for(let t of e.points)t.x+=l;e.labelPoint&&(e.labelPoint.x+=l)}}return{width:(e.width??600)+l,height:e.height??400,entities:a,relationships:s}}function La(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=Fa(e,t);return Ia(Ve(n,t.layoutCache),e,r,t)}var Ra=70,za={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function Ba(e,t,n=`Inter`,r=!1,i=qe,a,o,s,c={}){let l=[];l.push(Fi(M(e.width,e.height,t,r,o,s,void 0,c.styleAttribute,c.description),a)),l.push($e(n,!0,c.nonce,c.bodyFont)),l.push(`<defs>`),l.push(`</defs>`);for(let t of e.relationships)l.push(Ua(t));for(let t of e.entities)l.push(Va(t,i));for(let t of e.relationships)l.push(Ga(t));for(let t of e.relationships)l.push(Wa(t,i));return l.push(`</svg>`),l.join(`
40
+ `)}function Va(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:c,label:u,attributes:d,inlineStyle:p}=e,m=[],h=l(p?.fill??`var(--_node-fill)`),_=l(p?.stroke??`var(--_node-stroke)`),v=l(p?.[`stroke-width`]??String(R.outerBox)),y=l(p?.[`stroke-width`]??String(R.innerBox)),b=p?.fill?h:`var(--_group-hdr)`,x=p?.color?l(p.color):p?.fill?l(g(p.fill,`var(--_text)`)):void 0,S=O(e.className);m.push(f`<g class="${S?f`entity ${S}`:`entity`}" data-id="${l(n)}" data-label="${l(u)}">`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+f`rx="0" ry="0" fill="${h}" stroke="${_}" stroke-width="${v}" />`),m.push(f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+f`rx="0" ry="0" fill="${b}" stroke="${_}" stroke-width="${v}" />`),m.push(` `+w(u,r+a/2,i+s/2,t.nodeLabel,f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x??`var(--_text)`}"`));let C=i+s;m.push(f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+f`stroke="${_}" stroke-width="${y}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=C+e*c+c/2;m.push(` `+Ha(t,r,n,a,x).replace(/\n/g,`
41
+ `))}return d.length===0&&m.push(f` <text x="${r+a/2}" y="${C+c/2}" text-anchor="middle" dy="${z}" `+f`font-size="${za.attrSize}" fill="${x??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),m.push(`</g>`),m.join(`
42
+ `)}function Ha(e,t,n,r,i){let a=[],o=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
43
+ `);a.push(f`<g><title>${Ja(t)}</title>`)}let s=0;e.keys.length>0&&(s=I(e.keys.join(`,`),za.keySize,za.keyWeight)+8,a.push(f`<rect x="${t+6}" y="${n-7}" width="${s}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),a.push(f`<text x="${t+6+s/2}" y="${n}" text-anchor="middle" dy="${z}" `+f`font-size="${za.keySize}" font-weight="${za.keyWeight}" fill="${i??`var(--_text-sec)`}">${e.keys.join(`,`)}</text>`));let c=t+8+(s>0?s+6:0);a.push(f`<text x="${c}" y="${n}" class="mono" dy="${z}" `+f`font-size="${za.attrSize}" font-weight="${za.attrWeight}">`+f`<tspan fill="${i??`var(--_text-muted)`}">${Ja(e.type)}</tspan></text>`);let l=t+r-8;return a.push(f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${z}" `+f`font-size="${za.attrSize}" font-weight="${za.attrWeight}">`+f`<tspan fill="${i??`var(--_text-sec)`}">${Ja(e.name)}</tspan></text>`),o&&a.push(`</g>`),a.join(`
44
+ `)}function Ua(e){if(e.points.length<2)return``;let t=e.points.map(e=>f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?f` data-label="${l(e.label)}"`:``,i=[`class="er-relationship"`,f`data-entity1="${l(e.entity1)}"`,f`data-entity2="${l(e.entity2)}"`,f`data-cardinality1="${e.cardinality1}"`,f`data-cardinality2="${e.cardinality2}"`,f`data-identifying="${e.identifying}"`];return f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+f`stroke-width="${R.connector}"${n} />`}function Wa(e,t){if(!e.label||e.points.length<2)return``;let n=e.labelPoint??qa(e.points),r=v(e.label,t.edgeLabel,L.edgeLabel),i=r.width+8,a=r.height+6;return 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" />`+f`\n${w(e.label,n.x,n.y,t.edgeLabel,f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${L.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${Ra}%, var(--bg))"`)}`}function Ga(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Ka(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Ka(i,a,e.cardinality2)),t.join(`
45
+ `)}function Ka(e,t,n){let r=[],i=R.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let c=a/s,l=o/s,u=-l,d=c,p=e.x-c*4,m=e.y-l*4,h=e.x-c*16,g=e.y-l*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(f`<line x1="${p+u*6}" y1="${m+d*6}" `+f`x2="${p-u*6}" y2="${m-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-c*4,t=m-l*4;r.push(f`<line x1="${e+u*6}" y1="${t+d*6}" `+f`x2="${e-u*6}" y2="${t-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(f`<line x1="${e+u*7}" y1="${t+d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e}" y1="${t}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(f`<line x1="${e-u*7}" y1="${t-d*7}" `+f`x2="${h}" y2="${g}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-c*20,n=e.y-l*20;r.push(f`<line x1="${t+u*6}" y1="${n+d*6}" `+f`x2="${t-u*6}" y2="${n-d*6}" `+f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-c*t,a=e.y-l*t;r.push(f`<circle cx="${n}" cy="${a}" r="4" `+f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
46
+ `)}function qa(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 Ja=u,Ya={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},Xa=60,Za=45,Qa=20;function $a(e){return e+8}var eo=14,to=new Set([`boundary`,`control`,`entity`,`database`]);function no(e){return e.type===`actor`||to.has(e.participantType)}var ro=4;function io(e,t,n){return 14+v(e,t,n).height/2}function ao(e){return{...Ya,actorHeight:e?.actorHeight??Ya.actorHeight,headerGap:e?.headerGap??Ya.headerGap,messageRowHeight:e?.messageRowHeight??Ya.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Ya.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Ya.noteStackGap}}var oo=16;function so(e,t,n=L.edgeLabel){return v(e,t,n).width}function co(e,t){return e.type===`rect`&&e.color!==void 0?0:so(`${e.type}${e.label?` [${e.label}]`:``}`.split(`
47
+ `)[0],t,L.groupHeader)+16}function lo(e){return e.map((t,n)=>e.slice(0,n).flatMap((e,n)=>e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex?[n]:[]))}function uo(e,t,n,r,i){let a=new Map(e.actors.map((e,t)=>[e.id,t])),o=(e,t,r)=>{if(e<0||t>=n.length)return;let i=0;for(let r=e+1;r<=t;r++)i+=n[r];if(i>=r)return;let a=(r-i)/(t-e);for(let r=e+1;r<=t;r++)n[r]+=a};for(let t of e.messages){if(!t.label)continue;let e=a.get(t.from),n=a.get(t.to),r=so(t.label,i);e===n?(o(e-1,e,r/2+oo),o(e,e+1,r/2+oo)):o(Math.min(e,n),Math.max(e,n),r+32)}for(let n of e.notes){let e=a.get(n.actorIds[0]??``),s=Math.max(r.noteWidth,so(n.text,i)+r.notePadX*2),c=t[e]/2+r.noteGap+s+oo;n.position===`right`?o(e,e+1,c):n.position===`left`?o(e-1,e,c):n.actorIds.length===1&&(o(e,e+1,s/2+oo),o(e-1,e,s/2+oo))}for(let n of e.blocks){let s=e.actors.length;for(let t=n.startIndex;t<=n.endIndex;t++){let n=e.messages[t];n&&(s=Math.min(s,a.get(n.from),a.get(n.to)))}if(s===e.actors.length)continue;let c=-t[s]/2-r.blockPadX;o(s,s+1,c+co(n,i)+oo);for(let e of n.dividers)e.label&&o(s,s+1,c+8+so(`[${e.label}]`,i)+oo)}}function fo(e,n={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let r=ao(n.sequence),i=Je(n.fontSizes),a=e.actors.map(e=>{let t=I(e.label,i.nodeLabel,L.nodeLabel);return Math.max(t+r.actorPadX*2,80)}),o=a.map((e,t)=>t===0?0:Math.max(r.actorGap,(a[t-1]+e)/2+40));uo(e,a,o,r,i.edgeLabel);let s=[],c=r.padding+a[0]/2;for(let t=0;t<e.actors.length;t++)c+=o[t],s.push(c);let l=new Map;for(let t=0;t<e.actors.length;t++)l.set(e.actors[t].id,t);let u=e.boxes.filter(e=>e.actorIds.length>0),d=u.some(e=>e.label!==``),f=u.length===0?0:r.boxPad+(d?$a(i.edgeLabel):0),p=r.padding+f,m=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:s[t],y:p,width:a[t],height:r.actorHeight})),h=u.map(e=>{let t=e.actorIds.map(e=>l.get(e)??0),n=Math.min(...t),i=Math.max(...t),o=s[n]-a[n]/2-r.boxPad,c=s[i]+a[i]/2+r.boxPad,u={label:e.label,x:o,y:r.padding,width:c-o,height:0};return e.color!==void 0&&(u.color=e.color),u}),g=e.actors.map(e=>no(e)?io(e.label,i.nodeLabel,L.nodeLabel):0),_=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?g[t]:0)),v=i.edgeLabel+12,y=p+r.actorHeight+Math.max(r.headerGap,_>0?_+ro+v:0),b=[],x=new Map,S=new Map;for(let t of e.blocks){x.set(t.startIndex,(x.get(t.startIndex)??0)+r.blockHeaderExtra);for(let e of t.dividers)S.set(e.index,r.dividerExtra)}let C=lo(e.blocks),w=new Map;e.blocks.forEach((e,t)=>{let n=w.get(e.endIndex)??[];n.push(t),w.set(e.endIndex,n)});let T=[],E=t=>e.notes.slice(t.noteStartIndex,t.noteEndIndex),D=new Map;for(let t of e.notes){let e=D.get(t.afterIndex)??[];e.push(t),D.set(t.afterIndex,e)}let O=[],k=new Map,ee=(e,n)=>{let o=Math.max(r.noteWidth,so(e.text,i.edgeLabel)+r.notePadX*2),c=e.text.split(`
48
+ `).length,u=i.edgeLabel*(1+(c-1)*t)+r.notePadY*2,d=l.get(e.actorIds[0]??``)??0,f;if(e.position===`left`)f=s[d]-a[d]/2-o-r.noteGap;else if(e.position===`right`)f=s[d]+a[d]/2+r.noteGap;else if(e.actorIds.length>1){let t=l.get(e.actorIds[e.actorIds.length-1]??``)??d;f=(s[d]+s[t])/2-o/2}else f=s[d]-o/2;let p={text:e.text,x:f,y:n,width:o,height:u,position:e.position,actors:e.actorIds};return O.push(p),k.set(e,p),n+u+r.noteStackGap},A=D.get(-1);if(A&&A.length>0){let e=y;for(let t of A)e=ee(t,e);y=Math.max(y,e+r.messageRowHeight/2)}let j=new Map,te=[],ne=r.activationWidth/2;function M(e,t){let n=j.get(e)??[];j.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function re(e,t){let n=j.get(e);if(!n||n.length===0)return;let{startY:i,depth:a}=n.pop(),o=l.get(e)??0,c=a*ne;te.push({actorId:e,x:s[o]-r.activationWidth/2+c,topY:i,bottomY:t,width:r.activationWidth,depth:a})}let N=new Map;for(let t of e.activations){let e=N.get(t.afterIndex)??[];e.push(t),N.set(t.afterIndex,e)}function ie(e,t){for(let n of N.get(e)??[])n.kind===`start`?M(n.actorId,t):re(n.actorId,t)}ie(-1,y);for(let t=0;t<e.messages.length;t++){let n=e.messages[t],i=l.get(n.from)??0,o=l.get(n.to)??0,c=n.from===n.to;y+=(x.get(t)??0)+(S.get(t)??0);let u=s[i],d=s[o],f=!c&&e.actors[o].createdAt===t;if(f){let e=a[o]/2;d+=u<d?-e:e}b.push({from:n.from,to:n.to,label:n.label,lineStyle:n.lineStyle,arrowHead:n.arrowHead,x1:u,x2:d,y,isSelf:c,bidirectional:n.bidirectional??!1,seqNumber:n.seqNumber}),n.activate&&M(n.to,y),n.deactivate&&re(n.from,y),ie(t,y),y+=c?r.selfMessageHeight+r.messageRowHeight:r.messageRowHeight,f&&(y+=r.actorHeight/2);let p=n=>{let i=b[t].y+(c?20:0)+r.blockPadBottom+12;for(let t of E(e.blocks[n])){let e=k.get(t);i=Math.max(i,e.y+e.height+r.blockPadBottom)}for(let e of C[n])i=Math.max(i,T[e]+r.blockPadBottom);T[n]=i,y=Math.max(y,i+r.messageRowHeight/2)},m=w.get(t)??[],h=D.get(t);if(h&&h.length>0){let n=c?r.selfMessageHeight:0,i=b[t].y+n+r.noteOffsetAfterMessage;for(let t of h){let n=e.notes.indexOf(t);for(let t of m)T[t]===void 0&&e.blocks[t].noteEndIndex<=n&&(p(t),i=Math.max(i,T[t]+r.noteOffsetAfterMessage));i=ee(t,i)}y=Math.max(y,i+r.messageRowHeight/2)}for(let e of m)T[e]===void 0&&p(e)}for(let[e,t]of j)for(let{startY:n,depth:i}of t){let t=l.get(e)??0,a=i*ne;te.push({actorId:e,x:s[t]-r.activationWidth/2+a,topY:n,bottomY:y-r.messageRowHeight/2,width:r.activationWidth,depth:i})}te.sort((e,t)=>e.depth-t.depth);let ae=[];e.blocks.forEach((t,n)=>{let o=C[n].map(e=>ae[e]),c=(b[t.startIndex]?.y??y)-r.blockPadTop;for(let e of o)c=Math.min(c,e.y-r.blockHeaderExtra);let u=T[n]??y+r.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(l.get(t.from)??0),d.add(l.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=s[f]-a[f]/2-r.blockPadX,h=s[p]+a[p]/2+r.blockPadX;for(let e of E(t)){let t=k.get(e);m=Math.min(m,t.x-r.blockPadX),h=Math.max(h,t.x+t.width+r.blockPadX)}for(let e of o)m=Math.min(m,e.x-r.blockPadX),h=Math.max(h,e.x+e.width+r.blockPadX);h=Math.max(h,m+co(t,i.edgeLabel)+r.blockPadX);for(let e of t.dividers)e.label&&(h=Math.max(h,m+8+so(`[${e.label}]`,i.edgeLabel)+oo));let g=t.dividers.map(t=>{let a=o.filter((r,i)=>e.blocks[C[n][i]].startIndex===t.index);if(a.length>0)return{y:Math.min(...a.map(e=>e.y))-r.dividerExtra,label:t.label};let s=b[t.index],c=s?.y??y,l=28;if(t.label&&s?.label){let e=I(`[${t.label}]`,i.edgeLabel,L.edgeLabel),n=m+8,r=n+e,a=I(s.label,i.edgeLabel,L.edgeLabel),o=(s.x1+s.x2)/2-a/2,c=o+a;r>o&&n<c&&(l=40)}return{y:c-l,label:t.label}});ae.push({type:t.type,label:t.label,...t.color===void 0?{}:{color:t.color},x:m,y:c,width:h-m,height:u-c,dividers:g})});let oe=O,se=y+r.padding,P=r.padding,F=0;for(let e of m)P=Math.min(P,e.x-e.width/2),F=Math.max(F,e.x+e.width/2);for(let e of ae)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of oe)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of h)P=Math.min(P,e.x),F=Math.max(F,e.x+e.width);for(let e of b)if(e.isSelf&&(F=Math.max(F,e.x1+45+8),e.label)){let t=I(e.label,i.edgeLabel,L.edgeLabel)/2+8;F=Math.max(F,e.x1+t),P=Math.min(P,e.x1-t)}let ce=P<r.padding?r.padding-P:0;if(ce>0){for(let e of m)e.x+=ce;for(let e of b)e.x1+=ce,e.x2+=ce;for(let e of te)e.x+=ce;for(let e of ae)e.x+=ce;for(let e of oe)e.x+=ce;for(let e of h)e.x+=ce;for(let e=0;e<s.length;e++)s[e]+=ce}for(let t=0;t<e.actors.length;t++){let n=e.actors[t].createdAt;n!==void 0&&(m[t].y=(b[n]?.y??y)-r.actorHeight/2)}let le=e.actors.map((e,t)=>{let n=e.destroyedAt,i={actorId:e.id,x:s[t],topY:m[t].y+r.actorHeight+(g[t]>0?g[t]+ro:0),bottomY:n===void 0?se-r.padding:b[n]?.y??y};return n!==void 0&&(i.destroyed=!0),i});for(let e of h)e.height=se-r.padding+r.boxPad-e.y;let ue=F+ce+r.padding;return{width:Math.max(ue,200),height:Math.max(se,100),actors:m,lifelines:le,messages:b,activations:te,blocks:ae,notes:oe,boxes:h}}function po(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let u=[];u.push(Fi(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(r(n,!1,l.nonce,l.bodyFont)),u.push(`<defs>`),u.push(mo()),u.push(`</defs>`);for(let t of e.boxes)u.push(Ao(t,a));for(let t of e.blocks)u.push(Mo(t,a));let d=So(e,a);for(let t of e.lifelines)u.push(wo(t,d));for(let t of e.activations)u.push(Eo(t));for(let t of e.messages)u.push(Do(t,a));for(let t of e.notes)u.push(No(t,a));for(let t of e.actors)u.push(go(t,a));return u.push(`</svg>`),u.join(`
49
+ `)}function mo(){let e=Qe.width,t=Qe.height;return f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
50
+ </marker>`+f`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+f`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
51
+ </marker>`}var ho={boundary:(e,t)=>`\n <circle cx="15" cy="12" r="8" ${e} />\n <path d="M1 6V18M1 12H7" ${t} />`,control:(e,t)=>`\n <circle cx="12" cy="13" r="9" ${e} />\n <path d="M13 1L10 4L13 7" ${t} />`,entity:(e,t)=>`\n <circle cx="12" cy="11" r="9" ${e} />\n <path d="M3 22H21" ${t} />`,database:(e,t)=>`\n <path d="M2 5A10 3.5 0 0 1 22 5V19A10 3.5 0 0 1 2 19Z" ${e} />\n <path d="M2 5A10 3.5 0 0 0 22 5" ${t} />`};function go(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:c,participantType:u}=e,d=[],p=f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${L.nodeLabel}" fill="var(--_text)"`;if(d.push(f`<g class="actor" data-id="${l(n)}" data-label="${l(s)}" data-type="${c}">`),c===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,c=R.outerBox/e,l=`var(--_line)`;d.push(f` <g transform="translate(${n},${a}) scale(${e})">`+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="${l}" stroke-width="${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="${l}" stroke-width="${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="${l}" stroke-width="${c}" />`+`
52
+ </g>`),d.push(` `+w(s,r,i+o+14,t.nodeLabel,p))}else if(no(e)){let e=o/24*.9,n=R.outerBox/e,a=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`,c=f`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`,l=ho[u](a,c);d.push(f` <g transform="translate(${r-12*e},${i+(o-24*e)/2}) scale(${e})">${l}\n </g>`),d.push(` `+w(s,r,i+o+14,t.nodeLabel,p))}else{let e=r-a/2,n=f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}"`,c=r,l=i+o/2;if(u===`queue`){let t=o/2,r=e+8,s=e+a-8;d.push(f` <path d="M${r},${i}H${s}A${8},${t} 0 0 1 ${s},${i+o}H${r}A${8},${t} 0 0 1 ${r},${i}Z" ${n} />`,f` <path d="M${s},${i}A${8},${t} 0 0 0 ${s},${i+o}" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`)}else u===`collections`?(d.push(f` <rect x="${e+4}" y="${i}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`,f` <rect x="${e}" y="${i+4}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`),c=r-2,l=i+2+(o-4)/2):d.push(f` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" ${n} />`);d.push(` `+w(s,c,l,t.nodeLabel,p))}return d.push(`</g>`),d.join(`
53
+ `)}var _o=10,vo=18,yo=3,bo=2,xo=3;function So(e,t){let n=[],r=e=>v(e,t.edgeLabel,L.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||i(t.label,(t.x1+t.x2)/2,t.y-_o);for(let r of e.blocks){if(jo(r))continue;let e=I(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
54
+ `)[0]??``,t.edgeLabel,L.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+vo});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function Co(e,t){let n=t.filter(t=>e.x>t.x0-yo&&e.x<t.x1+yo&&t.y1+bo>e.topY&&t.y0-bo<e.bottomY).map(e=>[e.y0-bo,e.y1+bo]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=xo&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=xo&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function wo(e,t){let n=Co(e,t).map(([t,n])=>f`<line class="lifeline" data-actor="${l(e.actorId)}" `+f`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
55
+ `);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=To;return n+f`\n<path class="destroy" data-actor="${l(e.actorId)}" `+f`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.outerBox}" stroke-linecap="round" />`}var To=8;function Eo(e){return f`<rect class="activation" data-actor="${l(e.actorId)}" `+f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`}function Do(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?f` marker-start="url(#${i})"`:``;return n.push(f`<g class="message" data-from="${l(e.from)}" data-to="${l(e.to)}" `+f`data-label="${l(e.label)}" data-line-style="${e.lineStyle}" `+f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf?n.push(f` <path d="M ${e.x1},${e.y} C ${e.x1+60},${e.y-10} ${e.x1+60},${e.y+20+10} ${e.x2},${e.y+20}" `+f`fill="none" stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`):n.push(f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+f`stroke="var(--_line)" stroke-width="${R.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+w(e.label,(e.x1+e.x2)/2,e.y-_o,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)),e.seqNumber!==void 0&&n.push(` `+Oo(e,t)),n.push(`</g>`),n.join(`
56
+ `)}function Oo(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+Qe.width):e.x1;return`<g class="seq-number">`+f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${R.innerBox}" />`+w(String(e.seqNumber),r,e.y,n,f`font-size="${n}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var ko=35;function Ao(e,t){let n=e.label?f` data-label="${l(e.label)}"`:``,r=e.color===void 0?``:f` data-color="${l(e.color)}"`,i=e.color===void 0?`none`:f`color-mix(in srgb, ${l(e.color)} ${ko}%, var(--bg))`,a=[f`<g class="participant-box"${n}${r}>`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`];return e.label&&a.push(` `+w(e.label,e.x+e.width/2,e.y+$a(t.edgeLabel)/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
57
+ `)}function jo(e){return e.type===`rect`&&e.color!==void 0}function Mo(e,t){let n=[];if(jo(e))return[f`<g class="block" data-type="rect" data-color="${l(e.color)}">`,f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`fill="${l(e.color)}" />`,`</g>`].join(`
58
+ `);let r=e.label?f` data-label="${l(e.label)}"`:``;n.push(f`<g class="block" data-type="${l(e.type)}"${r}>`),n.push(f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`);let i=f`${e.type}${e.label?f` [${e.label}]`:``}`,a=i.split(`
59
+ `)[0],o=I(a,t.edgeLabel,L.groupHeader)+16,s=vo;n.push(f` <rect x="${e.x}" y="${e.y}" width="${o}" height="${s}" `+f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${R.outerBox}" />`),n.push(` `+w(i,e.x+6,e.y+s/2,t.edgeLabel,f`font-size="${t.edgeLabel}" font-weight="${L.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(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(` `+w(f`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
60
+ `)}function No(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?f` data-actors="${e.actors.map(l).join(`,`)}"`:``,s=e.position?f` data-position="${l(e.position)}"`:``,c=[f`${n},${r}`,f`${n+i-6},${r}`,f`${n+i},${r+6}`,f`${n+i},${r+a}`,f`${n},${r+a}`].join(` `);return f`<g class="note"${s}${o}>`+f`\n <polygon points="${c}" `+f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${R.innerBox}" />`+f`\n ${w(e.text,n+i/2,r+a/2,t.edgeLabel,f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${L.edgeLabel}" fill="var(--_text-muted)"`)}`+`
61
+ </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,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function Po(e,t,n){let r=Math.min(n,.2*e),i=(e-2*r)/t,a=.7*i>2*r?Math.floor(.35*i):r,o=e-2*a,s=.95*Math.min(2*a,o/t);return t<2?s:e/t*s*(t-1)/o}function Fo(e,t={}){return e.horizontal?Lo(e):Io(e)}function Io(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=S(a.min,a.max),s=Go(o),c=Math.max(...s.map(e=>I(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=Ro(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},C=Ho(e,y,l+m,b),w=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`})),T=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=zo(e,v),D=e.series.map((e,t)=>t),O=Uo(e,y,x,b,a.min,E,D),k=Wo(e,y,x,E,D),ee=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,A=i?qo(e,h/2,ee,D):[],j={x1:d,y1:l+m,x2:d+p,y2:l+m},te={x1:d,y1:l,x2:d,y2:l+m},ne={ticks:C,line:j,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},M={ticks:w,line:te,...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:ne,yAxis:M,plotArea:_,bars:O,lines:k,gridLines:T,legend:A}}function Lo(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=S(a.min,a.max),s=Go(o),c=Ro(e),l=zo(e,c),u=Math.max(...l.map(e=>I(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=Math.max(K.padding,I(s[s.length-1],K.axisLabelFontSize,K.axisLabelFontWeight)/2+4),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,C=e=>d+(e+.5)*x,w=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`})),T=l.map((e,t)=>({label:e,x:p,y:C(t),tx:p-K.tickLength,ty:C(t),labelX:p-K.yLabelGap,labelY:C(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=Po(g,c,K.axisLabelFontSize/2),n=t,r=0,i=0;for(let o of e.series){if(o.type!==`bar`){i++;continue}for(let e=0;e<o.data.length;e++){let s=C(e)-n/2,c=b(Math.max(o.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:s,width:Math.abs(c-u),height:t,value:o.data[e],label:l[e],seriesIndex:r,colorIndex:D[i]})}r++,i++}}let ee=[],A=0,j=0;for(let t of e.series){if(t.type!==`line`){j++;continue}let e=t.data.map((e,t)=>({x:b(e),y:C(t),value:e,label:l[t]}));ee.push({points:e,seriesIndex:A,colorIndex:D[j]}),A++,j++}let te={x1:p,y1:d+g,x2:p+h,y2:d+g},ne={x1:p,y1:d,x2:p,y2:d+g},M={ticks:w,line:te,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},re={ticks:T,line:ne,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},N=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,ie=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:N,xAxis:M,yAxis:re,plotArea:y,bars:k,lines:ee,gridLines:E,legend:i?qo(e,_/2,ie,D):[]}}function Ro(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 zo(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)=>Ko(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Bo=8;function Vo(e,t){let n=e.map(e=>I(e,K.axisLabelFontSize,K.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<Bo){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Ho(e,t,n,r){let i=zo(e,Ro(e)),a=Vo(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+K.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function Uo(e,t,n,r,i,a,o){if(e.series.filter(e=>e.type===`bar`).length===0)return[];let s=Math.max(...a.map(e=>I(e,K.axisLabelFontSize,K.axisLabelFontWeight))),c=Po(r*a.length,a.length,s/2),l=c,u=[],d=0,f=0;for(let r of e.series){if(r.type!==`bar`){f++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-l/2,p=n(r.data[e]),m=n(Math.max(0,i));u.push({x:s,y:Math.min(p,m),width:c,height:Math.abs(m-p),value:r.data[e],label:a[e],seriesIndex:d,colorIndex:o[f]})}d++,f++}return u}function Wo(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 Go(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 Ko(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function qo(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=I(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 Jo(e,t,n=`Inter`,i=!1,a=!1,o,s,c,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=Fi(M(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description).replace(`<svg `,`<svg data-xychart-colors="${d}" `),o);u.push(f),u.push(r(n,!1,l.nonce,l.bodyFont));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Yo(e,a,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?Zo(t.x,t.y,t.width,t.height,q.barRadius):Xo(t.x,t.y,t.width,t.height,q.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let n=ns(t.value),r=t.label?`${t.label}: ${n}`:n,i=ts(t.x+t.width/2,t.y,n);O.push({extent:e.horizontal?t.width:t.height,html:`<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(r)}</title>`+i+`</g>`})}}O.sort((e,t)=>t.extent-e.extent);for(let t of e.lines){if(t.points.length===0)continue;let n=e.horizontal?Qo(t.points):$o(t.points);u.push(`<path d="${n}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${n}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(a||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(a&&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:ns(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=es(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(a){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${X(t.label)}"`:``}`,i=ns(t.value),a=t.label?`${t.label}: ${i}`:i,o=ts(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)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${q.labelSize}" font-weight="${q.labelWeight}" dy="${z}" 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="${z}" 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="${z}" 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="${z}" 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="${z}" 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="${z}" class="xychart-label">${X(t.label)}</text>`)}for(let e of O)u.push(e.html);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
62
+ `)}function Yo(e,t,n,r,i,a){let o=r??ae,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let c=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${ae})`:le(e,o,i);c.push(` --xychart-color-${e}: ${t};`),c.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=`var(--xychart-color-${e})`;l.push(` .xychart-bar.xychart-color-${e} { stroke: ${t}; fill: var(--xychart-bar-fill-${e}); }`),l.push(` path.xychart-color-${e}, line.xychart-color-${e} { stroke: ${t}; }`),l.push(` circle.xychart-color-${e} { fill: ${t}; }`)}let u=t?`
61
63
  .xychart-tip { opacity: 0; pointer-events: none; }
62
64
  .xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
63
65
  .xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
@@ -75,7 +77,7 @@ import{DEFAULTS as e,applyThemeVariables as t,buildStyleBlock as n,checkGraphSiz
75
77
  .xychart-title { fill: var(--_text); }${d}
76
78
  ${l.join(`
77
79
  `)}${u}
78
- </style>`,defs:``}}function Po(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 Fo(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 Io(e){return e.map((e,t)=>`${t===0?`M`:`L`}${Y(e.x)},${Y(e.y)}`).join(` `)}function Lo(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 Ro(e,t,n,r){let i=I(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=I(e.legendLabel,J.fontSize,J.fontWeight),n=I(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="${z}" 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="${z}" 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="${z}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function zo(e,t,n){let r=I(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="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function Bo(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={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},Vo=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function Ho(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function Uo(e,t,n,r,i,a=0){if(i-r>=Vo-1e-9){let r=(n,r)=>`M${Q(e)},${Q(t-n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t+n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=Ho(e,t,n,r),s=Ho(e,t,n,i),c=+(i-r>Math.PI),l=`M${Q(o.x)},${Q(o.y)}A${Q(n)},${Q(n)},0,${c},1,${Q(s.x)},${Q(s.y)}`;if(a<=0)return`${l}L${Q(e)},${Q(t)}Z`;let u=Ho(e,t,a,i),d=Ho(e,t,a,r);return`${l}L${Q(u.x)},${Q(u.y)}A${Q(a)},${Q(a)},0,${c},0,${Q(d.x)},${Q(d.y)}Z`}function Wo(e,t,n){return n?`${e} [${String(t)}]`:e}function Go(e,t={}){let n=Z.height,r=n,i=Math.min(r,n)/2-Z.margin,a=r/2,o=n/2,s=e.slices.reduce((e,t)=>e+t.value,0),c=e.slices.map((e,t)=>({slice:e,colorIndex:t%Z.paletteSize})).filter(({slice:e})=>e.value/s*100>=Z.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=Z.legendRectSize+Z.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>Wo(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>I(e,Z.legendFontSize,Z.fontWeight))),h=Z.legendRectSize+Z.legendSpacing,g=u*d,_=f===`left`?m+h:0,v=f===`top`?g+u:0,y=a-m/2-h,b=o-g/2,x={right:{x:a+12*Z.legendRectSize,y:b},left:{x:a-i-h,y:b},center:{x:y,y:b},top:{x:y,y:o-i},bottom:{x:y,y:o+i+u}}[f],S=h+m,C=d>0&&(f===`left`||f===`right`)?r+Z.margin+S:r+Z.margin,w=f===`top`||f===`bottom`?n+g:n,T=e.title??``,E=T.length>0?I(T,Z.titleFontSize,Z.fontWeight):0,D=a-E/2,O=a+E/2,k=x.x,A=x.x+S,ee=x.y,j=x.y+g-u+Z.legendRectSize,te=Math.min(0,D,d>0?k:0),M=Math.max(C,O,d>0?A:0),N=d>0?Math.min(0,ee):0,P=d>0?Math.max(w,j):n,ne=-te,F=-N,re=a+_+ne,ie=o+v+F,ae=[],oe=0,se=e.donutHole??0,ce=se>0&&se<=.9?se*i:0,le=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=oe,a=oe+t.value/l*Vo;oe=a;let o=Ho(re,ie,le,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;ae.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:Uo(re,ie,i*u,r,a,ce*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let ue=p.map((e,t)=>{let n=x.x+ne,r=x.y+t*u+F;return{text:e,colorIndex:t%Z.paletteSize,x:n,y:r,size:Z.legendRectSize,textX:n+Z.legendRectSize+Z.legendSpacing,textY:r+Z.legendRectSize-Z.legendSpacing}});return{width:Math.ceil(M-te),height:Math.ceil(P-N),cx:re,cy:ie,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+ne,y:o+F-(n-50)/2}:void 0,slices:ae,legend:ue,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Ko(e){return String(Math.round(e*100)/100)}function qo(e,t,n){return e===0?`var(--accent, ${F})`:ce(e,t??F,n)}function Jo(e,t,n){let r=new Set;for(let t of e.slices)r.add(t.colorIndex);for(let t of e.legend)r.add(t.colorIndex);let i=[...r].sort((e,t)=>e-t),a=i.map(n=>` --pie-color-${n}: ${e.sliceColors?.[n]??qo(n,t.accent,t.bg)};`),o=i.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),s=e.slices.some(e=>e.highlighted)?`
80
+ </style>`,defs:``}}function Xo(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 Zo(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 Qo(e){return e.map((e,t)=>`${t===0?`M`:`L`}${Y(e.x)},${Y(e.y)}`).join(` `)}function $o(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 es(e,t,n,r){let i=I(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=I(e.legendLabel,J.fontSize,J.fontWeight),n=I(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="${z}" 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="${z}" 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="${z}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function ts(e,t,n){let r=I(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="${z}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function ns(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={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,highlightScale:1.05,minPercent:1},rs=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function is(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function as(e,t,n,r,i,a=0){if(i-r>=rs-1e-9){let r=(n,r)=>`M${Q(e)},${Q(t-n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t+n)}A${Q(n)},${Q(n)},0,1,${r},${Q(e)},${Q(t-n)}`;return r(n,1)+(a>0?r(a,0):``)+`Z`}let o=is(e,t,n,r),s=is(e,t,n,i),c=+(i-r>Math.PI),l=`M${Q(o.x)},${Q(o.y)}A${Q(n)},${Q(n)},0,${c},1,${Q(s.x)},${Q(s.y)}`;if(a<=0)return`${l}L${Q(e)},${Q(t)}Z`;let u=is(e,t,a,i),d=is(e,t,a,r);return`${l}L${Q(u.x)},${Q(u.y)}A${Q(a)},${Q(a)},0,${c},0,${Q(d.x)},${Q(d.y)}Z`}function os(e,t,n){return n?`${e} [${String(t)}]`:e}function ss(e,t={}){let n=Z.height,r=n,i=Math.min(r,n)/2-Z.margin,a=r/2,o=n/2,s=e.slices.reduce((e,t)=>e+t.value,0),c=e.slices.map((e,t)=>({slice:e,colorIndex:t%Z.paletteSize})).filter(({slice:e})=>e.value/s*100>=Z.minPercent),l=c.reduce((e,t)=>e+t.slice.value,0),u=Z.legendRectSize+Z.legendSpacing,d=e.slices.length,f=d>0?e.legendPosition??`right`:`right`,p=e.slices.map(t=>os(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>I(e,Z.legendFontSize,Z.fontWeight))),h=Z.legendRectSize+Z.legendSpacing,g=u*d,_=f===`left`?m+h:0,v=f===`top`?g+u:0,y=a-m/2-h,b=o-g/2,x={right:{x:a+12*Z.legendRectSize,y:b},left:{x:a-i-h,y:b},center:{x:y,y:b},top:{x:y,y:o-i},bottom:{x:y,y:o+i+u}}[f],S=h+m,C=d>0&&(f===`left`||f===`right`)?r+Z.margin+S:r+Z.margin,w=f===`top`||f===`bottom`?n+g:n,T=e.title??``,E=T.length>0?I(T,Z.titleFontSize,Z.fontWeight):0,D=a-E/2,O=a+E/2,k=x.x,ee=x.x+S,A=x.y,j=x.y+g-u+Z.legendRectSize,te=Math.min(0,D,d>0?k:0),ne=Math.max(C,O,d>0?ee:0),M=d>0?Math.min(0,A):0,re=d>0?Math.max(w,j):n,N=-te,ie=-M,ae=a+_+N,oe=o+v+ie,se=[],P=0,F=e.donutHole??0,ce=F>0&&F<=.9?F*i:0,le=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=P,a=P+t.value/l*rs;P=a;let o=is(ae,oe,le,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;se.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:as(ae,oe,i*u,r,a,ce*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let ue=p.map((e,t)=>{let n=x.x+N,r=x.y+t*u+ie;return{text:e,colorIndex:t%Z.paletteSize,x:n,y:r,size:Z.legendRectSize,textX:n+Z.legendRectSize+Z.legendSpacing,textY:r+Z.legendRectSize-Z.legendSpacing}});return{width:Math.ceil(ne-te),height:Math.ceil(re-M),cx:ae,cy:oe,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+N,y:o+ie-(n-50)/2}:void 0,slices:se,legend:ue,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function cs(e){return String(Math.round(e*100)/100)}function ls(e,t,n){return e===0?`var(--accent, ${ae})`:le(e,t??ae,n)}function us(e,t,n){let r=new Set;for(let t of e.slices)r.add(t.colorIndex);for(let t of e.legend)r.add(t.colorIndex);let i=[...r].sort((e,t)=>e-t),a=i.map(n=>` --pie-color-${n}: ${e.sliceColors?.[n]??ls(n,t.accent,t.bg)};`),o=i.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),s=e.slices.some(e=>e.highlighted)?`
79
81
  .pie-slice.pie-highlight { opacity: 1; }`:``,c=a.length>0?`\n svg {\n${a.join(`
80
82
  `)}\n }`:``;return`${A(n)}
81
83
  .pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
@@ -85,21 +87,21 @@ ${l.join(`
85
87
  .pie-legend-text { fill: var(--_text); font-size: ${Z.legendFontSize}px; font-weight: ${Z.fontWeight}; }${c}
86
88
  ${o.join(`
87
89
  `)}
88
- </style>`}function Yo(e,t,r=`Inter`,i=!1,a,o,s,u={}){let d=[];d.push(wi(M(e.width,e.height,t,i,o??e.accTitle,s,void 0,u.styleAttribute,e.accDescr),a)),d.push(n(r,!1,u.nonce,u.bodyFont)),d.push(Jo(e,t,u.nonce)),d.push(`<circle cx="${Ko(e.cx)}" cy="${Ko(e.cy)}" r="${Ko(e.outerRadius)}" class="pie-outer"/>`);for(let t of e.slices)d.push(`<path d="${t.path}" class="pie-slice${t.highlighted?` pie-highlight`:``} pie-color-${t.colorIndex}" data-label="${c(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)d.push(`<text x="${Ko(t.labelX)}" y="${Ko(t.labelY)}" text-anchor="middle" class="pie-slice-label">${l(t.percentText)}</text>`);e.title&&d.push(`<text x="${Ko(e.title.x)}" y="${Ko(e.title.y)}" text-anchor="middle" class="pie-title">${l(e.title.text)}</text>`);for(let t of e.legend)d.push(`<g class="pie-legend"><rect x="${Ko(t.x)}" y="${Ko(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${Ko(t.textX)}" y="${Ko(t.textY)}" class="pie-legend-text">${l(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
89
- `)}var Xo={titlePadding:10,titleFontSize:20,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2,xAxisPosition:`top`,yAxisPosition:`left`,width:500,height:500,axisLabelPadding:5,axisLabelFontSize:16,internalBorderWidth:1,externalBorderWidth:2},Zo={chartWidth:500,chartHeight:500};function Qo(e){return{anchor:`middle`,baseline:`hanging`,rotation:0,...e}}function $o(e){let t={...Xo,...Zo,...e.config},n=e.points.length>0,r=!!(e.xAxisLeft||e.xAxisRight),i=!!(e.yAxisBottom||e.yAxisTop),a=!!e.title,o=t.xAxisLabelPadding*2+t.xAxisLabelFontSize,s=t.yAxisLabelPadding*2+t.yAxisLabelFontSize,c=a?t.titleFontSize+t.titlePadding*2:0,l=!n&&t.xAxisPosition===`top`,u=l&&r?o:0,d=!l&&r?o:0,f=t.yAxisPosition===`left`&&i?s:0,p=t.yAxisPosition===`right`&&i?s:0,m=t.quadrantPadding+f,h=t.quadrantPadding+u+c,g=t.chartWidth-t.quadrantPadding*2-f-p,_=t.chartHeight-t.quadrantPadding*2-u-d-c,v=g/2,y=_/2,b=[[m+v,h],[m,h],[m,h+y],[m+v,h+y]].map(([r,i],a)=>({index:a,x:r,y:i,width:v,height:y,text:Qo({text:e.quadrants[a],x:r+v/2,y:n?i+t.quadrantTextTopPadding:i+y/2,fontSize:t.quadrantLabelFontSize,baseline:n?`hanging`:`middle`})})),x=t.quadrantExternalBorderStrokeWidth/2,S=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantExternalBorderStrokeWidth,kind:`external`}),C=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantInternalBorderStrokeWidth,kind:`internal`}),w=[S(m-x,h,m+g+x,h),S(m+g,h+x,m+g,h+_-x),S(m-x,h+_,m+g+x,h+_),S(m,h+x,m,h+_-x),C(m+v,h+x,m+v,h+_-x),C(m+x,h+y,m+g-x,h+y)],T=[],E=l?t.xAxisLabelPadding+c:t.xAxisLabelPadding+h+_+t.quadrantPadding,D=!!e.xAxisRight,O=(e,n)=>T.push(Qo({text:e,x:n,y:E,fontSize:t.xAxisLabelFontSize,anchor:D?`middle`:`start`}));r&&e.xAxisLeft&&O(e.xAxisLeft,m+(D?v/2:0)),r&&e.xAxisRight&&O(e.xAxisRight,m+v+v/2);let k=t.yAxisPosition===`left`?t.yAxisLabelPadding:t.yAxisLabelPadding+m+g+t.quadrantPadding,A=!!e.yAxisTop,ee=(e,n)=>T.push(Qo({text:e,x:k,y:n,fontSize:t.yAxisLabelFontSize,anchor:A?`middle`:`start`,rotation:-90}));i&&e.yAxisBottom&&ee(e.yAxisBottom,h+_-(A?y/2:0)),i&&e.yAxisTop&&ee(e.yAxisTop,h+y-y/2);let j=[...e.points].reverse().map(e=>{let n=m+e.x*g,r=h+_-e.y*_;return{x:n,y:r,radius:e.radius??t.pointRadius,color:e.color,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth??`0px`,text:Qo({text:e.label,x:n,y:r+t.pointTextPadding,fontSize:t.pointLabelFontSize})}});return{width:t.chartWidth,height:t.chartHeight,themeColors:e.themeColors,title:a?Qo({text:e.title,x:t.chartWidth/2,y:t.titlePadding,fontSize:t.titleFontSize}):void 0,quadrants:b,lines:w,axisLabels:T,points:j}}function es(e){return String(Math.round(e*100)/100)}var ts=[14,10,6,3];function ns(e,t){let n=`var(--accent, ${F})`,r=`color-mix(in srgb, ${n} 35%, var(--bg))`,i=ts.map((e,t)=>` .quadrant-cell-${t} { fill: color-mix(in srgb, ${n} ${e}%, var(--bg)); }`),a=e.points.flatMap((e,t)=>{let n=[e.color&&`fill: ${e.color};`,e.strokeColor&&`stroke: ${e.strokeColor};`,e.strokeWidth!==`0px`&&`stroke-width: ${e.strokeWidth};`].filter(Boolean);return n.length>0?[` .quadrant-point-${t} { ${n.join(` `)} }`]:[]}),o=e.themeColors??{},s=[...[1,2,3,4].flatMap(e=>[o[`quadrant${e}Fill`]&&` .quadrant-cell-${e-1} { fill: ${o[`quadrant${e}Fill`]}; }`,o[`quadrant${e}TextFill`]&&` .quadrant:nth-child(${e}) .quadrant-label { fill: ${o[`quadrant${e}TextFill`]}; }`]),o.quadrantPointFill&&` .quadrant-point { fill: ${o.quadrantPointFill}; stroke: ${o.quadrantPointFill}; }`,o.quadrantPointTextFill&&` .quadrant-point-label { fill: ${o.quadrantPointTextFill}; }`,o.quadrantXAxisTextFill&&` .quadrant-axis-label[transform$="rotate(0)"] { fill: ${o.quadrantXAxisTextFill}; }`,o.quadrantYAxisTextFill&&` .quadrant-axis-label[transform$="rotate(-90)"] { fill: ${o.quadrantYAxisTextFill}; }`,o.quadrantTitleFill&&` .quadrant-title { fill: ${o.quadrantTitleFill}; }`,o.quadrantInternalBorderStrokeFill&&` .quadrant-line-internal { stroke: ${o.quadrantInternalBorderStrokeFill}; }`,o.quadrantExternalBorderStrokeFill&&` .quadrant-line-external { stroke: ${o.quadrantExternalBorderStrokeFill}; }`].filter(Boolean);return`${A(t)}
90
+ </style>`}function ds(e,t,n=`Inter`,i=!1,a,o,s,c={}){let d=[];d.push(Fi(M(e.width,e.height,t,i,o??e.accTitle,s,void 0,c.styleAttribute,e.accDescr),a)),d.push(r(n,!1,c.nonce,c.bodyFont)),d.push(us(e,t,c.nonce)),d.push(`<circle cx="${cs(e.cx)}" cy="${cs(e.cy)}" r="${cs(e.outerRadius)}" class="pie-outer"/>`);for(let t of e.slices)d.push(`<path d="${t.path}" class="pie-slice${t.highlighted?` pie-highlight`:``} pie-color-${t.colorIndex}" data-label="${l(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)d.push(`<text x="${cs(t.labelX)}" y="${cs(t.labelY)}" text-anchor="middle" class="pie-slice-label">${u(t.percentText)}</text>`);e.title&&d.push(`<text x="${cs(e.title.x)}" y="${cs(e.title.y)}" text-anchor="middle" class="pie-title">${u(e.title.text)}</text>`);for(let t of e.legend)d.push(`<g class="pie-legend"><rect x="${cs(t.x)}" y="${cs(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${cs(t.textX)}" y="${cs(t.textY)}" class="pie-legend-text">${u(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
91
+ `)}var fs={titlePadding:10,titleFontSize:20,quadrantPadding:5,xAxisLabelPadding:5,yAxisLabelPadding:5,xAxisLabelFontSize:16,yAxisLabelFontSize:16,quadrantLabelFontSize:16,quadrantTextTopPadding:5,pointTextPadding:5,pointLabelFontSize:12,pointRadius:5,quadrantInternalBorderStrokeWidth:1,quadrantExternalBorderStrokeWidth:2,xAxisPosition:`top`,yAxisPosition:`left`,width:500,height:500,axisLabelPadding:5,axisLabelFontSize:16,internalBorderWidth:1,externalBorderWidth:2},ps={chartWidth:500,chartHeight:500};function ms(e){return{anchor:`middle`,baseline:`hanging`,rotation:0,...e}}function hs(e){let t={...fs,...ps,...e.config},n=e.points.length>0,r=!!(e.xAxisLeft||e.xAxisRight),i=!!(e.yAxisBottom||e.yAxisTop),a=!!e.title,o=t.xAxisLabelPadding*2+t.xAxisLabelFontSize,s=t.yAxisLabelPadding*2+t.yAxisLabelFontSize,c=a?t.titleFontSize+t.titlePadding*2:0,l=!n&&t.xAxisPosition===`top`,u=l&&r?o:0,d=!l&&r?o:0,f=t.yAxisPosition===`left`&&i?s:0,p=t.yAxisPosition===`right`&&i?s:0,m=t.quadrantPadding+f,h=t.quadrantPadding+u+c,g=t.chartWidth-t.quadrantPadding*2-f-p,_=t.chartHeight-t.quadrantPadding*2-u-d-c,v=g/2,y=_/2,b=[[m+v,h],[m,h],[m,h+y],[m+v,h+y]].map(([r,i],a)=>({index:a,x:r,y:i,width:v,height:y,text:ms({text:e.quadrants[a],x:r+v/2,y:n?i+t.quadrantTextTopPadding:i+y/2,fontSize:t.quadrantLabelFontSize,baseline:n?`hanging`:`middle`})})),x=t.quadrantExternalBorderStrokeWidth/2,S=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantExternalBorderStrokeWidth,kind:`external`}),C=(e,n,r,i)=>({x1:e,y1:n,x2:r,y2:i,strokeWidth:t.quadrantInternalBorderStrokeWidth,kind:`internal`}),w=[S(m-x,h,m+g+x,h),S(m+g,h+x,m+g,h+_-x),S(m-x,h+_,m+g+x,h+_),S(m,h+x,m,h+_-x),C(m+v,h+x,m+v,h+_-x),C(m+x,h+y,m+g-x,h+y)],T=[],E=l?t.xAxisLabelPadding+c:t.xAxisLabelPadding+h+_+t.quadrantPadding,D=!!e.xAxisRight,O=(e,n)=>T.push(ms({text:e,x:n,y:E,fontSize:t.xAxisLabelFontSize,anchor:D?`middle`:`start`}));r&&e.xAxisLeft&&O(e.xAxisLeft,m+(D?v/2:0)),r&&e.xAxisRight&&O(e.xAxisRight,m+v+v/2);let k=t.yAxisPosition===`left`?t.yAxisLabelPadding:t.yAxisLabelPadding+m+g+t.quadrantPadding,ee=!!e.yAxisTop,A=(e,n)=>T.push(ms({text:e,x:k,y:n,fontSize:t.yAxisLabelFontSize,anchor:ee?`middle`:`start`,rotation:-90}));i&&e.yAxisBottom&&A(e.yAxisBottom,h+_-(ee?y/2:0)),i&&e.yAxisTop&&A(e.yAxisTop,h+y-y/2);let j=[...e.points].reverse().map(e=>{let n=m+e.x*g,r=h+_-e.y*_;return{x:n,y:r,radius:e.radius??t.pointRadius,color:e.color,strokeColor:e.strokeColor,strokeWidth:e.strokeWidth??`0px`,text:ms({text:e.label,x:n,y:r+t.pointTextPadding,fontSize:t.pointLabelFontSize})}});return{width:t.chartWidth,height:t.chartHeight,themeColors:e.themeColors,title:a?ms({text:e.title,x:t.chartWidth/2,y:t.titlePadding,fontSize:t.titleFontSize}):void 0,quadrants:b,lines:w,axisLabels:T,points:j}}function gs(e){return String(Math.round(e*100)/100)}var _s=[14,10,6,3];function vs(e,t){let n=`var(--accent, ${ae})`,r=`color-mix(in srgb, ${n} 35%, var(--bg))`,i=_s.map((e,t)=>` .quadrant-cell-${t} { fill: color-mix(in srgb, ${n} ${e}%, var(--bg)); }`),a=e.points.flatMap((e,t)=>{let n=[e.color&&`fill: ${e.color};`,e.strokeColor&&`stroke: ${e.strokeColor};`,e.strokeWidth!==`0px`&&`stroke-width: ${e.strokeWidth};`].filter(Boolean);return n.length>0?[` .quadrant-point-${t} { ${n.join(` `)} }`]:[]}),o=e.themeColors??{},s=[...[1,2,3,4].flatMap(e=>[o[`quadrant${e}Fill`]&&` .quadrant-cell-${e-1} { fill: ${o[`quadrant${e}Fill`]}; }`,o[`quadrant${e}TextFill`]&&` .quadrant:nth-child(${e}) .quadrant-label { fill: ${o[`quadrant${e}TextFill`]}; }`]),o.quadrantPointFill&&` .quadrant-point { fill: ${o.quadrantPointFill}; stroke: ${o.quadrantPointFill}; }`,o.quadrantPointTextFill&&` .quadrant-point-label { fill: ${o.quadrantPointTextFill}; }`,o.quadrantXAxisTextFill&&` .quadrant-axis-label[transform$="rotate(0)"] { fill: ${o.quadrantXAxisTextFill}; }`,o.quadrantYAxisTextFill&&` .quadrant-axis-label[transform$="rotate(-90)"] { fill: ${o.quadrantYAxisTextFill}; }`,o.quadrantTitleFill&&` .quadrant-title { fill: ${o.quadrantTitleFill}; }`,o.quadrantInternalBorderStrokeFill&&` .quadrant-line-internal { stroke: ${o.quadrantInternalBorderStrokeFill}; }`,o.quadrantExternalBorderStrokeFill&&` .quadrant-line-external { stroke: ${o.quadrantExternalBorderStrokeFill}; }`].filter(Boolean);return`${A(t)}
90
92
  ${i.join(`
91
93
  `)}
92
94
  .quadrant-line { stroke: ${r}; }
93
95
  .quadrant-text { fill: var(--_text); }
94
96
  .quadrant-point { fill: var(--fg); stroke: var(--fg); stroke-width: 0px; }${[...s,...a].map(e=>`
95
97
  `+e).join(``)}
96
- </style>`}function rs(e,t){return e.text?`<text x="0" y="0" class="quadrant-text ${t}" font-size="${e.fontSize}" dominant-baseline="${e.baseline}" text-anchor="${e.anchor}" transform="translate(${es(e.x)}, ${es(e.y)}) rotate(${e.rotation})">${l(e.text)}</text>`:``}function is(e,t,r=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(wi(M(e.width,e.height,t,i,o,s,void 0,c.styleAttribute,c.description),a)),l.push(n(r,!1,c.nonce,c.bodyFont)),l.push(ns(e,c.nonce)),l.push(`<g class="quadrants">`);for(let t of e.quadrants)l.push(`<g class="quadrant"><rect x="${es(t.x)}" y="${es(t.y)}" width="${es(t.width)}" height="${es(t.height)}" class="quadrant-cell-${t.index}"/>${rs(t.text,`quadrant-label`)}</g>`);l.push(`</g>`),l.push(`<g class="border">`);for(let t of e.lines)l.push(`<line x1="${es(t.x1)}" y1="${es(t.y1)}" x2="${es(t.x2)}" y2="${es(t.y2)}" stroke-width="${t.strokeWidth}" class="quadrant-line quadrant-line-${t.kind}"/>`);l.push(`</g>`),l.push(`<g class="data-points">`),e.points.forEach((e,t)=>{let n=e.color||e.strokeColor||e.strokeWidth!==`0px`?` quadrant-point-${t}`:``;l.push(`<g class="data-point"><circle cx="${es(e.x)}" cy="${es(e.y)}" r="${e.radius}" class="quadrant-point${n}"/>${rs(e.text,`quadrant-point-label`)}</g>`)}),l.push(`</g>`),l.push(`<g class="labels">`);for(let t of e.axisLabels)l.push(`<g class="label">${rs(t,`quadrant-axis-label`)}</g>`);return l.push(`</g>`),l.push(`<g class="title">`),e.title&&l.push(rs(e.title,`quadrant-title`)),l.push(`</g>`),l.push(`</svg>`),l.join(`
97
- `)}var as=2048,os=[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],ss=[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 cs(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?ss:os)[n-32]/as}var $={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},ls=$.width-2*$.shapePadding;function us(e,t,n){let r=[];for(let i of e.split(`
98
- `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&gs(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function ds(e,t){let n=Math.min(Math.max(e*$.personHeadRatio,$.personHeadMin),$.personHeadMax),r=n*(2-$.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*$.personRx,i*$.personRxMaxOfHeight),headRadius:n,pillTop:r}}function fs(e,t){return e*$.nameLine+$.typeLine+ps(t)}function ps(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function ms(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function hs(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function gs(e,t,n){let r=0;for(let i of e){let e=cs(i,n>=600);r+=e===void 0?I(i,t,n)*$.textScale:e*t}return r}function _s(e,t,n,r){let i=fs(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:ds(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=ms(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=hs(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function vs(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}}}var ys=$.messageSize+5;function bs(e){return e.labelLines??ae(e)}function xs(e){let t=e.labelPosition;return t?bs(e).map((n,r,i)=>({cx:e.technology!==void 0&&r===i.length-1&&e.technologyX!==void 0?e.technologyX:t.x,cy:t.y+r*ys,w:gs(n,$.messageSize,400),h:$.messageSize})):[]}function Ss(){return{next:{cnt:0}}}function Cs(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 ws(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Ts(e,t){e.next.cnt+=1;let n=$.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>$.shapeInRow)&&(r=e.next.startx+n+$.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,ws(e,`startx`,r,Math.min),ws(e,`starty`,a,Math.min),ws(e,`stopx`,i,Math.max),ws(e,`stopy`,o,Math.max),ws(e.next,`startx`,r,Math.min),ws(e.next,`starty`,a,Math.min),ws(e.next,`stopx`,i,Math.max),ws(e.next,`stopy`,o,Math.max)}function Es(e){let t=us(e.label,ls,$.nameSize),n=e.description?us(e.description,ls,$.descrSize):[],r=Math.max(...t.map(e=>gs(e,$.nameSize,700)),gs(oe(e),$.typeSize,400),...n.map(e=>gs(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,..._s(e,t.length,n.length,r)}}function Ds(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 Os(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Es(r);t.set(r.alias,n),Ts(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=Ss();c.widthLimit=e.widthLimit/Math.min($.boundaryInRow,t.length);for(let[l,u]of t.entries()){let t=u.boundary,d=0,f=d+8;d=f+$.boundaryLabelHeight;let p;t&&ie(t)&&(p=d+5,d=p+$.boundaryTypeHeight);let m;if(t?.description&&(m=d+20,d=m+$.boundaryDescrHeight),t||(d=$.rootHeadingHeight),l===0||l%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+d;Cs(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;Cs(c,e,e,c.starty,c.starty)}if(u.elements.length>0&&a(c,u.elements),u.children.length>0&&o(c,u.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=$.width,c.stopx=c.startx+e),r===0&&(r=d+$.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:f,...p===void 0?{}:{typeY:p},...m===void 0?{}:{descrY:m}})}e.stopy=Math.max(c.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+$.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=Ss();return Cs(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function ks(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 As(e,t){let n=ds(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 Ms({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function js(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 Ms(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=js(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 Ns=1e-6;function Ps(e,t){let n=ks(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=ms(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-Ns||Math.abs(Math.abs(s)-e.width/2)<=Ns&&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 Fs(e,t){let n=ks(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=hs(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-Ns||Math.abs(Math.abs(s)-e.height/2)<=Ns&&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 Is(e,t){let n=e.el;return n?.kind===`person`?As(e,t):n?.shape===`db`?Ps(e,t):n?.shape===`queue`?Fs(e,t):ks(e,t)}var Ls=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Rs(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Is(i,Ls(a)),s=Is(a,Ls(i)),c=s.x-o.x,l=s.y-o.y,u=e=>({x:e.x,y:e.y+r}),d={...e,points:[u(o),u(s)]};if(t>0&&(d.curve=u({x:o.x+c/2-c/4,y:o.y+l/2})),ae(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=ae(e)[0],r=e.label!==``||e.index!==void 0?gs(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=gs(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var zs=2,Bs=6,Vs=2,Hs=[0,14,-14,28,-28],Us=[.75,.55,.4],Ws=1e3,Gs=100,Ks=10,qs=2,Js=5,Ys=4,Xs=e=>({x0:e.cx-e.w/2,x1:e.cx+e.w/2,y0:e.cy-e.h/2,y1:e.cy+e.h/2}),Zs=(e,t)=>e.x0<t.x1+zs&&e.x1>t.x0-zs&&e.y0<t.y1+zs&&e.y1>t.y0-zs;function Qs(e){let t=e.points[0],n=e.points[e.points.length-1],r=e.curve,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.max(1,Math.ceil(i/Ys));return Array.from({length:a+1},(e,i)=>{let o=i/a;if(!r)return{x:t.x+(n.x-t.x)*o,y:t.y+(n.y-t.y)*o};let s=1-o;return{x:s*s*t.x+2*s*o*r.x+o*o*n.x,y:s*s*t.y+2*s*o*r.y+o*o*n.y}})}function $s(e){return e.flatMap(e=>{let t=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:Gs}),n=(n,r,i,a)=>{let o=gs(n,i,a),s=e.x+e.width/2;return t(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,Js)},r=ie({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,qs),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,qs),t(e.x,e.x,e.y,e.y+e.height,qs),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,qs),n(e.label,e.labelY,$.boundarySize+2,700),...r?[n(r,e.typeY,$.boundarySize,400)]:[],...e.description?[n(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function ec(e,t){return xs({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(Xs)}function tc(e,t,n,r){let i=e.points[0],a=e.points[e.points.length-1],o=e.labelPosition;if(!o||!i||!a)return;let s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c),u=ae(e),d=e.label!==``||e.index!==void 0,f=d?gs(u[0],$.messageSize,400):0,p=o.x-f/2,m=[{variant:{lines:u,position:o,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(d){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([u.join(`
99
- `)]);Us.forEach((e,r)=>{let i=us(u[0],f*e,$.messageSize),a=[...i,...t].join(`
100
- `);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>gs(e,$.messageSize,400)));m.push({variant:{lines:[...i,...t],position:{x:p+s/2,y:o.y}},cost:25*(r+1)})})}let h=l===0?0:s/l,g=l===0?0:c/l,_=l/2+Math.max(...Hs)+zs,v=m.flatMap(t=>ec(e,t.variant)),y={x0:Math.min(...v.map(e=>e.x0))-_,x1:Math.max(...v.map(e=>e.x1))+_,y0:Math.min(...v.map(e=>e.y0))-_,y1:Math.max(...v.map(e=>e.y1))+_},b=e=>e.x0<y.x1&&e.x1>y.x0&&e.y0<y.y1&&e.y1>y.y0,x=[...t,...r].filter(b),S=Math.max(Vs,l/200),C=n.filter(e=>b({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),w=C.map(e=>({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),T,E=e=>T?.penalty===0&&e>=T.cost;for(let{variant:t,cost:n}of m){let r=ec(e,t);for(let e of Hs)if(!E(n+2*Math.abs(e)))for(let i=0;i<=l/2&&!E(n+2*Math.abs(e)+i);i+=S)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*h-e*g,y:o*g+e*h},c=r.map(e=>({x0:e.x0+s.x,x1:e.x1+s.x,y0:e.y0+s.y,y1:e.y1+s.y})),l=0,u=T?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of x)if(Zs(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of C.entries()){let r=w[t];r.x1<=e.x0||r.x0>=e.x1||r.y1<=e.y0||r.y0>=e.y1||n.some(t=>t.x>e.x0&&t.x<e.x1&&t.y>e.y0&&t.y<e.y1)&&(l+=Ks)}}let d=n+i+2*Math.abs(e);(!T||l<T.penalty||l===T.penalty&&d<T.cost)&&(T={v:t,at:s,penalty:l,cost:d})}}let{v:D,at:O}=T;e.labelPosition={x:D.position.x+O.x,y:D.position.y+O.y},D.lines!==u&&(e.labelLines=D.lines),D.technologyX===void 0?delete e.technologyX:e.technologyX=D.technologyX+O.x,r.push(...xs(e).map(e=>({...Xs(e),weight:Gs})))}function nc(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};if(e.title){let n=2*$.diagramMarginY+$.titleExtra;t.title=e.title,t.width=Math.ceil(2*$.diagramMarginX+gs(e.title,16,400)),t.height=n,t.titlePosition={x:$.diagramMarginX,y:n/2}}return t}let n=Os(Ds(e)),r=e.title?$.titleExtra:0,i=$.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)=>Rs(e,t,s,i)),l=[...a.map(e=>({x0:e.x-Bs,x1:e.x+e.width+Bs,y0:e.y-Bs,y1:e.y+e.height+Bs,weight:Ws})),...$s(o)],u=c.map(Qs),d=[];c.forEach((e,t)=>tc(e,l,u.filter((e,n)=>n!==t),d));let f=n.maxX+$.diagramMarginX,p=n.maxY+$.diagramMarginY+r,m={variant:e.variant,width:f,height:p,elements:a,boundaries:o,relationships:c};return e.title&&(m.title=e.title,m.titlePosition={x:(n.maxX-$.diagramMarginX)/2-4*$.diagramMarginX,y:$.diagramMarginY+$.diagramMarginY+i}),m}function rc(e,t,r=`Inter`,i=!1,a=Ke,o,s,c,u={}){let f=[];f.push(wi(M(e.width,e.height,t,i,s??e.title,c,void 0,u.styleAttribute,u.description),o)),f.push(n(r,!1,u.nonce,u.bodyFont)),e.title&&e.titlePosition&&f.push(d`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${z}" `+d`font-size="16" fill="var(--_text)">${l(e.title)}</text>`);for(let t of e.boundaries)f.push(ac(t));for(let t of e.elements)f.push(oc(t));for(let t of e.relationships)f.push(mc(t));for(let t of e.relationships)f.push(hc(t));return f.push(`</svg>`),f.filter(Boolean).join(`
101
- `)}function ic(e,t,n,r,i){return d` <text x="${t}" y="${n}" text-anchor="middle" dy="${z}" font-size="${r}" `+d`${i}>${l(e)}</text>`}function ac(e){let t=[];t.push(d`<g class="c4-boundary" data-id="${c(e.alias)}" data-label="${c(e.label)}" data-depth="${e.depth}">`),t.push(d` <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(ic(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=ie({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push(ic(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(ic(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
102
- `)}function oc(e){let t=vs(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=fs(e.nameLines.length,e.descriptionLines.length),l=[];l.push(d`<g class="c4-element" data-id="${c(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+d`data-external="${e.external}" data-label="${c(e.label)}">`);let u,f=o;if(e.kind===`person`)l.push(...cc(e,t)),u=r+ds(i).pillTop+$.shapePadding;else if(e.shape===`db`){l.push(...lc(e,t));let{ry:n}=ms(i);u=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){l.push(...uc(e,t));let{rx:n}=hs(a);f=o-n,u=r+a/2-s/2}else l.push(d` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+d`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),u=r+$.shapePadding;let p=u;for(let n of e.nameLines)l.push(ic(n,f,p+$.nameLine/2,$.nameSize,d`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return l.push(ic(oe(e),f,p+$.typeLine/2,$.typeSize,d`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{l.push(ic(e,f,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,d`fill="${t.text}"`))}),p+=ps(e.descriptionLines.length),l.push(`</g>`),l.join(`
103
- `)}function sc(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=ds(r,i),c=t+r/2,l=n+s,u=n+i,f=Math.sqrt(Math.max(0,o*o-(l-(n+o))**2));return d`M ${t+a} ${l} H ${c-f} A ${o} ${o} 0 1 1 ${c+f} ${l} `+d`H ${t+r-a} A ${a} ${a} 0 0 1 ${t+r} ${l+a} V ${u-a} `+d`A ${a} ${a} 0 0 1 ${t+r-a} ${u} H ${t+a} `+d`A ${a} ${a} 0 0 1 ${t} ${u-a} V ${l+a} `+d`A ${a} ${a} 0 0 1 ${t+a} ${l} Z`}function cc(e,t){return[d` <path class="c4-person-shape" d="${sc(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function lc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=ms(i),c=d`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[d` <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" ${c} />`,d` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function uc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=hs(a),c=d`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[d` <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" ${c} />`,d` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function dc(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,c=e.y-o*10;return d`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${c+a*5} ${s+o*5},${c-a*5}" `+`fill="var(--_text)" />`}var fc=3,pc=1;function mc(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,d`data-from="${c(e.from)}"`,d`data-to="${c(e.to)}"`];e.label&&r.push(d`data-label="${c(e.label)}"`),e.technology&&r.push(d`data-technology="${c(e.technology)}"`);let i=e.curve?d`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:d`M ${t.x},${t.y} L ${n.x},${n.y}`,a=d`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,l=dc(n,o),u=dc(t,s);return[a,...e.bidirectional?[l,u]:[e.reversed?u:l]].filter(Boolean).join(`
104
- `)}function hc(e){let t=bs(e),n=xs(e);if(n.length===0)return``;let r=[d`<g class="c4-relationship-label" data-from="${c(e.from)}" data-to="${c(e.to)}">`],i=Math.min(...n.map(e=>e.cx-e.w/2))-fc,a=Math.max(...n.map(e=>e.cx+e.w/2))+fc,o=n[0].cy-n[0].h/2-pc,s=n[n.length-1],l=s.cy+s.h/2+pc;return r.push(d` <rect class="c4-label-plate" x="${i}" y="${o}" width="${a-i}" height="${l-o}" rx="2" ry="2" fill="var(--bg)" />`),t.forEach((i,a)=>{let o=e.technology!==void 0&&a===t.length-1,s=n[a];r.push(ic(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
105
- `)}var gc={type:`xychart`,parse:_e,layoutForSvg:yo,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Mo(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},_c={type:`sequence`,parse:ge,layoutForSvg:Ja,renderSvg(e,t){return Ya(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function vc(e){return(e.interactivity??`static`)!==`none`}function yc(e){return(e.interactivity??`static`)===`full`}var bc={type:`class`,parse:de,layoutForSvg:Qi,renderSvg(e,t,n){return ia(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,vc(n),t.emit)}},xc={type:`er`,parse:fe,layoutForSvg(e,t){return Ea(P(e,t.direction),t)},renderSvg(e,t){return ka(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Sc={type:`flowchart`,parse:(e,t)=>pe(t),layoutForSvg(e,t){return{graph:gr(P(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return Dr(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,yc(n),vc(n),t.title,t.decorative,t.emit)}},Cc={type:`c4`,parse:ue,layoutForSvg(e,t){return nc(e,t)},renderSvg(e,t){return rc(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},wc={xychart:gc,er:xc,sequence:_c,class:bc,flowchart:Sc,architecture:{type:`architecture`,parse:le,layoutForSvg(e,t){return{graph:mr(P(re(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:Sc.renderSvg},c4:Cc,pie:{type:`pie`,parse:(e,t)=>me(t),layoutForSvg:(e,t)=>Go(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return Yo(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}},quadrant:{type:`quadrant`,parse:(e,t)=>he(t),layoutForSvg:(e,t)=>$o(t.honorThemeVariables?e:{...e,themeColors:void 0}),renderSvg(e,t){return is(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function Tc(t){return{bg:t.bg??e.bg,fg:t.fg??e.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.muted),surface:t.surface,border:t.border}}function Ec(e={}){return N(Tc(e),e.transparent)}function Dc(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:xe(e)}}function Oc(e,t={}){let{svg:n,colors:r}=jc(e,t),i=kc(n);return t.resolveColors?zi(i,r):i}function kc(e){let t=new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g),e=>e[1]??``));if(t.size===0)return e;let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=`zm${(n>>>0).toString(36)}-`,i=e=>t.has(e)&&!e.startsWith(`zm-`)?r+e:e;return e.replace(/(\sid=")([^"]+)"/g,(e,t,n)=>`${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g,(e,t)=>`url(#${i(t)})`).replace(/(href=")#([^"]+)"/g,(e,t,n)=>`${t}#${i(n)}"`)}function Ac(e){let t=u(ve(e)).text;wc[o(t)].parse(k(t),t)}function jc(e,n){i(`maxInputLength`,e.length,n.limits),a(e,n.limits);let s=u(ve(e)),c=s.text,l=n.font??`Inter`;O(g(l));let d=n.transparent??!1,f=qe(n.fontSizes),p=o(c),m=n.embedSource?e:void 0,h=n.title??s.accTitle,_=n.decorative,v={...Dc(n),description:s.accDescr},y=k(c),b=wc[p],x=b.parse(y,c),S=x;S.nodes instanceof Map&&Array.isArray(S.edges)&&r(S.nodes.size,S.edges.length,n.limits);let C=b.layoutForSvg(x,n),w=Tc(n.honorThemeVariables?t(n,x.initConfig):n),T={colors:w,font:l,transparent:d,fontSizes:f,embedSource:m,title:h,decorative:_,emit:v};return{svg:b.renderSvg(C,T,n),colors:w}}async function Mc(e,t={}){return t.embedFont===`subset`&&await be(),Oc(e,t)}var Nc=Oc,Pc=Mc;export{Ba as ACTOR_LABEL_OFFSET,Ze as ARROW_HEAD,Ye as ASYMMETRIC_NOTCH,W as CLS,$e as ELK_DIRECTION_FALLBACK,Me as ElkNotRegisteredError,Ke as FONT_SIZES,L as FONT_WEIGHTS,Je as GROUP_HEADER_CONTENT_PAD,it as INLINE_CENTERED_EDGE_LABEL,We as MONO_FONT,Ge as MONO_FONT_STACK,Xe as NODE_PADDING,Z as PIE,Xo as QUADRANT,R as STROKE_WIDTHS,z as TEXT_BASELINE_SHIFT,nt as baseElkLayoutOptions,za as boxLabelHeight,ot as buildElkEdge,at as buildElkEdgeLabel,rt as buildElkLeafNode,Qe as buildSvgStyleBlock,Yi as classBackEdges,Wi as classNoteId,Ot as clipEdgeToShape,_r as convertToElkFormat,Le as createLayoutCache,et as directionToElk,Be as elkLayoutSync,tt as elkPadding,Ue as estimateMonoTextWidth,I as estimateTextWidth,Ni as evaluateCssColorValue,Gt as extractEdgeLabelPosition,Wt as extractEdgePoints,ko as formatTickLabels,Ha as hasLabelBelowIcon,Qi as layoutClassDiagramSync,Ea as layoutErDiagramSync,gr as layoutFlowchartSync,mr as layoutGraphSync,Go as layoutPieChart,$o as layoutQuadrantChart,Ja as layoutSequenceDiagram,yo as layoutXYChart,be as loadEmbeddedFont,b as niceTickValues,qo as pieColorValue,De as pointsToPath,Ne as registerElk,ia as renderClassSvg,ka as renderErSvg,Pc as renderMermaid,Oc as renderMermaidSVG,Mc as renderMermaidSVGAsync,Nc as renderMermaidSync,Yo as renderPieSvg,is as renderQuadrantSvg,Ya as renderSequenceSvg,Dr as renderSvg,Mo as renderXYChartSvg,zi as resolveCssColors,qe as resolveFontSizes,Lo as smoothCurvePath,Io as straightLinePath,Ec as themeCssVariables,Ac as validateMermaid,wi as withDataSrc,To as xLabelStep};
98
+ </style>`}function ys(e,t){return e.text?`<text x="0" y="0" class="quadrant-text ${t}" font-size="${e.fontSize}" dominant-baseline="${e.baseline}" text-anchor="${e.anchor}" transform="translate(${gs(e.x)}, ${gs(e.y)}) rotate(${e.rotation})">${u(e.text)}</text>`:``}function bs(e,t,n=`Inter`,i=!1,a,o,s,c={}){let l=[];l.push(Fi(M(e.width,e.height,t,i,o,s,void 0,c.styleAttribute,c.description),a)),l.push(r(n,!1,c.nonce,c.bodyFont)),l.push(vs(e,c.nonce)),l.push(`<g class="quadrants">`);for(let t of e.quadrants)l.push(`<g class="quadrant"><rect x="${gs(t.x)}" y="${gs(t.y)}" width="${gs(t.width)}" height="${gs(t.height)}" class="quadrant-cell-${t.index}"/>${ys(t.text,`quadrant-label`)}</g>`);l.push(`</g>`),l.push(`<g class="border">`);for(let t of e.lines)l.push(`<line x1="${gs(t.x1)}" y1="${gs(t.y1)}" x2="${gs(t.x2)}" y2="${gs(t.y2)}" stroke-width="${t.strokeWidth}" class="quadrant-line quadrant-line-${t.kind}"/>`);l.push(`</g>`),l.push(`<g class="data-points">`),e.points.forEach((e,t)=>{let n=e.color||e.strokeColor||e.strokeWidth!==`0px`?` quadrant-point-${t}`:``;l.push(`<g class="data-point"><circle cx="${gs(e.x)}" cy="${gs(e.y)}" r="${e.radius}" class="quadrant-point${n}"/>${ys(e.text,`quadrant-point-label`)}</g>`)}),l.push(`</g>`),l.push(`<g class="labels">`);for(let t of e.axisLabels)l.push(`<g class="label">${ys(t,`quadrant-axis-label`)}</g>`);return l.push(`</g>`),l.push(`<g class="title">`),e.title&&l.push(ys(e.title,`quadrant-title`)),l.push(`</g>`),l.push(`</svg>`),l.join(`
99
+ `)}var xs=2048,Ss=[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],Cs=[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 ws(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?Cs:Ss)[n-32]/xs}var $={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},Ts=$.width-2*$.shapePadding;function Es(e,t,n){let r=[];for(let i of e.split(`
100
+ `)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Ms(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function Ds(e,t){let n=Math.min(Math.max(e*$.personHeadRatio,$.personHeadMin),$.personHeadMax),r=n*(2-$.personHeadOverlap),i=t===void 0?1/0:t-r;return{rx:Math.min(e*$.personRx,i*$.personRxMaxOfHeight),headRadius:n,pillTop:r}}function Os(e,t){return e*$.nameLine+$.typeLine+ks(t)}function ks(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function As(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function js(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Ms(e,t,n){let r=0;for(let i of e){let e=ws(i,n>=600);r+=e===void 0?I(i,t,n)*$.textScale:e*t}return r}function Ns(e,t,n,r){let i=Os(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:Ds(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=As(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=js(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function Ps(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}}}var Fs=$.messageSize+5;function Is(e){return e.labelLines??P(e)}function Ls(e){let t=e.labelPosition;return t?Is(e).map((n,r,i)=>({cx:e.technology!==void 0&&r===i.length-1&&e.technologyX!==void 0?e.technologyX:t.x,cy:t.y+r*Fs,w:Ms(n,$.messageSize,400),h:$.messageSize})):[]}function Rs(){return{next:{cnt:0}}}function zs(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 Bs(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Vs(e,t){e.next.cnt+=1;let n=$.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>$.shapeInRow)&&(r=e.next.startx+n+$.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,Bs(e,`startx`,r,Math.min),Bs(e,`starty`,a,Math.min),Bs(e,`stopx`,i,Math.max),Bs(e,`stopy`,o,Math.max),Bs(e.next,`startx`,r,Math.min),Bs(e.next,`starty`,a,Math.min),Bs(e.next,`stopx`,i,Math.max),Bs(e.next,`stopy`,o,Math.max)}function Hs(e){let t=Es(e.label,Ts,$.nameSize),n=e.description?Es(e.description,Ts,$.descrSize):[],r=Math.max(...t.map(e=>Ms(e,$.nameSize,700)),Ms(F(e),$.typeSize,400),...n.map(e=>Ms(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...Ns(e,t.length,n.length,r)}}function Us(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 Ws(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Hs(r);t.set(r.alias,n),Vs(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=Rs();c.widthLimit=e.widthLimit/Math.min($.boundaryInRow,t.length);for(let[l,u]of t.entries()){let t=u.boundary,d=0,f=d+8;d=f+$.boundaryLabelHeight;let p;t&&se(t)&&(p=d+5,d=p+$.boundaryTypeHeight);let m;if(t?.description&&(m=d+20,d=m+$.boundaryDescrHeight),t||(d=$.rootHeadingHeight),l===0||l%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+d;zs(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;zs(c,e,e,c.starty,c.starty)}if(u.elements.length>0&&a(c,u.elements),u.children.length>0&&o(c,u.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=$.width,c.stopx=c.startx+e),r===0&&(r=d+$.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:f,...p===void 0?{}:{typeY:p},...m===void 0?{}:{descrY:m}})}e.stopy=Math.max(c.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+$.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=Rs();return zs(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function Gs(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 Ks(e,t){let n=Ds(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 Js({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function qs(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 Js(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=qs(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 Ys=1e-6;function Xs(e,t){let n=Gs(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=As(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-Ys||Math.abs(Math.abs(s)-e.width/2)<=Ys&&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 Zs(e,t){let n=Gs(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=js(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-Ys||Math.abs(Math.abs(s)-e.height/2)<=Ys&&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 Qs(e,t){let n=e.el;return n?.kind===`person`?Ks(e,t):n?.shape===`db`?Xs(e,t):n?.shape===`queue`?Zs(e,t):Gs(e,t)}var $s=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function ec(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Qs(i,$s(a)),s=Qs(a,$s(i)),c=s.x-o.x,l=s.y-o.y,u=e=>({x:e.x,y:e.y+r}),d={...e,points:[u(o),u(s)]};if(t>0&&(d.curve=u({x:o.x+c/2-c/4,y:o.y+l/2})),P(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=P(e)[0],r=e.label!==``||e.index!==void 0?Ms(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=Ms(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var tc=2,nc=6,rc=2,ic=[0,14,-14,28,-28],ac=[.75,.55,.4],oc=1e3,sc=100,cc=10,lc=2,uc=5,dc=4,fc=e=>({x0:e.cx-e.w/2,x1:e.cx+e.w/2,y0:e.cy-e.h/2,y1:e.cy+e.h/2}),pc=(e,t)=>e.x0<t.x1+tc&&e.x1>t.x0-tc&&e.y0<t.y1+tc&&e.y1>t.y0-tc;function mc(e){let t=e.points[0],n=e.points[e.points.length-1],r=e.curve,i=Math.hypot(n.x-t.x,n.y-t.y),a=Math.max(1,Math.ceil(i/dc));return Array.from({length:a+1},(e,i)=>{let o=i/a;if(!r)return{x:t.x+(n.x-t.x)*o,y:t.y+(n.y-t.y)*o};let s=1-o;return{x:s*s*t.x+2*s*o*r.x+o*o*n.x,y:s*s*t.y+2*s*o*r.y+o*o*n.y}})}function hc(e){return e.flatMap(e=>{let t=(e,t,n,r,i)=>({x0:e-i,x1:t+i,y0:n-i,y1:r+i,weight:sc}),n=(n,r,i,a)=>{let o=Ms(n,i,a),s=e.x+e.width/2;return t(s-o/2,s+o/2,e.y+r-i/2,e.y+r+i/2,uc)},r=se({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,lc),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,lc),t(e.x,e.x,e.y,e.y+e.height,lc),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,lc),n(e.label,e.labelY,$.boundarySize+2,700),...r?[n(r,e.typeY,$.boundarySize,400)]:[],...e.description?[n(e.description,e.descrY,$.boundarySize-2,400)]:[]]})}function gc(e,t){return Ls({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(fc)}function _c(e,t,n,r){let i=e.points[0],a=e.points[e.points.length-1],o=e.labelPosition;if(!o||!i||!a)return;let s=a.x-i.x,c=a.y-i.y,l=Math.hypot(s,c),u=P(e),d=e.label!==``||e.index!==void 0,f=d?Ms(u[0],$.messageSize,400):0,p=o.x-f/2,m=[{variant:{lines:u,position:o,...e.technologyX===void 0?{}:{technologyX:e.technologyX}},cost:0}];if(d){let t=e.technology?[`[${e.technology}]`]:[],n=new Set([u.join(`
101
+ `)]);ac.forEach((e,r)=>{let i=Es(u[0],f*e,$.messageSize),a=[...i,...t].join(`
102
+ `);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>Ms(e,$.messageSize,400)));m.push({variant:{lines:[...i,...t],position:{x:p+s/2,y:o.y}},cost:25*(r+1)})})}let h=l===0?0:s/l,g=l===0?0:c/l,_=l/2+Math.max(...ic)+tc,v=m.flatMap(t=>gc(e,t.variant)),y={x0:Math.min(...v.map(e=>e.x0))-_,x1:Math.max(...v.map(e=>e.x1))+_,y0:Math.min(...v.map(e=>e.y0))-_,y1:Math.max(...v.map(e=>e.y1))+_},b=e=>e.x0<y.x1&&e.x1>y.x0&&e.y0<y.y1&&e.y1>y.y0,x=[...t,...r].filter(b),S=Math.max(rc,l/200),C=n.filter(e=>b({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),w=C.map(e=>({x0:Math.min(...e.map(e=>e.x)),x1:Math.max(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),y1:Math.max(...e.map(e=>e.y))})),T,E=e=>T?.penalty===0&&e>=T.cost;for(let{variant:t,cost:n}of m){let r=gc(e,t);for(let e of ic)if(!E(n+2*Math.abs(e)))for(let i=0;i<=l/2&&!E(n+2*Math.abs(e)+i);i+=S)for(let a of i===0?[1]:[1,-1]){let o=a*i,s={x:o*h-e*g,y:o*g+e*h},c=r.map(e=>({x0:e.x0+s.x,x1:e.x1+s.x,y0:e.y0+s.y,y1:e.y1+s.y})),l=0,u=T?.penalty??1/0;for(let e of c){if(l>u)break;for(let t of x)if(pc(e,t)&&(l+=t.weight),l>u)break;if(l>u)break;for(let[t,n]of C.entries()){let r=w[t];r.x1<=e.x0||r.x0>=e.x1||r.y1<=e.y0||r.y0>=e.y1||n.some(t=>t.x>e.x0&&t.x<e.x1&&t.y>e.y0&&t.y<e.y1)&&(l+=cc)}}let d=n+i+2*Math.abs(e);(!T||l<T.penalty||l===T.penalty&&d<T.cost)&&(T={v:t,at:s,penalty:l,cost:d})}}let{v:D,at:O}=T;e.labelPosition={x:D.position.x+O.x,y:D.position.y+O.y},D.lines!==u&&(e.labelLines=D.lines),D.technologyX===void 0?delete e.technologyX:e.technologyX=D.technologyX+O.x,r.push(...Ls(e).map(e=>({...fc(e),weight:sc})))}function vc(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};if(e.title){let n=2*$.diagramMarginY+$.titleExtra;t.title=e.title,t.width=Math.ceil(2*$.diagramMarginX+Ms(e.title,16,400)),t.height=n,t.titlePosition={x:$.diagramMarginX,y:n/2}}return t}let n=Ws(Us(e)),r=e.title?$.titleExtra:0,i=$.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)=>ec(e,t,s,i)),l=[...a.map(e=>({x0:e.x-nc,x1:e.x+e.width+nc,y0:e.y-nc,y1:e.y+e.height+nc,weight:oc})),...hc(o)],u=c.map(mc),d=[];c.forEach((e,t)=>_c(e,l,u.filter((e,n)=>n!==t),d));let f=n.maxX+$.diagramMarginX,p=n.maxY+$.diagramMarginY+r,m={variant:e.variant,width:f,height:p,elements:a,boundaries:o,relationships:c};return e.title&&(m.title=e.title,m.titlePosition={x:(n.maxX-$.diagramMarginX)/2-4*$.diagramMarginX,y:$.diagramMarginY+$.diagramMarginY+i}),m}function yc(e,t,n=`Inter`,i=!1,a=qe,o,s,c,l={}){let d=[];d.push(Fi(M(e.width,e.height,t,i,s??e.title,c,void 0,l.styleAttribute,l.description),o)),d.push(r(n,!1,l.nonce,l.bodyFont)),e.title&&e.titlePosition&&d.push(f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${z}" `+f`font-size="16" fill="var(--_text)">${u(e.title)}</text>`);for(let t of e.boundaries)d.push(xc(t));for(let t of e.elements)d.push(Sc(t));for(let t of e.relationships)d.push(Ac(t));for(let t of e.relationships)d.push(jc(t));return d.push(`</svg>`),d.filter(Boolean).join(`
103
+ `)}function bc(e,t,n,r,i){return f` <text x="${t}" y="${n}" text-anchor="middle" dy="${z}" font-size="${r}" `+f`${i}>${u(e)}</text>`}function xc(e){let t=[];t.push(f`<g class="c4-boundary" data-id="${l(e.alias)}" data-label="${l(e.label)}" data-depth="${e.depth}">`),t.push(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(bc(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=se({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push(bc(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(bc(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
104
+ `)}function Sc(e){let t=Ps(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=Os(e.nameLines.length,e.descriptionLines.length),c=[];c.push(f`<g class="c4-element" data-id="${l(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+f`data-external="${e.external}" data-label="${l(e.label)}">`);let u,d=o;if(e.kind===`person`)c.push(...wc(e,t)),u=r+Ds(i).pillTop+$.shapePadding;else if(e.shape===`db`){c.push(...Tc(e,t));let{ry:n}=As(i);u=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){c.push(...Ec(e,t));let{rx:n}=js(a);d=o-n,u=r+a/2-s/2}else c.push(f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),u=r+$.shapePadding;let p=u;for(let n of e.nameLines)c.push(bc(n,d,p+$.nameLine/2,$.nameSize,f`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return c.push(bc(F(e),d,p+$.typeLine/2,$.typeSize,f`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{c.push(bc(e,d,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,f`fill="${t.text}"`))}),p+=ks(e.descriptionLines.length),c.push(`</g>`),c.join(`
105
+ `)}function Cc(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=Ds(r,i),c=t+r/2,l=n+s,u=n+i,d=Math.sqrt(Math.max(0,o*o-(l-(n+o))**2));return f`M ${t+a} ${l} H ${c-d} A ${o} ${o} 0 1 1 ${c+d} ${l} `+f`H ${t+r-a} A ${a} ${a} 0 0 1 ${t+r} ${l+a} V ${u-a} `+f`A ${a} ${a} 0 0 1 ${t+r-a} ${u} H ${t+a} `+f`A ${a} ${a} 0 0 1 ${t} ${u-a} V ${l+a} `+f`A ${a} ${a} 0 0 1 ${t+a} ${l} Z`}function wc(e,t){return[f` <path class="c4-person-shape" d="${Cc(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function Tc(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=As(i),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[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" ${c} />`,f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function Ec(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=js(a),c=f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[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" ${c} />`,f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function Dc(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,c=e.y-o*10;return f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${c+a*5} ${s+o*5},${c-a*5}" `+`fill="var(--_text)" />`}var Oc=3,kc=1;function Ac(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,f`data-from="${l(e.from)}"`,f`data-to="${l(e.to)}"`];e.label&&r.push(f`data-label="${l(e.label)}"`),e.technology&&r.push(f`data-technology="${l(e.technology)}"`);let i=e.curve?f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,c=Dc(n,o),u=Dc(t,s);return[a,...e.bidirectional?[c,u]:[e.reversed?u:c]].filter(Boolean).join(`
106
+ `)}function jc(e){let t=Is(e),n=Ls(e);if(n.length===0)return``;let r=[f`<g class="c4-relationship-label" data-from="${l(e.from)}" data-to="${l(e.to)}">`],i=Math.min(...n.map(e=>e.cx-e.w/2))-Oc,a=Math.max(...n.map(e=>e.cx+e.w/2))+Oc,o=n[0].cy-n[0].h/2-kc,s=n[n.length-1],c=s.cy+s.h/2+kc;return r.push(f` <rect class="c4-label-plate" x="${i}" y="${o}" width="${a-i}" height="${c-o}" rx="2" ry="2" fill="var(--bg)" />`),t.forEach((i,a)=>{let o=e.technology!==void 0&&a===t.length-1,s=n[a];r.push(bc(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
107
+ `)}var Mc={type:`xychart`,parse:ve,layoutForSvg:Fo,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Jo(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Nc={type:`sequence`,parse:_e,layoutForSvg:fo,renderSvg(e,t){return po(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function Pc(e){return(e.interactivity??`static`)!==`none`}function Fc(e){return(e.interactivity??`static`)===`full`}var Ic={type:`class`,parse:fe,layoutForSvg:la,renderSvg(e,t,n){return ha(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Pc(n),t.emit)}},Lc={type:`er`,parse:pe,layoutForSvg(e,t){return La(N(e,t.direction),t)},renderSvg(e,t){return Ba(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Rc={type:`flowchart`,parse:(e,t)=>me(t),layoutForSvg(e,t){return{graph:wr(N(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return Fr(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,Fc(n),Pc(n),t.title,t.decorative,t.emit)}},zc={type:`c4`,parse:de,layoutForSvg(e,t){return vc(e,t)},renderSvg(e,t){return yc(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Bc={xychart:Mc,er:Lc,sequence:Nc,class:Ic,flowchart:Rc,architecture:{type:`architecture`,parse:ue,layoutForSvg(e,t){return{graph:Sr(N(oe(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:Rc.renderSvg},c4:zc,pie:{type:`pie`,parse:(e,t)=>he(t),layoutForSvg:(e,t)=>ss(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return ds(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}},quadrant:{type:`quadrant`,parse:(e,t)=>ge(t),layoutForSvg:(e,t)=>hs(t.honorThemeVariables?e:{...e,themeColors:void 0}),renderSvg(e,t){return bs(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function Vc(t){return{bg:t.bg??e.bg,fg:t.fg??e.fg,line:t.line,accent:t.accent,muted:t.muted??(t.bg||t.fg?void 0:e.muted),surface:t.surface,border:t.border}}function Hc(e={}){return re(Vc(e),e.transparent)}function Uc(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute,bodyFont:Se(e)}}function Wc(e,t={}){let{svg:n,colors:r}=qc(e,t),i=Gc(n);return t.resolveColors?Xi(i,r):i}function Gc(e){let t=new Set(Array.from(e.matchAll(/\sid="([^"]+)"/g),e=>e[1]??``));if(t.size===0)return e;let n=2166136261;for(let t=0;t<e.length;t++)n=Math.imul(n^e.charCodeAt(t),16777619);let r=`zm${(n>>>0).toString(36)}-`,i=e=>t.has(e)&&!e.startsWith(`zm-`)?r+e:e;return e.replace(/(\sid=")([^"]+)"/g,(e,t,n)=>`${t}${i(n)}"`).replace(/url\(#([^)]+)\)/g,(e,t)=>`url(#${i(t)})`).replace(/(href=")#([^"]+)"/g,(e,t,n)=>`${t}#${i(n)}"`)}function Kc(e){let t=d(ye(e)).text;Bc[s(t)].parse(ee(t),t)}function qc(e,t){a(`maxInputLength`,e.length,t.limits),o(e,t.limits);let r=d(ye(e)),c=r.text,l=t.font??`Inter`;k(_(l));let u=t.transparent??!1,f=Je(t.fontSizes),p=s(c),m=t.embedSource?e:void 0,h=t.title??r.accTitle,g=t.decorative,v={...Uc(t),description:r.accDescr},y=ee(c),b=Bc[p],x=b.parse(y,c),S=x;S.nodes instanceof Map&&Array.isArray(S.edges)&&i(S.nodes.size,S.edges.length,t.limits);let C=b.layoutForSvg(x,t),w=Vc(t.honorThemeVariables?n(t,x.initConfig):t),T={colors:w,font:l,transparent:u,fontSizes:f,embedSource:m,title:h,decorative:g,emit:v};return{svg:b.renderSvg(C,T,t),colors:w}}async function Jc(e,t={}){return t.embedFont===`subset`&&await xe(),Wc(e,t)}var Yc=Wc,Xc=Jc;export{eo as ACTOR_LABEL_OFFSET,Qe as ARROW_HEAD,Xe as ASYMMETRIC_NOTCH,W as CLS,nt as ELK_DIRECTION_FALLBACK,Ne as ElkNotRegisteredError,qe as FONT_SIZES,L as FONT_WEIGHTS,Ye as GROUP_HEADER_CONTENT_PAD,st as INLINE_CENTERED_EDGE_LABEL,Ge as MONO_FONT,Ke as MONO_FONT_STACK,Ze as NODE_PADDING,Z as PIE,fs as QUADRANT,Xa as SELF_LOOP_CONTROL,Za as SELF_LOOP_EXTENT,Qa as SELF_LOOP_HEIGHT,R as STROKE_WIDTHS,z as TEXT_BASELINE_SHIFT,at as baseElkLayoutOptions,$a as boxLabelHeight,lt as buildElkEdge,ct as buildElkEdgeLabel,ot as buildElkLeafNode,$e as buildSvgStyleBlock,oa as classBackEdges,ta as classNoteId,Pt as clipEdgeToShape,Tr as convertToElkFormat,Re as createLayoutCache,rt as directionToElk,Ve as elkLayoutSync,it as elkPadding,We as estimateMonoTextWidth,I as estimateTextWidth,Wi as evaluateCssColorValue,Zt as extractEdgeLabelPosition,Xt as extractEdgePoints,Go as formatTickLabels,no as hasLabelBelowIcon,la as layoutClassDiagramSync,La as layoutErDiagramSync,wr as layoutFlowchartSync,Sr as layoutGraphSync,ss as layoutPieChart,hs as layoutQuadrantChart,fo as layoutSequenceDiagram,Fo as layoutXYChart,xe as loadEmbeddedFont,x as niceTickValues,ls as pieColorValue,Oe as pointsToPath,Pe as registerElk,ha as renderClassSvg,Ba as renderErSvg,Xc as renderMermaid,Wc as renderMermaidSVG,Jc as renderMermaidSVGAsync,Yc as renderMermaidSync,ds as renderPieSvg,bs as renderQuadrantSvg,po as renderSequenceSvg,Fr as renderSvg,Jo as renderXYChartSvg,Xi as resolveCssColors,Je as resolveFontSizes,$o as smoothCurvePath,Qo as straightLinePath,Hc as themeCssVariables,Kc as validateMermaid,Fi as withDataSrc,Vo as xLabelStep};