@zombie-mermaid/svg-renderer 5.8.0 → 5.8.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.cjs +39 -38
- package/dist/index.d.cts +1 -758
- package/dist/index.d.ts +1 -758
- package/dist/index.js +56 -55
- package/dist/shared/index.d.ts +758 -0
- package/dist/shared/package.json +1 -0
- package/package.json +13 -4
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,detectDiagramType as a,dropInvalidColors as o,escapeAttr as s,escapeXml as c,extractAccessibility as l,f as u,findBackEdgeIndexes as d,findBackEdges as f,formatCssColor as p,getReadableTextColor as m,isMonospaceFont as h,measureMultilineText as g,measureTextWidth as _,mixSrgb as v,niceTickValues as y,niceTickValues as b,parseCssColor as x,renderMultilineText as S,renderMultilineTextWithBackground as C,resolveNodeStyle as w,safeHref as T,sanitizeClassName as E,setMonospaceMetrics as D,splitStatements as O,styleOpenTag as k,subgraphDirectionIsHonored as ee,subgraphFeedbackEdges as te,subgraphsTied as
|
|
1
|
+
import{DEFAULTS as e,applyThemeVariables as t,buildStyleBlock as n,checkGraphSize as r,checkLimit as i,detectDiagramType as a,dropInvalidColors as o,escapeAttr as s,escapeXml as c,extractAccessibility as l,f as u,findBackEdgeIndexes as d,findBackEdges as f,formatCssColor as p,getReadableTextColor as m,isMonospaceFont as h,measureMultilineText as g,measureTextWidth as _,mixSrgb as v,niceTickValues as y,niceTickValues as b,parseCssColor as x,renderMultilineText as S,renderMultilineTextWithBackground as C,resolveNodeStyle as w,safeHref as T,sanitizeClassName as E,setMonospaceMetrics as D,splitStatements as O,styleOpenTag as k,subgraphDirectionIsHonored as ee,subgraphFeedbackEdges as te,subgraphsTied as A,svgOpenTag as j,themeStyleDeclarations as M,withDirectionOverride as N,withoutOwnClusterEdges as ne}from"@zombie-mermaid/core";import{CHART_ACCENT_FALLBACK as P,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,parseSequenceDiagram as he,parseXYChart as ge}from"@zombie-mermaid/mermaid-parser";import{decodeXML as _e}from"entities";function ve(e){return u`M ${e.x} ${e.y}`}function ye(e){return ve(e[0])+e.slice(1).map(e=>u` L ${e.x} ${e.y}`).join(``)}function be(e){if(e.length<3)return ye(e);let t=e[e.length-1],n=[ve(e[0])],r=(e,t,n)=>u` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+u` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+u` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(u` L ${(5*e[0].x+e[1].x)/6}`+u` ${(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(u` L ${t.x} ${t.y}`),n.join(``)}function xe(e){if(e.length<3)return ye(e);let t=[ve(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(u` L ${i.x} ${i.y}`);continue}let c=Math.min(12,o/2,s/2),l=i.x-(i.x-r.x)/o*c,d=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(u` L ${l} ${d}`),t.push(u` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(u` L ${n.x} ${n.y}`),t.join(``)}function Se(e,t){let n=[ve(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(u` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(u` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(u` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(u` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function Ce(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return ve(e[0]);switch(t){case`basis`:return be(e);case`natural`:return xe(e);case`step`:return Se(e,`mid`);case`stepBefore`:return Se(e,`before`);case`stepAfter`:return Se(e,`after`);default:return ye(e)}}function we(e){let t=e?.worker?.worker;return typeof t==`object`&&!!t&&`dispatcher`in t}var Te=null,Ee=null,De=null,Oe=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 ke(e){Te=e,Ee=null,De=null}function Ae(){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://${je(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 je(e){let t=e.cwd;return typeof t==`function`?t.call(e):`/`}var Me=20;function Ne(e=Me){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function Pe(e){if(Array.isArray(e))return`[${e.map(Pe).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${Pe(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function Fe(){if(Ee&&De)return De;let e=Te??=Ae();if(!e)throw new Oe;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(!we(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 Ee=s,t.forEach(e=>e()),De=Ee.worker.worker,De}function Ie(e,t){let n=t,r=n?Pe(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=Fe(),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 Le=`JetBrains Mono NL`,Re=`@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 P(e,t,n){return _(e,t,n)}function Be(e,t){return e.length*t*.6}var Ve=`'JetBrains Mono'`,He=`${Ve}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,Ue={nodeLabel:13,edgeLabel:11,groupHeader:12};function We(e){return{nodeLabel:e?.nodeLabel??Ue.nodeLabel,edgeLabel:e?.edgeLabel??Ue.edgeLabel,groupHeader:e?.groupHeader??Ue.groupHeader}}var F={nodeLabel:500,edgeLabel:400,groupHeader:600},Ge=12,Ke={horizontal:20,vertical:10,diamondExtra:24},I={outerBox:1,innerBox:.75,connector:1},L=`0.35em`,R={width:8,height:5};function qe(e,t,r){return n(e,t?{family:Re,faceCss:ze}:!1,r)}var z={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:Ue},Je={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function Ye(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 Xe(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 Ze(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":Xe(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function Qe(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var $e={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function et(e,t){let n=g(e,t.fontSize,F.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function tt(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[et(e.label,e.labelStyle)]),t}var nt={"state-start":`FIRST`},rt={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function it(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var B={top:44,left:16,bottom:16,right:16},at={top:16,left:16,bottom:16,right:16};function ot(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 st=new WeakMap;function ct(e,t){let n=st.get(e);return n||(n=it(e)||ht(e.subgraphs)?new Set:d(e,t?.walkOrder,t?.feedbackEdges??te(e)),st.set(e,n)),n}function lt(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 ut(e){return Ye(e,Je.flowchart)}function dt(e){return{...Ze(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 ft(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:$e}}function pt(e,t,n,r){let i=g(t,r,F.nodeLabel),a=i.width+Ke.horizontal*2,o=i.height+Ke.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+Ke.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+=Ke.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=Ke.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 mt=` root`;function ht(e){for(let t of e)if(t.direction!==void 0||ht(t.children))return!0;return!1}function gt(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)gt(n,t)}function _t(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 vt(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function yt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),xt(t,i,a);let o=St(e.subgraphs),s=_t(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=ht(e.subgraphs),f=[],p=[],m={...dt({direction:ut(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(z.thoroughness),"elk.layered.highDegreeNodes.treatment":`false`,"elk.layered.compaction.postCompaction.strategy":(e.subgraphs.length===0||ot(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...ot(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...it(e)?rt:{},"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=vt(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]:mt,tt({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:ft(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=pt(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=Qe(t,i,o.label),c=it(e)?nt[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=it(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(bt(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return lt(e,new Set([t.id]));let r=e.subgraphs[n-b],i=lt(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return gt(r,a),lt(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=ct(e,n);for(let{index:e,edge:t}of l.get(null)){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=tt({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:ft(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(mt)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(tt({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:ft(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function bt(e,t,n,r,i,a,o){let s=e.direction!==void 0&&ee(e,t)?e.direction:o,c=dt({direction:ut(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?at:B}),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=pt(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(Qe(r,t,e.label))}}let f=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of f)d.push(bt(e,t,n,r,i,a,s));let p=[],m=r.get(e.id)??[],h=ct(t);for(let{index:e,edge:t}of m)t.source!==t.target&&p.push(tt({id:`e${e}`,source:h.has(e)?t.target:t.source,target:h.has(e)?t.source:t.target,label:t.label,labelStyle:ft(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 xt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),xt(r,t,n)}function St(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 Ct(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]=wt(e[0],e[1],t);else{let n=e.length-1;r[n]=wt(e[n],e[n-1],t)}}return r}function wt(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?Et(t,c,a)??a:Et(t,a,o)??a:t<=r?Et(t,s,c)??s:Et(t,o,s)??s}{let t=e.y;return l>0?t<=i?Tt(t,a,c)??c:Tt(t,c,s)??c:t<=i?Tt(t,a,o)??o:Tt(t,o,s)??o}}function Tt(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 Et(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 Dt=12;function Ot(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=z.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,Dt-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 kt=.5;function At(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+kt,r=e.x+e.width-kt,i=e.y+kt,a=e.y+e.height-kt;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function jt(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(...jt(e,t,i.children)));return r}function Mt(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(jt(t,n,r).map(e=>e.id)),u=jt(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 Nt=2;function Pt(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)<=Nt)return!0}return!1}function Ft(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[d,f]of u){if(f.length<2)continue;let u=f[0].style;if(f.some(e=>e.label||e.style!==u))continue;let p=i.get(d);if(!p)continue;let m=[];for(let e of f){let t=i.get(e.target);t&&(o?t.x>p.x+p.width:s?t.x+t.width<p.x:c?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(l){let i=o?p.x+p.width:p.x,s=g;if(Pt(e,new Set(m.map(e=>e.edge)),d,i,!0))continue;let c=i+((o?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=Mt(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=o?n.x:n.x+n.width,a=n.y+n.height/2,u=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];At(u,t,new Set([d,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)}else{let i=h,o=c?p.y:p.y+p.height;if(Pt(e,new Set(m.map(e=>e.edge)),d,o,!1))continue;let s=o+((c?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-o)/2;s=Mt(s,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=c?n.y+n.height:n.y,u=[{x:i,y:o},{x:i,y:s},{x:r,y:s},{x:r,y:a}];At(u,t,new Set([d,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 d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[a,u]of d){if(u.length<2)continue;let d=u[0].style;if(u.some(e=>e.label||e.style!==d))continue;let f=i.get(a);if(!f)continue;let p=[];for(let e of u){let t=i.get(e.source);t&&(o?t.x+t.width<f.x:s?t.x>f.x+f.width:c?t.y>f.y+f.height:t.y+t.height<f.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x:f.x+f.width,s=h;if(Pt(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let c=o?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),l=c+(i-c)/2;l=Mt(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=o?n.x+n.width:n.x,c=n.y+n.height/2,d=[{x:r,y:c},{x:l,y:c},{x:l,y:s},{x:i,y:s}];At(d,t,new Set([n.id,a]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}else{let i=m,o=c?f.y+f.height:f.y;if(Pt(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=c?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=Mt(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:c?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];At(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 It=1.5,Lt=.01;function Rt(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)<Lt&&Math.abs(i.x-a.x)<Lt&&Math.abs(r.y-i.y)<Lt&&Math.abs(r.x-i.x)<=It&&Math.abs(r.x-i.x)>=Lt,s=Math.abs(e.y-r.y)<Lt&&Math.abs(i.y-a.y)<Lt&&Math.abs(r.x-i.x)<Lt&&Math.abs(r.y-i.y)<=It&&Math.abs(r.y-i.y)>=Lt;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 zt(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 Bt(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 Vt=16,Ht=28,Ut=18,Wt=28,Gt=10;function Kt(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Wt,e.height*.6)/2,a=Ht+t*Ut,o=[];for(let e=0;e<=Vt;e++){let t=Math.PI*e/Vt;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Gt,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}=Kt(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:on(i,e),id:a.id,animate:a.animate})}}function Jt(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(...Jt(n.children));return t}function Yt(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)an(e,o);Xt(e,t,o,r,a,0,0);let s=Jt(a);$t(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),Ot(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));qt(t,c,i),n&&Ft(i,r,a,t.direction);for(let e of i){e.points=Rt(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=Ct(e.points,t,!0)),n&&(e.points=Ct(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=R.width,f=z.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 Xt(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=[];Xt(s,t,n,r,a,e,c);let o=rn(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=w(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&&Xt(s,t,n,r,i,e,c)}}}function Zt(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 Qt(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 $t(e,t,n,r,i,a){let o=new Map;en(e,o,0,0);let s=new Map;nn(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??Qt(o));let f=tn(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=Qt(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:ct(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:on(e,t),id:i.id,animate:i.animate})}}function en(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;en(i,t,n+e,r+a)}}function tn(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 nn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=Zt(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=zt(a,l,u),f=Bt(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)nn(a,t,n+(a.x??0),r+(a.y??0),i)}function rn(e,t){for(let n of e){if(n.id===t)return n;let e=rn(n.children,t);if(e)return e}}function an(e,t){t.add(e.id);for(let n of e.children)an(n,t)}function on(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&&o(n)}var sn=10,cn=14,ln=14,un=10,dn=24,fn=400,pn=new Set([`rectangle`,`rounded`,`subroutine`]);function mn(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 hn(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 gn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function _n(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function vn(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<cn&&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<cn&&r>0)return!0}}}return!1}function yn(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 bn=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 xn(e,t,n,r,i,a=[]){let o=mn(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+un,a1:d.a1-un,c0:d.c0+un,c1:d.c1-un},p=a.map(e=>e.map(e=>_n(o,e))),m=n.map(e=>gn(o.span(e),sn)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>pn.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=>hn(n,r,e))||hn(n,r,s)||hn(n,r,c)||p.some(e=>vn(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-sn),y.add(e.c1+sn);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(ln,n),i=c.a0-Math.min(ln,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=yn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?fn:0,i=bn(n)+dn*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Sn(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 Cn=`__zm_spine__`,wn=8,Tn=6,En=12,Dn=4,On=4,kn=.25,An=.02,jn=40,Mn=e=>e===`TD`||e===`TB`||e===`BT`,Nn=e=>e.startsWith(Cn);function Pn(e){return e.flatMap(e=>[e,...Pn(e.children)])}function V(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of V(n))t.add(e);return t}function Fn(e){if(e.subgraphs.length===0||it(e)||ht(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Nn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Pn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...V(t)].some(t=>e.nodes.has(t)))}function In(e,t){let n=Mn(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 Ln(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...V(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=`${Cn}${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);!Nn(t)&&!Nn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Rn(e,t,n,r=()=>!1,i=()=>!1){let a=e=>{let n=[...V(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=[...V(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 V(e))n.has(r)&&n.set(r,n.get(r)+l[t])})}for(let a of e)Rn(a.children,t,n,r,i)}function zn(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=V(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)||Nn(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 Bn=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function Vn(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...V(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=e.region?at:B,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:g(e.label,n.groupHeader,F.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 Hn=e=>e.flatMap(e=>[e,...Hn(e.children)]);function Un(e,t,n,r,i,a){let o=Mn(r),s=new Map(Pn(t).map(e=>[e.id,V(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-jn,y:e.y-jn,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Hn(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))||!Bn(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)=>Hn(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 Wn(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=te(e),o=t(i,{feedbackEdges:a}),s=In(o.nodes,e.direction),c=Mn(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=Pn(e.subgraphs),f=Ln(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)]));Rn(e.subgraphs,s,m,(t,n)=>{let r=V(t),i=V(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=[...V(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=zn([...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,wn+(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=>!Nn(e.id)).map(e=>[e.id,e])),g=Vn(e.subgraphs,h,n),y=Un(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===En)return;qn(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=Vn(e.subgraphs,h,n),y=Un(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=Kn(e,i,h,g,d);return t&&Xn(m,[...h.values()],g,t,e.direction)}if(l===Tn)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>An?i:kn;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+On)}}},b=Gn(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function Gn(e,t,n,r){let i=r.map(e=>{let t=V(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 Kn(e,t,n,r,i){let a=new Map(Hn(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=V(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>V(e).size-V(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=xn(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?Sn(d):void 0,inlineStyle:on(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+Dn,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 Jn=8;function Yn(e,t,n,r){let i=Mn(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)<Jn&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?Jn:-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 Xn(e,t,n,r,i){let a=[...e.edges.filter(e=>!Nn(e.source)&&!Nn(e.target)),...r],o=Hn(n);Yn(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=z.padding-Math.min(...s),u=z.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+z.padding),f=Math.max(f,e.y+e.height+z.padding);for(let e of o)d=Math.max(d,e.x+e.width+z.padding),f=Math.max(f,e.y+e.height+z.padding);for(let e of a){for(let t of e.points)d=Math.max(d,t.x+R.width+z.padding),f=Math.max(f,t.y+R.width+z.padding);e.labelPosition&&(d=Math.max(d,e.labelPosition.x+60+z.padding),f=Math.max(f,e.labelPosition.y+20+z.padding))}return{...e,nodes:t,edges:a,groups:n,width:d,height:f}}var Zn=12,Qn=8,$n=4;function er(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=f(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 p=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 p)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=tr(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}=p[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 tr(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<Qn&&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,Zn)),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)),nr(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<$n;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 nr(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 rr=28,ir=18,ar=10,or=32;function sr(e,t={}){let n={...z,...t,fontSizes:We(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=g(i,n.fontSizes.edgeLabel,F.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,_=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){_.set(e.source,[..._.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:B.bottom,axisEnd:B.top,crossStart:B.left,crossEnd:B.right}:{axisStart:B.top,axisEnd:B.bottom,crossStart:B.left,crossEnd:B.right}:{axisStart:i?B.right:B.left,axisEnd:i?B.left:B.right,crossStart:B.top,crossEnd:B.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=pt(t,r.label,r.shape,n.fontSizes.nodeLabel);b.set(t,y(i.width,i.height))}let x=e=>{let t=_.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+ar));return rr+(t.length-1)*ir+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=g(t.label,n.fontSizes.groupHeader,F.groupHeader).width,u=c.axisSize+v.axisStart+v.axisEnd,d=c.crossSize+v.crossStart+v.crossEnd,f=r?0:l+or,p=r?l+or: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=er(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),T=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};T.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,te=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}},ne=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}},A=e=>{for(let t of e)Object.assign(t,ne(T.get(t.id))),A(t.children)};A(O);let j=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.shape,...ne(T.get(t)),inlineStyle:w(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),M=new Map(j.map(e=>[e.id,e])),re=[];e.edges.forEach((t,n)=>{let r=E.get(n);if(!r)return;let i=T.get(t.source),a=T.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=Rt(cr(u.map(te)));o&&d.reverse();let f=M.get(t.source),p=M.get(t.target);f&&(d=Ct(d,f,!0)),p&&(d=Ct(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&&te(r.label),inlineStyle:on(n,e),id:t.id,animate:t.animate})}),qt(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+R.width+k),ie=Math.max(ie,t.y+R.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:j,edges:re,groups:O}}function cr(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 lr(e,t={}){return ur(e,t)}function ur(e,t,n){let r={...z,...t,fontSizes:We(t.fontSizes)};return Yt(Le(yt(e,r,n),t.layoutCache),e,r.mergeEdges)}function dr(e,t={}){let n=re(e);if(t.layout===`simple`&&!it(n))return sr(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(Fn(n)){let e=Wn(n,(e,n)=>ur(e,t,n),We(t.fontSizes));if(e)return e}return lr(n,t)}function fr(e,t={}){return yt(e,{...z,...t,fontSizes:We(t.fontSizes)})}var pr=12,mr=2;function hr(e){return e.flatMap(e=>[e,...hr(e.children)])}function gr(e,t){let n=t.groupHeader+16;return hr(e).filter(e=>e.label!==``).map(e=>{let r=g(e.label,t.groupHeader,F.groupHeader);return{x:e.x+pr-mr,y:e.y+n/2-r.height/2-mr,width:r.width+4,height:r.height+4}})}function _r(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 vr(e){return{x:e.x+mr,y:e.y+mr,width:e.width-4,height:e.height-4}}function yr(e,t){let n=e.points,r=t.map(vr);for(let e=0;e+1<n.length;e++)if(r.some(t=>_r(n[e],n[e+1],t)))return!0;return!1}function br(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 xr(e,t,n){let r=`zm-title-gap-${br(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
|
|
10
|
-
`)}function
|
|
11
|
-
`)}function
|
|
8
|
+
}`;function F(e,t,n){return _(e,t,n)}function ze(e,t){return e.length*t*.6}var Be=`'JetBrains Mono'`,Ve=`${Be}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,He={nodeLabel:13,edgeLabel:11,groupHeader:12};function Ue(e){return{nodeLabel:e?.nodeLabel??He.nodeLabel,edgeLabel:e?.edgeLabel??He.edgeLabel,groupHeader:e?.groupHeader??He.groupHeader}}var I={nodeLabel:500,edgeLabel:400,groupHeader:600},We=12,Ge={horizontal:20,vertical:10,diamondExtra:24},L={outerBox:1,innerBox:.75,connector:1},R=`0.35em`,z={width:8,height:5};function Ke(e,t,r){return n(e,t?{family:Le,faceCss:Re}:!1,r)}var B={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:He},qe={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function Je(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 Ye(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 Xe(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":Ye(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function Ze(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var Qe={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function $e(e,t){let n=g(e,t.fontSize,I.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function et(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[$e(e.label,e.labelStyle)]),t}var tt={"state-start":`FIRST`},nt={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function rt(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},it={top:16,left:16,bottom:16,right:16};function at(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 ot=new WeakMap;function st(e,t){let n=ot.get(e);return n||(n=rt(e)||mt(e.subgraphs)?new Set:d(e,t?.walkOrder,t?.feedbackEdges??te(e)),ot.set(e,n)),n}function ct(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 lt(e){return Je(e,qe.flowchart)}function ut(e){return{...Xe(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 dt(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:Qe}}function ft(e,t,n,r){let i=g(t,r,I.nodeLabel),a=i.width+Ge.horizontal*2,o=i.height+Ge.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+Ge.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+=Ge.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=Ge.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 pt=` root`;function mt(e){for(let t of e)if(t.direction!==void 0||mt(t.children))return!0;return!1}function ht(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)ht(n,t)}function gt(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 _t(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function vt(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),bt(t,i,a);let o=xt(e.subgraphs),s=gt(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=mt(e.subgraphs),f=[],p=[],m={...ut({direction:lt(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||at(e))&&!n?.forceNodeOrder?`NONE`:`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...at(e)?{"elk.spacing.edgeEdge":`40`}:{},...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...rt(e)?nt:{},"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=_t(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]:pt,et({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:dt(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=ft(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=Ze(t,i,o.label),c=rt(e)?tt[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=rt(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(yt(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return ct(e,new Set([t.id]));let r=e.subgraphs[n-b],i=ct(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return ht(r,a),ct(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=st(e,n);for(let{index:e,edge:t}of l.get(null)){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=et({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:dt(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(pt)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(et({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:dt(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function yt(e,t,n,r,i,a,o){let s=e.direction!==void 0&&ee(e,t)?e.direction:o,c=ut({direction:lt(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:e.region?it: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=ft(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(Ze(r,t,e.label))}}let f=e.children.some(e=>e.region)?e.children:[...e.children].reverse();for(let e of f)d.push(yt(e,t,n,r,i,a,s));let p=[],m=r.get(e.id)??[],h=st(t);for(let{index:e,edge:t}of m)t.source!==t.target&&p.push(et({id:`e${e}`,source:h.has(e)?t.target:t.source,target:h.has(e)?t.source:t.target,label:t.label,labelStyle:dt(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 bt(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),bt(r,t,n)}function xt(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 St(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]=Ct(e[0],e[1],t);else{let n=e.length-1;r[n]=Ct(e[n],e[n-1],t)}}return r}function Ct(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?Tt(t,c,a)??a:Tt(t,a,o)??a:t<=r?Tt(t,s,c)??s:Tt(t,o,s)??s}{let t=e.y;return l>0?t<=i?wt(t,a,c)??c:wt(t,c,s)??c:t<=i?wt(t,a,o)??o:wt(t,o,s)??o}}function wt(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 Tt(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 Et=12;function Dt(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,Et-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 Ot=.5;function kt(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+Ot,r=e.x+e.width-Ot,i=e.y+Ot,a=e.y+e.height-Ot;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function At(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(...At(e,t,i.children)));return r}function jt(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(At(t,n,r).map(e=>e.id)),u=At(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 Mt=2;function Nt(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)<=Mt)return!0}return!1}function Pt(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[d,f]of u){if(f.length<2)continue;let u=f[0].style;if(f.some(e=>e.label||e.style!==u))continue;let p=i.get(d);if(!p)continue;let m=[];for(let e of f){let t=i.get(e.target);t&&(o?t.x>p.x+p.width:s?t.x+t.width<p.x:c?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(l){let i=o?p.x+p.width:p.x,s=g;if(Nt(e,new Set(m.map(e=>e.edge)),d,i,!0))continue;let c=i+((o?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=jt(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=o?n.x:n.x+n.width,a=n.y+n.height/2,u=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];kt(u,t,new Set([d,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)}else{let i=h,o=c?p.y:p.y+p.height;if(Nt(e,new Set(m.map(e=>e.edge)),d,o,!1))continue;let s=o+((c?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-o)/2;s=jt(s,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=c?n.y+n.height:n.y,u=[{x:i,y:o},{x:i,y:s},{x:r,y:s},{x:r,y:a}];kt(u,t,new Set([d,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 d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[a,u]of d){if(u.length<2)continue;let d=u[0].style;if(u.some(e=>e.label||e.style!==d))continue;let f=i.get(a);if(!f)continue;let p=[];for(let e of u){let t=i.get(e.source);t&&(o?t.x+t.width<f.x:s?t.x>f.x+f.width:c?t.y>f.y+f.height:t.y+t.height<f.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x:f.x+f.width,s=h;if(Nt(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let c=o?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),l=c+(i-c)/2;l=jt(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=o?n.x+n.width:n.x,c=n.y+n.height/2,d=[{x:r,y:c},{x:l,y:c},{x:l,y:s},{x:i,y:s}];kt(d,t,new Set([n.id,a]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}else{let i=m,o=c?f.y+f.height:f.y;if(Nt(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=c?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=jt(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:c?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];kt(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 Ft=1.5,It=.01;function Lt(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)<It&&Math.abs(i.x-a.x)<It&&Math.abs(r.y-i.y)<It&&Math.abs(r.x-i.x)<=Ft&&Math.abs(r.x-i.x)>=It,s=Math.abs(e.y-r.y)<It&&Math.abs(i.y-a.y)<It&&Math.abs(r.x-i.x)<It&&Math.abs(r.y-i.y)<=Ft&&Math.abs(r.y-i.y)>=It;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 Rt(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 Bt=16,Vt=28,Ht=18,Ut=28,Wt=10;function Gt(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Ut,e.height*.6)/2,a=Vt+t*Ht,o=[];for(let e=0;e<=Bt;e++){let t=Math.PI*e/Bt;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Wt,y:r}}}function Kt(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}=Gt(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:an(i,e),id:a.id,animate:a.animate})}}function qt(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(...qt(n.children));return t}function Jt(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)rn(e,o);Yt(e,t,o,r,a,0,0);let s=qt(a);Qt(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),Dt(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));Kt(t,c,i),n&&Pt(i,r,a,t.direction);for(let e of i){e.points=Lt(e.points);let t=c.get(e.source),n=c.get(e.target);t&&(e.points=St(e.points,t,!0)),n&&(e.points=St(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=z.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 Yt(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=[];Yt(s,t,n,r,a,e,c);let o=nn(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=w(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&&Yt(s,t,n,r,i,e,c)}}}function Xt(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 Zt(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 Qt(e,t,n,r,i,a){let o=new Map;$t(e,o,0,0);let s=new Map;tn(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??Zt(o));let f=en(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=Zt(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:st(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:an(e,t),id:i.id,animate:i.animate})}}function $t(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;$t(i,t,n+e,r+a)}}function en(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 tn(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=Xt(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=Rt(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)tn(a,t,n+(a.x??0),r+(a.y??0),i)}function nn(e,t){for(let n of e){if(n.id===t)return n;let e=nn(n.children,t);if(e)return e}}function rn(e,t){t.add(e.id);for(let n of e.children)rn(n,t)}function an(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&&o(n)}var on=10,sn=14,cn=14,ln=10,un=24,dn=400,fn=new Set([`rectangle`,`rounded`,`subroutine`]);function pn(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 mn(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 hn=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function gn(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function _n(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<sn&&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<sn&&r>0)return!0}}}return!1}function vn(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 yn=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 bn(e,t,n,r,i,a=[]){let o=pn(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+ln,a1:d.a1-ln,c0:d.c0+ln,c1:d.c1-ln},p=a.map(e=>e.map(e=>gn(o,e))),m=n.map(e=>hn(o.span(e),on)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>fn.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=>mn(n,r,e))||mn(n,r,s)||mn(n,r,c)||p.some(e=>_n(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-on),y.add(e.c1+on);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(cn,n),i=c.a0-Math.min(cn,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=vn(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?dn:0,i=yn(n)+un*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function xn(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 Sn=`__zm_spine__`,Cn=8,wn=6,Tn=12,En=4,Dn=4,On=.25,kn=.02,An=40,jn=e=>e===`TD`||e===`TB`||e===`BT`,Mn=e=>e.startsWith(Sn);function Nn(e){return e.flatMap(e=>[e,...Nn(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 Pn(e){if(e.subgraphs.length===0||rt(e)||mt(e.subgraphs))return!1;for(let t of e.nodes.keys())if(Mn(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Nn(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...H(t)].some(t=>e.nodes.has(t)))}function Fn(e,t){let n=jn(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 In(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=`${Sn}${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);!Mn(t)&&!Mn(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Ln(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)Ln(a.children,t,n,r,i)}function Rn(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)||Mn(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 zn=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function Bn(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?it: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:g(e.label,n.groupHeader,I.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 Vn=e=>e.flatMap(e=>[e,...Vn(e.children)]);function Hn(e,t,n,r,i,a){let o=jn(r),s=new Map(Nn(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-An,y:e.y-An,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Vn(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))||!zn(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)=>Vn(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 Un(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=te(e),o=t(i,{feedbackEdges:a}),s=Fn(o.nodes,e.direction),c=jn(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=Nn(e.subgraphs),f=In(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)]));Ln(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)=>A(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=Rn([...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,Cn+(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=>!Mn(e.id)).map(e=>[e.id,e])),g=Bn(e.subgraphs,h,n),y=Hn(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===Tn)return;Kn(y.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...h.values()],m.edges),g=Bn(e.subgraphs,h,n),y=Hn(g,e.subgraphs,h,e.direction,new Set(p.keys()),s)}let t=Gn(e,i,h,g,d);return t&&Yn(m,[...h.values()],g,t,e.direction)}if(l===wn)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>kn?i:On;c.set(e,{width:n,overlap:t}),o.set(e,n+t/a+Dn)}}},b=Wn(e,f,s,d);return(b.size>0?y(b):void 0)??y(new Set)}function Wn(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 Gn(e,t,n,r,i){let a=new Map(Vn(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=bn(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?xn(d):void 0,inlineStyle:an(r,e),id:t.id,animate:t.animate})}return o}function Kn(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+En,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 qn=8;function Jn(e,t,n,r){let i=jn(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)<qn&&f>e[a]&&d<e[a]+e[s]);if(h){let e=h.s+(u[i]>=h.s?qn:-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 Yn(e,t,n,r,i){let a=[...e.edges.filter(e=>!Mn(e.source)&&!Mn(e.target)),...r],o=Vn(n);Jn(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+z.width+B.padding),f=Math.max(f,t.y+z.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 Xn=12,Zn=8,Qn=4;function $n(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=f(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 p=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 p)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=er(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}=p[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 er(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<Zn&&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,Xn)),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)),tr(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<Qn;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 tr(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 nr=28,rr=18,ir=10,ar=32;function or(e,t={}){let n={...B,...t,fontSizes:Ue(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=g(i,n.fontSizes.edgeLabel,I.edgeLabel),o=a.width+8,s=a.height+6;return r?{axis:s,cross:o}:{axis:o,cross:s}},h=new Map,_=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target){_.set(e.source,[..._.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=ft(t,r.label,r.shape,n.fontSizes.nodeLabel);b.set(t,y(i.width,i.height))}let x=e=>{let t=_.get(e);if(!r||!t)return 0;let n=Math.max(0,...t.map(e=>(m(e)?.cross??-10)+ir));return nr+(t.length-1)*rr+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=g(t.label,n.fontSizes.groupHeader,I.groupHeader).width,u=c.axisSize+v.axisStart+v.axisEnd,d=c.crossSize+v.crossStart+v.crossEnd,f=r?0:l+ar,p=r?l+ar: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=$n(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),T=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};T.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,te=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}},A=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}},j=e=>{for(let t of e)Object.assign(t,A(T.get(t.id))),j(t.children)};j(O);let M=c.map(t=>{let n=e.nodes.get(t);return{id:t,label:n.label,shape:n.shape,...A(T.get(t)),inlineStyle:w(t,e),className:e.classAssignments.get(t),interaction:e.interactions.get(t)}}),N=new Map(M.map(e=>[e.id,e])),ne=[];e.edges.forEach((t,n)=>{let r=E.get(n);if(!r)return;let i=T.get(t.source),a=T.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=Lt(sr(u.map(te)));o&&d.reverse();let f=N.get(t.source),p=N.get(t.target);f&&(d=St(d,f,!0)),p&&(d=St(d,p,!1)),ne.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:r.label&&te(r.label),inlineStyle:an(n,e),id:t.id,animate:t.animate})}),Kt(e,N,ne);let P=(r?C.crossSize:C.axisSize)+k*2,re=(r?C.axisSize:C.crossSize)+k*2;for(let e of ne){for(let t of e.points)P=Math.max(P,t.x+z.width+k),re=Math.max(re,t.y+z.width+k);e.labelPosition&&(P=Math.max(P,e.labelPosition.x+60+k),re=Math.max(re,e.labelPosition.y+20+k))}return{width:P,height:re,nodes:M,edges:ne,groups:O}}function sr(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 cr(e,t={}){return lr(e,t)}function lr(e,t,n){let r={...B,...t,fontSizes:Ue(t.fontSizes)};return Jt(Ie(vt(e,r,n),t.layoutCache),e,r.mergeEdges)}function ur(e,t={}){let n=ne(e);if(t.layout===`simple`&&!rt(n))return or(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(Pn(n)){let e=Un(n,(e,n)=>lr(e,t,n),Ue(t.fontSizes));if(e)return e}return cr(n,t)}function dr(e,t={}){return vt(e,{...B,...t,fontSizes:Ue(t.fontSizes)})}var fr=12,pr=2;function mr(e){return e.flatMap(e=>[e,...mr(e.children)])}function hr(e,t){let n=t.groupHeader+16;return mr(e).filter(e=>e.label!==``).map(e=>{let r=g(e.label,t.groupHeader,I.groupHeader);return{x:e.x+fr-pr,y:e.y+n/2-r.height/2-pr,width:r.width+4,height:r.height+4}})}function gr(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 _r(e){return{x:e.x+pr,y:e.y+pr,width:e.width-4,height:e.height-4}}function vr(e,t){let n=e.points,r=t.map(_r);for(let e=0;e+1<n.length;e++)if(r.some(t=>gr(n[e],n[e+1],t)))return!0;return!1}function yr(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 br(e,t,n){let r=`zm-title-gap-${yr(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 xr(e,t,r=`Inter`,i=!1,a=He,o=`linear`,s,c=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!T(e.interaction?.href));p.push(vi(j(e.width,e.height,t,i,u,d,m,f.styleAttribute,f.description),s)),p.push(n(r,!1,f.nonce)),c&&e.edges.some(e=>e.animate)&&p.push(Sr(f.nonce)),p.push(`<defs>`),p.push(Cr());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(wr(e));let g=hr(e.groups,a),_=new Set(e.edges.filter(e=>vr(e,g))),v;if(_.size>0){let t=br(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(Dr(t,r,a));for(let t of e.edges)p.push(Or(t,o,c,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(Ar(t,r,a));for(let t of e.nodes)p.push(Pr(t,r,a,l));return p.push(`</svg>`),p.join(`
|
|
10
|
+
`)}function Sr(e){return[k(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 Cr(){return Tr(`var(--_arrow)`,``)}function wr(e){return Tr(s(e),u`-${Er(e)}`)}function Tr(e,t){let n=z.width,r=z.height,i=n-1,a=u`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=u`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${a} />`,s=(e,t)=>u` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r/2}" orient="${t}">`+u`\n ${o}`+`
|
|
12
12
|
</marker>`;return s(u`arrowhead${t}`,`auto`)+`
|
|
13
|
-
`+s(u`arrowhead-start${t}`,`auto-start-reverse`)}function
|
|
14
|
-
`)}i.push(u`<g class="subgraph" data-id="${s(e.id)}" data-label="${s(e.label)}">`),i.push(u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+u`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${
|
|
15
|
-
`)}function
|
|
16
|
-
`)}\n`+`</g>`}function
|
|
17
|
-
`)}function
|
|
18
|
-
`)}function
|
|
19
|
-
`)}function mi(e,t,n,r,i,a,o){let s=[u`${e+n*.42},${t}`,u`${e+n},${t}`,u`${e+n*.62},${t+r*.42}`,u`${e+n},${t+r*.42}`,u`${e+n*.3},${t+r}`,u`${e+n*.5},${t+r*.55}`,u`${e},${t+r*.55}`].join(` `);return u`<polygon points="${s}" ${H(i,a,o)} />`}function hi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return u`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function gi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return u`<circle cx="${i}" cy="${a}" r="${o}" `+u`fill="none" stroke="var(--_text)" stroke-width="${I.innerBox*2}" />`+u`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function _i(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=s(e.inlineStyle?.color??m(e.inlineStyle?.fill,`var(--_text)`)),o=u`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${F.nodeLabel}" fill="${a}"`,c=e.inlineStyle?.[`font-family`];return c&&(o+=u` style="font-family: ${s(c)};"`),S(e.label,r,i,n.nodeLabel,o)}function vi(e){return s(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function yi(e,t){return t===void 0?e:e.replace(`<svg `,u`<svg data-src="${vi(t)}" `)}var bi=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=Di(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 xi(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 Si(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 Ci=`(?<![\\w-])(var|color-mix)\\(`;function wi(e,t){let[n,...r]=Si(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function Ti(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 Ei(e){let t=Si(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=Ti(r),o=Ti(i);if(!a||!o)return null;let s=x(a.color),c=x(o.color);if(!s||!c)return null;let l=v(s,c,a.pct,o.pct);return l?p(l):null}function Di(e,t){let n=``,r=0,i=new RegExp(Ci,`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=xi(e,c);if(l===-1)break;let u=Di(e.slice(c+1,l),t),d=o===`var`?wi(u,t):Ei(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Oi(e,t){let n=new bi;for(let[e,r]of Object.entries(t))n.declare(e,r);return Di(e,n)}var ki=/(--[\w-]+)\s*:\s*([^;{}]+)/g,Ai=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,ji=new Set([`data-src`]);function Mi(e,t){ki.lastIndex=0;let n;for(;(n=ki.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Ni(e,t){return e.replace(Ai,(e,n,r,i,a)=>{if(ji.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Di(a.slice(1,-1),t)}${o}`})}function Pi(e,t){let n=new bi;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&&Mi(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&Mi(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+=Di(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:Ni(s,n),i=a+1}return r+e.slice(i)}var Fi=[.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],Ii=[.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 Li(e){return e>=4352?1:.6}function Ri(e,t){let n=t?Ii:Fi,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:Li(e)}return i*16}var U={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 zi(e){return`note ${e}`}function Bi(e){return`${e} link`}function Vi(e){return`namespace ${e}`}function Hi(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:Vi(i),name:a.name,classIds:e})}return r}function Ui(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 Wi(e){return f(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function Gi(e,t,n){let r=new Map,i=new Map,a=We(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:P(t.label,a.nodeLabel,F.edgeLabel)+U.lollipopLabelPadX*2,height:U.lollipopLabelHeight,headerHeight:U.lollipopLabelHeight,attrHeight:0,methodHeight:0});continue}let e=t.annotation?U.headerBaseHeight+U.annotationHeight:U.headerBaseHeight,i=t.attributes.length>0?t.attributes.length*U.memberRowHeight+U.sectionPadY:U.emptySectionHeight,o=t.methods.length>0?t.methods.length*U.memberRowHeight+U.sectionPadY:U.emptySectionHeight,s=P(t.label,a.nodeLabel,F.nodeLabel),c=Zi(t.attributes),l=Zi(t.methods),u=Math.max(Xi(t),s+U.boxPadX*2,c+U.boxPadX*2,l+U.boxPadX*2),d=e+i+o;r.set(t.id,{width:u,height:d,headerHeight:e,attrHeight:i,methodHeight:o})}let o=Hi(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=P(e.name,U.namespaceTitleFontSize,F.groupHeader)+U.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":Xe({top:U.namespaceTitleHeight+U.namespacePad/2,left:U.namespacePad,bottom:U.namespacePad,right:U.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=Qe(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=Wi(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(tt({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=zi(t),r=g(n.text,a.edgeLabel,F.edgeLabel),o={width:r.width+U.notePadX*2,height:r.height+U.notePadY*2};i.set(e,o),l.push(Qe(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(tt({id:Bi(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...Ze({direction:Ye(e.direction,Je.class),nodeSpacing:U.nodeSpacing,layerSpacing:U.layerSpacing,padding:U.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 Ki(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:w(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=Wi(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=zt(t,r.x,r.y),o=m.has(e)?i.reverse():i,s=Bt(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=zi(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(Bi(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:zt(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=Ui(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=Gi(n.diagram,t,n.labels);return Ki(Le(r,t.layoutCache),e,i,a,o,n)}function Ji(e){return e.length*Math.ceil(Be(`M`,U.memberFontSize))}function Yi(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function Xi(e){let t=Ri(e.label,!0),n=e.annotation?Ri(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>Ri(Yi(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+U.mermaidPad*2}function Zi(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=Ji(ce(n));e>t&&(t=e)}return t}var Qi={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function $i(e,t,n=`Inter`,r=!1,i=Ue,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!T(e.interaction?.href));u.push(yi(A(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push(qe(n,!0,l.nonce)),u.push(`<defs>`),u.push(ta(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push(ea(t));for(let t of e.relationships)u.push(ca(t));for(let t of e.notes)u.push(sa(t));for(let t of e.classes)u.push(na(t,i,c));for(let t of e.relationships){let e=la(t,i);e&&u.push(e)}for(let t of e.notes)u.push(oa(t,i));for(let t of e.relationships)u.push(fa(t,i));return u.push(`</svg>`),u.join(`
|
|
20
|
-
`)}function
|
|
21
|
-
`)}function
|
|
13
|
+
`+s(u`arrowhead-start${t}`,`auto-start-reverse`)}function Er(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function Dr(e,t,n){let r=n.groupHeader+16,i=[];if(e.region){i.push(u`<g class="subgraph subgraph-region" data-id="${s(e.id)}">`,u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+u`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" stroke-dasharray="6 4" />`);for(let r of e.children)i.push(Dr(r,t,n));return i.push(`</g>`),i.join(`
|
|
14
|
+
`)}i.push(u`<g class="subgraph" data-id="${s(e.id)}" data-label="${s(e.label)}">`),i.push(u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+u`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`),i.push(u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+u`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`),i.push(` `+S(e.label,e.x+12,e.y+r/2,n.groupHeader,u`font-size="${n.groupHeader}" font-weight="${I.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(Dr(r,t,n));return i.push(`</g>`),i.join(`
|
|
15
|
+
`)}function Or(e,t,n=!0,r){if(e.points.length<2)return``;let i=n&&(e.animate??!1),a=t!==`linear`,o=e.style===`invisible`,c=e.style===`dotted`?` stroke-dasharray="4 4"`:``,l=e.style===`thick`?L.connector*2:L.connector,d=o?`none`:s(e.inlineStyle?.stroke??`var(--_line)`),f=s(e.inlineStyle?.[`stroke-width`]??String(l)),p=e.inlineStyle?.stroke?u`-${Er(e.inlineStyle.stroke)}`:``,m=``;o||(e.hasArrowEnd&&(m+=u` marker-end="url(#arrowhead${p})"`),e.hasArrowStart&&(m+=u` marker-start="url(#arrowhead-start${p})"`));let h=[u`class="edge${i?` edge-animated`:``}"`,u`data-from="${s(e.source)}"`,u`data-to="${s(e.target)}"`,u`data-style="${e.style}"`,u`data-arrow-start="${e.hasArrowStart}"`,u`data-arrow-end="${e.hasArrowEnd}"`];e.label&&h.push(u`data-label="${s(e.label)}"`),e.id&&h.push(u`data-id="${s(e.id)}"`);let g=i&&!c?` stroke-dasharray="8 6"`:``,_=a?u`d="${Ce(e.points,t)}"`:u`points="${kr(e.points)}"`;return u`<${a?`path`:`polyline`} ${h.join(` `)} ${_} `+u`fill="none" stroke="${d}" `+u`stroke-width="${f}"${c}${g}${m}`+(r?u` mask="url(#${r})"`:``)+` />`}function kr(e){return e.map(e=>u`${e.x},${e.y}`).join(` `)}function Ar(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??Mr(e.points),a=g(r,n.edgeLabel,I.edgeLabel),o=C(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,u`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${I.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return u`<g class="edge-label" data-from="${s(e.source)}" data-to="${s(e.target)}" data-label="${s(r)}">\n`+u` ${o.replace(/\n/g,`
|
|
16
|
+
`)}\n`+`</g>`}function jr(e,t){let n=e[t];if(!n)throw Error(u`edgeMidpoint: missing point at index ${t}`);return n}function Mr(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+=Nr(jr(e,n-1),jr(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=jr(e,t-1),i=jr(e,t),a=Nr(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 Nr(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Pr(e,t,n,r=!0){let i=Fr(e),a=gi(e,t,n),o=[],l=E(e.className),d=l?u`node ${l}`:`node`,f=e.interaction,p=[u`class="${d}"`,u`data-id="${s(e.id)}"`,u`data-label="${s(e.label)}"`,u`data-shape="${e.shape}"`];o.push(u`<g ${p.join(` `)}>`);let m=r?T(f?.href):void 0,h=m?` `:` `;if(m){let e=f?.target?u` target="${s(f.target)}"`:``;o.push(u` <a href="${s(m)}"${e}>`)}return r&&f?.tooltip&&o.push(u`${h}<title>${c(f.tooltip)}</title>`),o.push(u`${h}${i.replace(/\n/g,u`\n${h}`)}`),a&&o.push(u`${h}${a.replace(/\n/g,u`\n${h}`)}`),m&&o.push(` </a>`),o.push(`</g>`),o.join(`
|
|
17
|
+
`)}function Fr(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,c=s(o?.fill??`var(--_node-fill)`),l=s(o?.stroke??`var(--_node-stroke)`),u=s(o?.[`stroke-width`]??String(L.innerBox));switch(a){case`diamond`:return Br(t,n,r,i,c,l,u);case`rounded`:return Lr(t,n,r,i,c,l,u);case`stadium`:return Rr(t,n,r,i,c,l,u);case`circle`:return zr(t,n,r,i,c,l,u);case`subroutine`:return Vr(t,n,r,i,c,l,u);case`doublecircle`:return Hr(t,n,r,i,c,l,u);case`hexagon`:return Ur(t,n,r,i,c,l,u);case`cylinder`:return Wr(t,n,r,i,c,l,u);case`asymmetric`:return Gr(t,n,r,i,c,l,u);case`trapezoid`:return Kr(t,n,r,i,c,l,u);case`trapezoid-alt`:return qr(t,n,r,i,c,l,u);case`parallelogram`:return Jr(t,n,r,i,c,l,u);case`parallelogram-alt`:return Yr(t,n,r,i,c,l,u);case`state-start`:return mi(t,n,r,i);case`state-end`:return hi(t,n,r,i);case`document`:return Xr(t,n,r,i,c,l,u);case`stacked-document`:return Zr(t,n,r,i,c,l,u,!0);case`stacked-process`:return Zr(t,n,r,i,c,l,u,!1);case`card`:return Qr(t,n,r,i,c,l,u);case`lined-process`:return $r(t,n,r,i,c,l,u);case`divided-process`:return ei(t,n,r,i,c,l,u);case`window-pane`:return ti(t,n,r,i,c,l,u);case`triangle`:return ni(t,n,r,i,c,l,u,!1);case`flipped-triangle`:return ni(t,n,r,i,c,l,u,!0);case`filled-circle`:return ri(t,n,r,i,l);case`crossed-circle`:return ii(t,n,r,i,c,l,u);case`fork-join`:return ai(t,n,r,i,l);case`note`:return oi(t,n,r,i,s(o?.fill??`var(--bg)`),l,u);case`notched-pentagon`:return si(t,n,r,i,c,l,u);case`sloped-rectangle`:return ci(t,n,r,i,c,l,u);case`flag`:return li(t,n,r,i,c,l,u);case`bow-tie-rectangle`:return ui(t,n,r,i,c,l,u);case`half-rounded-rectangle`:return di(t,n,r,i,c,l,u);case`brace`:return fi(t,n,r,i,c,l,u,`left`);case`brace-right`:return fi(t,n,r,i,c,l,u,`right`);case`braces`:return fi(t,n,r,i,c,l,u,`both`);case`bolt`:return pi(t,n,r,i,c,l,u);case`text`:case`anchor`:return``;default:return Ir(t,n,r,i,c,l,u)}}function Ir(e,t,n,r,i,a,o){return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+u`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Lr(e,t,n,r,i,a,o){return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+u`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Rr(e,t,n,r,i,a,o){let s=r/2;return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+u`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function zr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2;return u`<circle cx="${s}" cy="${c}" r="${l}" `+u`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Br(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=n/2,d=r/2,f=[u`${s},${c-d}`,u`${s+l},${c}`,u`${s},${c+d}`,u`${s-l},${c}`].join(` `);return u`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Vr(e,t,n,r,i,a,o){return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+u`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+u`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+u`stroke="${a}" stroke-width="${o}" />`+u`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+u`stroke="${a}" stroke-width="${o}" />`}function Hr(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2,d=l-5;return u`<circle cx="${s}" cy="${c}" r="${l}" `+u`fill="${i}" stroke="${a}" stroke-width="${o}" />`+u`\n<circle cx="${s}" cy="${c}" r="${d}" `+u`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ur(e,t,n,r,i,a,o){let s=r/4,c=[u`${e+s},${t}`,u`${e+n-s},${t}`,u`${e+n},${t+r/2}`,u`${e+n-s},${t+r}`,u`${e+s},${t+r}`,u`${e},${t+r/2}`].join(` `);return u`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Wr(e,t,n,r,i,a,o){let s=e+n/2,c=t+7,l=r-14;return u`<rect x="${e}" y="${c}" width="${n}" height="${l}" `+u`fill="${i}" stroke="none" />`+u`\n<line x1="${e}" y1="${c}" x2="${e}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+u`\n<line x1="${e+n}" y1="${c}" x2="${e+n}" y2="${c+l}" stroke="${a}" stroke-width="${o}" />`+u`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+u`fill="${i}" stroke="${a}" stroke-width="${o}" />`+u`\n<ellipse cx="${s}" cy="${c}" rx="${n/2}" ry="${7}" `+u`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Gr(e,t,n,r,i,a,o){let s=[u`${e+12},${t}`,u`${e+n},${t}`,u`${e+n},${t+r}`,u`${e+12},${t+r}`,u`${e},${t+r/2}`].join(` `);return u`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Kr(e,t,n,r,i,a,o){let s=n*.15,c=[u`${e+s},${t}`,u`${e+n-s},${t}`,u`${e+n},${t+r}`,u`${e},${t+r}`].join(` `);return u`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function qr(e,t,n,r,i,a,o){let s=n*.15,c=[u`${e},${t}`,u`${e+n},${t}`,u`${e+n-s},${t+r}`,u`${e+s},${t+r}`].join(` `);return u`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Jr(e,t,n,r,i,a,o){let s=n*.15,c=[u`${e+s},${t}`,u`${e+n},${t}`,u`${e+n-s},${t+r}`,u`${e},${t+r}`].join(` `);return u`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Yr(e,t,n,r,i,a,o){let s=n*.15,c=[u`${e},${t}`,u`${e+n-s},${t}`,u`${e+n},${t+r}`,u`${e+s},${t+r}`].join(` `);return u`<polygon points="${c}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function U(e,t,n){return u`fill="${e}" stroke="${t}" stroke-width="${n}"`}function Xr(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),c=t+r-s,l=u`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${c} `+u`C ${e+n*.75} ${c+s*1.8} ${e+n*.25} ${c-s*.8} ${e} ${c} Z`;return u`<path d="${l}" ${U(i,a,o)} />`}function Zr(e,t,n,r,i,a,o,s){let c=n-10,l=r-10,d=[];for(let n=2;n>=1;n--)d.push(u`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${c}" height="${l}" `+u`${U(i,a,o)} />`);return d.push(s?Xr(e,t+10,c,l,i,a,o):u`<rect x="${e}" y="${t+10}" width="${c}" height="${l}" ${U(i,a,o)} />`),d.join(`
|
|
18
|
+
`)}function Qr(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[u`${e+s},${t}`,u`${e+n},${t}`,u`${e+n},${t+r}`,u`${e},${t+r}`,u`${e},${t+s}`].join(` `);return u`<polygon points="${c}" ${U(i,a,o)} />`}function $r(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+u`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function ei(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+u`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function ti(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),c=t+Math.min(14,r*.28);return u`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${U(i,a,o)} />\n`+u`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+u`<line x1="${e}" y1="${c}" x2="${e+n}" y2="${c}" stroke="${a}" stroke-width="${o}" />`}function ni(e,t,n,r,i,a,o,s){let c=s?[u`${e},${t}`,u`${e+n},${t}`,u`${e+n/2},${t+r}`]:[u`${e+n/2},${t}`,u`${e+n},${t+r}`,u`${e},${t+r}`];return u`<polygon points="${c.join(` `)}" ${U(i,a,o)} />`}function ri(e,t,n,r,i){let a=Math.min(n,r)/2-2;return u`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function ii(e,t,n,r,i,a,o){let s=e+n/2,c=t+r/2,l=Math.min(n,r)/2-2,d=l/Math.SQRT2;return u`<circle cx="${s}" cy="${c}" r="${l}" ${U(i,a,o)} />\n`+u`<line x1="${s-d}" y1="${c-d}" x2="${s+d}" y2="${c+d}" stroke="${a}" stroke-width="${o}" />\n`+u`<line x1="${s+d}" y1="${c-d}" x2="${s-d}" y2="${c+d}" stroke="${a}" stroke-width="${o}" />`}function ai(e,t,n,r,i){let a=Math.min(8,r);return u`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function oi(e,t,n,r,i,a,o){let s=[u`${e},${t}`,u`${e+n-6},${t}`,u`${e+n},${t+6}`,u`${e+n},${t+r}`,u`${e},${t+r}`].join(` `);return u`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />\n`+u`<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 si(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),c=[u`${e+s},${t}`,u`${e+n-s},${t}`,u`${e+n},${t+s}`,u`${e+n},${t+r}`,u`${e},${t+r}`,u`${e},${t+s}`].join(` `);return u`<polygon points="${c}" ${U(i,a,o)} />`}function ci(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),c=[u`${e},${t+s}`,u`${e+n},${t}`,u`${e+n},${t+r}`,u`${e},${t+r}`].join(` `);return u`<polygon points="${c}" ${U(i,a,o)} />`}function li(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),c=u`M ${e} ${t+s} `+u`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+u`L ${e+n} ${t+r-s} `+u`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return u`<path d="${c}" ${U(i,a,o)} />`}function ui(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),c=u`M ${e+s} ${t} L ${e+n} ${t} `+u`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+u`L ${e+s} ${t+r} `+u`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return u`<path d="${c}" ${U(i,a,o)} />`}function di(e,t,n,r,i,a,o){let s=r/2,c=Math.max(0,n-s),l=u`M ${e} ${t} L ${e+c} ${t} `+u`A ${s} ${s} 0 0 1 ${e+c} ${t+r} `+u`L ${e} ${t+r} Z`;return u`<path d="${l}" ${U(i,a,o)} />`}function fi(e,t,n,r,i,a,o,s){let c=Math.min(10,n*.12),l=[u`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],d=u`M ${e+c} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+u`Q ${e} ${t+r/2} ${e-c*.4} ${t+r/2} `+u`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+u`Q ${e} ${t+r} ${e+c} ${t+r}`,f=u`M ${e+n-c} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+u`Q ${e+n} ${t+r/2} ${e+n+c*.4} ${t+r/2} `+u`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+u`Q ${e+n} ${t+r} ${e+n-c} ${t+r}`;return(s===`left`||s===`both`)&&l.push(u`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&l.push(u`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`),l.join(`
|
|
19
|
+
`)}function pi(e,t,n,r,i,a,o){let s=[u`${e+n*.42},${t}`,u`${e+n},${t}`,u`${e+n*.62},${t+r*.42}`,u`${e+n},${t+r*.42}`,u`${e+n*.3},${t+r}`,u`${e+n*.5},${t+r*.55}`,u`${e},${t+r*.55}`].join(` `);return u`<polygon points="${s}" ${U(i,a,o)} />`}function mi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return u`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function hi(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return u`<circle cx="${i}" cy="${a}" r="${o}" `+u`fill="none" stroke="var(--_text)" stroke-width="${L.innerBox*2}" />`+u`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function gi(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=s(e.inlineStyle?.color??m(e.inlineStyle?.fill,`var(--_text)`)),o=u`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${I.nodeLabel}" fill="${a}"`,c=e.inlineStyle?.[`font-family`];return c&&(o+=u` style="font-family: ${s(c)};"`),S(e.label,r,i,n.nodeLabel,o)}function _i(e){return s(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function vi(e,t){return t===void 0?e:e.replace(`<svg `,u`<svg data-src="${_i(t)}" `)}var yi=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=Ei(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 bi(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 xi(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 Si=`(?<![\\w-])(var|color-mix)\\(`;function Ci(e,t){let[n,...r]=xi(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function wi(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 Ti(e){let t=xi(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=wi(r),o=wi(i);if(!a||!o)return null;let s=x(a.color),c=x(o.color);if(!s||!c)return null;let l=v(s,c,a.pct,o.pct);return l?p(l):null}function Ei(e,t){let n=``,r=0,i=new RegExp(Si,`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=bi(e,c);if(l===-1)break;let u=Ei(e.slice(c+1,l),t),d=o===`var`?Ci(u,t):Ti(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function Di(e,t){let n=new yi;for(let[e,r]of Object.entries(t))n.declare(e,r);return Ei(e,n)}var Oi=/(--[\w-]+)\s*:\s*([^;{}]+)/g,ki=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,Ai=new Set([`data-src`]);function ji(e,t){Oi.lastIndex=0;let n;for(;(n=Oi.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Mi(e,t){return e.replace(ki,(e,n,r,i,a)=>{if(Ai.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${Ei(a.slice(1,-1),t)}${o}`})}function Ni(e,t){let n=new yi;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+=Ei(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:Mi(s,n),i=a+1}return r+e.slice(i)}var Pi=[.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],Fi=[.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 Ii(e){return e>=4352?1:.6}function Li(e,t){let n=t?Fi:Pi,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:Ii(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 Ri(e){return`note ${e}`}function zi(e){return`${e} link`}function Bi(e){return`namespace ${e}`}function Vi(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:Bi(i),name:a.name,classIds:e})}return r}function Hi(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 Ui(e){return f(e.relationships.map(e=>({source:e.from,target:e.to})),e.classes.map(e=>e.id))}function Wi(e,t,n){let r=new Map,i=new Map,a=Ue(t.fontSizes);for(let t of e.classes){if(n.has(t.id)){r.set(t.id,{width:F(t.label,a.nodeLabel,I.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=F(t.label,a.nodeLabel,I.nodeLabel),c=Xi(t.attributes),l=Xi(t.methods),u=Math.max(Yi(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=Vi(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=F(e.name,W.namespaceTitleFontSize,I.groupHeader)+W.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":Ye({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=Ze(e,t),r=c.get(s.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:a.edgeLabel},d=Ui(e),f=[];for(let[t,n]of e.relationships.entries()){let e=d.has(t);f.push(et({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=Ri(t),r=g(n.text,a.edgeLabel,I.edgeLabel),o={width:r.width+W.notePadX*2,height:r.height+W.notePadY*2};i.set(e,o),l.push(Ze(e,o)),n.forClass!==void 0&&p.has(n.forClass)&&f.push(et({id:zi(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...Xe({direction:Je(e.direction,qe.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 Gi(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:w(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=Ui(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=Rt(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=Ri(e),i=h.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=v.get(zi(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:Rt(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 Ki(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let n=Hi(e),{elkGraph:r,classSizes:i,noteSizes:a,namespaces:o}=Wi(n.diagram,t,n.labels);return Gi(Ie(r,t.layoutCache),e,i,a,o,n)}function qi(e){return e.length*Math.ceil(ze(`M`,W.memberFontSize))}function Ji(e){let t=e.isMethod?`${e.name}(${e.params||``})`:e.name;return`${e.visibility||``}${e.visibilitySpace?` `:``}${t}${e.isMethod&&e.type?` : ${e.type}`:``}`}function Yi(e){let t=Li(e.label,!0),n=e.annotation?Li(`\u00ab${e.annotation}\u00bb`,!1):0,r=Math.max(0,...[...e.attributes,...e.methods].map(e=>Li(Ji(e),!1))),i=Math.max(t,n);return i/2+Math.max(i/2,r)+W.mermaidPad*2}function Xi(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=qi(se(n));e>t&&(t=e)}return t}var Zi={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Qi(e,t,n=`Inter`,r=!1,i=He,a,o,s,c=!0,l={}){let u=[],d=c&&e.classes.some(e=>!!T(e.interaction?.href));u.push(vi(j(e.width,e.height,t,r,o,s,d,l.styleAttribute,l.description),a)),u.push(Ke(n,!0,l.nonce)),u.push(`<defs>`),u.push(ea(e.relationships.some(e=>e.type===`lollipop`))),u.push(`</defs>`);for(let t of e.namespaces)u.push($i(t));for(let t of e.relationships)u.push(sa(t));for(let t of e.notes)u.push(oa(t));for(let t of e.classes)u.push(ta(t,i,c));for(let t of e.relationships){let e=ca(t,i);e&&u.push(e)}for(let t of e.notes)u.push(aa(t,i));for(let t of e.relationships)u.push(da(t,i));return u.push(`</svg>`),u.join(`
|
|
20
|
+
`)}function $i(e){let{x:t,y:n,width:r,height:i}=e,a=W.namespaceTitleHeight,o=L.outerBox;return[u`<g class="class-namespace" data-id="${s(e.name)}" data-label="${s(e.name)}">`,u` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,u` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,u` <text x="${t+W.namespacePad}" y="${n+a/2}" dy="${R}" font-size="${W.namespaceTitleFontSize}" font-weight="${I.groupHeader}" fill="var(--_text-sec)">${ma(e.name)}</text>`,`</g>`].join(`
|
|
21
|
+
`)}function ea(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,41 +32,42 @@ 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
|
|
36
|
-
`)}var
|
|
37
|
-
</g>`}function
|
|
38
|
-
</g>`}function
|
|
39
|
-
`)}function
|
|
40
|
-
`)}function
|
|
41
|
-
`))}return f.length===0&&h.push(u` <text x="${r+a/2}" y="${w+l/2}" text-anchor="middle" dy="${
|
|
42
|
-
`)}function
|
|
43
|
-
`);a.push(u`<g><title>${
|
|
44
|
-
`)}function
|
|
45
|
-
`)}function
|
|
46
|
-
`)}function
|
|
47
|
-
`)}function
|
|
35
|
+
</marker>`:``)}function ta(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:c,attrHeight:l,inlineStyle:d}=e,f=[],p=e.interaction,h=s(d?.fill??`var(--_node-fill)`),g=s(d?.stroke??`var(--_node-stroke)`),_=s(d?.[`stroke-width`]??String(L.outerBox)),v=d?.fill?h:`var(--_group-hdr)`,y=d?.color?s(d.color):d?.fill?s(m(d.fill,`var(--_text)`)):void 0,b=e.annotation?u` data-annotation="${s(e.annotation)}"`:``,x=E(e.className),C=[u`class="${x?u`class-node ${x}`:`class-node`}"`,u`data-id="${s(e.id)}"`,u`data-label="${s(e.label)}"`];f.push(u`<g ${C.join(` `)}${b}>`);let w=n?T(p?.href):void 0;if(w){let e=p?.target?u` target="${s(p.target)}"`:``;f.push(u` <a href="${s(w)}"${e}>`)}n&&p?.tooltip&&f.push(u` <title>${ma(p.tooltip)}</title>`),f.push(u` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+u`rx="0" ry="0" fill="${h}" stroke="${g}" stroke-width="${_}" />`),f.push(u` <rect x="${r}" y="${i}" width="${a}" height="${c}" `+u`rx="0" ry="0" fill="${v}" stroke="${g}" stroke-width="${_}" />`);let D=i+c/2;if(e.annotation){let t=i+12;f.push(u` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${R}" `+u`font-size="${Zi.annotationSize}" font-weight="${Zi.annotationWeight}" `+u`font-style="italic" fill="${y??`var(--_text-muted)`}"><<${ma(e.annotation)}>></text>`),D=i+c/2+6}f.push(` `+S(e.label,r+a/2,D,t.nodeLabel,u`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${y??`var(--_text)`}"`));let O=i+c;f.push(u` <line x1="${r}" y1="${O}" x2="${r+a}" y2="${O}" `+u`stroke="${g}" stroke-width="${L.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=O+4+t*20+10;f.push(` `+ra(n,r+W.boxPadX,i,y))}let k=O+l;f.push(u` <line x1="${r}" y1="${k}" x2="${r+a}" y2="${k}" `+u`stroke="${g}" stroke-width="${L.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=k+4+t*20+10;f.push(` `+ra(n,r+W.boxPadX,i,y))}return w&&f.push(` </a>`),f.push(`</g>`),f.join(`
|
|
36
|
+
`)}var na=700;function ra(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(u`<tspan fill="${s}" font-weight="${na}">${ma(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let d=e.isMethod?u`${e.name}(${e.params||``})`:e.name;return l.push(u`<tspan fill="${s}">${ma(d)}</tspan>`),e.type&&(l.push(u`<tspan fill="${o}">: </tspan>`),l.push(u`<tspan fill="${c}">${ma(e.type)}</tspan>`)),u`<text x="${t}" y="${n}" class="mono" dy="${R}" `+u`font-size="${Zi.memberSize}" font-weight="${Zi.memberWeight}"${i}${a}>`+u`${l.join(``)}</text>`}var ia=6;function aa(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:u` data-for="${s(e.forClass)}"`,c=[u`${n},${r}`,u`${n+i-ia},${r}`,u`${n+i},${r+ia}`,u`${n+i},${r+a}`,u`${n},${r+a}`].join(` `),l=u`${n+i-ia},${r} ${n+i},${r+ia} `+u`${n+i-ia},${r+ia}`;return u`<g class="class-note"${o}>`+u`\n <polygon points="${c}" `+u`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`+u`\n <polygon points="${l}" `+u`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`+u`\n ${S(e.text,n+i/2,r+a/2,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
37
|
+
</g>`}function oa(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>u`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:u` data-for="${s(e.forClass)}"`;return u`<polyline class="class-note-link"${n} points="${t}" `+u`fill="none" stroke="var(--_line)" stroke-width="${L.connector}" stroke-dasharray="2 3" />`}function sa(e){if(e.points.length<2)return``;let t=e.points.map(e=>u`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=la(e.type,e.markerAt),i=[`class="class-relationship"`,u`data-from="${s(e.from)}"`,u`data-to="${s(e.to)}"`,u`data-type="${e.type}"`,u`data-marker-at="${e.markerAt}"`];return e.label&&i.push(u`data-label="${s(e.label)}"`),e.fromCardinality&&i.push(u`data-from-cardinality="${s(e.fromCardinality)}"`),e.toCardinality&&i.push(u`data-to-cardinality="${s(e.toCardinality)}"`),u`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+u`stroke-width="${L.connector}"${n}${r} />`}function ca(e,t){let n=e.interfaceLabel;if(!n)return``;let r=e.markerAt===`from`?e.from:e.to;return u`<g class="class-interface" data-id="${s(r)}" data-label="${s(n.text)}">\n `+S(n.text,n.x+n.width/2,n.y+n.height/2,t.nodeLabel,u`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="${I.edgeLabel}" fill="var(--_text)"`)+`
|
|
38
|
+
</g>`}function la(e,t){let n=ua(e);return n?(t===`to`?``:u` marker-start="url(#${n})"`)+(t===`from`?``:u` marker-end="url(#${n})"`):``}function ua(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 da(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=e.labelPosition??fa(e.points);n.push(S(e.label,r.x,r.y-8,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=pa(r,i);n.push(S(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.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=pa(r,i);n.push(S(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
|
|
39
|
+
`)}function fa(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function pa(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=c,G={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function ha(e){return e.length*Math.ceil(ze(`M`,G.attrFontSize))}function ga(e,t){let n=new Map,r=Ue(t.fontSizes);for(let t of e.entities){let e=F(t.label,r.nodeLabel,I.nodeLabel),i=0;for(let e of t.attributes){let t=ha(`${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(Ze(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(et({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...Xe({direction:Je(e.direction,qe.er),nodeSpacing:G.nodeSpacing,layerSpacing:G.layerSpacing,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 _a(e,t,n){let r=new Map;for(let e of t.entities)r.set(e.id,e);let i=[];for(let a of e.children??[]){let e=r.get(a.id);if(e){let r=n.get(e.id);if(!r)throw Error(`Missing computed size for entity "${e.id}"`);i.push({id:e.id,label:e.label,attributes:e.attributes,x:a.x??0,y:a.y??0,width:a.width??r.width,height:a.height??r.height,headerHeight:G.headerHeight,rowHeight:G.rowHeight,inlineStyle:w(e.id,t),className:t.classAssignments.get(e.id)})}}let a=[];for(let[n,r]of(e.edges??[]).entries()){let e=t.relationships[n],i=Rt(r);a.push({entity1:e.entity1,entity2:e.entity2,cardinality1:e.cardinality1,cardinality2:e.cardinality2,label:e.label,identifying:e.identifying,points:i})}return{width:e.width??600,height:e.height??400,entities:i,relationships:a}}function va(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=ga(e,t);return _a(Ie(n,t.layoutCache),e,r)}var ya=70,ba={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function xa(e,t,n=`Inter`,r=!1,i=He,a,o,s,c={}){let l=[];l.push(vi(j(e.width,e.height,t,r,o,s,void 0,c.styleAttribute,c.description),a)),l.push(Ke(n,!0,c.nonce)),l.push(`<defs>`),l.push(`</defs>`);for(let t of e.relationships)l.push(wa(t));for(let t of e.entities)l.push(Sa(t,i));for(let t of e.relationships)l.push(Ea(t));for(let t of e.relationships)l.push(Ta(t,i));return l.push(`</svg>`),l.join(`
|
|
40
|
+
`)}function Sa(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:c,rowHeight:l,label:d,attributes:f,inlineStyle:p}=e,h=[],g=s(p?.fill??`var(--_node-fill)`),_=s(p?.stroke??`var(--_node-stroke)`),v=s(p?.[`stroke-width`]??String(L.outerBox)),y=s(p?.[`stroke-width`]??String(L.innerBox)),b=p?.fill?g:`var(--_group-hdr)`,x=p?.color?s(p.color):p?.fill?s(m(p.fill,`var(--_text)`)):void 0,C=E(e.className);h.push(u`<g class="${C?u`entity ${C}`:`entity`}" data-id="${s(n)}" data-label="${s(d)}">`),h.push(u` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+u`rx="0" ry="0" fill="${g}" stroke="${_}" stroke-width="${v}" />`),h.push(u` <rect x="${r}" y="${i}" width="${a}" height="${c}" `+u`rx="0" ry="0" fill="${b}" stroke="${_}" stroke-width="${v}" />`),h.push(` `+S(d,r+a/2,i+c/2,t.nodeLabel,u`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${x??`var(--_text)`}"`));let w=i+c;h.push(u` <line x1="${r}" y1="${w}" x2="${r+a}" y2="${w}" `+u`stroke="${_}" stroke-width="${y}" />`);for(let e=0;e<f.length;e++){let t=f[e],n=w+e*l+l/2;h.push(` `+Ca(t,r,n,a,x).replace(/\n/g,`
|
|
41
|
+
`))}return f.length===0&&h.push(u` <text x="${r+a/2}" y="${w+l/2}" text-anchor="middle" dy="${R}" `+u`font-size="${ba.attrSize}" fill="${x??`var(--_text-muted)`}" font-style="italic">(no attributes)</text>`),h.push(`</g>`),h.join(`
|
|
42
|
+
`)}function Ca(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(u`<g><title>${ka(t)}</title>`)}let s=0;e.keys.length>0&&(s=F(e.keys.join(`,`),ba.keySize,ba.keyWeight)+8,a.push(u`<rect x="${t+6}" y="${n-7}" width="${s}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),a.push(u`<text x="${t+6+s/2}" y="${n}" text-anchor="middle" dy="${R}" `+u`font-size="${ba.keySize}" font-weight="${ba.keyWeight}" fill="${i??`var(--_text-sec)`}">${e.keys.join(`,`)}</text>`));let c=t+8+(s>0?s+6:0);a.push(u`<text x="${c}" y="${n}" class="mono" dy="${R}" `+u`font-size="${ba.attrSize}" font-weight="${ba.attrWeight}">`+u`<tspan fill="${i??`var(--_text-muted)`}">${ka(e.type)}</tspan></text>`);let l=t+r-8;return a.push(u`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${R}" `+u`font-size="${ba.attrSize}" font-weight="${ba.attrWeight}">`+u`<tspan fill="${i??`var(--_text-sec)`}">${ka(e.name)}</tspan></text>`),o&&a.push(`</g>`),a.join(`
|
|
44
|
+
`)}function wa(e){if(e.points.length<2)return``;let t=e.points.map(e=>u`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?u` data-label="${s(e.label)}"`:``,i=[`class="er-relationship"`,u`data-entity1="${s(e.entity1)}"`,u`data-entity2="${s(e.entity2)}"`,u`data-cardinality1="${e.cardinality1}"`,u`data-cardinality2="${e.cardinality2}"`,u`data-identifying="${e.identifying}"`];return u`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+u`stroke-width="${L.connector}"${n} />`}function Ta(e,t){if(!e.label||e.points.length<2)return``;let n=Oa(e.points),r=g(e.label,t.edgeLabel,I.edgeLabel),i=r.width+8,a=r.height+6;return u`<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" />`+u`\n${S(e.label,n.x,n.y,t.edgeLabel,u`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${I.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${ya}%, var(--bg))"`)}`}function Ea(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(Da(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(Da(i,a,e.cardinality2)),t.join(`
|
|
45
|
+
`)}function Da(e,t,n){let r=[],i=L.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,d=-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(u`<line x1="${p+d*6}" y1="${m+f*6}" `+u`x2="${p-d*6}" y2="${m-f*6}" `+u`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-c*4,t=m-l*4;r.push(u`<line x1="${e+d*6}" y1="${t+f*6}" `+u`x2="${e-d*6}" y2="${t-f*6}" `+u`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(u`<line x1="${e+d*7}" y1="${t+f*7}" `+u`x2="${h}" y2="${g}" `+u`stroke="var(--_line)" stroke-width="${i}" />`),r.push(u`<line x1="${e}" y1="${t}" `+u`x2="${h}" y2="${g}" `+u`stroke="var(--_line)" stroke-width="${i}" />`),r.push(u`<line x1="${e-d*7}" y1="${t-f*7}" `+u`x2="${h}" y2="${g}" `+u`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-c*20,n=e.y-l*20;r.push(u`<line x1="${t+d*6}" y1="${n+f*6}" `+u`x2="${t-d*6}" y2="${n-f*6}" `+u`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(u`<circle cx="${n}" cy="${a}" r="4" `+u`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
|
|
46
|
+
`)}function Oa(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 ka=c,Aa={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 ja(e){return e+8}var Ma=14,Na=new Set([`boundary`,`control`,`entity`,`database`]);function Pa(e){return e.type===`actor`||Na.has(e.participantType)}var Fa=4;function Ia(e,t,n){return 14+g(e,t,n).height/2}function La(e){return{...Aa,actorHeight:e?.actorHeight??Aa.actorHeight,headerGap:e?.headerGap??Aa.headerGap,messageRowHeight:e?.messageRowHeight??Aa.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??Aa.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??Aa.noteStackGap}}function Ra(e,t={}){if(e.actors.length===0)return{width:0,height:0,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[]};let n=La(t.sequence),r=Ue(t.fontSizes),i=e.actors.map(e=>{let t=F(e.label,r.nodeLabel,I.nodeLabel);return Math.max(t+n.actorPadX*2,80)}),a=[],o=n.padding+i[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=Math.max(n.actorGap,(i[t-1]+i[t])/2+40);o+=e}a.push(o)}let s=new Map;for(let t=0;t<e.actors.length;t++)s.set(e.actors[t].id,t);let c=e.boxes.filter(e=>e.actorIds.length>0),l=c.some(e=>e.label!==``),u=c.length===0?0:n.boxPad+(l?ja(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,...e.participantType!==void 0&&{participantType:e.participantType},x:a[t],y:d,width:i[t],height:n.actorHeight})),p=c.map(e=>{let t=e.actorIds.map(e=>s.get(e)??0),r=Math.min(...t),o=Math.max(...t),c=a[r]-i[r]/2-n.boxPad,l=a[o]+i[o]/2+n.boxPad,u={label:e.label,x:c,y:n.padding,width:l-c,height:0};return e.color!==void 0&&(u.color=e.color),u}),m=e.actors.map(e=>Pa(e)?Ia(e.label,r.nodeLabel,I.nodeLabel):0),h=Math.max(0,...e.actors.map((e,t)=>e.createdAt===void 0?m[t]:0)),g=r.edgeLabel+12,_=d+n.actorHeight+Math.max(n.headerGap,h>0?h+Fa+g:0),v=[],y=new Map;for(let t of e.blocks){let e=y.get(t.startIndex)??0;y.set(t.startIndex,Math.max(e,n.blockHeaderExtra));for(let e of t.dividers){let t=y.get(e.index)??0;y.set(e.index,Math.max(t,n.dividerExtra))}}let b=new Map;for(let t of e.notes){let e=b.get(t.afterIndex)??[];e.push(t),b.set(t.afterIndex,e)}let x=[],S=b.get(-1);if(S&&S.length>0){let e=_;for(let t of S){let o=Math.max(n.noteWidth,F(t.text,r.edgeLabel,I.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(t.actorIds[0]??``)??0,u;if(t.position===`left`)u=a[l]-i[l]/2-o-n.noteGap;else if(t.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(t.actorIds.length>1){let e=s.get(t.actorIds[t.actorIds.length-1]??``)??l;u=(a[l]+a[e])/2-o/2}else u=a[l]-o/2;x.push({text:t.text,x:u,y:e,width:o,height:c,position:t.position,actors:t.actorIds}),e+=c+n.noteStackGap}_=Math.max(_,e+n.messageRowHeight/2)}let C=new Map,w=[],T=n.activationWidth/2;function E(e,t){let n=C.get(e)??[];C.set(e,n);let r=n.length;n.push({startY:t,depth:r})}function D(e,t){let r=C.get(e);if(!r||r.length===0)return;let{startY:i,depth:o}=r.pop(),c=s.get(e)??0,l=o*T;w.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:o})}let O=new Map;for(let t of e.activations){let e=O.get(t.afterIndex)??[];e.push(t),O.set(t.afterIndex,e)}function k(e,t){for(let n of O.get(e)??[])n.kind===`start`?E(n.actorId,t):D(n.actorId,t)}k(-1,_);for(let t=0;t<e.messages.length;t++){let o=e.messages[t],c=s.get(o.from)??0,l=s.get(o.to)??0,u=o.from===o.to,d=y.get(t)??0;d>0&&(_+=d);let f=a[c],p=a[l],m=!u&&e.actors[l].createdAt===t;if(m){let e=i[l]/2;p+=f<p?-e:e}v.push({from:o.from,to:o.to,label:o.label,lineStyle:o.lineStyle,arrowHead:o.arrowHead,x1:f,x2:p,y:_,isSelf:u,bidirectional:o.bidirectional??!1,seqNumber:o.seqNumber}),o.activate&&E(o.to,_),o.deactivate&&D(o.from,_),k(t,_),_+=u?n.selfMessageHeight+n.messageRowHeight:n.messageRowHeight,m&&(_+=n.actorHeight/2);let h=b.get(t);if(h&&h.length>0){let e=u?n.selfMessageHeight:0,o=v[t].y+e+n.noteOffsetAfterMessage;for(let e of h){let t=Math.max(n.noteWidth,F(e.text,r.edgeLabel,I.edgeLabel)+n.notePadX*2),c=r.edgeLabel+n.notePadY*2,l=s.get(e.actorIds[0]??``)??0,u;if(e.position===`left`)u=a[l]-i[l]/2-t-n.noteGap;else if(e.position===`right`)u=a[l]+i[l]/2+n.noteGap;else if(e.actorIds.length>1){let n=s.get(e.actorIds[e.actorIds.length-1]??``)??l;u=(a[l]+a[n])/2-t/2}else u=a[l]-t/2;x.push({text:e.text,x:u,y:o,width:t,height:c,position:e.position,actors:e.actorIds}),o+=c+n.noteStackGap}_=Math.max(_,o+n.messageRowHeight/2)}}for(let[e,t]of C)for(let{startY:r,depth:i}of t){let t=s.get(e)??0,o=i*T;w.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:_-n.messageRowHeight/2,width:n.activationWidth,depth:i})}w.sort((e,t)=>e.depth-t.depth);let ee=e.blocks.map(t=>{let o=v[t.startIndex],c=v[t.endIndex],l=(o?.y??_)-n.blockPadTop,u=(c?.y??_)+n.blockPadBottom+12,d=new Set;for(let n=t.startIndex;n<=t.endIndex;n++){let t=e.messages[n];t&&(d.add(s.get(t.from)??0),d.add(s.get(t.to)??0))}if(d.size===0)for(let t=0;t<e.actors.length;t++)d.add(t);let f=Math.min(...d),p=Math.max(...d),m=a[f]-i[f]/2-n.blockPadX,h=a[p]+i[p]/2+n.blockPadX,g=t.dividers.map(e=>{let t=v[e.index],n=t?.y??_,i=28;if(e.label&&t?.label){let n=F(`[${e.label}]`,r.edgeLabel,I.edgeLabel),a=m+8,o=a+n,s=F(t.label,r.edgeLabel,I.edgeLabel),c=t.isSelf?t.x1+36:(t.x1+t.x2)/2-s/2,l=c+s;o>c&&a<l&&(i=36)}return{y:n-i,label:e.label}});return{type:t.type,label:t.label,...t.color===void 0?{}:{color:t.color},x:m,y:l,width:h-m,height:u-l,dividers:g}}),te=x,A=_+n.padding,j=n.padding,M=0;for(let e of f)j=Math.min(j,e.x-e.width/2),M=Math.max(M,e.x+e.width/2);for(let e of ee)j=Math.min(j,e.x),M=Math.max(M,e.x+e.width);for(let e of te)j=Math.min(j,e.x),M=Math.max(M,e.x+e.width);for(let e of p)j=Math.min(j,e.x),M=Math.max(M,e.x+e.width);for(let e of v)if(e.isSelf&&e.label){let t=e.x1+30+8,n=F(e.label,r.edgeLabel,I.edgeLabel);M=Math.max(M,t+n+8)}let N=j<n.padding?n.padding-j:0;if(N>0){for(let e of f)e.x+=N;for(let e of v)e.x1+=N,e.x2+=N;for(let e of w)e.x+=N;for(let e of ee)e.x+=N;for(let e of te)e.x+=N;for(let e of p)e.x+=N;for(let e=0;e<a.length;e++)a[e]+=N}for(let t=0;t<e.actors.length;t++){let r=e.actors[t].createdAt;r!==void 0&&(f[t].y=(v[r]?.y??_)-n.actorHeight/2)}let ne=e.actors.map((e,t)=>{let r=e.destroyedAt,i={actorId:e.id,x:a[t],topY:f[t].y+n.actorHeight+(m[t]>0?m[t]+Fa:0),bottomY:r===void 0?A-n.padding:v[r]?.y??_};return r!==void 0&&(i.destroyed=!0),i});for(let e of p)e.height=A-n.padding+n.boxPad-e.y;let P=M+N+n.padding;return{width:Math.max(P,200),height:Math.max(A,100),actors:f,lifelines:ne,messages:v,activations:w,blocks:ee,notes:te,boxes:p}}function za(e,t,r=`Inter`,i=!1,a=He,o,s,c,l={}){let u=[];u.push(vi(j(e.width,e.height,t,i,s,c,void 0,l.styleAttribute,l.description),o)),u.push(n(r,!1,l.nonce)),u.push(`<defs>`),u.push(Ba()),u.push(`</defs>`);for(let t of e.boxes)u.push(ao(t,a));for(let t of e.blocks)u.push(so(t,a));let d=Za(e,a);for(let t of e.lifelines)u.push($a(t,d));for(let t of e.activations)u.push(to(t));for(let t of e.messages)u.push(no(t,a));for(let t of e.notes)u.push(co(t,a));for(let t of e.actors)u.push(Ha(t,a));return u.push(`</svg>`),u.join(`
|
|
47
|
+
`)}function Ba(){let e=z.width,t=z.height;return u` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+u`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
|
|
48
48
|
</marker>`+u`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+u`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
|
|
49
|
-
</marker>`}var
|
|
50
|
-
</g>`),f.push(` `+S(c,r,i+o+14,t.nodeLabel,p))}else if(
|
|
51
|
-
`)}var
|
|
52
|
-
`)[0]??``,t.edgeLabel,
|
|
53
|
-
`);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=
|
|
54
|
-
`)}function
|
|
55
|
-
`)}function so(e,t){let n=[]
|
|
56
|
-
`)
|
|
57
|
-
`)
|
|
58
|
-
</g>`}var G={plotWidth:600,plotHeight:340,padding:22,titleFontSize:18,titleFontWeight:600,titleHeight:42,axisLabelFontSize:14,axisLabelFontWeight:400,axisTitleFontSize:15,axisTitleFontWeight:500,xLabelHeight:38,yLabelWidth:58,yLabelGap:18,axisTitlePad:30,tickLength:4,barPadRatio:.2,barGroupGap:0,maxBarWidth:40,legendFontSize:14,legendFontWeight:400,legendHeight:28,legendSwatchW:14,legendSwatchH:14,legendGap:6,legendItemGap:16};function lo(e,t={}){return e.horizontal?fo(e):uo(e)}function uo(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=b(a.min,a.max),s=bo(o),c=Math.max(...s.map(e=>P(e,G.axisLabelFontSize,G.axisLabelFontWeight)),G.yLabelWidth),l=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),u=G.padding+G.xLabelHeight+(n?G.axisTitlePad:0),d=G.padding+c+G.yLabelGap+(r?G.axisTitlePad:0),f=G.padding,p=G.plotWidth,m=G.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=po(e),y=e=>d+(e+.5)*(p/v),x=p/v,S=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},C=_o(e,y,l+m,x),w=o.map((e,t)=>({label:s[t],x:d,y:S(e),tx:d-G.tickLength,ty:S(e),labelX:d-G.yLabelGap,labelY:S(e),textAnchor:`end`})),T=o.map(e=>({x1:d,y1:S(e),x2:d+p,y2:S(e)})),E=mo(e,v),D=e.series.map((e,t)=>t),O=vo(e,y,S,x,a.min,E,D),k=yo(e,y,S,E,D),ee=G.padding+(t?G.titleHeight:0)+G.legendHeight/2,te=i?So(e,h/2,ee,D):[],ne={x1:d,y1:l+m,x2:d+p,y2:l+m},A={x1:d,y1:l,x2:d,y2:l+m},j={ticks:C,line:ne,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-G.padding}}:{}},M={ticks:w,line:A,...e.yAxis.title?{title:{text:e.yAxis.title,x:G.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:G.padding+G.titleFontSize}:void 0,xAxis:j,yAxis:M,plotArea:_,bars:O,lines:k,gridLines:T,legend:te}}function fo(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=b(a.min,a.max),s=bo(o),c=po(e),l=mo(e,c),u=Math.max(...l.map(e=>P(e,G.axisLabelFontSize,G.axisLabelFontWeight)),40),d=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),f=G.padding+G.xLabelHeight+(r?G.axisTitlePad:0),p=G.padding+u+G.yLabelGap+(n?G.axisTitlePad:0),m=G.padding,h=G.plotWidth,g=G.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},x=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:x(e),y:d+g,tx:x(e),ty:d+g+G.tickLength,labelX:x(e),labelY:d+g+18,textAnchor:`middle`})),T=l.map((e,t)=>({label:e,x:p,y:C(t),tx:p-G.tickLength,ty:C(t),labelX:p-G.yLabelGap,labelY:C(t),textAnchor:`end`})),E=o.map(e=>({x1:x(e),y1:d,x2:x(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-G.barPadRatio),n=O>1?(t-(O-1)*G.barGroupGap)/O:t,r=Math.min(n,G.maxBarWidth),i=O>1?r*O+G.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=C(e)-i/2+o*(r+G.barGroupGap),c=x(Math.max(t.data[e],a.min)),u=x(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 ee=[],te=0,ne=0;for(let t of e.series){if(t.type!==`line`){ne++;continue}let e=t.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:l[t]}));ee.push({points:e,seriesIndex:te,colorIndex:D[ne]}),te++,ne++}let A={x1:p,y1:d+g,x2:p+h,y2:d+g},j={x1:p,y1:d,x2:p,y2:d+g},M={ticks:w,line:A,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-G.padding}}:{}},re={ticks:T,line:j,...e.xAxis.title?{title:{text:e.xAxis.title,x:G.padding+4,y:d+g/2,rotate:-90}}:{}},N=e.title?{text:e.title,x:_/2,y:G.padding+G.titleFontSize}:void 0,ie=G.padding+(t?G.titleHeight:0)+G.legendHeight/2;return{width:_,height:v,horizontal:!0,title:N,xAxis:M,yAxis:re,plotArea:y,bars:k,lines:ee,gridLines:E,legend:i?So(e,_/2,ie,D):[]}}function po(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 mo(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)=>xo(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var ho=8;function go(e,t){let n=e.map(e=>P(e,G.axisLabelFontSize,G.axisLabelFontWeight));for(let r=1;r<e.length;r++){let i=!0;for(let a=0;a+r<e.length;a+=r)if(r*t-(n[a]+n[a+r])/2<ho){i=!1;break}if(i)return r}return Math.max(1,e.length)}function _o(e,t,n,r){let i=mo(e,po(e)),a=go(i,r);return i.map((e,r)=>({label:r%a===0?e:``,x:t(r),y:n,tx:t(r),ty:n+G.tickLength,labelX:t(r),labelY:n+18,textAnchor:`middle`}))}function vo(e,t,n,r,i,a,o){let s=e.series.filter(e=>e.type===`bar`).length;if(s===0)return[];let c=r*(1-G.barPadRatio),l=s>1?(c-(s-1)*G.barGroupGap)/s:c,u=Math.min(l,G.maxBarWidth),d=s>1?u*s+G.barGroupGap*(s-1):u,f=[],p=0,m=0;for(let r of e.series){if(r.type!==`bar`){m++;continue}for(let e=0;e<r.data.length;e++){let s=t(e)-d/2+p*(u+G.barGroupGap),c=n(r.data[e]),l=n(Math.max(0,i));f.push({x:s,y:Math.min(c,l),width:u,height:Math.abs(l-c),value:r.data[e],label:a[e],seriesIndex:p,colorIndex:o[m]})}p++,m++}return f}function yo(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 bo(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 xo(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function So(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=P(e.label,G.legendFontSize,G.legendFontWeight);return G.legendSwatchW+G.legendGap+t}),c=t-(s.reduce((e,t)=>e+t,0)+(i.length-1)*G.legendItemGap)/2;for(let e=0;e<i.length;e++)i[e].x=c,c+=s[e]+G.legendItemGap;return i}var K={titleSize:18,titleWeight:600,axisTitleSize:15,axisTitleWeight:500,labelSize:14,labelWeight:400,legendSize:14,legendWeight:400,dotRadius:5,lineWidth:2.5,barRadius:8},q={fontSize:15,fontWeight:500,height:32,padX:14,offsetY:12,rx:8,minY:4,pointerSize:6};function Co(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=yi(A(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));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=wo(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="${J(t)}" cy="${J(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,r=e.horizontal?Eo(t.x,t.y,t.width,t.height,K.barRadius):To(t.x,t.y,t.width,t.height,K.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),a){let e=Ao(t.value),n=t.label?`${t.label}: ${e}`:e,r=ko(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${J(t.x)}" y="${J(t.y)}" width="${J(t.width)}" height="${J(t.height)}" fill="transparent"/><title>${Y(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=Do(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(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=J(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(a&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.map(e=>e.y)),o=K.dotRadius*3,s=`<rect x="${J(n-o)}" y="${J(i-o)}" width="${J(o*2)}" height="${J(a-i+o*2)}" fill="transparent" class="xychart-hit"/>`,c=e.map(e=>({text:Ao(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Oo(n,i-K.dotRadius,r,c),u=c.map(e=>e.text),d=r?`${r}: ${u.join(` · `)}`:u.join(` · `),f=`<g class="xychart-dot-group">${s}`;for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;f+=`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${Y(d)}</title>${l}</g>`,k.push(f)}else if(a){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,i=Ao(t.value),a=t.label?`${t.label}: ${i}`:i,o=ko(n,t.y-K.dotRadius,i),s=m?`<circle cx="${J(n)}" cy="${J(t.y)}" r="${K.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${Y(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;u.push(`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${L}" class="xychart-label">${Y(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${L}" class="xychart-label">${Y(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${L}" class="xychart-axis-title">${Y(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${L}" class="xychart-axis-title">${Y(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${K.titleSize}" font-weight="${K.titleWeight}" dy="${L}" class="xychart-title">${Y(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${K.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${K.legendSize}" font-weight="${K.legendWeight}" dy="${L}" class="xychart-label">${Y(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
59
|
-
`)}function wo(e,t,n,r,i,a){let o=r??N,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, ${N})`: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?`
|
|
49
|
+
</marker>`}var Va={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 Ha(e,t){let{id:n,x:r,y:i,width:a,height:o,label:c,type:l,participantType:d}=e,f=[],p=u`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${I.nodeLabel}" fill="var(--_text)"`;if(f.push(u`<g class="actor" data-id="${s(n)}" data-label="${s(c)}" data-type="${l}">`),l===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,s=L.outerBox/e,l=`var(--_line)`;f.push(u` <g transform="translate(${n},${a}) scale(${e})">`+u`\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="${s}" />`+u`\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="${s}" />`+u`\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="${s}" />`+`
|
|
50
|
+
</g>`),f.push(` `+S(c,r,i+o+14,t.nodeLabel,p))}else if(Pa(e)){let e=o/24*.9,n=L.outerBox/e,a=u`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${n}"`,s=u`fill="none" stroke="var(--_node-stroke)" stroke-width="${n}"`,l=Va[d](a,s);f.push(u` <g transform="translate(${r-12*e},${i+(o-24*e)/2}) scale(${e})">${l}\n </g>`),f.push(` `+S(c,r,i+o+14,t.nodeLabel,p))}else{let e=r-a/2,n=u`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}"`,s=r,l=i+o/2;if(d===`queue`){let t=o/2,r=e+8,s=e+a-8;f.push(u` <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} />`,u` <path d="M${s},${i}A${8},${t} 0 0 0 ${s},${i+o}" fill="none" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`)}else d===`collections`?(f.push(u` <rect x="${e+4}" y="${i}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`,u` <rect x="${e}" y="${i+4}" width="${a-4}" height="${o-4}" rx="4" ry="4" ${n} />`),s=r-2,l=i+2+(o-4)/2):f.push(u` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" ${n} />`);f.push(` `+S(c,s,l,t.nodeLabel,p))}return f.push(`</g>`),f.join(`
|
|
51
|
+
`)}var Ua=30,Wa=20,Ga=8,Ka=10,qa=18,Ja=3,Ya=2,Xa=3;function Za(e,t){let n=[],r=e=>g(e,t.edgeLabel,I.edgeLabel),i=(e,t,i)=>{let a=r(e);n.push({x0:t-a.width/2,x1:t+a.width/2,y0:i-a.height/2,y1:i+a.height/2})},a=(e,t,i)=>{let a=r(e);n.push({x0:t,x1:t+a.width,y0:i-a.height/2,y1:i+a.height/2})};for(let t of e.messages)t.label&&(t.isSelf?a(t.label,t.x1+Ua+Ga,t.y+Wa/2):i(t.label,(t.x1+t.x2)/2,t.y-Ka));for(let r of e.blocks){if(oo(r))continue;let e=F(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
|
|
52
|
+
`)[0]??``,t.edgeLabel,I.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+qa});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function Qa(e,t){let n=t.filter(t=>e.x>t.x0-Ja&&e.x<t.x1+Ja&&t.y1+Ya>e.topY&&t.y0-Ya<e.bottomY).map(e=>[e.y0-Ya,e.y1+Ya]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=Xa&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=Xa&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function $a(e,t){let n=Qa(e,t).map(([t,n])=>u`<line class="lifeline" data-actor="${s(e.actorId)}" `+u`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=eo;return n+u`\n<path class="destroy" data-actor="${s(e.actorId)}" `+u`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+u`fill="none" stroke="var(--_line)" stroke-width="${L.outerBox}" stroke-linecap="round" />`}var eo=8;function to(e){return u`<rect class="activation" data-actor="${s(e.actorId)}" `+u`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+u`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`}function no(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?u` marker-start="url(#${i})"`:``;if(n.push(u`<g class="message" data-from="${s(e.from)}" data-to="${s(e.to)}" `+u`data-label="${s(e.label)}" data-line-style="${e.lineStyle}" `+u`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf){let o=Ua,s=Wa,c=Ga;n.push(u` <polyline points="${e.x1},${e.y} ${e.x1+o},${e.y} ${e.x1+o},${e.y+s} ${e.x2},${e.y+s}" `+u`fill="none" stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+S(e.label,e.x1+o+c,e.y+s/2,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`))}else{n.push(u` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+u`stroke="var(--_line)" stroke-width="${L.connector}"${r} marker-end="url(#${i})"${a} />`);let o=(e.x1+e.x2)/2;n.push(` `+S(e.label,o,e.y-Ka,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`))}return e.seqNumber!==void 0&&n.push(` `+ro(e,t)),n.push(`</g>`),n.join(`
|
|
54
|
+
`)}function ro(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+z.width):e.x1;return`<g class="seq-number">`+u`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${L.innerBox}" />`+S(String(e.seqNumber),r,e.y,n,u`font-size="${n}" text-anchor="middle" font-weight="${I.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var io=35;function ao(e,t){let n=e.label?u` data-label="${s(e.label)}"`:``,r=e.color===void 0?``:u` data-color="${s(e.color)}"`,i=e.color===void 0?`none`:u`color-mix(in srgb, ${s(e.color)} ${io}%, var(--bg))`,a=[u`<g class="participant-box"${n}${r}>`,u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+u`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`];return e.label&&a.push(` `+S(e.label,e.x+e.width/2,e.y+ja(t.edgeLabel)/2,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
|
|
55
|
+
`)}function oo(e){return e.type===`rect`&&e.color!==void 0}function so(e,t){let n=[];if(oo(e))return[u`<g class="block" data-type="rect" data-color="${s(e.color)}">`,u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+u`fill="${s(e.color)}" />`,`</g>`].join(`
|
|
56
|
+
`);let r=e.label?u` data-label="${s(e.label)}"`:``;n.push(u`<g class="block" data-type="${s(e.type)}"${r}>`),n.push(u` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+u`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`);let i=u`${e.type}${e.label?u` [${e.label}]`:``}`,a=i.split(`
|
|
57
|
+
`)[0],o=F(a,t.edgeLabel,I.groupHeader)+16,c=qa;n.push(u` <rect x="${e.x}" y="${e.y}" width="${o}" height="${c}" `+u`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${L.outerBox}" />`),n.push(` `+S(i,e.x+6,e.y+c/2,t.edgeLabel,u`font-size="${t.edgeLabel}" font-weight="${I.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(u` <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(` `+S(u`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${I.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
|
|
58
|
+
`)}function co(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?u` data-actors="${e.actors.map(s).join(`,`)}"`:``,c=e.position?u` data-position="${s(e.position)}"`:``,l=[u`${n},${r}`,u`${n+i-6},${r}`,u`${n+i},${r+6}`,u`${n+i},${r+a}`,u`${n},${r+a}`].join(` `);return u`<g class="note"${c}${o}>`+u`\n <polygon points="${l}" `+u`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`+u`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+u`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${L.innerBox}" />`+u`\n ${S(e.text,n+i/2,r+a/2,t.edgeLabel,u`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${I.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 lo(e,t={}){return e.horizontal?fo(e):uo(e)}function uo(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=b(a.min,a.max),s=bo(o),c=Math.max(...s.map(e=>F(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=po(e),y=e=>d+(e+.5)*(p/v),x=p/v,S=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},C=_o(e,y,l+m,x),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=mo(e,v),D=e.series.map((e,t)=>t),O=vo(e,y,S,x,a.min,E,D),k=yo(e,y,S,E,D),ee=K.padding+(t?K.titleHeight:0)+K.legendHeight/2,te=i?So(e,h/2,ee,D):[],A={x1:d,y1:l+m,x2:d+p,y2:l+m},j={x1:d,y1:l,x2:d,y2:l+m},M={ticks:C,line:A,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-K.padding}}:{}},N={ticks:w,line:j,...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:te}}function fo(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=b(a.min,a.max),s=bo(o),c=po(e),l=mo(e,c),u=Math.max(...l.map(e=>F(e,K.axisLabelFontSize,K.axisLabelFontWeight)),40),d=K.padding+(t?K.titleHeight:0)+(i?K.legendHeight:0),f=K.padding+K.xLabelHeight+(r?K.axisTitlePad:0),p=K.padding+u+K.yLabelGap+(n?K.axisTitlePad:0),m=K.padding,h=K.plotWidth,g=K.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},x=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:x(e),y:d+g,tx:x(e),ty:d+g+K.tickLength,labelX:x(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:x(e),y1:d,x2:x(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=x(Math.max(t.data[e],a.min)),u=x(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 ee=[],te=0,A=0;for(let t of e.series){if(t.type!==`line`){A++;continue}let e=t.data.map((e,t)=>({x:x(e),y:C(t),value:e,label:l[t]}));ee.push({points:e,seriesIndex:te,colorIndex:D[A]}),te++,A++}let j={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:j,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-K.padding}}:{}},ne={ticks:T,line:M,...e.xAxis.title?{title:{text:e.xAxis.title,x:K.padding+4,y:d+g/2,rotate:-90}}:{}},P=e.title?{text:e.title,x:_/2,y:K.padding+K.titleFontSize}:void 0,re=K.padding+(t?K.titleHeight:0)+K.legendHeight/2;return{width:_,height:v,horizontal:!0,title:P,xAxis:N,yAxis:ne,plotArea:y,bars:k,lines:ee,gridLines:E,legend:i?So(e,_/2,re,D):[]}}function po(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 mo(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)=>xo(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var ho=8;function go(e,t){let n=e.map(e=>F(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<ho){i=!1;break}if(i)return r}return Math.max(1,e.length)}function _o(e,t,n,r){let i=mo(e,po(e)),a=go(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 vo(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 yo(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 bo(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 xo(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function So(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=F(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 Co(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=vi(j(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));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=wo(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?Eo(t.x,t.y,t.width,t.height,q.barRadius):To(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=Ao(t.value),n=t.label?`${t.label}: ${e}`:e,r=ko(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${Y(t.x)}" y="${Y(t.y)}" width="${Y(t.width)}" height="${Y(t.height)}" fill="transparent"/><title>${X(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=Do(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(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:Ao(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Oo(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=Ao(t.value),a=t.label?`${t.label}: ${i}`:i,o=ko(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="${R}" 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="${R}" 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="${R}" 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="${R}" 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="${R}" 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="${R}" 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 wo(e,t,n,r,i,a){let o=r??P,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, ${P})`: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?`
|
|
60
61
|
.xychart-tip { opacity: 0; pointer-events: none; }
|
|
61
62
|
.xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
|
|
62
|
-
.xychart-tip-text { fill: var(--bg); font-size: ${
|
|
63
|
+
.xychart-tip-text { fill: var(--bg); font-size: ${J.fontSize}px; font-weight: ${J.fontWeight}; }
|
|
63
64
|
.xychart-tip-ptr { fill: var(--_text); }
|
|
64
65
|
.xychart-bar-group:hover .xychart-tip,
|
|
65
66
|
.xychart-dot-group:hover .xychart-tip { opacity: 1; }`:``,d=c.length>0?`\n svg {\n${c.join(`
|
|
66
67
|
`)}\n }`:``;return{style:`${k(a)}
|
|
67
68
|
.xychart-grid { fill: var(--_inner-stroke); stroke: none; opacity: 0.65; }
|
|
68
69
|
.xychart-bar { stroke-width: 1.5; }
|
|
69
|
-
.xychart-line { fill: none; stroke-width: ${
|
|
70
|
+
.xychart-line { fill: none; stroke-width: ${q.lineWidth}; stroke-linecap: round; stroke-linejoin: round; }
|
|
70
71
|
.xychart-line-shadow { fill: none; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; opacity: 0.12; }
|
|
71
72
|
.xychart-dot { stroke: var(--bg); stroke-width: 2; }
|
|
72
73
|
.xychart-label { fill: var(--_text-muted); }
|
|
@@ -74,23 +75,23 @@ import{DEFAULTS as e,applyThemeVariables as t,buildStyleBlock as n,checkGraphSiz
|
|
|
74
75
|
.xychart-title { fill: var(--_text); }${d}
|
|
75
76
|
${l.join(`
|
|
76
77
|
`)}${u}
|
|
77
|
-
</style>`,defs:``}}function To(e,t,n,r,i){let a=Math.min(i,n/2,r/2);return a<=0?`M${
|
|
78
|
+
</style>`,defs:``}}function To(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 Eo(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 Do(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 Oo(e,t,n,r){let i=F(n,J.fontSize,600),a=Math.max(...r.map(e=>{let t=F(e.legendLabel,J.fontSize,J.fontWeight),n=F(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="${R}" 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="${R}" 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="${R}" class="xychart-tip xychart-tip-text">${X(e.text)}</text>`;return m}function ko(e,t,n){let r=F(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="${R}" class="xychart-tip xychart-tip-text">${X(n)}</text>`}function Ao(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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}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},jo=Math.PI*2;function Q(e){return String(Math.round(e*100)/100)}function Mo(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function No(e,t,n,r,i,a=0){if(i-r>=jo-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=Mo(e,t,n,r),s=Mo(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=Mo(e,t,a,i),d=Mo(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 Po(e,t,n){return n?`${e} [${String(t)}]`:e}function Fo(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=>Po(t.label,t.value,e.showData)),m=Math.max(0,...p.map(e=>F(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?F(T,Z.titleFontSize,Z.fontWeight):0,D=a-E/2,O=a+E/2,k=x.x,ee=x.x+S,te=x.y,A=x.y+g-u+Z.legendRectSize,j=Math.min(0,D,d>0?k:0),M=Math.max(C,O,d>0?ee:0),N=d>0?Math.min(0,te):0,ne=d>0?Math.max(w,A):n,P=-j,re=-N,ie=a+_+P,ae=o+v+re,oe=[],se=0,ce=e.donutHole??0,le=ce>0&&ce<=.9?ce*i:0,ue=i*(e.textPosition??Z.textPosition);for(let{slice:t,colorIndex:n}of c){let r=se,a=se+t.value/l*jo;se=a;let o=Mo(ie,ae,ue,(r+a)/2),c=e.highlightSlice!==void 0&&e.highlightSlice!==`hover`&&e.highlightSlice!==``&&e.highlightSlice===t.label,u=c?Z.highlightScale:1;oe.push({label:t.label,value:t.value,colorIndex:n,startAngle:r,endAngle:a,path:No(ie,ae,i*u,r,a,le*u),percentText:`${(t.value/s*100).toFixed(0)}%`,labelX:o.x,labelY:o.y,...c?{highlighted:c}:{}})}let de=p.map((e,t)=>{let n=x.x+P,r=x.y+t*u+re;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-j),height:Math.ceil(ne-N),cx:ie,cy:ae,radius:i,outerRadius:i+Z.outerStrokeWidth/2,title:T.length>0?{text:T,x:a+P,y:o+re-(n-50)/2}:void 0,slices:oe,legend:de,accTitle:e.accTitle,accDescr:e.accDescr,sliceColors:e.sliceColors}}function Io(e){return String(Math.round(e*100)/100)}function Lo(e,t,n){return e===0?`var(--accent, ${P})`:ce(e,t??P,n)}function Ro(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]??Lo(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)?`
|
|
78
79
|
.pie-slice.pie-highlight { opacity: 1; }`:``,c=a.length>0?`\n svg {\n${a.join(`
|
|
79
80
|
`)}\n }`:``;return`${k(n)}
|
|
80
|
-
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${
|
|
81
|
+
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${Z.outerStrokeWidth}px; }
|
|
81
82
|
.pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }${s}
|
|
82
|
-
.pie-slice-label { fill: var(--_text); font-size: ${
|
|
83
|
-
.pie-title { fill: var(--_text); font-size: ${
|
|
84
|
-
.pie-legend-text { fill: var(--_text); font-size: ${
|
|
83
|
+
.pie-slice-label { fill: var(--_text); font-size: ${Z.sectionFontSize}px; font-weight: ${Z.fontWeight}; }
|
|
84
|
+
.pie-title { fill: var(--_text); font-size: ${Z.titleFontSize}px; font-weight: ${Z.fontWeight}; }
|
|
85
|
+
.pie-legend-text { fill: var(--_text); font-size: ${Z.legendFontSize}px; font-weight: ${Z.fontWeight}; }${c}
|
|
85
86
|
${o.join(`
|
|
86
87
|
`)}
|
|
87
|
-
</style>`}function
|
|
88
|
-
`)}var
|
|
89
|
-
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&
|
|
90
|
-
`)]);
|
|
91
|
-
`);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>
|
|
92
|
-
`)}function
|
|
93
|
-
`)}function
|
|
94
|
-
`)}function
|
|
95
|
-
`)}function
|
|
96
|
-
`)}var
|
|
88
|
+
</style>`}function zo(e,t,r=`Inter`,i=!1,a,o,l,u={}){let d=[];d.push(vi(j(e.width,e.height,t,i,o??e.accTitle,l,void 0,u.styleAttribute,e.accDescr),a)),d.push(n(r,!1,u.nonce)),d.push(Ro(e,t,u.nonce)),d.push(`<circle cx="${Io(e.cx)}" cy="${Io(e.cy)}" r="${Io(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="${s(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)d.push(`<text x="${Io(t.labelX)}" y="${Io(t.labelY)}" text-anchor="middle" class="pie-slice-label">${c(t.percentText)}</text>`);e.title&&d.push(`<text x="${Io(e.title.x)}" y="${Io(e.title.y)}" text-anchor="middle" class="pie-title">${c(e.title.text)}</text>`);for(let t of e.legend)d.push(`<g class="pie-legend"><rect x="${Io(t.x)}" y="${Io(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${Io(t.textX)}" y="${Io(t.textY)}" class="pie-legend-text">${c(t.text)}</text></g>`);return d.push(`</svg>`),d.join(`
|
|
89
|
+
`)}var Bo=2048,Vo=[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],Ho=[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 Uo(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?Ho:Vo)[n-32]/Bo}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},Wo=$.width-2*$.shapePadding;function Go(e,t,n){let r=[];for(let i of e.split(`
|
|
90
|
+
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Zo(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function Ko(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 qo(e,t){return e*$.nameLine+$.typeLine+Jo(t)}function Jo(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function Yo(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function Xo(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Zo(e,t,n){let r=0;for(let i of e){let e=Uo(i,n>=600);r+=e===void 0?F(i,t,n)*$.textScale:e*t}return r}function Qo(e,t,n,r){let i=qo(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:Ko(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=Yo(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=Xo(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function $o(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 es=$.messageSize+5;function ts(e){return e.labelLines??ae(e)}function ns(e){let t=e.labelPosition;return t?ts(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*es,w:Zo(n,$.messageSize,400),h:$.messageSize})):[]}function rs(){return{next:{cnt:0}}}function is(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 as(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function os(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,as(e,`startx`,r,Math.min),as(e,`starty`,a,Math.min),as(e,`stopx`,i,Math.max),as(e,`stopy`,o,Math.max),as(e.next,`startx`,r,Math.min),as(e.next,`starty`,a,Math.min),as(e.next,`stopx`,i,Math.max),as(e.next,`stopy`,o,Math.max)}function ss(e){let t=Go(e.label,Wo,$.nameSize),n=e.description?Go(e.description,Wo,$.descrSize):[],r=Math.max(...t.map(e=>Zo(e,$.nameSize,700)),Zo(oe(e),$.typeSize,400),...n.map(e=>Zo(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...Qo(e,t.length,n.length,r)}}function cs(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 ls(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=ss(r);t.set(r.alias,n),os(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&&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;is(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;is(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 is(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function us(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 ds(e,t){let n=Ko(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 ps({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function fs(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 ps(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=fs(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 ms=1e-6;function hs(e,t){let n=us(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Yo(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-ms||Math.abs(Math.abs(s)-e.width/2)<=ms&&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 gs(e,t){let n=us(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Xo(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-ms||Math.abs(Math.abs(s)-e.height/2)<=ms&&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 _s(e,t){let n=e.el;return n?.kind===`person`?ds(e,t):n?.shape===`db`?hs(e,t):n?.shape===`queue`?gs(e,t):us(e,t)}var vs=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function ys(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=_s(i,vs(a)),s=_s(a,vs(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?Zo(n??``,$.messageSize,400):0;if(d.labelPosition=u({x:t.x+r/2,y:t.y}),e.technology){let n=Zo(`[${e.technology}]`,$.messageSize,400);d.technologyX=t.x+Math.max(r,n)/2}}return d}var bs=2,xs=6,Ss=2,Cs=[0,14,-14,28,-28],ws=[.75,.55,.4],Ts=1e3,Es=100,Ds=10,Os=2,ks=5,As=4,js=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}),Ms=(e,t)=>e.x0<t.x1+bs&&e.x1>t.x0-bs&&e.y0<t.y1+bs&&e.y1>t.y0-bs;function Ns(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/As));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 Ps(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:Es}),n=(n,r,i,a)=>{let o=Zo(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,ks)},r=ie({...e,elementAliases:[],children:[]});return[t(e.x,e.x+e.width,e.y,e.y,Os),t(e.x,e.x+e.width,e.y+e.height,e.y+e.height,Os),t(e.x,e.x,e.y,e.y+e.height,Os),t(e.x+e.width,e.x+e.width,e.y,e.y+e.height,Os),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 Fs(e,t){return ns({...e,labelLines:t.lines,labelPosition:t.position,...t.technologyX===void 0?{}:{technologyX:t.technologyX}}).map(js)}function Is(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?Zo(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(`
|
|
91
|
+
`)]);ws.forEach((e,r)=>{let i=Go(u[0],f*e,$.messageSize),a=[...i,...t].join(`
|
|
92
|
+
`);if(n.has(a))return;n.add(a);let s=Math.max(...i.map(e=>Zo(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(...Cs)+bs,v=m.flatMap(t=>Fs(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(Ss,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=Fs(e,t);for(let e of Cs)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(Ms(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+=Ds)}}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(...ns(e).map(e=>({...js(e),weight:Es})))}function Ls(e,t={}){if(e.elements.length===0&&e.boundaries.length===0){let t={variant:e.variant,width:0,height:0,elements:[],boundaries:[],relationships:[]};return e.title&&(t.title=e.title),t}let n=ls(cs(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)=>ys(e,t,s,i)),l=[...a.map(e=>({x0:e.x-xs,x1:e.x+e.width+xs,y0:e.y-xs,y1:e.y+e.height+xs,weight:Ts})),...Ps(o)],u=c.map(Ns),d=[];c.forEach((e,t)=>Is(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 Rs(e,t,r=`Inter`,i=!1,a=He,o,s,l,d={}){let f=[];f.push(vi(j(e.width,e.height,t,i,s??e.title,l,void 0,d.styleAttribute,d.description),o)),f.push(n(r,!1,d.nonce)),e.title&&e.titlePosition&&f.push(u`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${R}" `+u`font-size="16" fill="var(--_text)">${c(e.title)}</text>`);for(let t of e.boundaries)f.push(Bs(t));for(let t of e.elements)f.push(Vs(t));for(let t of e.relationships)f.push(Ys(t));for(let t of e.relationships)f.push(Xs(t));return f.push(`</svg>`),f.filter(Boolean).join(`
|
|
93
|
+
`)}function zs(e,t,n,r,i){return u` <text x="${t}" y="${n}" text-anchor="middle" dy="${R}" font-size="${r}" `+u`${i}>${c(e)}</text>`}function Bs(e){let t=[];t.push(u`<g class="c4-boundary" data-id="${s(e.alias)}" data-label="${s(e.label)}" data-depth="${e.depth}">`),t.push(u` <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(zs(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(zs(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push(zs(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
|
|
94
|
+
`)}function Vs(e){let t=$o(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,c=qo(e.nameLines.length,e.descriptionLines.length),l=[];l.push(u`<g class="c4-element" data-id="${s(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+u`data-external="${e.external}" data-label="${s(e.label)}">`);let d,f=o;if(e.kind===`person`)l.push(...Us(e,t)),d=r+Ko(i).pillTop+$.shapePadding;else if(e.shape===`db`){l.push(...Ws(e,t));let{ry:n}=Yo(i);d=r+(2*n+a)/2-c/2}else if(e.shape===`queue`){l.push(...Gs(e,t));let{rx:n}=Xo(a);f=o-n,d=r+a/2-c/2}else l.push(u` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+u`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),d=r+$.shapePadding;let p=d;for(let n of e.nameLines)l.push(zs(n,f,p+$.nameLine/2,$.nameSize,u`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return l.push(zs(oe(e),f,p+$.typeLine/2,$.typeSize,u`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{l.push(zs(e,f,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,u`fill="${t.text}"`))}),p+=Jo(e.descriptionLines.length),l.push(`</g>`),l.join(`
|
|
95
|
+
`)}function Hs(e){let{x:t,y:n,width:r,height:i}=e,{rx:a,headRadius:o,pillTop:s}=Ko(r,i),c=t+r/2,l=n+s,d=n+i,f=Math.sqrt(Math.max(0,o*o-(l-(n+o))**2));return u`M ${t+a} ${l} H ${c-f} A ${o} ${o} 0 1 1 ${c+f} ${l} `+u`H ${t+r-a} A ${a} ${a} 0 0 1 ${t+r} ${l+a} V ${d-a} `+u`A ${a} ${a} 0 0 1 ${t+r-a} ${d} H ${t+a} `+u`A ${a} ${a} 0 0 1 ${t} ${d-a} V ${l+a} `+u`A ${a} ${a} 0 0 1 ${t+a} ${l} Z`}function Us(e,t){return[u` <path class="c4-person-shape" d="${Hs(e)}" fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`]}function Ws(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Yo(i),c=u`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[u` <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} />`,u` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function Gs(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Xo(a),c=u`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[u` <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} />`,u` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${c} />`]}function Ks(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 u`<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 qs=3,Js=1;function Ys(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,u`data-from="${s(e.from)}"`,u`data-to="${s(e.to)}"`];e.label&&r.push(u`data-label="${s(e.label)}"`),e.technology&&r.push(u`data-technology="${s(e.technology)}"`);let i=e.curve?u`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:u`M ${t.x},${t.y} L ${n.x},${n.y}`,a=u`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,c=e.curve??n,l=Ks(n,o),d=Ks(t,c);return[a,...e.bidirectional?[l,d]:[e.reversed?d:l]].filter(Boolean).join(`
|
|
96
|
+
`)}function Xs(e){let t=ts(e),n=ns(e);if(n.length===0)return``;let r=[u`<g class="c4-relationship-label" data-from="${s(e.from)}" data-to="${s(e.to)}">`],i=Math.min(...n.map(e=>e.cx-e.w/2))-qs,a=Math.max(...n.map(e=>e.cx+e.w/2))+qs,o=n[0].cy-n[0].h/2-Js,c=n[n.length-1],l=c.cy+c.h/2+Js;return r.push(u` <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(zs(i,s.cx,s.cy,$.messageSize,o?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),r.push(`</g>`),r.join(`
|
|
97
|
+
`)}var Zs={type:`xychart`,parse:ge,layoutForSvg:lo,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return Co(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Qs={type:`sequence`,parse:he,layoutForSvg:Ra,renderSvg(e,t){return za(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function $s(e){return(e.interactivity??`static`)!==`none`}function ec(e){return(e.interactivity??`static`)===`full`}var tc={type:`class`,parse:de,layoutForSvg:Ki,renderSvg(e,t,n){return Qi(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,$s(n),t.emit)}},nc={type:`er`,parse:fe,layoutForSvg(e,t){return va(N(e,t.direction),t)},renderSvg(e,t){return xa(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},rc={type:`flowchart`,parse:(e,t)=>pe(t),layoutForSvg(e,t){return{graph:ur(N(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return xr(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,ec(n),$s(n),t.title,t.decorative,t.emit)}},ic={type:`c4`,parse:ue,layoutForSvg(e,t){return Ls(e,t)},renderSvg(e,t){return Rs(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},ac={xychart:Zs,er:nc,sequence:Qs,class:tc,flowchart:rc,architecture:{type:`architecture`,parse:le,layoutForSvg(e,t){return{graph:cr(N(re(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:rc.renderSvg},c4:ic,pie:{type:`pie`,parse:(e,t)=>me(t),layoutForSvg:(e,t)=>Fo(t.honorThemeVariables?e:{...e,sliceColors:void 0},t),renderSvg(e,t){return zo(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function oc(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 sc(e={}){return M(oc(e),e.transparent)}function cc(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function lc(e,t={}){let{svg:n,colors:r}=fc(e,t),i=uc(n);return t.resolveColors?Ni(i,r):i}function uc(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 dc(e){let t=l(_e(e)).text;ac[a(t)].parse(O(t),t)}function fc(e,n){i(`maxInputLength`,e.length,n.limits);let o=l(_e(e)),s=o.text,c=n.font??`Inter`;D(h(c));let u=n.transparent??!1,d=Ue(n.fontSizes),f=a(s),p=n.embedSource?e:void 0,m=n.title??o.accTitle,g=n.decorative,_={...cc(n),description:o.accDescr},v=O(s),y=ac[f],b=y.parse(v,s),x=b;x.nodes instanceof Map&&Array.isArray(x.edges)&&r(x.nodes.size,x.edges.length,n.limits);let S=y.layoutForSvg(b,n),C=oc(n.honorThemeVariables?t(n,b.initConfig):n),w={colors:C,font:c,transparent:u,fontSizes:d,embedSource:p,title:m,decorative:g,emit:_};return{svg:y.renderSvg(S,w,n),colors:C}}async function pc(e,t={}){return lc(e,t)}var mc=lc,hc=pc;export{Ma as ACTOR_LABEL_OFFSET,z as ARROW_HEAD,W as CLS,qe as ELK_DIRECTION_FALLBACK,Oe as ElkNotRegisteredError,He as FONT_SIZES,I as FONT_WEIGHTS,We as GROUP_HEADER_CONTENT_PAD,Qe as INLINE_CENTERED_EDGE_LABEL,Be as MONO_FONT,Ve as MONO_FONT_STACK,Ge as NODE_PADDING,Z as PIE,L as STROKE_WIDTHS,R as TEXT_BASELINE_SHIFT,Xe as baseElkLayoutOptions,ja as boxLabelHeight,et as buildElkEdge,$e as buildElkEdgeLabel,Ze as buildElkLeafNode,Ke as buildSvgStyleBlock,Ui as classBackEdges,Ri as classNoteId,St as clipEdgeToShape,dr as convertToElkFormat,Ne as createLayoutCache,Je as directionToElk,Ie as elkLayoutSync,Ye as elkPadding,ze as estimateMonoTextWidth,F as estimateTextWidth,Di as evaluateCssColorValue,zt as extractEdgeLabelPosition,Rt as extractEdgePoints,bo as formatTickLabels,Pa as hasLabelBelowIcon,Ki as layoutClassDiagramSync,va as layoutErDiagramSync,ur as layoutFlowchartSync,cr as layoutGraphSync,Fo as layoutPieChart,Ra as layoutSequenceDiagram,lo as layoutXYChart,y as niceTickValues,Lo as pieColorValue,Ce as pointsToPath,ke as registerElk,Qi as renderClassSvg,xa as renderErSvg,hc as renderMermaid,lc as renderMermaidSVG,pc as renderMermaidSVGAsync,mc as renderMermaidSync,zo as renderPieSvg,za as renderSequenceSvg,xr as renderSvg,Co as renderXYChartSvg,Ni as resolveCssColors,Ue as resolveFontSizes,Do as smoothCurvePath,sc as themeCssVariables,dc as validateMermaid,vi as withDataSrc,go as xLabelStep};
|