agentic-mermaid 0.5.4 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/AGENT_NATIVE.md +5 -9
  2. package/CHANGELOG.md +66 -0
  3. package/Instructions_for_agents.md +171 -97
  4. package/README.md +1 -1
  5. package/dist/agent-core.d.ts +7 -7
  6. package/dist/agent-core.js +1 -1
  7. package/dist/agent.d.ts +9 -10
  8. package/dist/agent.js +1 -1
  9. package/dist/agentic-mermaid-mcp.js +1 -1
  10. package/dist/am.js +1 -1
  11. package/dist/browser-lazy/chunks/{agentic-producer-core-ECZ3CMZM.js → agentic-producer-core-MYYZCUJS.js} +1 -1
  12. package/dist/browser-lazy/chunks/{architecture-H5LTMKQW.js → architecture-OHEIJI33.js} +6 -6
  13. package/dist/browser-lazy/chunks/{block-566X6FNV.js → block-DMBSQUFZ.js} +6 -6
  14. package/dist/browser-lazy/chunks/{builtin-backends-VAFEZXKY.js → builtin-backends-JTN3XG37.js} +3 -3
  15. package/dist/browser-lazy/chunks/{c4-ZXFDLBFK.js → c4-TK5GVVGU.js} +3 -3
  16. package/dist/browser-lazy/chunks/{chunk-7UFOFWBA.js → chunk-2R6M4CUH.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-YVNJDVQO.js → chunk-3K25OV6X.js} +1 -1
  18. package/dist/browser-lazy/chunks/{chunk-QVSZOF5M.js → chunk-3QXHJBE3.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-IUI4DYC3.js → chunk-4G652M75.js} +1 -1
  20. package/dist/browser-lazy/chunks/{chunk-LBXXKLIR.js → chunk-4WON4RCG.js} +3 -3
  21. package/dist/browser-lazy/chunks/{chunk-V6I2VGNQ.js → chunk-5SZ2YBKG.js} +9 -9
  22. package/dist/browser-lazy/chunks/{chunk-XHU3A432.js → chunk-CJZMMNPO.js} +1 -1
  23. package/dist/browser-lazy/chunks/{chunk-5LKPDHPC.js → chunk-F4CQMYR2.js} +4 -4
  24. package/dist/browser-lazy/chunks/{chunk-G4JBA7HU.js → chunk-GK5PSUKH.js} +3 -3
  25. package/dist/browser-lazy/chunks/{chunk-VRZKI33U.js → chunk-HAMXYU5V.js} +1 -1
  26. package/dist/browser-lazy/chunks/{chunk-Z7UHFVKN.js → chunk-IFUYPCDA.js} +6 -6
  27. package/dist/browser-lazy/chunks/{chunk-3JTYTXA6.js → chunk-ILCWDEZN.js} +4 -4
  28. package/dist/browser-lazy/chunks/{chunk-64JFHCJC.js → chunk-JJFXEH35.js} +1 -1
  29. package/dist/browser-lazy/chunks/{chunk-PXTLV57R.js → chunk-KOO3MCMJ.js} +1 -1
  30. package/dist/browser-lazy/chunks/{chunk-A7V5VDKN.js → chunk-LO25KEJY.js} +1 -1
  31. package/dist/browser-lazy/chunks/{chunk-TT5GR5EJ.js → chunk-MGB5QQEH.js} +1 -1
  32. package/dist/browser-lazy/chunks/{chunk-PSZEE64O.js → chunk-NVZKY7UI.js} +8 -8
  33. package/dist/browser-lazy/chunks/{chunk-6UOOATQR.js → chunk-PA7YKMP5.js} +1 -1
  34. package/dist/browser-lazy/chunks/{chunk-NKW2ZNCD.js → chunk-PS4HSV54.js} +1 -1
  35. package/dist/browser-lazy/chunks/{chunk-OBI5U5XU.js → chunk-QG67RIGQ.js} +1 -1
  36. package/dist/browser-lazy/chunks/{chunk-J57YRC2M.js → chunk-QOIFBX26.js} +1 -1
  37. package/dist/browser-lazy/chunks/chunk-QQCKPJF3.js +1 -0
  38. package/dist/browser-lazy/chunks/{chunk-O34YYEQV.js → chunk-QXSPMZ67.js} +1 -1
  39. package/dist/browser-lazy/chunks/{chunk-4NILRBC7.js → chunk-QYORAVMZ.js} +1 -1
  40. package/dist/browser-lazy/chunks/{chunk-OFOS57WQ.js → chunk-SC7LXD2V.js} +1 -1
  41. package/dist/browser-lazy/chunks/{chunk-EIYLJ4FI.js → chunk-SZAI2WB4.js} +12 -12
  42. package/dist/browser-lazy/chunks/{chunk-37FZNMPR.js → chunk-TXYQEDUF.js} +1 -1
  43. package/dist/browser-lazy/chunks/{chunk-2JQXRKBC.js → chunk-VR6YRNUZ.js} +1 -1
  44. package/dist/browser-lazy/chunks/{chunk-7TTFBJYA.js → chunk-WNTLLJPT.js} +1 -1
  45. package/dist/browser-lazy/chunks/{chunk-62MR3LWJ.js → chunk-YYF5TS6K.js} +1 -1
  46. package/dist/browser-lazy/chunks/{class-XIFNVBFE.js → class-QOJOM2XO.js} +8 -8
  47. package/dist/browser-lazy/chunks/{er-VEUYJBGG.js → er-2W6UXQT7.js} +6 -6
  48. package/dist/browser-lazy/chunks/{eventmodeling-G7DITZX7.js → eventmodeling-IVAFIO2U.js} +9 -9
  49. package/dist/browser-lazy/chunks/{flowchart-SSFIU4EU.js → flowchart-Y6OWQ46O.js} +1 -1
  50. package/dist/browser-lazy/chunks/{gantt-HQNVDX2B.js → gantt-BXTFJPZM.js} +6 -6
  51. package/dist/browser-lazy/chunks/{gitgraph-Z5MN6M6L.js → gitgraph-PW6R75SQ.js} +4 -4
  52. package/dist/browser-lazy/chunks/{ishikawa-UEERNFQV.js → ishikawa-GFX3XQQZ.js} +2 -2
  53. package/dist/browser-lazy/chunks/{journey-3BEWWGB5.js → journey-Q3M2GVKJ.js} +7 -7
  54. package/dist/browser-lazy/chunks/{kanban-2WFNCWLB.js → kanban-WVGVXROE.js} +11 -11
  55. package/dist/browser-lazy/chunks/{mindmap-R2C6SNYR.js → mindmap-CEDNSFJ6.js} +6 -6
  56. package/dist/browser-lazy/chunks/{packet-GMVCI5YZ.js → packet-Z56OVP2O.js} +3 -3
  57. package/dist/browser-lazy/chunks/{pie-WER45DKC.js → pie-FOJURIAM.js} +7 -7
  58. package/dist/browser-lazy/chunks/{quadrant-NCUPSFKN.js → quadrant-OGUQEK5C.js} +4 -4
  59. package/dist/browser-lazy/chunks/{radar-WLYS4YC5.js → radar-XTAUIQIJ.js} +9 -9
  60. package/dist/browser-lazy/chunks/render-core-QRFSDWGQ.js +3 -0
  61. package/dist/browser-lazy/chunks/{requirement-AK3NWMJ6.js → requirement-KEJ7ILX2.js} +7 -7
  62. package/dist/browser-lazy/chunks/{sankey-C2DY6WVU.js → sankey-ODWGDRAM.js} +8 -8
  63. package/dist/browser-lazy/chunks/{sequence-D4WJB44W.js → sequence-4ZNQR7S7.js} +1 -1
  64. package/dist/browser-lazy/chunks/{state-YUQVESE7.js → state-6IWPVJ4C.js} +2 -2
  65. package/dist/browser-lazy/chunks/{timeline-BMBJJXWR.js → timeline-LPJMPVPV.js} +4 -4
  66. package/dist/browser-lazy/chunks/{treemap-B66XBZZ6.js → treemap-2KFOQZRA.js} +4 -4
  67. package/dist/browser-lazy/chunks/xychart-KIPWFNVQ.js +16 -0
  68. package/dist/browser-lazy/chunks/{zenuml-62RLYFWP.js → zenuml-2ABFLOUP.js} +6 -6
  69. package/dist/browser-lazy/index.js +1 -1
  70. package/dist/browser.global.js +436 -436
  71. package/dist/chunk-3QC3FE2X.js +4 -0
  72. package/dist/{chunk-XU5LPD2D.js → chunk-5BYN55G4.js} +1 -1
  73. package/dist/chunk-5XKELJT2.js +2 -0
  74. package/dist/chunk-7HIKKNPP.js +150 -0
  75. package/dist/chunk-A5TX2FW5.js +2 -0
  76. package/dist/chunk-AS6A6XHE.js +2 -0
  77. package/dist/{chunk-DOFB572I.js → chunk-CGCGMO4U.js} +15 -15
  78. package/dist/chunk-GO4CS5KS.js +52 -0
  79. package/dist/{chunk-KXMANAST.js → chunk-JRLCGATA.js} +47 -47
  80. package/dist/{chunk-7XYB2LNC.js → chunk-K6TYUPTW.js} +2 -2
  81. package/dist/{chunk-HINRNKPO.js → chunk-QVP364DJ.js} +2 -2
  82. package/dist/chunk-V5RFODN6.js +2 -0
  83. package/dist/cli-PVKOWT4V.js +191 -0
  84. package/dist/elk-constructor.js +1 -1
  85. package/dist/{index-Bvhprdxz.d.ts → index-Bs7imZCS.d.ts} +14 -4
  86. package/dist/index.d.ts +4 -4
  87. package/dist/index.js +1 -1
  88. package/dist/{jsonl-RPJY6YWO.js → jsonl-5N4DTV7P.js} +2 -2
  89. package/dist/mcp-cli-EPIA7DTH.js +2 -0
  90. package/dist/{paint-certification-BoLyr006.d.ts → paint-certification-aIPtFDcn.d.ts} +2 -2
  91. package/dist/server-X6OFY2ZN.js +527 -0
  92. package/dist/{svg-styles-BnCoXyYe.d.ts → svg-styles-DfHloZTH.d.ts} +1 -1
  93. package/dist/svg-styles.d.ts +1 -1
  94. package/dist/svg-styles.js +1 -1
  95. package/dist/svg.d.ts +4 -4
  96. package/dist/svg.js +1 -1
  97. package/dist/{types-CLVJCaH2.d.ts → types-DkUbM48-.d.ts} +1 -1
  98. package/dist/zenuml/chunks/{appearance-5RM5MVM2.js → appearance-ROFRJDW7.js} +1 -1
  99. package/dist/zenuml/chunks/{builtin-backends-UTNWL4N3.js → builtin-backends-LM2A6WWK.js} +2 -2
  100. package/dist/zenuml/chunks/{chunk-ZNZRIISS.js → chunk-E6ZQYSVJ.js} +2 -2
  101. package/dist/zenuml/chunks/{chunk-IARQ24W3.js → chunk-KCHXQ5UA.js} +2 -2
  102. package/dist/zenuml/chunks/{chunk-3A6S6GNB.js → chunk-TEDVLVJM.js} +1 -1
  103. package/dist/zenuml/chunks/{chunk-CNLL4BGF.js → chunk-WD3ZPN3X.js} +1 -1
  104. package/dist/zenuml/chunks/{chunk-6J4BGPB2.js → chunk-WUHZDXTF.js} +24 -24
  105. package/dist/zenuml/chunks/{chunk-55WS466K.js → chunk-ZGLUBUQJ.js} +9 -9
  106. package/dist/zenuml/chunks/{render-core-ECIWU5ZS.js → render-core-WTHYSKBN.js} +2 -2
  107. package/dist/zenuml/chunks/{zenuml-N3LZMB2G.js → zenuml-3TCHUQJZ.js} +8 -8
  108. package/dist/zenuml.d.ts +2 -2
  109. package/dist/zenuml.js +1 -1
  110. package/docs/api.md +84 -4
  111. package/docs/quality.md +6 -3
  112. package/docs/style-authoring.md +23 -0
  113. package/docs/testing-strategy.md +59 -52
  114. package/examples/styles/readme-hero.md +4 -3
  115. package/package.json +4 -4
  116. package/server.json +2 -2
  117. package/skills/agentic-mermaid-diagram-workflow/SKILL.md +19 -154
  118. package/skills/agentic-mermaid-diagram-workflow/references/code-mode.md +12 -2
  119. package/skills/agentic-mermaid-diagram-workflow/references/hosted-mcp.md +5 -1
  120. package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +0 -1
  121. package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +0 -3
  122. package/dist/browser-lazy/chunks/xychart-HAVFROGT.js +0 -16
  123. package/dist/chunk-2DNGDTJD.js +0 -2
  124. package/dist/chunk-4F2UGYTM.js +0 -4
  125. package/dist/chunk-EHJI3QYE.js +0 -52
  126. package/dist/chunk-MKE7GNYU.js +0 -146
  127. package/dist/chunk-U4MT3RRE.js +0 -2
  128. package/dist/chunk-VUFVLGTH.js +0 -2
  129. package/dist/chunk-WYIB6BUR.js +0 -2
  130. package/dist/cli-ZYIDBYNS.js +0 -226
  131. package/dist/mcp-cli-YVDCORWA.js +0 -2
  132. package/dist/server-4JGAVXR3.js +0 -524
  133. package/docs/MCP-DIRECTORY-LISTINGS.md +0 -145
@@ -1,20 +1,20 @@
1
- import{a as e}from"./chunk-YHMTSXIR.js";import{c as t}from"./chunk-QCU5G5PZ.js";var r,n,i=0;function o(e,t){if(!r)return t();let o=n,a=i;n=e,i++;let s=performance.now();try{return t()}finally{let t=performance.now()-s;n=o,i=a,r(Object.freeze({stage:e,ms:t,depth:a,...o?{parent:o}:{}}))}}var a=new WeakMap;function s(e){return Object.freeze({...e,attempts:Object.freeze(e.attempts.map(e=>Object.freeze({...e})))})}function l(e,t){let r=a.get(e)??[],n=s(t);r.some(e=>JSON.stringify(e)===JSON.stringify(n))||a.set(e,Object.freeze([...r,n]))}function d(e){return a.get(e)??Object.freeze([])}function u(e,t){let r=a.get(e);r&&a.set(t,r)}var c=class extends Error{constructor(e){super(`No certified layout after ${e.length} bounded attempts: ${e.map(e=>`${e.strategy}: ${e.violations.join("; ")}`).join(" | ")}`),this.attempts=e,this.name="LayoutCertificationError"}attempts;code="LAYOUT_CERTIFICATION_FAILED"},f=class extends Error{constructor(e,t){super(`${e} has not loaded`),this.dependency=e,this.load=t}dependency;load};function h(e){let t=new Set;for(;e instanceof Error&&!t.has(e);){if(e instanceof f)return e;t.add(e),e=e.cause}}function p(e){let t=new Set(e),r=new Map;return(e,n=e)=>{let i="string"==typeof n?n:[...n];if("string"!=typeof i&&i.some(e=>"number"==typeof e&&!Number.isFinite(e)))throw TypeError("Generated identity key numeric components must be finite");let o=JSON.stringify(i),a=r.get(o);if(void 0!==a)return a;let s=e,l=1;for(;t.has(s);)s=`${e}#${l++}`;return t.add(s),r.set(o,s),s}}var m=48;function g(e,t=m){return t+(e-1)*(t+40)}function y(e){let t=0x811c9dc5;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return t>>>0}function b(...e){return y(e.join("|")).toString(36)}function x(e){let t=e>>>0;return()=>{t|=0;let e=Math.imul((t=t+0x6d2b79f5|0)^t>>>15,1|t);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}}function k(e,t,r){return y(`${e>>>0}|${t}|${r}`)}var v,w=class extends Error{constructor(e){super(`Agentic graph layout does not support this input: ${e}`),this.reason=e,this.name="GraphLayoutUnsupportedError"}reason;code="GRAPH_LAYOUT_UNSUPPORTED"};function $(e,t){let r=v;v=e;try{return t()}finally{v=r}}function M(e,t,r,n=!1,i){let o=e.graphLayout;if(!o)return r();let a=[],l,d=o.backend,u;if("agentic"===o.backend)try{l=t()}catch(t){let e=t instanceof w;if(!e&&!(n&&t instanceof c)||"elk"!==o.fallback)throw t;u=e?t.reason:"candidate failed mandatory geometry certification",a.push({backend:"agentic",outcome:e?"unsupported":"candidate-rejected",reason:u}),l=r(),d="elk"}else l=r();a.push({backend:d,outcome:"selected"});let f={requested:o.backend,fallback:o.fallback??"none",selected:d,attempts:a,implementation:"agentic"===d?"agentic-layered@28":"elk-layered@1",...u?{reason:u}:{}};return i?.(l,f),v?.(s(f)),l}function z(e){switch(e){case"LR":return"RIGHT";case"RL":return"LEFT";case"BT":return"UP";default:return"DOWN"}}var S="0.5.4",j=Object.freeze(["svg","png","ascii","unicode","html","layout"]),E=/^[a-z][a-z0-9.-]*:[a-z0-9][a-z0-9._/-]*$/,T=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,O=new Set(["required","preferred","optional"]);function C(e){return E.test(e)}function W(e){if("string"!=typeof e)return;let t=e.match(T);if(!t)return;let r=t[4];if(!r?.split(".").some(e=>/^\d+$/.test(e)&&e.length>1&&e.startsWith("0")))return{major:t[1],minor:t[2],patch:t[3],...r?{prerelease:r}:{}}}function F(e,t){return e.length!==t.length?e.length<t.length?-1:1:e===t?0:e<t?-1:1}function N(e){if("string"!=typeof e)return!1;let t=e.trim();if("*"===t||/^(0|[1-9]\d*)\.(?:x|\*)$/i.test(t))return!0;let r=t.match(/^(\^|~|>=)?(.+)$/),n=W(r?.[2]??"");return!!r&&!!n&&(!n.prerelease||void 0===r[1])}function I(e,t){let r=W(e);if(!r||"string"!=typeof t)return!1;let n=t.trim();if("*"===n)return void 0===r.prerelease;let i=n.match(/^(0|[1-9]\d*)\.(?:x|\*)$/i);if(i)return void 0===r.prerelease&&r.major===i[1];let o=n.match(/^(\^|~|>=)?(.+)$/),a=W(o?.[2]??"");if(!o||!a)return!1;let s=F(r.major,a.major)||F(r.minor,a.minor)||F(r.patch,a.patch);if(r.prerelease||a.prerelease)return void 0===o[1]&&0===s&&r.prerelease===a.prerelease;switch(o[1]){case">=":return s>=0;case"~":return s>=0&&r.major===a.major&&r.minor===a.minor;case"^":return!(s<0)&&("0"!==a.major?r.major===a.major:"0"!==a.minor?"0"===r.major&&r.minor===a.minor:"0"===r.major&&"0"===r.minor&&r.patch===a.patch);default:return 0===s}}var A=Object.freeze([{id:"core:render-request",version:"1.0.0"},{id:"core:family-descriptor",version:"1.0.0"}].map(e=>Object.freeze(e)));function L(e,t){var r,n,i;let o;return r=t.offers,n=t.requirements,i=t.outputAvailable,o={id:`output:${e}`,version:"1.0.0"},function(e,t){if(!Array.isArray(e))throw TypeError("Capability offers must be an array");if(!Array.isArray(t))throw TypeError("Capability requirements must be an array");let r=new Map;for(let[t,n]of e.entries()){if(!n||"object"!=typeof n||Array.isArray(n))throw TypeError(`Capability offer at index ${t} must be an object`);if("string"!=typeof n.id)throw Error(`Invalid capability id "${String(n.id)}"`);if(!C(n.id))throw Error(`Invalid capability id "${n.id}"`);if("string"!=typeof n.version)throw Error(`Capability "${n.id}" has invalid semantic version "${String(n.version)}"`);if(!W(n.version))throw Error(`Capability "${n.id}" has invalid semantic version "${n.version}"`);if(r.has(n.id))throw Error(`Duplicate capability offer "${n.id}"`);r.set(n.id,n.version)}let n=new Set,i=t.map((e,t)=>{if(!e||"object"!=typeof e||Array.isArray(e))throw TypeError(`Capability requirement at index ${t} must be an object`);if("string"!=typeof e.id)throw Error(`Invalid capability id "${String(e.id)}"`);if(!C(e.id))throw Error(`Invalid capability id "${e.id}"`);if(!O.has(e.level))throw Error(`Capability "${e.id}" has invalid requirement level "${String(e.level)}"`);if(!N(e.range))throw Error(`Capability "${e.id}" has invalid semantic-version range "${String(e.range)}"`);if(n.has(e.id))throw Error(`Duplicate capability requirement "${e.id}"`);n.add(e.id);let i=r.get(e.id),o=void 0===i?"unsupported":I(i,e.range)?"selected":"incompatible";return Object.freeze({id:e.id,range:e.range,level:e.level,status:o,...void 0!==i?{version:i}:{}})});return Object.freeze({version:1,accepted:i.every(e=>"required"!==e.level||"selected"===e.status),resolutions:Object.freeze(i)})}([...A,...r,...j.includes(e)&&i?[o]:[]],[{id:"core:render-request",range:"^1.0.0",level:"required"},...n,{id:`output:${e}`,range:"^1.0.0",level:"required"}])}var P=Object.freeze({core:S,scene:"2.0.0"}),q=/^[a-z][a-z0-9-]*$/,B=/^[a-z0-9][a-z0-9._/-]*$/,H=new WeakSet,R=new WeakMap;function D(e,t){if(!q.test(e))throw Error(`Invalid extension kind "${e}"`);if(!B.test(t))throw Error(`Invalid ${e} extension local id "${t}"`);return`${e}:${t}`}function G(e){let t=e.indexOf(":");if(t<=0||t===e.length-1||-1!==e.indexOf(":",t+1))return;let r=e.slice(0,t),n=e.slice(t+1);if(!(!q.test(r)||!B.test(n)))return{kind:r,localId:n}}function Z(e){let t=e.id,r=e.kind,n=e.version,i=e.compatibility,o=e.provenance,a=Object.freeze({...i??{}}),s=Object.freeze({...o}),l=G(t);if(!l||l.kind!==r)throw Error(`Extension id "${t}" must use the "${r}:" namespace`);if(!W(n))throw Error(`Extension "${t}" requires a semantic version (received "${n}")`);if(0===s.owner.trim().length)throw Error(`Extension "${t}" requires a provenance owner`);if(0===s.source.trim().length)throw Error(`Extension "${t}" requires a provenance source`);let d=Object.freeze({id:t,kind:r,version:n,compatibility:a,provenance:s}),u=function(e){let t=[];for(let[r,n]of Object.entries(e.compatibility)){if(void 0===n)continue;let e=P[r];if(!N(n)){t.push(Object.freeze({contract:r,range:n,status:"invalid",diagnostic:`Compatibility requirement "${r}" has invalid semantic-version range "${n}".`}));continue}if(void 0!==e){let i=I(e,n);t.push(Object.freeze({contract:r,range:n,status:i?"compatible":"incompatible",version:e,...i?{}:{diagnostic:`Compatibility requirement "${r}" range "${n}" does not include host version ${e}.`}}));continue}if(!C(r)){t.push(Object.freeze({contract:r,range:n,status:"invalid",diagnostic:`Unknown compatibility requirement "${r}" must use a namespace.`}));continue}t.push(Object.freeze({contract:r,range:n,status:"deferred"}))}return Object.freeze({accepted:t.every(e=>"compatible"===e.status||"deferred"===e.status),resolutions:Object.freeze(t)})}(d);if(!u.accepted)throw Error(`Extension "${t}" has incompatible requirements: ${u.resolutions.filter(e=>"incompatible"===e.status||"invalid"===e.status).map(e=>e.diagnostic).join("; ")}`);return H.add(d),d}var _=class extends Error{constructor(e,t){super(`Cannot register ${e.kind} "${e.id}" for owner "${e.provenance.owner}": already registered by "${t.provenance.owner}" at version ${t.version}`),this.incoming=e,this.existing=t,this.name="ExtensionCollisionError"}incoming;existing;code="EXTENSION_ID_COLLISION"};function J(e,t){let r=function(e,t){let r=R.get(e);if(r)throw r.reentrantAttempted=!0,Error(`Extension registry mutation is forbidden while ${r.operation} is in progress`);let n={operation:t,reentrantAttempted:!1};return R.set(e,n),n}(e,"extension registration");try{let n=Object.freeze({identity:t.identity,value:t.value});if(!H.has(n.identity))throw TypeError("Extension registration identity must be created by createExtensionIdentity()");let i=n.identity.id,o=e.get(i);if(o)throw new _(n.identity,o.identity);(function(e){if(e.reentrantAttempted)throw Error(`Extension registry mutation is forbidden after a reentrant attempt during ${e.operation}`)})(r),e.set(i,n)}finally{R.get(e)===r&&R.delete(e)}}var U=Object.freeze({fontFamily:{kind:"font"},fontSize:{kind:"number",minimum:1,maximum:256,expected:"between 1 and 256"},fontWeight:{kind:"number",minimum:1,maximum:1e3,expected:"between 1 and 1000"},letterSpacing:{kind:"number",minimum:-2,maximum:4,expected:"between -2 and 4"},textTransform:{kind:"enum",values:["uppercase","lowercase","capitalize"]},textColor:{kind:"color"},paddingX:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},paddingY:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},cornerRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},lineWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20"},bendRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},fillColor:{kind:"color"},borderColor:{kind:"color"},strokeColor:{kind:"color"},headerFillColor:{kind:"color"},cue:{kind:"enum",values:["none","outline","double-line","pattern"]}}),V=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),X=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","lineWidth","bendRadius","strokeColor"]),Y=Object.freeze([...V,"fontFamily","headerFillColor"]),Q=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),K=Object.freeze(["fontFamily","fontSize","fontWeight","letterSpacing","textTransform","textColor","fillColor","borderColor","strokeColor","lineWidth","cue"]),ee=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","cue"]),et=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","textColor"]),er=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth"]),en=Object.freeze(["borderColor","strokeColor","lineWidth"]),ei=Object.freeze([...er,"cue"]);function eo(e,t){return Object.freeze({properties:e,...t?{bindingFamilies:Object.freeze([...t])}:{}})}var ea=Object.freeze({node:eo(V),edge:eo(X),group:eo(Y),"group-header":eo(K,["journey"]),label:eo(Q),actor:eo(V,["sequence"]),relationship:eo(X,["er"]),"pie-slice":eo(ee,["pie","radar"]),legend:eo(et,["radar"]),bar:eo(er,["xychart","sankey","treemap"]),series:eo(en,["xychart"]),point:eo(er,["radar","xychart"]),task:eo(ei,["gantt"]),milestone:eo(ei,["gantt"])}),es=Object.freeze(Object.keys(ea)),el=Object.freeze(es.filter(e=>"bindingFamilies"in ea[e])),ed=Object.freeze([...new Set(el.flatMap(e=>ea[e].properties))]),eu=["shape","connector","text","group","document"],ec=["shape"],ef=["connector"],eh=["text"],ep=["shape","group"],em=["connector","group"],eg=["text","group"];function ey(e,t,r,n={}){let i=ea[e];return Object.freeze({applicableKinds:t,styleFallback:r,styleConsumption:i?"exact":"fallback-only",styleExtras:Object.freeze([]),...i?{styleProperties:i.properties}:{},styleBindingFamilies:Object.freeze([...i?.bindingFamilies??[]]),domIdentity:!1,relation:!1,sketch:"none",textHalo:!1,...n})}var eb=Object.freeze({node:ey("node",ep,"node",{domIdentity:!0,sketch:"shape"}),edge:ey("edge",ef,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),"edge-label":ey("edge-label",eg,"label"),group:ey("group",ep,"group",{domIdentity:!0,sketch:"shape"}),"group-header":ey("group-header",eu,"group",{sketch:"shape",textHalo:!0}),label:ey("label",eh,"label",{textHalo:!0}),actor:ey("actor",ep,"node",{domIdentity:!0,sketch:"shape"}),lifeline:ey("lifeline",em,"edge",{sketch:"connector"}),activation:ey("activation",ep,"node",{domIdentity:!0,sketch:"shape"}),message:ey("message",em,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),block:ey("block",eu,"group",{domIdentity:!0,sketch:"shape"}),note:ey("note",ep,"group",{domIdentity:!0,sketch:"shape"}),"class-box":ey("class-box",ep,"node",{domIdentity:!0,sketch:"shape"}),member:ey("member",eh,"label",{domIdentity:!0,textHalo:!0}),entity:ey("entity",ep,"node",{domIdentity:!0,sketch:"shape"}),attribute:ey("attribute",eg,"label",{domIdentity:!0,textHalo:!0}),relationship:ey("relationship",ef,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),cardinality:ey("cardinality",["shape","text"],"label",{domIdentity:!0,textHalo:!0}),"pie-slice":ey("pie-slice",ec,"node",{domIdentity:!0,sketch:"shape"}),legend:ey("legend",["shape","text","group"],"group",{textHalo:!0}),bar:ey("bar",ec,"node",{domIdentity:!0,sketch:"shape"}),series:ey("series",ef,"edge",{domIdentity:!0,sketch:"connector"}),point:ey("point",ec,"node",{domIdentity:!0}),axis:ey("axis",eu,"label",{textHalo:!0}),grid:ey("grid",eu,"edge"),plate:ey("plate",ec,"node",{domIdentity:!0,sketch:"shape"}),section:ey("section",eu,"group",{domIdentity:!0,sketch:"shape",textHalo:!0}),task:ey("task",eu,"node",{domIdentity:!0,sketch:"shape"}),milestone:ey("milestone",ec,"node",{domIdentity:!0,sketch:"shape"}),"marker-line":ey("marker-line",eu,"edge"),rail:ey("rail",eu,"edge",{sketch:"connector"}),period:ey("period",ep,"group",{domIdentity:!0,sketch:"shape"}),event:ey("event",ep,"group",{domIdentity:!0,sketch:"shape"}),score:ey("score",eu,"node"),"actor-pill":ey("actor-pill",ec,"node",{sketch:"shape"}),service:ey("service",ep,"node",{domIdentity:!0,sketch:"shape"}),junction:ey("junction",ep,"node",{domIdentity:!0}),icon:ey("icon",["shape","text","group","document"],"node",{textHalo:!0}),title:ey("title",eu,"label",{domIdentity:!0,textHalo:!0}),defs:ey("defs",["document"],"label"),prelude:ey("prelude",["document"],"label"),chrome:ey("chrome",eu,"label")}),ex=Object.freeze({applicableKinds:eu,styleFallback:"label",styleConsumption:"fallback-only",styleExtras:Object.freeze([]),styleBindingFamilies:Object.freeze([]),domIdentity:!0,relation:!1,sketch:"none",textHalo:!1}),ek=Object.freeze(Object.entries(eb).map(([e,t])=>Object.freeze({identity:Z({id:`role:${e}`,kind:"role",version:"1.0.0",compatibility:{core:S,scene:"^2.0.0"},provenance:{owner:"agentic-mermaid",source:"built-in",reference:"src/scene/roles.ts"}}),role:e,traits:t,style:Object.freeze({fallbackRole:t.styleFallback,applicableProperties:t.styleProperties??Object.freeze([])})})));function ev(e){let t;return((t=eb[e])?{traits:t,source:"builtin"}:{traits:ex,source:"namespaced-safe"}).traits}function ew(e,t,r={},n={}){let i=ek.find(e=>e.role===t),o=e?.roles,a=!1===n.includeFallback?void 0:i?o?.[i.style.fallbackRole]:void 0,s=o?.[t],l=a||s?{...a,...s}:void 0,d=new Set(i?.style.applicableProperties??[]);for(let n of e?.bindings??[]){if(void 0!==n.role&&n.role!==t||!function(e,t){let r=t[e.channel];return Array.isArray(r)?r.includes(e.value):String(r??"")===e.value}(n,r))continue;let i=e?.semanticSlots?.[n.slot];if(!i)continue;let o=Object.fromEntries(Object.entries(i).filter(([e])=>d.has(e)));l={...l,...o}}return l?Object.freeze(l):void 0}var e$=Object.freeze({id:"agentic-mermaid:inter-estimate",version:"4.0.0"});function eM(e,t){let r=function(e){if(void 0===e)return;if("object"!=typeof e||null===e)throw TypeError("textMeasurement must be an object with id, version, and measure");let{id:t,version:r,measure:n}=e;if("string"!=typeof t||t.length>160||!/^[A-Za-z][A-Za-z0-9._:/-]*$/.test(t))throw TypeError("textMeasurement.id must be a stable name of at most 160 characters");if(t===e$.id)throw TypeError("textMeasurement.id is reserved for the deterministic default");if("string"!=typeof r||r.length>80||!W(r))throw TypeError("textMeasurement.version must be a semantic version");if("function"!=typeof n)throw TypeError("textMeasurement.measure must be a function");return Object.freeze({id:t,version:r,measure:n})}(e);if(!r)return;let n=Object.freeze({id:r.id,version:r.version}),i=new Map;return Object.freeze({identity:n,width(e){let o=e.fontFamily??(e.monospace?"JetBrains Mono":t),a=JSON.stringify([e.text,o,e.fontSize,e.fontWeight,e.fontStyle,e.monospace]),s=i.get(a);if(void 0!==s)return s;let l=ez(void 0,()=>r.measure(Object.freeze({...e,fontFamily:o})));if("number"!=typeof l||!Number.isFinite(l)||l<0||l>1e6)throw RangeError(`Text measurement profile ${n.id}@${n.version} must return a finite width between 0 and 1000000 pixels`);return i.size<2e4&&i.set(a,l),l}})}function ez(e,t){let r=eE;eE=e;try{return t()}finally{eE=r}}function eS(){return void 0!==eE}function ej(e){return eE?.width(e)}var eE,eT,eO=["text-spans","indexed-layout","position-cache"],eC=globalThis,eW=eC.process?.env?.AGENTIC_MERMAID_EXPERIMENTS??eC.AGENTIC_MERMAID_EXPERIMENTS,eF=new Set("string"==typeof eW?eW.split(",").map(e=>e.trim()).filter(Boolean):eO);function eN(e){return(eT??eF).has(e)}var eI=class{#e=new Map;#t=0;#r;#n;#i;constructor(e,t,r){this.#r=e,this.#n=t,this.#i=r}get(e){let t=this.#e.get(e);if(t)return this.#e.delete(e),this.#e.set(e,t),t.value}canFit(e,t){let r=this.#e.get(e);return Number.isFinite(t)&&t>=0&&this.#e.size+ +!r<=this.#r&&this.#t-(r?.weight??0)+t<=this.#n}leastRecentlyUsed(){let e=this.#e.values().next();return e.done?void 0:e.value.value}delete(e){let t=this.#e.get(e);return!!t&&(this.#e.delete(e),this.#t-=t.weight,this.#i?.(e,t.value),!0)}set(e,t,r){if(!(!Number.isFinite(r)||r<0||r>this.#n))for(this.delete(e),this.#e.set(e,{value:t,weight:r}),this.#t+=r;this.#e.size>this.#r||this.#t>this.#n;){let e=this.#e.keys().next().value;this.delete(e)}}clear(){if(this.#i)for(let e of this.#e.keys())this.delete(e);else this.#e.clear(),this.#t=0}},eA="<\\/?(?:b|strong|i|em|u|s|del)\\s*>",eL=/<(\/)?(?:(b|strong)|(i|em)|(u)|(s|del))\s*>/gi,eP=RegExp(eA,"i");function eq(e){let t,r=[],n=!1,i=!1,o=!1,a=!1,s=0;for(eL.lastIndex=0;null!==(t=eL.exec(e));){t.index>s&&r.push({text:e.slice(s,t.index),bold:n,italic:i,underline:o,strikethrough:a}),s=t.index+t[0].length;let l=!!t[1];t[2]?n=!l:t[3]?i=!l:t[4]?o=!l:t[5]&&(a=!l)}return s<e.length&&r.push({text:e.slice(s),bold:n,italic:i,underline:o,strikethrough:a}),r}var eB=new Intl.Segmenter(void 0,{granularity:"grapheme"}),eH=/^[\x20-\x7e]*$/;function eR(e){return eH.test(e)?e.split(""):Array.from(eB.segment(e),e=>e.segment)}function eD(e=()=>!1){let t=new WeakSet,r=r=>t.has(r)||e(r);return{has:r,freeze:e=>(Object.freeze(e),Reflect.ownKeys(e).every(t=>{let n=Object.getOwnPropertyDescriptor(e,t),i=n.value;return"value"in n&&(null===i||"object"!=typeof i&&"function"!=typeof i||r(i))})&&t.add(e),e)}}function eG(e,t=!1){if(!/[\u0000-\u001f\u007f-\u009f]/.test(e))return e;let r="";for(let n of e){let e=n.codePointAt(0),i=e<=31||e>=127&&e<=159;" "===n?r+=" ":!i||t&&(n===`
1
+ import{a as e}from"./chunk-YHMTSXIR.js";import{c as t}from"./chunk-QCU5G5PZ.js";var r,n,i=0;function o(e,t){if(!r)return t();let o=n,a=i;n=e,i++;let s=performance.now();try{return t()}finally{let t=performance.now()-s;n=o,i=a,r(Object.freeze({stage:e,ms:t,depth:a,...o?{parent:o}:{}}))}}var a=new WeakMap;function s(e){return Object.freeze({...e,attempts:Object.freeze(e.attempts.map(e=>Object.freeze({...e})))})}function l(e,t){let r=a.get(e)??[],n=s(t);r.some(e=>JSON.stringify(e)===JSON.stringify(n))||a.set(e,Object.freeze([...r,n]))}function d(e){return a.get(e)??Object.freeze([])}function u(e,t){let r=a.get(e);r&&a.set(t,r)}var c=class extends Error{constructor(e){super(`No certified layout after ${e.length} bounded attempts: ${e.map(e=>`${e.strategy}: ${e.violations.join("; ")}`).join(" | ")}`),this.attempts=e,this.name="LayoutCertificationError"}attempts;code="LAYOUT_CERTIFICATION_FAILED"},f=class extends Error{constructor(e,t){super(`${e} has not loaded`),this.dependency=e,this.load=t}dependency;load};function h(e){let t=new Set;for(;e instanceof Error&&!t.has(e);){if(e instanceof f)return e;t.add(e),e=e.cause}}function p(e){let t=new Set(e),r=new Map;return(e,n=e)=>{let i="string"==typeof n?n:[...n];if("string"!=typeof i&&i.some(e=>"number"==typeof e&&!Number.isFinite(e)))throw TypeError("Generated identity key numeric components must be finite");let o=JSON.stringify(i),a=r.get(o);if(void 0!==a)return a;let s=e,l=1;for(;t.has(s);)s=`${e}#${l++}`;return t.add(s),r.set(o,s),s}}var m=48;function g(e,t=m){return t+(e-1)*(t+40)}function y(e){let t=0x811c9dc5;for(let r=0;r<e.length;r++)t^=e.charCodeAt(r),t=Math.imul(t,0x1000193);return t>>>0}function b(...e){return y(e.join("|")).toString(36)}function x(e){let t=e>>>0;return()=>{t|=0;let e=Math.imul((t=t+0x6d2b79f5|0)^t>>>15,1|t);return(((e=e+Math.imul(e^e>>>7,61|e)^e)^e>>>14)>>>0)/0x100000000}}function k(e,t,r){return y(`${e>>>0}|${t}|${r}`)}var v,w=class extends Error{constructor(e){super(`Agentic graph layout does not support this input: ${e}`),this.reason=e,this.name="GraphLayoutUnsupportedError"}reason;code="GRAPH_LAYOUT_UNSUPPORTED"};function $(e,t){let r=v;v=e;try{return t()}finally{v=r}}function M(e,t,r,n=!1,i){let o=e.graphLayout;if(!o)return r();let a=[],l,d=o.backend,u;if("agentic"===o.backend)try{l=t()}catch(t){let e=t instanceof w;if(!e&&!(n&&t instanceof c)||"elk"!==o.fallback)throw t;u=e?t.reason:"candidate failed mandatory geometry certification",a.push({backend:"agentic",outcome:e?"unsupported":"candidate-rejected",reason:u}),l=r(),d="elk"}else l=r();a.push({backend:d,outcome:"selected"});let f={requested:o.backend,fallback:o.fallback??"none",selected:d,attempts:a,implementation:"agentic"===d?"agentic-layered@28":"elk-layered@1",...u?{reason:u}:{}};return i?.(l,f),v?.(s(f)),l}function z(e){switch(e){case"LR":return"RIGHT";case"RL":return"LEFT";case"BT":return"UP";default:return"DOWN"}}var S="0.5.6",j=Object.freeze(["svg","png","ascii","unicode","html","layout"]),E=/^[a-z][a-z0-9.-]*:[a-z0-9][a-z0-9._/-]*$/,T=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,O=new Set(["required","preferred","optional"]);function C(e){return E.test(e)}function W(e){if("string"!=typeof e)return;let t=e.match(T);if(!t)return;let r=t[4];if(!r?.split(".").some(e=>/^\d+$/.test(e)&&e.length>1&&e.startsWith("0")))return{major:t[1],minor:t[2],patch:t[3],...r?{prerelease:r}:{}}}function F(e,t){return e.length!==t.length?e.length<t.length?-1:1:e===t?0:e<t?-1:1}function I(e){if("string"!=typeof e)return!1;let t=e.trim();if("*"===t||/^(0|[1-9]\d*)\.(?:x|\*)$/i.test(t))return!0;let r=t.match(/^(\^|~|>=)?(.+)$/),n=W(r?.[2]??"");return!!r&&!!n&&(!n.prerelease||void 0===r[1])}function N(e,t){let r=W(e);if(!r||"string"!=typeof t)return!1;let n=t.trim();if("*"===n)return void 0===r.prerelease;let i=n.match(/^(0|[1-9]\d*)\.(?:x|\*)$/i);if(i)return void 0===r.prerelease&&r.major===i[1];let o=n.match(/^(\^|~|>=)?(.+)$/),a=W(o?.[2]??"");if(!o||!a)return!1;let s=F(r.major,a.major)||F(r.minor,a.minor)||F(r.patch,a.patch);if(r.prerelease||a.prerelease)return void 0===o[1]&&0===s&&r.prerelease===a.prerelease;switch(o[1]){case">=":return s>=0;case"~":return s>=0&&r.major===a.major&&r.minor===a.minor;case"^":return!(s<0)&&("0"!==a.major?r.major===a.major:"0"!==a.minor?"0"===r.major&&r.minor===a.minor:"0"===r.major&&"0"===r.minor&&r.patch===a.patch);default:return 0===s}}var A=Object.freeze([{id:"core:render-request",version:"1.0.0"},{id:"core:family-descriptor",version:"1.0.0"}].map(e=>Object.freeze(e)));function L(e,t){var r,n,i;let o;return r=t.offers,n=t.requirements,i=t.outputAvailable,o={id:`output:${e}`,version:"1.0.0"},function(e,t){if(!Array.isArray(e))throw TypeError("Capability offers must be an array");if(!Array.isArray(t))throw TypeError("Capability requirements must be an array");let r=new Map;for(let[t,n]of e.entries()){if(!n||"object"!=typeof n||Array.isArray(n))throw TypeError(`Capability offer at index ${t} must be an object`);if("string"!=typeof n.id)throw Error(`Invalid capability id "${String(n.id)}"`);if(!C(n.id))throw Error(`Invalid capability id "${n.id}"`);if("string"!=typeof n.version)throw Error(`Capability "${n.id}" has invalid semantic version "${String(n.version)}"`);if(!W(n.version))throw Error(`Capability "${n.id}" has invalid semantic version "${n.version}"`);if(r.has(n.id))throw Error(`Duplicate capability offer "${n.id}"`);r.set(n.id,n.version)}let n=new Set,i=t.map((e,t)=>{if(!e||"object"!=typeof e||Array.isArray(e))throw TypeError(`Capability requirement at index ${t} must be an object`);if("string"!=typeof e.id)throw Error(`Invalid capability id "${String(e.id)}"`);if(!C(e.id))throw Error(`Invalid capability id "${e.id}"`);if(!O.has(e.level))throw Error(`Capability "${e.id}" has invalid requirement level "${String(e.level)}"`);if(!I(e.range))throw Error(`Capability "${e.id}" has invalid semantic-version range "${String(e.range)}"`);if(n.has(e.id))throw Error(`Duplicate capability requirement "${e.id}"`);n.add(e.id);let i=r.get(e.id),o=void 0===i?"unsupported":N(i,e.range)?"selected":"incompatible";return Object.freeze({id:e.id,range:e.range,level:e.level,status:o,...void 0!==i?{version:i}:{}})});return Object.freeze({version:1,accepted:i.every(e=>"required"!==e.level||"selected"===e.status),resolutions:Object.freeze(i)})}([...A,...r,...j.includes(e)&&i?[o]:[]],[{id:"core:render-request",range:"^1.0.0",level:"required"},...n,{id:`output:${e}`,range:"^1.0.0",level:"required"}])}var P=Object.freeze({core:S,scene:"2.0.0"}),q=/^[a-z][a-z0-9-]*$/,B=/^[a-z0-9][a-z0-9._/-]*$/,R=new WeakSet,H=new WeakMap;function D(e,t){if(!q.test(e))throw Error(`Invalid extension kind "${e}"`);if(!B.test(t))throw Error(`Invalid ${e} extension local id "${t}"`);return`${e}:${t}`}function G(e){let t=e.indexOf(":");if(t<=0||t===e.length-1||-1!==e.indexOf(":",t+1))return;let r=e.slice(0,t),n=e.slice(t+1);if(!(!q.test(r)||!B.test(n)))return{kind:r,localId:n}}function Z(e){let t=e.id,r=e.kind,n=e.version,i=e.compatibility,o=e.provenance,a=Object.freeze({...i??{}}),s=Object.freeze({...o}),l=G(t);if(!l||l.kind!==r)throw Error(`Extension id "${t}" must use the "${r}:" namespace`);if(!W(n))throw Error(`Extension "${t}" requires a semantic version (received "${n}")`);if(0===s.owner.trim().length)throw Error(`Extension "${t}" requires a provenance owner`);if(0===s.source.trim().length)throw Error(`Extension "${t}" requires a provenance source`);let d=Object.freeze({id:t,kind:r,version:n,compatibility:a,provenance:s}),u=function(e){let t=[];for(let[r,n]of Object.entries(e.compatibility)){if(void 0===n)continue;let e=P[r];if(!I(n)){t.push(Object.freeze({contract:r,range:n,status:"invalid",diagnostic:`Compatibility requirement "${r}" has invalid semantic-version range "${n}".`}));continue}if(void 0!==e){let i=N(e,n);t.push(Object.freeze({contract:r,range:n,status:i?"compatible":"incompatible",version:e,...i?{}:{diagnostic:`Compatibility requirement "${r}" range "${n}" does not include host version ${e}.`}}));continue}if(!C(r)){t.push(Object.freeze({contract:r,range:n,status:"invalid",diagnostic:`Unknown compatibility requirement "${r}" must use a namespace.`}));continue}t.push(Object.freeze({contract:r,range:n,status:"deferred"}))}return Object.freeze({accepted:t.every(e=>"compatible"===e.status||"deferred"===e.status),resolutions:Object.freeze(t)})}(d);if(!u.accepted)throw Error(`Extension "${t}" has incompatible requirements: ${u.resolutions.filter(e=>"incompatible"===e.status||"invalid"===e.status).map(e=>e.diagnostic).join("; ")}`);return R.add(d),d}var _=class extends Error{constructor(e,t){super(`Cannot register ${e.kind} "${e.id}" for owner "${e.provenance.owner}": already registered by "${t.provenance.owner}" at version ${t.version}`),this.incoming=e,this.existing=t,this.name="ExtensionCollisionError"}incoming;existing;code="EXTENSION_ID_COLLISION"};function J(e,t){let r=function(e,t){let r=H.get(e);if(r)throw r.reentrantAttempted=!0,Error(`Extension registry mutation is forbidden while ${r.operation} is in progress`);let n={operation:t,reentrantAttempted:!1};return H.set(e,n),n}(e,"extension registration");try{let n=Object.freeze({identity:t.identity,value:t.value});if(!R.has(n.identity))throw TypeError("Extension registration identity must be created by createExtensionIdentity()");let i=n.identity.id,o=e.get(i);if(o)throw new _(n.identity,o.identity);(function(e){if(e.reentrantAttempted)throw Error(`Extension registry mutation is forbidden after a reentrant attempt during ${e.operation}`)})(r),e.set(i,n)}finally{H.get(e)===r&&H.delete(e)}}var V=Object.freeze({fontFamily:{kind:"font"},fontSize:{kind:"number",minimum:1,maximum:256,expected:"between 1 and 256"},fontWeight:{kind:"number",minimum:1,maximum:1e3,expected:"between 1 and 1000"},letterSpacing:{kind:"number",minimum:-2,maximum:4,expected:"between -2 and 4"},textTransform:{kind:"enum",values:["uppercase","lowercase","capitalize"]},textColor:{kind:"color"},paddingX:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},paddingY:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},cornerRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},lineWidth:{kind:"number",exclusiveMinimum:0,maximum:20,expected:"greater than 0 and at most 20"},bendRadius:{kind:"number",minimum:0,maximum:256,expected:"between 0 and 256"},fillColor:{kind:"color"},borderColor:{kind:"color"},strokeColor:{kind:"color"},headerFillColor:{kind:"color"},cue:{kind:"enum",values:["none","outline","double-line","pattern"]}}),U=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","paddingX","paddingY","cornerRadius","lineWidth","fillColor","borderColor"]),Y=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor","lineWidth","bendRadius","strokeColor"]),X=Object.freeze([...U,"fontFamily","headerFillColor"]),Q=Object.freeze(["fontSize","fontWeight","letterSpacing","textTransform","textColor"]),K=Object.freeze(["fontFamily","fontSize","fontWeight","letterSpacing","textTransform","textColor","fillColor","borderColor","strokeColor","lineWidth","cue"]),ee=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","cue"]),et=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth","textColor"]),er=Object.freeze(["fillColor","borderColor","strokeColor","lineWidth"]),en=Object.freeze(["borderColor","strokeColor","lineWidth"]),ei=Object.freeze([...er,"cue"]);function eo(e,t){return Object.freeze({properties:e,...t?{bindingFamilies:Object.freeze([...t])}:{}})}var ea=Object.freeze({node:eo(U),edge:eo(Y),group:eo(X),"group-header":eo(K,["journey"]),label:eo(Q),actor:eo(U,["sequence"]),relationship:eo(Y,["er"]),"pie-slice":eo(ee,["pie","radar"]),legend:eo(et,["radar"]),bar:eo(er,["xychart","sankey","treemap"]),series:eo(en,["xychart"]),point:eo(er,["radar","xychart"]),task:eo(ei,["gantt"]),milestone:eo(ei,["gantt"])}),es=Object.freeze(Object.keys(ea)),el=Object.freeze(es.filter(e=>"bindingFamilies"in ea[e])),ed=Object.freeze([...new Set(el.flatMap(e=>ea[e].properties))]),eu=["shape","connector","text","group","document"],ec=["shape"],ef=["connector"],eh=["text"],ep=["shape","group"],em=["connector","group"],eg=["text","group"];function ey(e,t,r,n={}){let i=ea[e];return Object.freeze({applicableKinds:t,styleFallback:r,styleConsumption:i?"exact":"fallback-only",styleExtras:Object.freeze([]),...i?{styleProperties:i.properties}:{},styleBindingFamilies:Object.freeze([...i?.bindingFamilies??[]]),domIdentity:!1,relation:!1,sketch:"none",textHalo:!1,...n})}var eb=Object.freeze({node:ey("node",ep,"node",{domIdentity:!0,sketch:"shape"}),edge:ey("edge",ef,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),"edge-label":ey("edge-label",eg,"label"),group:ey("group",ep,"group",{domIdentity:!0,sketch:"shape"}),"group-header":ey("group-header",eu,"group",{sketch:"shape",textHalo:!0}),label:ey("label",eh,"label",{textHalo:!0}),actor:ey("actor",ep,"node",{domIdentity:!0,sketch:"shape"}),lifeline:ey("lifeline",em,"edge",{sketch:"connector"}),activation:ey("activation",ep,"node",{domIdentity:!0,sketch:"shape"}),message:ey("message",em,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),block:ey("block",eu,"group",{domIdentity:!0,sketch:"shape"}),note:ey("note",ep,"group",{domIdentity:!0,sketch:"shape"}),"class-box":ey("class-box",ep,"node",{domIdentity:!0,sketch:"shape"}),member:ey("member",eh,"label",{domIdentity:!0,textHalo:!0}),entity:ey("entity",ep,"node",{domIdentity:!0,sketch:"shape"}),attribute:ey("attribute",eg,"label",{domIdentity:!0,textHalo:!0}),relationship:ey("relationship",ef,"edge",{domIdentity:!0,relation:!0,sketch:"connector"}),cardinality:ey("cardinality",["shape","text"],"label",{domIdentity:!0,textHalo:!0}),"pie-slice":ey("pie-slice",ec,"node",{domIdentity:!0,sketch:"shape"}),legend:ey("legend",["shape","text","group"],"group",{textHalo:!0}),bar:ey("bar",ec,"node",{domIdentity:!0,sketch:"shape"}),series:ey("series",ef,"edge",{domIdentity:!0,sketch:"connector"}),point:ey("point",ec,"node",{domIdentity:!0}),axis:ey("axis",eu,"label",{textHalo:!0}),grid:ey("grid",eu,"edge"),plate:ey("plate",ec,"node",{domIdentity:!0,sketch:"shape"}),section:ey("section",eu,"group",{domIdentity:!0,sketch:"shape",textHalo:!0}),task:ey("task",eu,"node",{domIdentity:!0,sketch:"shape"}),milestone:ey("milestone",ec,"node",{domIdentity:!0,sketch:"shape"}),"marker-line":ey("marker-line",eu,"edge"),rail:ey("rail",eu,"edge",{sketch:"connector"}),period:ey("period",ep,"group",{domIdentity:!0,sketch:"shape"}),event:ey("event",ep,"group",{domIdentity:!0,sketch:"shape"}),score:ey("score",eu,"node"),"actor-pill":ey("actor-pill",ec,"node",{sketch:"shape"}),service:ey("service",ep,"node",{domIdentity:!0,sketch:"shape"}),junction:ey("junction",ep,"node",{domIdentity:!0}),icon:ey("icon",["shape","text","group","document"],"node",{textHalo:!0}),title:ey("title",eu,"label",{domIdentity:!0,textHalo:!0}),defs:ey("defs",["document"],"label"),prelude:ey("prelude",["document"],"label"),chrome:ey("chrome",eu,"label")}),ex=Object.freeze({applicableKinds:eu,styleFallback:"label",styleConsumption:"fallback-only",styleExtras:Object.freeze([]),styleBindingFamilies:Object.freeze([]),domIdentity:!0,relation:!1,sketch:"none",textHalo:!1}),ek=Object.freeze(Object.entries(eb).map(([e,t])=>Object.freeze({identity:Z({id:`role:${e}`,kind:"role",version:"1.0.0",compatibility:{core:S,scene:"^2.0.0"},provenance:{owner:"agentic-mermaid",source:"built-in",reference:"src/scene/roles.ts"}}),role:e,traits:t,style:Object.freeze({fallbackRole:t.styleFallback,applicableProperties:t.styleProperties??Object.freeze([])})})));function ev(e){let t;return((t=eb[e])?{traits:t,source:"builtin"}:{traits:ex,source:"namespaced-safe"}).traits}function ew(e,t,r={},n={}){let i=ek.find(e=>e.role===t),o=e?.roles,a=!1===n.includeFallback?void 0:i?o?.[i.style.fallbackRole]:void 0,s=o?.[t],l=a||s?{...a,...s}:void 0,d=new Set(i?.style.applicableProperties??[]);for(let n of e?.bindings??[]){if(void 0!==n.role&&n.role!==t||!function(e,t){let r=t[e.channel];return Array.isArray(r)?r.includes(e.value):String(r??"")===e.value}(n,r))continue;let i=e?.semanticSlots?.[n.slot];if(!i)continue;let o=Object.fromEntries(Object.entries(i).filter(([e])=>d.has(e)));l={...l,...o}}return l?Object.freeze(l):void 0}var e$=Object.freeze({id:"agentic-mermaid:inter-estimate",version:"4.0.0"});function eM(e,t){let r=function(e){if(void 0===e)return;if("object"!=typeof e||null===e)throw TypeError("textMeasurement must be an object with id, version, and measure");let{id:t,version:r,measure:n}=e;if("string"!=typeof t||t.length>160||!/^[A-Za-z][A-Za-z0-9._:/-]*$/.test(t))throw TypeError("textMeasurement.id must be a stable name of at most 160 characters");if(t===e$.id)throw TypeError("textMeasurement.id is reserved for the deterministic default");if("string"!=typeof r||r.length>80||!W(r))throw TypeError("textMeasurement.version must be a semantic version");if("function"!=typeof n)throw TypeError("textMeasurement.measure must be a function");return Object.freeze({id:t,version:r,measure:n})}(e);if(!r)return;let n=Object.freeze({id:r.id,version:r.version}),i=new Map;return Object.freeze({identity:n,width(e){let o=e.fontFamily??(e.monospace?"JetBrains Mono":t),a=JSON.stringify([e.text,o,e.fontSize,e.fontWeight,e.fontStyle,e.monospace]),s=i.get(a);if(void 0!==s)return s;let l=ez(void 0,()=>r.measure(Object.freeze({...e,fontFamily:o})));if("number"!=typeof l||!Number.isFinite(l)||l<0||l>1e6)throw RangeError(`Text measurement profile ${n.id}@${n.version} must return a finite width between 0 and 1000000 pixels`);return i.size<2e4&&i.set(a,l),l}})}function ez(e,t){let r=eE;eE=e;try{return t()}finally{eE=r}}function eS(){return void 0!==eE}function ej(e){return eE?.width(e)}var eE,eT,eO=["text-spans","indexed-layout","position-cache"],eC=globalThis,eW=eC.process?.env?.AGENTIC_MERMAID_EXPERIMENTS??eC.AGENTIC_MERMAID_EXPERIMENTS,eF=new Set("string"==typeof eW?eW.split(",").map(e=>e.trim()).filter(Boolean):eO);function eI(e){return(eT??eF).has(e)}var eN=class{#e=new Map;#t=0;#r;#n;#i;constructor(e,t,r){this.#r=e,this.#n=t,this.#i=r}get(e){let t=this.#e.get(e);if(t)return this.#e.delete(e),this.#e.set(e,t),t.value}canFit(e,t){let r=this.#e.get(e);return Number.isFinite(t)&&t>=0&&this.#e.size+ +!r<=this.#r&&this.#t-(r?.weight??0)+t<=this.#n}leastRecentlyUsed(){let e=this.#e.values().next();return e.done?void 0:e.value.value}delete(e){let t=this.#e.get(e);return!!t&&(this.#e.delete(e),this.#t-=t.weight,this.#i?.(e,t.value),!0)}set(e,t,r){if(!(!Number.isFinite(r)||r<0||r>this.#n))for(this.delete(e),this.#e.set(e,{value:t,weight:r}),this.#t+=r;this.#e.size>this.#r||this.#t>this.#n;){let e=this.#e.keys().next().value;this.delete(e)}}clear(){if(this.#i)for(let e of this.#e.keys())this.delete(e);else this.#e.clear(),this.#t=0}},eA="<\\/?(?:b|strong|i|em|u|s|del)\\s*>",eL=/<(\/)?(?:(b|strong)|(i|em)|(u)|(s|del))\s*>/gi,eP=RegExp(eA,"i");function eq(e){let t,r=[],n=!1,i=!1,o=!1,a=!1,s=0;for(eL.lastIndex=0;null!==(t=eL.exec(e));){t.index>s&&r.push({text:e.slice(s,t.index),bold:n,italic:i,underline:o,strikethrough:a}),s=t.index+t[0].length;let l=!!t[1];t[2]?n=!l:t[3]?i=!l:t[4]?o=!l:t[5]&&(a=!l)}return s<e.length&&r.push({text:e.slice(s),bold:n,italic:i,underline:o,strikethrough:a}),r}var eB=new Intl.Segmenter(void 0,{granularity:"grapheme"}),eR=/^[\x20-\x7e]*$/;function eH(e){return eR.test(e)?e.split(""):Array.from(eB.segment(e),e=>e.segment)}function eD(e=()=>!1){let t=new WeakSet,r=r=>t.has(r)||e(r);return{has:r,freeze:e=>(Object.freeze(e),Reflect.ownKeys(e).every(t=>{let n=Object.getOwnPropertyDescriptor(e,t),i=n.value;return"value"in n&&(null===i||"object"!=typeof i&&"function"!=typeof i||r(i))})&&t.add(e),e)}}function eG(e,t=!1){if(!/[\u0000-\u001f\u007f-\u009f]/.test(e))return e;let r="";for(let n of e){let e=n.codePointAt(0),i=e<=31||e>=127&&e<=159;" "===n?r+=" ":!i||t&&(n===`
2
2
  `||"\r"===n)?r+=n:r+="?"}return r}function eZ(e){return e.split(`
3
3
  `).map(e=>eG(e)).join(`
4
- `)}var e_=new eI(512,4194304),eJ=new WeakSet,eU=eD();function eV(e){return eJ.add(e),e}function eX(e){return eJ.has(e)?e:eV(eU.freeze({source:e.source,display:e.display,...e.transform?{transform:e.transform}:{},lineStarts:eU.freeze([...e.lineStarts]),lines:eU.freeze(e.lines.map(e=>eU.freeze(e.map(e=>eU.freeze({...e,...e.clusters?{clusters:eU.freeze(e.clusters.map(e=>eU.freeze({...e})))}:{}})))))}))}function eY(e,t){return t?.value===e?t.prepared:e}function eQ(e){return e.lines.map(e=>e.map(e=>e.text).join("")).join(`
5
- `)}function eK(e,t,r){if((e=eX(e)).transform)throw TypeError("Display tokens must be decoded before text transforms");let n=new RegExp(t.source,t.flags.includes("g")?t.flags:t.flags+"g"),i=e.lines.map(e=>eU.freeze(e.map(e=>{let t=[],i=[];for(let r of e.clusters??[{text:e.text,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}])for(let e=0;e<r.text.length;e++)t.push(r.sourceStart),i.push(r.sourceEnd);let o=[],a=(r,n,a,s)=>{let l=n;for(let d of eR(r))o.push(eU.freeze({text:eG(d),sourceStart:t[s?n:l]??e.sourceStart,sourceEnd:i[s?a-1:l+d.length-1]??e.sourceEnd})),l+=d.length},s=0;for(let t of e.text.matchAll(n)){if(0===t[0].length)throw TypeError("Display token patterns must not match empty text");a(e.text.slice(s,t.index),s,t.index,!1),a(r(t[0]),t.index,t.index+t[0].length,!0),s=t.index+t[0].length}return a(e.text.slice(s),s,e.text.length,!1),eU.freeze({...e,text:o.map(e=>e.text).join(""),clusters:eU.freeze(o)})})));return eV(eU.freeze({...e,lines:eU.freeze(i)}))}function e0(e){let t=[[]],r=[0],n="",i="literal";for(let o of e){let e=e1(o,"literal");if(e.transform)throw TypeError("Display text must be combined before text transforms");"formatted"===e.display&&(i="formatted");let a=n.length;for(let[n,i]of e.lines.entries())for(let o of(n>0&&(t.push([]),r.push(a+e.lineStarts[n])),i))t.at(-1).push(eU.freeze({...o,sourceStart:a+o.sourceStart,sourceEnd:a+o.sourceEnd,...o.clusters?{clusters:eU.freeze(o.clusters.map(e=>eU.freeze({...e,sourceStart:a+e.sourceStart,sourceEnd:a+e.sourceEnd})))}:{}}));n+=e.source}return eV(eU.freeze({source:n,display:i,lines:eU.freeze(t.map(e=>eU.freeze(e))),lineStarts:eU.freeze(r)}))}function e1(e,t="formatted",r){if("string"!=typeof e){if(e=eX(e),!r||e.transform===r)return e;if(e.transform)throw TypeError("A prepared display transform cannot be replaced without its original runs");return e2(e,r)}let n=eN("text-spans")&&e.length<=16384?JSON.stringify([e,t,r]):void 0;if(void 0!==n){let e=e_.get(n);if(e)return e}let i=0,o=[],a=eU.freeze([]),s=e.split(`
6
- `).map(e=>{let r;if(o.push(i),""===e)return i++,a;if("literal"===t)r=[{text:e,bold:!1,italic:!1,underline:!1,strikethrough:!1,sourceStart:i,sourceEnd:i+e.length}];else{let t=RegExp(eA,"gi"),n=[],o=0;for(let r of e.matchAll(t))r.index>o&&n.push({start:o,end:r.index}),o=r.index+r[0].length;o<e.length&&n.push({start:o,end:e.length}),r=eq(e).map((e,t)=>({...e,sourceStart:i+n[t].start,sourceEnd:i+n[t].end}))}return r=r.map(e=>{let t=e.sourceStart,r=eR(e.text).map(e=>{let r=eU.freeze({text:eG(e),sourceStart:t,sourceEnd:t+e.length});return t+=e.length,r});return eU.freeze({...e,text:r.map(e=>e.text).join(""),clusters:eU.freeze(r)})}),i+=e.length+1,eU.freeze(r)}),l=eV(eU.freeze({source:e,display:t,lines:eU.freeze(s),lineStarts:eU.freeze(o)})),d=r?e2(l,r):l;return void 0!==n&&e_.set(n,d,2*n.length+96*e.length+256),d}function e2(e,t){let r=e.lines.map(e=>{let r=e.map(e=>e.text).join(""),n="uppercase"===t?r.toUpperCase():"lowercase"===t?r.toLowerCase():"capitalize"===t?r.replace(/(?<![\p{L}\p{M}\p{N}\p{Pc}])\p{L}/gu,e=>e.toUpperCase()):r,i="capitalize"===t?new Set([...r.matchAll(/(?<![\p{L}\p{M}\p{N}\p{Pc}])\p{L}/gu)].map(e=>e.index)):void 0,o=0,a=0;return eU.freeze(e.map(e=>{let r=a,s=(e.clusters??[{text:e.text,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}]).map(e=>{let r="uppercase"===t||i?.has(o)?e.text.toUpperCase().length:"lowercase"===t?e.text.toLowerCase().length:e.text.length,s=n.slice(a,a+r);return o+=e.text.length,a+=r,eU.freeze({...e,text:s})});return eU.freeze({...e,text:n.slice(r,a),clusters:eU.freeze(s)})}))});return eV(eU.freeze({...e,transform:t,lines:eU.freeze(r)}))}var e5=[[11904,12031],[12032,12255],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12688,12799],[12800,13311],[13312,19903],[19968,40959],[63744,64255],[131072,196607]],e3=[[4352,4447],[12592,12687],[44032,55215]],e6=[[9001,9002],[65040,65049],[65072,65135],[65280,65376],[65504,65510]],e4=[[127744,129791]],e8=[[768,879],[6832,6911],[7616,7679],[8400,8447],[65056,65071]],e9=new Set([8203,8204,8205,65279]);function e7(e,t){for(let[r,n]of t)if(e>=r&&e<=n)return!0;return!1}var te=new Set(["i","l","t","f","j","I","1","!","|",".",",",":",";","'"]),tt=new Set(["W","M","w","m","@","%"]),tr=new Set(["W","M"]),tn=new Set(["(",")","[","]","{","}","/","\\","-",'"',"`"]);function ti(e){return e7(e,e8)||e9.has(e)||65038===e||65039===e}function to(e){return e7(e,e5)||e7(e,e3)||e7(e,e6)||e7(e,e4)}var ta=/\p{Emoji_Presentation}|\p{Extended_Pictographic}/u;function ts(e){let t=e.codePointAt(0);return void 0===t||ti(t)?0:to(t)||ta.test(e)?2:" "===e?.3:tr.has(e)?1.5:tt.has(e)?1.2:te.has(e)?.4:tn.has(e)?.5:"r"===e?.8:t>=65&&t<=90?1.2:1}var tl={version:4,unit:"px",fontCalibration:"Inter-compatible proportional estimate",monospaceCalibration:"0.6em-per-cell",wideCodepoints:"src/shared/unicode-ranges.ts",emojiDetection:"Emoji_Presentation-or-Extended_Pictographic",ambiguousWidth:"single-cell",paintedAdvanceProjection:"prepared-positions-or-svg-textLength-spacingAndGlyphs",naturalAdvanceExemptions:"prepared-non-ascii-shaping-runs"};function td(e){var t;let r=(t=e.fontWeight)>=600?.6:t>=500?.57:.54,n=0,i=0;for(let t of e.text)n+=ts(t),i++;let o=.15*e.fontSize;return{contract:tl,width:ej({...e,fontStyle:e.fontStyle??"normal",monospace:!1})??n*e.fontSize*r+o,charWidthUnits:n,codePointCount:i,fontSize:e.fontSize,fontWeight:e.fontWeight,baseRatio:r,minPadding:o}}function tu(e,t,r,n="normal",i){return td({text:e,fontSize:t,fontWeight:r,fontStyle:n,fontFamily:i}).width}function tc(e,t,r,n="normal",i){let o=td({text:e,fontSize:t,fontWeight:r,fontStyle:n,fontFamily:i});if(eS())return o.width;let a=0;for(let t of e)tr.has(t)&&(a+=1.85-1.5);return o.width+a*t*o.baseRatio}function tf(e,t,r=0,n=400,i="normal",o){let a=eR(e),s=Math.max(0,a.length-1)*r,l=ej({text:e,fontSize:t,fontWeight:n,fontStyle:i,fontFamily:o,monospace:!0});if(void 0!==l)return Math.max(0,l+s);let d=0;for(let e of a){let t=0;for(let r of e){let e=r.codePointAt(0);void 0===e||ti(e)||(t=Math.max(t,to(e)||ta.test(r)?2:1))}d+=t}return Math.max(0,d*t*.6+s)}function th(e,t,r,n=0,i="normal",o){let a=eP.test(e)?eq(e):[{text:e,bold:!1}],s=a.map(e=>e.text).join(""),l=0===n?0:Math.max(0,eR(s).length-1)*n;return Math.max(0,a.reduce((e,n)=>e+tu(n.text,t,n.bold?Math.max(700,r):r,"italic"in n&&n.italic||"italic"===i?"italic":"normal",o),0)+l)}var tp=1.3;function tm(e,t,r,n=0){if("string"!=typeof e){let i=e.lines.map(e=>e.map(e=>e.text).join("")),o=e.lines.reduce((e,o,a)=>{let s=0===n?0:Math.max(0,eR(i[a]).length-1)*n;return Math.max(e,o.reduce((e,n)=>e+tu(n.text,t,n.bold?Math.max(700,r):r),0)+s)},0),a=t*tp;return{width:o,height:i.length*a,lines:i,lineHeight:a}}let i=e.split(`
4
+ `)}var e_=new eN(512,4194304),eJ=new WeakSet,eV=eD();function eU(e){return eJ.add(e),e}function eY(e){return eJ.has(e)?e:eU(eV.freeze({source:e.source,display:e.display,...e.transform?{transform:e.transform}:{},lineStarts:eV.freeze([...e.lineStarts]),lines:eV.freeze(e.lines.map(e=>eV.freeze(e.map(e=>eV.freeze({...e,...e.clusters?{clusters:eV.freeze(e.clusters.map(e=>eV.freeze({...e})))}:{}})))))}))}function eX(e,t){return t?.value===e?t.prepared:e}function eQ(e){return e.lines.map(e=>e.map(e=>e.text).join("")).join(`
5
+ `)}function eK(e,t,r){if((e=eY(e)).transform)throw TypeError("Display tokens must be decoded before text transforms");let n=new RegExp(t.source,t.flags.includes("g")?t.flags:t.flags+"g"),i=e.lines.map(e=>eV.freeze(e.map(e=>{let t=[],i=[];for(let r of e.clusters??[{text:e.text,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}])for(let e=0;e<r.text.length;e++)t.push(r.sourceStart),i.push(r.sourceEnd);let o=[],a=(r,n,a,s)=>{let l=n;for(let d of eH(r))o.push(eV.freeze({text:eG(d),sourceStart:t[s?n:l]??e.sourceStart,sourceEnd:i[s?a-1:l+d.length-1]??e.sourceEnd})),l+=d.length},s=0;for(let t of e.text.matchAll(n)){if(0===t[0].length)throw TypeError("Display token patterns must not match empty text");a(e.text.slice(s,t.index),s,t.index,!1),a(r(t[0]),t.index,t.index+t[0].length,!0),s=t.index+t[0].length}return a(e.text.slice(s),s,e.text.length,!1),eV.freeze({...e,text:o.map(e=>e.text).join(""),clusters:eV.freeze(o)})})));return eU(eV.freeze({...e,lines:eV.freeze(i)}))}function e0(e){let t=[[]],r=[0],n="",i="literal";for(let o of e){let e=e1(o,"literal");if(e.transform)throw TypeError("Display text must be combined before text transforms");"formatted"===e.display&&(i="formatted");let a=n.length;for(let[n,i]of e.lines.entries())for(let o of(n>0&&(t.push([]),r.push(a+e.lineStarts[n])),i))t.at(-1).push(eV.freeze({...o,sourceStart:a+o.sourceStart,sourceEnd:a+o.sourceEnd,...o.clusters?{clusters:eV.freeze(o.clusters.map(e=>eV.freeze({...e,sourceStart:a+e.sourceStart,sourceEnd:a+e.sourceEnd})))}:{}}));n+=e.source}return eU(eV.freeze({source:n,display:i,lines:eV.freeze(t.map(e=>eV.freeze(e))),lineStarts:eV.freeze(r)}))}function e1(e,t="formatted",r){if("string"!=typeof e){if(e=eY(e),!r||e.transform===r)return e;if(e.transform)throw TypeError("A prepared display transform cannot be replaced without its original runs");return e2(e,r)}let n=eI("text-spans")&&e.length<=16384?JSON.stringify([e,t,r]):void 0;if(void 0!==n){let e=e_.get(n);if(e)return e}let i=0,o=[],a=eV.freeze([]),s=e.split(`
6
+ `).map(e=>{let r;if(o.push(i),""===e)return i++,a;if("literal"===t)r=[{text:e,bold:!1,italic:!1,underline:!1,strikethrough:!1,sourceStart:i,sourceEnd:i+e.length}];else{let t=RegExp(eA,"gi"),n=[],o=0;for(let r of e.matchAll(t))r.index>o&&n.push({start:o,end:r.index}),o=r.index+r[0].length;o<e.length&&n.push({start:o,end:e.length}),r=eq(e).map((e,t)=>({...e,sourceStart:i+n[t].start,sourceEnd:i+n[t].end}))}return r=r.map(e=>{let t=e.sourceStart,r=eH(e.text).map(e=>{let r=eV.freeze({text:eG(e),sourceStart:t,sourceEnd:t+e.length});return t+=e.length,r});return eV.freeze({...e,text:r.map(e=>e.text).join(""),clusters:eV.freeze(r)})}),i+=e.length+1,eV.freeze(r)}),l=eU(eV.freeze({source:e,display:t,lines:eV.freeze(s),lineStarts:eV.freeze(o)})),d=r?e2(l,r):l;return void 0!==n&&e_.set(n,d,2*n.length+96*e.length+256),d}function e2(e,t){let r=e.lines.map(e=>{let r=e.map(e=>e.text).join(""),n="uppercase"===t?r.toUpperCase():"lowercase"===t?r.toLowerCase():"capitalize"===t?r.replace(/(?<![\p{L}\p{M}\p{N}\p{Pc}])\p{L}/gu,e=>e.toUpperCase()):r,i="capitalize"===t?new Set([...r.matchAll(/(?<![\p{L}\p{M}\p{N}\p{Pc}])\p{L}/gu)].map(e=>e.index)):void 0,o=0,a=0;return eV.freeze(e.map(e=>{let r=a,s=(e.clusters??[{text:e.text,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}]).map(e=>{let r="uppercase"===t||i?.has(o)?e.text.toUpperCase().length:"lowercase"===t?e.text.toLowerCase().length:e.text.length,s=n.slice(a,a+r);return o+=e.text.length,a+=r,eV.freeze({...e,text:s})});return eV.freeze({...e,text:n.slice(r,a),clusters:eV.freeze(s)})}))});return eU(eV.freeze({...e,transform:t,lines:eV.freeze(r)}))}var e5=[[11904,12031],[12032,12255],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12688,12799],[12800,13311],[13312,19903],[19968,40959],[63744,64255],[131072,196607]],e3=[[4352,4447],[12592,12687],[44032,55215]],e6=[[9001,9002],[65040,65049],[65072,65135],[65280,65376],[65504,65510]],e4=[[127744,129791]],e8=[[768,879],[6832,6911],[7616,7679],[8400,8447],[65056,65071]],e9=new Set([173,8203,8204,8205,65279]);function e7(e,t){for(let[r,n]of t)if(e>=r&&e<=n)return!0;return!1}var te=new Set(["i","l","t","f","j","I","1","!","|",".",",",":",";","'"]),tt=new Set(["W","M","w","m","@","%"]),tr=new Set(["W","M"]),tn=new Set(["(",")","[","]","{","}","/","\\","-",'"',"`"]);function ti(e){return e7(e,e8)||e9.has(e)||65038===e||65039===e}function to(e){return e7(e,e5)||e7(e,e3)||e7(e,e6)||e7(e,e4)}var ta=/\p{Emoji_Presentation}|\p{Extended_Pictographic}/u;function ts(e){let t=e.codePointAt(0);return void 0===t||ti(t)?0:to(t)||ta.test(e)?2:" "===e?.3:tr.has(e)?1.5:tt.has(e)?1.2:te.has(e)?.4:tn.has(e)?.5:"r"===e?.8:t>=65&&t<=90?1.2:1}var tl={version:4,unit:"px",fontCalibration:"Inter-compatible proportional estimate",monospaceCalibration:"0.6em-per-cell",wideCodepoints:"src/shared/unicode-ranges.ts",emojiDetection:"Emoji_Presentation-or-Extended_Pictographic",ambiguousWidth:"single-cell",paintedAdvanceProjection:"prepared-positions-or-svg-textLength-spacingAndGlyphs",naturalAdvanceExemptions:"prepared-non-ascii-shaping-runs"};function td(e){var t;let r=(t=e.fontWeight)>=600?.6:t>=500?.57:.54,n=0,i=0;for(let t of e.text)n+=ts(t),i++;let o=.15*e.fontSize;return{contract:tl,width:ej({...e,fontStyle:e.fontStyle??"normal",monospace:!1})??n*e.fontSize*r+o,charWidthUnits:n,codePointCount:i,fontSize:e.fontSize,fontWeight:e.fontWeight,baseRatio:r,minPadding:o}}function tu(e,t,r,n="normal",i){return td({text:e,fontSize:t,fontWeight:r,fontStyle:n,fontFamily:i}).width}function tc(e,t,r,n="normal",i){let o=td({text:e,fontSize:t,fontWeight:r,fontStyle:n,fontFamily:i});if(eS())return o.width;let a=0;for(let t of e)tr.has(t)&&(a+=1.85-1.5);return o.width+a*t*o.baseRatio}function tf(e,t,r=0,n=400,i="normal",o){let a=eH(e),s=Math.max(0,a.length-1)*r,l=ej({text:e,fontSize:t,fontWeight:n,fontStyle:i,fontFamily:o,monospace:!0});if(void 0!==l)return Math.max(0,l+s);let d=0;for(let e of a){let t=0;for(let r of e){let e=r.codePointAt(0);void 0===e||ti(e)||(t=Math.max(t,to(e)||ta.test(r)?2:1))}d+=t}return Math.max(0,d*t*.6+s)}function th(e,t,r,n=0,i="normal",o){let a=eP.test(e)?eq(e):[{text:e,bold:!1}],s=a.map(e=>e.text).join(""),l=0===n?0:Math.max(0,eH(s).length-1)*n;return Math.max(0,a.reduce((e,n)=>e+tu(n.text,t,n.bold?Math.max(700,r):r,"italic"in n&&n.italic||"italic"===i?"italic":"normal",o),0)+l)}var tp=1.3;function tm(e,t,r,n=0){if("string"!=typeof e){let i=e.lines.map(e=>e.map(e=>e.text).join("")),o=e.lines.reduce((e,o,a)=>{let s=0===n?0:Math.max(0,eH(i[a]).length-1)*n;return Math.max(e,o.reduce((e,n)=>e+tu(n.text,t,n.bold?Math.max(700,r):r),0)+s)},0),a=t*tp;return{width:o,height:i.length*a,lines:i,lineHeight:a}}let i=e.split(`
7
7
  `),o=t*tp,a=0;for(let e of i){let i=th(e,t,r,n);i>a&&(a=i)}return{width:a,height:i.length*o,lines:i,lineHeight:o}}function tg(e,t=!0){return ty(tb(e,t))}function ty(e){return e.replace(/\*\*(.+?)\*\*/g,"<b>$1</b>").replace(/(?<!\*)\*([^\s*](?:[^*]*[^\s*])?)\*(?!\*)/g,"<i>$1</i>").replace(/~~(.+?)~~/g,"<s>$1</s>")}function tb(e,t=!0){let r=tk(e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e);return(t?r.replace(/\\n/g,`
8
8
  `):r).replace(/<\/?(?:sub|sup|small|mark)\s*>/gi,"")}var tx=/<br\s*\/?>/gi;function tk(e){return e.replace(tx,`
9
9
  `)}function tv(e,t="formatted"){return e1(e,t).lines.map(e=>e.map(e=>e.text).join("")).join(`
10
10
  `)}var tw=/[&<>"']/,t$=/[&<>"'\t\n\r]/;function tM(e){return"string"!=typeof e||tw.test(e)?e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;"):e}function tz(e){return"string"!=typeof e||t$.test(e)?tM(e).replace(/[\t\n\r]/g,e=>" "===e?"&#9;":e===`
11
11
  `?"&#10;":"&#13;"):e}function tS(e){return tz(eZ(e))}function tj(e,t=400){let r=[];e.bold&&r.push(`font-weight="${t>700?t:"bold"}"`),e.italic&&r.push('font-style="italic"');let n=[];return e.underline&&n.push("underline"),e.strikethrough&&n.push("line-through"),n.length&&r.push(`text-decoration="${n.join(" ")}"`),r}function tE(e,t=400){return 0===e.length?"":e.every(e=>!e.bold&&!e.italic&&!e.underline&&!e.strikethrough)?e.map(e=>tM(e.text)).join(""):e.map(e=>{let r=tM(e.text);return e.bold||e.italic||e.underline||e.strikethrough?`<tspan ${tj(e,t).join(" ")}>${r}</tspan>`:r}).join("")}function tT(e,t,r,n,i){let o=e.lineBlocks[t];if(/[^\x20-\x7e]/u.test(o.runs.map(e=>e.text).join(""))){let t="start"===n?r+o.width/2:"end"===n?r-o.width/2:r;return`<tspan x="${tL(t)}"${void 0===i?"":` y="${tL(i)}"`} text-anchor="middle" data-text-fragment="true">${tE(o.runs,e.fontWeight)}</tspan>`}if(0===e.letterSpacing&&!o.fragments)return tE(o.runs,e.fontWeight);if(!o.fragments)throw TypeError("Tracked text requires retained fragment allocations");let a=("middle"===n?r-o.width/2:"end"===n?r-o.width:r)+o.originX;return o.fragments.map(t=>{let r=tj(o.runs[t.runIndex],e.fontWeight),n=/^ | $/.test(t.text)?' xml:space="preserve"':"";return`<tspan x="${tL(a+t.x)}" text-anchor="start" letter-spacing="0" data-text-fragment="true" textLength="${tL(Math.max(0,t.width))}" lengthAdjust="spacingAndGlyphs"${n}${r.length?` ${r.join(" ")}`:""}>${tM(t.text)}</tspan>`}).join("")}function tO(e,t,r,n,i,o=.35,a=!1){let s="string"==typeof e?void 0:e,l=s?s.text:e,d=s?s.lines:l.split(`
12
12
  `),u=s?.prepared.display??(a?"literal":"formatted"),c=i.match(/\btext-anchor="([^"]*)"/)?.[1]??"start",f=s&&/[^\x20-\x7e]/u.test(s.lineBlocks.map(e=>e.runs.map(e=>e.text).join("")).join("")),h=s&&(0!==s.letterSpacing||f),p=(e,r)=>s?tT(s,r,t,c):function(e,t="formatted"){return"literal"!==t&&eP.test(e)?tE(e1(e,t).lines[0]):tM(e)}(e,u);"literal"===u&&eP.test(l)&&!i.includes("data-literal-text=")&&(i+=' data-literal-text="true"');let m=s?s.lineBlocks.map(e=>e.runs.map(e=>e.text).join("")).join(`
13
- `):tv(l,u);/(?:^ | $| {2}|\t)/m.test(m)&&!i.includes("xml:space=")&&(i+=' xml:space="preserve"'),s&&(i+=' data-prepared-text="true"');let g=e=>!s||h||s.lineBlocks[e].fragments?"":` textLength="${tL(s.lineBlocks[e].width)}" lengthAdjust="spacingAndGlyphs" data-font-metrics="deterministic-fit"`;if(1===d.length){let e=n*o;return f?`<text x="${tL(t)}" y="${tL(r)}" ${i}>${tT(s,0,t,c,r+e)}</text>`:`<text x="${tL(t)}" y="${tL(r)}" ${i} dy="${tL(e)}"${g(0)}>${p(l,0)}</text>`}let y=s?.lineHeight??n*tp,b=-((d.length-1)/2)*y+n*o,x=d.map((e,n)=>{let i=f?`y="${tL(r+b+n*y)}"`:`dy="${tL(0===n?b:y)}"`;return`<tspan x="${tL(t)}" ${i}${g(n)}>${p(e,n)}</tspan>`}).join("");return`<text x="${tL(t)}" y="${tL(r)}" ${i}>${x}</text>`}var tC=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g,tW=/\.\d{12}/,tF=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?(?:%|px|pt|pc|em|ex|rem|cm|mm|in)?$/,tN=new Set(["x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","dx","dy","width","height","refX","refY","markerWidth","markerHeight","stroke-width","stroke-dashoffset","stroke-miterlimit","pathLength","font-size","font-weight","letter-spacing","textLength","opacity","fill-opacity","stroke-opacity","stop-opacity","offset"]),tI=new Map,tA=new Map;function tL(e){let t=tI.get(e);if(void 0!==t)return t;let r=String(e),n=r.length>=14&&tW.test(r)&&Number.isFinite(e)?String(Number(e.toPrecision(12))):r;return tI.size>=1024&&tI.clear(),tI.set(e,n),n}function tP(e,t){if(t.length<13||!tW.test(t))return t;let r=t.length<=512?`${e}\0${t}`:void 0,n=void 0===r?void 0:tA.get(r);if(void 0!==n)return n;if(!(tN.has(e)&&tF.test(t)||("viewBox"===e||"points"===e||"stroke-dasharray"===e)&&/^[-+\d.eE,\s]+$/.test(t)||"d"===e&&/^[MmZzLlHhVvCcSsQqTtAa\d.eE,+\s-]+$/.test(t)||("transform"===e||"gradientTransform"===e||"patternTransform"===e)&&/^(?:(?:matrix|translate|scale|rotate|skewX|skewY)\s*\([-+\d.eE,\s]+\)\s*)+$/.test(t)))return t;let i=t.replace(tC,(e,r)=>{if(!tW.test(e))return e;let n=Number(e);if(!Number.isFinite(n))return e;let i=tL(n);return e.startsWith(".")&&r>0&&/[\d.]/.test(t[r-1])?` ${i}`:i});return void 0!==r&&(tA.size>=256&&tA.clear(),tA.set(r,i)),i}function tq(e){return!e.includes("->")&&!/[#:"\[\],\u0000-\u001f]/.test(e)}function tB(e,t,r=""){let n=tq(e)&&tq(t)?`${e}->${t}`:`relation:${JSON.stringify([e,t])}`;return r?`${r}:${n}`:n}function tH(e,...t){let r=t.map(String);return tq(e)&&r.every(tq)?[e,...r].join(":"):`part:${JSON.stringify([e,...r])}`}function tR(e,t,...r){let n=r.map(String);return tq(t)&&n.every(tq)?[e,t,...n].join(":"):`${e}:${JSON.stringify([t,...n])}`}function tD(e){return ev(e).domIdentity}function tG(e,t){if(!tD(t.role))return e;let r=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0];if(!r||r.startsWith("<style")||r.startsWith("<defs")||r.startsWith("<svg"))return e;let n=(e,t,r)=>{let n=tz(r),i=RegExp(`\\s${t}="[^"]*"`);if(i.test(e))return e.replace(i,` ${t}="${n}"`);let o=e.endsWith("/>")?"/>":">";return`${e.slice(0,-o.length).trimEnd()} ${t}="${n}"${"/>"===o?" /":""}>`},i=n(n(r,"data-id",t.id),"data-role",t.role);return void 0!==t.from&&(i=n(i,"data-from",t.from)),void 0!==t.to&&(i=n(i,"data-to",t.to)),i===r?e:e.replace(r,i)}function tZ(e,t,r=0){return Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r}function t_(e,t){let r=t.x-e.x,n=t.y-e.y,i=Math.hypot(r,n);return Number.isFinite(i)&&i>0?{x:r/i,y:n/i}:void 0}function tJ(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function tU(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function tV(e,t,r){let n=tU(t,r);return 0===n?tU(e,t):Math.abs((r.x-t.x)*(t.y-e.y)-(t.x-e.x)*(r.y-t.y))/n}function tX(e,t,r,n,i=.5,o=12){if(!Number.isFinite(i)||i<=0)throw TypeError("Cubic flattening tolerance must be positive and finite");if(!Number.isSafeInteger(o)||o<0)throw TypeError("Cubic flattening maxDepth must be a non-negative safe integer");for(let i of[e,t,r,n])if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw TypeError("Cubic flattening points must be finite");let a=[{...e}],s=(e,t,r,n,l)=>{let d=tU(e,n),u=tU(e,t)+tU(t,r)+tU(r,n)-d;if(Math.max(tV(t,e,n),tV(r,e,n))<=i&&u<=i||l>=o)return void a.push({...n});let c=tJ(e,t),f=tJ(t,r),h=tJ(r,n),p=tJ(c,f),m=tJ(f,h),g=tJ(p,m);s(e,c,p,g,l+1),s(g,m,h,n,l+1)};return s(e,t,r,n,0),a}function tY(...e){let t=e[0];if(t)for(let r=1;r<e.length;r++){let n=t_(t,e[r]);if(n)return n}}function tQ(e,t,r,n=.5){var i,o,a,s,l,d,u;let c,f;for(let e of[t,...r.flatMap(e=>"line"===e.kind?[e.end]:"quadratic"===e.kind?[e.control,e.end]:[e.control1,e.control2,e.end])])if(!Number.isFinite(e.x)||!Number.isFinite(e.y))throw TypeError("Connector path projection points must be finite");let h=[{...t}],p=[],m=t;for(let e of r){if(p.push(m),"line"===e.kind)h.push({...e.end});else if("quadratic"===e.kind){let[t,r]=(i=m,o=e.control,a=e.end,[{x:i.x+(o.x-i.x)*2/3,y:i.y+(o.y-i.y)*2/3},{x:a.x+(o.x-a.x)*2/3,y:a.y+(o.y-a.y)*2/3}]);h.push(...tX(m,t,r,e.end,n).slice(1))}else h.push(...tX(m,e.control1,e.control2,e.end,n).slice(1));m=e.end}for(let e=0;e<r.length&&!c;e++)s=p[e],c="line"===(l=r[e]).kind?tY(s,l.end):"quadratic"===l.kind?tY(s,l.control,l.end):tY(s,l.control1,l.control2,l.end);for(let e=r.length-1;e>=0&&!f;e--)d=p[e],f="line"===(u=r[e]).kind?tY(d,u.end):"quadratic"===u.kind?tY(u.control,u.end)??tY(d,u.end):tY(u.control2,u.end)??tY(u.control1,u.end)??tY(d,u.end);return{geometry:{kind:"path",d:e,points:h},contours:[{start:{...t},end:{...m},closed:!1,...c?{startTangent:c}:{},...f?{endTangent:f}:{}}]}}function tK(e,t,r){return"manhattan"===r?Math.abs(t.x-e.x)+Math.abs(t.y-e.y):tU(e,t)}function t0(e,t){if(void 0===t)return e;if(!Number.isSafeInteger(t)||t<0)throw TypeError("Rounded connector precision must be a non-negative safe integer");let r=10**t;return Math.round(e*r)/r}function t1(e,t,r,n,i){let o=tK(e,t,n);if(0===o)return{...e};let a=r/o;return{x:t0(e.x+(t.x-e.x)*a,i),y:t0(e.y+(t.y-e.y)*a,i)}}function t2(e,t){for(let r=1;r<e.length-1;r++){let n=t?r:e.length-1-r,i=e[n-1],o=e[n],a=e[n+1],s=o.x-i.x,l=o.y-i.y,d=a.x-o.x,u=a.y-o.y;if(s*u!=l*d||s*d+l*u<0)return n}return -1}function t5(e,t,r={}){if(0===e.length)throw RangeError("Rounded connector paths require at least one point");if(!Number.isFinite(t))throw TypeError("Rounded connector radius must be finite");let n=r.metric??"euclidean",i=r.terminalClearance;if(i&&(!Number.isFinite(i.start??0)||(i.start??0)<0||!Number.isFinite(i.end??0)||(i.end??0)<0))throw TypeError("Terminal clearance must be finite and non-negative");let o=e[0],a=[];if(t<=0||e.length<3){for(let t=1;t<e.length;t++)a.push({kind:"line",end:e[t]});return tQ(`M${e.map(e=>`${e.x},${e.y}`).join(" L")}`,o,a,r.tolerance)}let s=i?.start?t2(e,!0):-1,l=i?.end?t2(e,!1):-1,d=[`M${o.x},${o.y}`];for(let u=1;u<e.length-1;u++){let c=e[u-1],f=e[u],h=e[u+1],p=Math.max(0,Math.min(t,tK(c,f,n)/2,tK(f,h,n)/2,u===s?tK(o,f,n)-i.start:1/0,u===l?tK(e.at(-1),f,n)-i.end:1/0));if(p<=0){d.push(`L${f.x},${f.y}`),a.push({kind:"line",end:f});continue}let m=t1(f,c,p,n,r.precision),g=t1(f,h,p,n,r.precision);d.push(`L${m.x},${m.y}`),d.push(`Q${f.x},${f.y} ${g.x},${g.y}`),a.push({kind:"line",end:m}),a.push({kind:"quadratic",control:f,end:g})}let u=e.at(-1);return d.push(`L${u.x},${u.y}`),a.push({kind:"line",end:u}),tQ(d.join(" "),o,a,r.tolerance)}function t3(e,t=!1){return"line"===e.kind?[{points:[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],closed:!1}]:"path"===e.kind&&void 0!==e.subpaths?e.subpaths:[{points:e.points,closed:t}]}function t6(e){return"path"===e.kind&&/[AaCcQqSsTt]/.test(e.d)}function t4(e,t=!1){let r=[];for(let n of t3(e,t)){let t,i=n.points[0],o=n.points.at(-1);if(!i||!o)continue;for(let e=1;e<n.points.length&&!t;e++)t=t_(n.points[e-1],n.points[e]);let a=n.closed&&!tZ(i,o);!t&&a&&(t=t_(o,i));let s=a?t_(o,i):void 0;for(let e=n.points.length-1;e>0&&!s;e--)s=t_(n.points[e-1],n.points[e]);r.push({start:"line"===e.kind?i:{...i},end:"line"===e.kind?o:{...n.closed?i:o},closed:n.closed,...t?{startTangent:t}:{},...s?{endTangent:s}:{}})}return r}function t8(e,t=!1){let r=[],n=[];for(let i of t3(e,t)){let e=i.points[0],t=i.closed?e:i.points.at(-1);e&&r.push(e),t&&n.push(t)}return{starts:r,ends:n}}function t9(e,t=!1){let r=[];for(let[n,i]of t3(e,t).entries()){for(let e=1;e<i.points.length;e++)r.push({start:i.points[e-1],end:i.points[e],subpathIndex:n,closing:!1});let e=i.points[0],t=i.points.at(-1);i.closed&&e&&t&&!tZ(e,t)&&r.push({start:t,end:e,subpathIndex:n,closing:!0})}return r}function t7(e,t=!1){return"line"===e.kind?[]:"path"===e.kind?e.markerMidpoints??[]:t3(e,t).flatMap(e=>{if(e.points.length<2)return[];let t=e.closed&&tZ(e.points[0],e.points.at(-1))?e.points.slice(0,-1):e.points;return e.closed?t.slice(1):t.slice(1,-1)})}var re=Object.assign(Object.create(null),{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}),rt=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function rr(e){let t=e.replace("#",""),r=3===t.length||4===t.length?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t;return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}function rn(e){return ry(e)?rr(e):null}function ri(e,t,r){return"#"+[e,t,r].map(e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0")).join("")}function ro(e,t,r){return ri(...ra(rr(e),rr(t),r))}function ra(e,t,r,n=[0,0,0]){let i=r/100;for(let r=0;r<3;r++)n[r]=Math.round(Math.max(0,Math.min(255,e[r]*i+t[r]*(1-i))));return n}function rs(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function rl(e){return .2126*rs(e[0]/255)+.7152*rs(e[1]/255)+.0722*rs(e[2]/255)}function rd(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function ru(e){let t=rk(e);return t?rl(t):null}function rc(e,t){let r=ru(e),n=ru(t);return null===r||null===n?null:rd(r,n)}function rf(e,t,r,n){let i=rc(e,t);if(null===i||i>=r)return e;let o=rc("#000000",t)??0,a=rc("#ffffff",t)??0,s=(n?rc(n,t)??0:0)>=r?n:o>=a?"#000000":"#ffffff";if((rc(s,t)??0)<r)return e;let l=ru(t),d=rr(s),u=rr(e),c=[0,0,0];for(let e=1;e<=1e3;e++)if(ra(d,u,e/10,c),rd(rl(c),l)>=r)return ri(...c);return s}var rh=4.5,rp=3,rm=3;function rg(e,t,r=rh){return rf(e,t,r)}function ry(e){return rt.test(e)}function rb(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function rx(e,t,r){return(299*e+587*t+114*r)/1e3}function rk(e){let t=e.trim().toLowerCase(),r=Object.hasOwn(re,t)?re[t]:void 0;if(r){let e=rr(r);return[e[0],e[1],e[2],1]}if("transparent"===t)return[0,0,0,0];let n=ry(t)?t.slice(1):void 0;if(n){let e=n.length<=4?[...n].map(e=>e+e).join(""):n;return[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16),8===e.length?Number.parseInt(e.slice(6,8),16)/255:1]}let i=t.match(/^rgba?\((.*)\)$/);if(i){let e=i[1].trim(),t=e.split("/").map(e=>e.trim());if(t.length>2||2===t.length&&e.includes(","))return null;let r=(e.includes(",")?e.split(","):t[0].split(/\s+/)).map(e=>e.trim()),n=t[1];if(e.includes(",")&&4===r.length&&void 0===n&&(n=r.pop()),3!==r.length||e.includes(",")&&r.some(e=>e.endsWith("%"))&&!r.every(e=>e.endsWith("%")))return null;let o=r.map(e=>{let t=e.endsWith("%"),r=rw(e,t);return null===r?null:Math.max(0,Math.min(255,t?2.55*r:r))});if(o.some(e=>null===e))return null;let a=rv(n);return null===a?null:[o[0],o[1],o[2],a]}let o=t.match(/^hsla?\((.*)\)$/);if(o){let e=o[1].trim(),t=e.split("/").map(e=>e.trim());if(t.length>2||2===t.length&&e.includes(","))return null;let r=(e.includes(",")?e.split(","):t[0].split(/\s+/)).map(e=>e.trim()),n=t[1];if(e.includes(",")&&4===r.length&&void 0===n&&(n=r.pop()),3!==r.length||e.includes(",")&&(!r[1].endsWith("%")||!r[2].endsWith("%")))return null;let i=function(e){let t=e.trim().match(/^([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(deg|grad|rad|turn)?$/i);if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;let n=r;switch(t[2]?.toLowerCase()){case"grad":n*=.9;break;case"rad":n*=180/Math.PI;break;case"turn":n*=360}return Number.isFinite(n)?n:null}(r[0]),a=rw(r[1],r[1].endsWith("%")),s=rw(r[2],r[2].endsWith("%")),l=rv(n);if(null===i||null===a||null===s||null===l)return null;let d=s/100,u=Math.max(0,a)/100*(1-Math.abs(2*d-1)),c=(i%360+360)%360/60,f=u*(1-Math.abs(c%2-1)),[h,p,m]=c<1?[u,f,0]:c<2?[f,u,0]:c<3?[0,u,f]:c<4?[0,f,u]:c<5?[f,0,u]:[u,0,f],g=d-u/2,y=[(h+g)*255,(p+g)*255,(m+g)*255];return y.some(e=>!Number.isFinite(e))?null:[Math.max(0,Math.min(255,y[0])),Math.max(0,Math.min(255,y[1])),Math.max(0,Math.min(255,y[2])),l]}return null}function rv(e){if(void 0===e)return 1;let t=e.endsWith("%"),r=rw(e,t);return null===r?null:Math.max(0,Math.min(1,t?r/100:r))}function rw(e,t){if(!(t?/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?%$/i:/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i).test(e))return null;let r=Number(t?e.slice(0,-1):e);return Number.isFinite(r)?r:null}function r$(e,t){let r=rk(e);if(!r)return null;if(1===r[3])return[r[0],r[1],r[2]];let n=rk(t);if(!n)return null;let i=n[3],o=r[3]+i*(1-r[3]);return o<=0?null:[0,1,2].map(e=>Math.min(255,Math.max(0,(r[e]*r[3]+n[e]*i*(1-r[3]))/o)))}function rM(e){let t=rn(e);return t?rl(t):null}function rz(e,t){let r=rM(e),n=rM(t);return null===r||null===n?null:rd(r,n)}function rS(e,t,r="#ffffff"){let n=r$(t,r);if(!n)return null;let i=ri(...n),o=r$(e,i);return o?rz(ri(...o),i):null}var rj=[1,0,0,1,0,0];function rE(e){if(!e)return rj;if("matrix"===e.kind)return[e.a,e.b,e.c,e.d,e.e,e.f];let t=e.angle*Math.PI/180,r=Math.cos(t),n=Math.sin(t);return[r,n,-n,r,e.cx-r*e.cx+n*e.cy,e.cy-n*e.cx-r*e.cy]}function rT(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function rO(e,t){return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}function rC(e){let t=e[0]*e[3]-e[1]*e[2];if(!(!Number.isFinite(t)||0===t))return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}function rW(e){return"rotate"===e.kind?`rotate(${e.angle} ${e.cx} ${e.cy})`:`matrix(${e.a} ${e.b} ${e.c} ${e.d} ${e.e} ${e.f})`}var rF=Symbol.for("agentic-mermaid.performance-observer.v1"),rN=globalThis;function rI(e,t){try{e(Object.freeze(t))}catch{}}function rA(e,t,r,n){let i=rN[rF];"function"==typeof i&&rI(i,{version:1,kind:"cache",owner:e,outcome:t,...r?{reason:r}:{},...n?{detail:n}:{}})}function rL(e,t,r){let n=rN[rF];"function"==typeof n&&rI(n,{version:1,kind:"fallback",owner:e,reason:t,...void 0!==r?{attempt:r}:{}})}var rP,rq=0,rB=0;function rH(e){let t;"function"==typeof(t=rN[rF])&&rI(t,{version:1,kind:"scope",owner:"graphical"});let r=rP,n=rq,i=rB;rP=new Map,rq=0,rB=0;try{return e()}finally{rP=r,rq=n,rB=i}}function rR(e,t,r){if(!rP)return rA("svg-inspection","bypass","outside-graphical-scope",e),r();let n=rP.get(e);if(n?.has(t))return rA("svg-inspection","hit",void 0,e),n.get(t);rA("svg-inspection","miss",void 0,e);let i=r();return rB<512&&rq+t.length<=524288?(n||(n=new Map,rP.set(e,n)),n.set(t,i),rq+=t.length,rB++):rA("svg-inspection","store-skipped",rB>=512?"entry-limit":"character-limit",e),i}function rD(e){if(void 0===e)return!1;let t=e.charCodeAt(0),r=32|t;return r>=97&&r<=122||t>=48&&t<=57||95===t||46===t||58===t||45===t}function rG(e){if(void 0===e)return!1;let t=e.charCodeAt(0);return t<128?32===t||t>=9&&t<=13:/\s/.test(e)}function rZ(e,t){let r=e.indexOf(">",t);if(r<0)return -1;for(let n=t;n<r;n++){let t=e[n];if('"'!==t&&"'"!==t)continue;let i=e.indexOf(t,n+1);if(i<0||(n=i,i>r&&(r=e.indexOf(">",i+1))<0))return -1}return r+1}function r_(e){return rR("start-tags",e,()=>rJ(e))}function rJ(e,t,r,n){let i=t||r||n?void 0:[];for(let o=e.indexOf("<");o>=0;o=e.indexOf("<",o+1)){if(e.startsWith("\x3c!--",o)){let t=e.indexOf("--\x3e",o+4);if(t<0)break;o=t+2;continue}let a=e[o+1];if(!a||"/"===a||"!"===a||"?"===a)continue;let s=o+1;for(;rD(e[s]);)s++;if(s===o+1)continue;let l=rZ(e,s);if(l<0)break;let d=l-2;for(;d>o&&rG(e[d]);)d--;let u=e.slice(o+1,s);n&&(n.name=u);let c="/"===e[d],f=i?[]:void 0;if(i||t||n){let i=s;for(;i<l-1;){for(;rG(e[i]);)i++;if(">"===e[i]||"/"===e[i]&&">"===e[i+1])break;let o=i;for(;rD(e[i]);)i++;if(i===o)break;let a=e.slice(o,i);for(;rG(e[i]);)i++;if("="!==e[i])break;for(i++;rG(e[i]);)i++;let s=e[i];if('"'!==s&&"'"!==s)break;let d=++i,u=e.indexOf(s,i);if(u<0||u>=l-1)break;if(i=u,f)f.push(Object.freeze({name:a,value:e.slice(d,i),quote:s,nameStart:o,valueStart:d,valueEnd:i}));else if(n&&n.name===n.expectedName)n.attribute(a,e.slice(d,i));else if(t&&rK.has(a)){let e={start:d,end:i};t.push(e),"style"===a&&r.push(e)}i++}}if(i&&i.push(Object.freeze({name:u,start:o,end:l,attributes:Object.freeze(f),selfClosing:c})),n)return;if(r&&"style"===u&&!c){let n=e.indexOf("</style",l);if(n>=0){let e={start:l,end:n};t?.push(e),r.push(e)}}o=l-1}return i&&Object.freeze(i)}function rU(e){let t=e.search(/\S/);if(t<0)return;let r=rZ(e,t);if(r<0)return;let n=r_(e.slice(0,r))[0];return n?.start===t&&"svg"===n.name?n:void 0}function rV(e,t){return e.attributes.find(e=>e.name===t)}function rX(t,r){let n=rV(t,r);return n?e(n.value):void 0}function rY(e,t){if(0===t.length)return e;let r=[...t].sort((e,t)=>t.start-e.start),n=[],i=e.length;for(let t of r){if(t.end>i){let t=e;for(let e of r)t=`${t.slice(0,e.start)}${e.value}${t.slice(e.end)}`;return t}n.push(e.slice(t.end,i),t.value),i=t.start}return n.push(e.slice(0,i)),n.reverse().join("")}function rQ(e,t){let r=[];for(let n of r_(e))for(let e of n.attributes){let i=t(e,n);void 0!==i&&i!==e.value&&r.push({start:e.valueStart,end:e.valueEnd,value:i})}return rY(e,r)}var rK=new Set(["clip-path","color","cursor","fill","filter","flood-color","lighting-color","marker-end","marker-mid","marker-start","mask","stop-color","stroke","style"]);function r0(e){let t=[],r=[];return rJ(e,t,r),{source:e,cssRanges:t,styleContexts:r}}function r1(e){let t=[];return rJ(e,void 0,t),t}function r2(e,t,r=r0(e)){if(r.source!==e)throw Error("SVG CSS projection does not match its source");return rY(e,r.cssRanges.map(r=>({...r,value:t(e.slice(r.start,r.end))})))}function r5(e,t,r){return`${e.slice(0,t.start)}${r}${e.slice(t.end)}`}function r3(e,t){let r=[...e].map(e=>e.codePointAt(0)),n=[...t].map(e=>e.codePointAt(0)),i=Math.min(r.length,n.length);for(let e=0;e<i;e++){let t=r[e]-n[e];if(0!==t)return t}return r.length-n.length}function r6(e,t,r){let n=r*Math.PI/180,i=Math.cos(n),o=Math.sin(n),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*i-s*o,y:t.y+a*o+s*i}}function r4(e,t,r){if(r%360==0)return{...e};let n=[r6({x:e.x0,y:e.y0},t,r),r6({x:e.x1,y:e.y0},t,r),r6({x:e.x0,y:e.y1},t,r),r6({x:e.x1,y:e.y1},t,r)];return{x0:Math.min(...n.map(e=>e.x)),y0:Math.min(...n.map(e=>e.y)),x1:Math.max(...n.map(e=>e.x)),y1:Math.max(...n.map(e=>e.y))}}var r8=new eI(256,8388608),r9=new WeakSet,r7=eD(function(e){return eU.has(e)});function ne(e){return r7.has(e)}function nt(e){return r9.has(e)}function nr(e,t){r9.has(e)&&r9.add(t)}function nn(e,t){return e.bold===t.bold&&e.italic===t.italic&&e.underline===t.underline&&e.strikethrough===t.strikethrough}function ni(e){let t=[],r;for(let n of e.flatMap(e=>e.fragments??e))r&&nn(r,n)?(r.text+=n.text,r.sourceEnd=n.sourceEnd):(r={...n},t.push(r));return t}function no(e,t){if(0===e.length)return 0;let r=t.safeFont?tc:tu,n=1!==e.length||e[0].fragments?ni(e):e,i=1===n.length?n[0].text:n.map(e=>e.text).join("");if((t.letterSpacing??0)!==0&&!/[^\x20-\x7e]/u.test(i))return ns(n,t).width;let o=t.monospace?eS()?n.reduce((e,r)=>e+tf(r.text,t.fontSize,0,r.bold?Math.max(700,t.fontWeight):t.fontWeight,r.italic?"italic":"normal",t.fontFamily),0):tf(i,t.fontSize):n.reduce((e,n)=>e+r(n.text,t.fontSize,n.bold?Math.max(700,t.fontWeight):t.fontWeight,n.italic?"italic":"normal",t.fontFamily),0);if(!eS()&&/[^\x20-\x7e]/u.test(i))return Math.max(o,n.reduce((e,r)=>e+[...r.text].reduce((e,n)=>e+(0===ts(n)?0:/[^\x20-\x7e]/u.test(n)?1.2*t.fontSize:tc(n,t.fontSize,r.bold?Math.max(700,t.fontWeight):t.fontWeight)),0),0)+eR(i).filter(e=>/\p{M}/u.test(e)&&[...e].every(e=>0===ts(e))).length*t.fontSize*1.2)+Math.max(0,[...i].length-1)*Math.abs(t.letterSpacing??0);if((t.letterSpacing??0)<0)return ns(n,t).width;let a=t.letterSpacing??0;return Math.max(0,o+(0===a?0:Math.max(0,eR(i).length-1)*a))}function na(e,t,r,n){let i=t.bold?Math.max(700,n.fontWeight):n.fontWeight,o=t.italic?"italic":"normal",a=n.safeFont?tc:tu;return n.monospace?tf(e,n.fontSize,0,i,o,n.fontFamily):a(e,n.fontSize,i,o,n.fontFamily)-(r||eS()?0:.15*n.fontSize)}function ns(e,t){let r=0,n=0,i=0;for(let o of e){let e=eR(o.text);for(let[a,s]of e.entries()){let l=na(s,o,a===e.length-1,t);n=Math.min(n,r),i=Math.max(i,r+l),r+=l+(t.letterSpacing??0)}}return{width:i-n,originX:-n}}function nl(e){let{fragments:t,...r}=e.fragments?.at(-1)??e;return{...r,text:"-",clusters:void 0}}function nd(e,t){if(eN("text-spans")&&(t={display:t.display,transform:t.transform,fontSize:t.fontSize,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,maxWidth:t.maxWidth,safeFont:t.safeFont,monospace:t.monospace,fontFamily:t.fontFamily}),!Number.isFinite(t.fontSize)||t.fontSize<=0||!Number.isFinite(t.fontWeight)||!Number.isFinite(t.letterSpacing??0))throw RangeError("Prepared text requires finite typography and a positive font size");let r=eN("text-spans")&&!eS()&&"string"==typeof e&&e.length<=16384?JSON.stringify([e,t]):void 0;if(void 0!==r){let e=r8.get(r);if(e)return e}let n=e1(e,t.display,t.transform),i=t.maxWidth,o=[],a=[];for(let[e,r]of n.lines.entries()){if(e>0&&a.push({kind:"authored",sourceOffset:n.lineStarts[e]-1}),0===r.length){o.push([]);continue}if(!i||!Number.isFinite(i)||i<=0||no(r,t)<=i){o.push([...r]);continue}let s=function(e){let t=e.flatMap(e=>(e.clusters??eR(e.text).map(t=>({text:t,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}))).map(t=>({...e,...t,clusters:void 0}))),r=0,n=0;return eR(t.map(e=>e.text).join("")).map(e=>{let i=e.length,o=[];for(;i>0;){let e=t[r],a=Math.min(i,e.text.length-n);o.push({...e,text:e.text.slice(n,n+a)}),i-=a,(n+=a)===e.text.length&&(r++,n=0)}return{...o[0],text:e,sourceEnd:o.at(-1).sourceEnd,...o.length>1?{fragments:o}:{}}})}(r),l=eN("text-spans"),d=l&&!eS()?function(e,t){if(1!==e.length||t.monospace||t.letterSpacing||e[0].bold||e[0].italic||e[0].underline||e[0].strikethrough||/[^\x20-\x7e]/u.test(e[0].text))return;let r=e[0],n=e=>Number.isInteger(e)&&e>=0&&e<=0xffffffff;if(!r.clusters||r.clusters.length!==r.text.length||!n(r.sourceEnd)||r.clusters.some((e,t)=>e.text!==r.text[t]||!n(e.sourceStart)))return;let i=new Float64Array(r.text.length+1),o=new Uint32Array(r.text.length+1),a=t.fontWeight>=600?.6:t.fontWeight>=500?.57:.54;for(let e=0;e<r.text.length;e++){let n=ts(r.text[e]);t.safeFont&&("W"===r.text[e]||"M"===r.text[e])&&(n+=.35),i[e+1]=i[e]+n,o[e]=r.clusters[e].sourceStart}return o[r.text.length]=r.sourceEnd,{offsets:o,width:(e,r)=>(i[r]-i[e])*t.fontSize*a+.15*t.fontSize}}(r,t):void 0,u=l?(e,r)=>{let n=d?.width(e,r);return void 0!==n&&Math.abs(n-i)>1e-8*Math.max(1,Math.abs(n),Math.abs(i))?n<i:no(s.slice(e,r),t)<=i}:void 0,c=0;for(;c<s.length;){let e=c,r=-1;if(u)for(;e<s.length&&u(c,e+1);)/\s/u.test(s[e].text)&&(r=e+1),e++;else for(;e<s.length&&no(s.slice(c,e+1),t)<=i;)/\s/u.test(s[e].text)&&(r=e+1),e++;if(e===s.length){o.push(ni(s.slice(c)));break}if(e>c&&!/\s/u.test(s[e-1].text)&&/\s/u.test(s[e]?.text??""))for(r=e;r<s.length&&/\s/u.test(s[r].text);)r++;let l=!1,f,h;if(r>c){if(s.slice(c,r).some(e=>!/\s/u.test(e.text)))for(;r<s.length&&/\s/u.test(s[r].text);)r++;for(f=e=r;f>c&&/\s/u.test(s[f-1].text);)f--;f===c?f=e:h=s.slice(f,e).map(e=>e.text).join("")}else{let r;if(r=e=Math.max(c+1,e),/[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}]/u.test(s[r-1]?.text??"")&&/\p{L}/u.test(s[r]?.text??"")){for(;e>c+1&&no([...s.slice(c,e),nl(s[e-1])],t)>i;)e--;l=no([...s.slice(c,e),nl(s[e-1])],t)<=i}}let p=ni(s.slice(c,f??e)),m=d?.offsets[e]??s[e]?.sourceStart??n.source.length;l&&p.push({...nl(s[e-1]),sourceStart:m,sourceEnd:m}),o.push(p),e<s.length&&a.push({kind:l?"hyphen":"wrap",sourceOffset:m,...h?{replacedText:h}:{}}),c=e}0===s.length&&o.push([])}let s=n.lines.map(e=>e.map(e=>e.text).join("")).join(`
14
- `),l=/\p{M}/u.test(s.normalize("NFD").replace(/[\uFE0E\uFE0F]/g,""))?eR(s.normalize("NFD")).reduce((e,t)=>Math.max(e,(t.replace(/[\uFE0E\uFE0F]/g,"").match(/\p{M}/gu)??[]).length),0):0,d=t.fontSize*Math.max(tp,2.4*!!/[\p{Script=Arabic}\p{Script=Hebrew}]/u.test(s),l?tp+.6*l:0),u=o.map((e,r)=>{var i;let o,a,s,l,u,c=e.map(e=>{let t;return"literal"===n.display?e.text:(t=e.text,e.strikethrough&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.italic&&(t=`<i>${t}</i>`),e.bold&&(t=`<b>${t}</b>`),t)}).join("");e.forEach(r7.freeze);let f=!/[^\x20-\x7e]/u.test(c),h=e.some(e=>e.bold||e.italic||e.underline||e.strikethrough),p=f?(t.letterSpacing??0)!==0?(i=t,o=e.flatMap((e,t)=>eR(e.text).map(e=>({runIndex:t,text:e}))),a=0,s=0,l=0,u=o.map((t,r)=>{let n=e[t.runIndex],d=o[r+1],u=!d||!nn(n,e[d.runIndex]),c=na(t.text,n,u,i),f=r7.freeze({...t,x:a,width:c});return s=Math.min(s,a),l=Math.max(l,a+c),a+=c+(i.letterSpacing??0),f}),{width:l-s,originX:-s,fragments:r7.freeze(u)}):h?function(e,t){let r=[];for(let[t,n]of e.entries()){let i=r.at(-1);i&&nn(e[i.runIndex],n)?i.text+=n.text:r.push({runIndex:t,text:n.text})}let n=0,i=r.map(({runIndex:r,text:i})=>{let o=no([{...e[r],text:i}],t),a=r7.freeze({runIndex:r,text:i,x:n,width:o});return n+=o,a});return{width:n,originX:0,fragments:r7.freeze(i)}}(e,t):void 0:void 0;return r7.freeze({runs:r7.freeze(e),text:c,width:p?.width??no(e,t),baseline:r*d+.35*t.fontSize,originX:p?.originX??0,...p?{fragments:p.fragments}:{}})}),c=u.map(e=>e.text);r7.freeze(c),a.forEach(r7.freeze);let f=u.reduce((e,t)=>Math.max(e,t.width),0),h=r7.freeze({unit:"px",prepared:n,text:c.join(`
15
- `),lines:c,lineBlocks:r7.freeze(u),breaks:r7.freeze(a),width:f,height:c.length*d,lineHeight:d,fontSize:t.fontSize,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing??0,monospace:t.monospace??!1,safeFont:t.safeFont??!1,...t.fontFamily?{fontFamily:t.fontFamily}:{}});return r9.add(h),void 0!==r&&r8.set(r,h,2*r.length+128*h.prepared.source.length+256*h.lines.length+512),h}function nu(e,t){let r=e?.lineBlocks[t];if(!e||!r)return;if(!nt(e))throw TypeError("Pixel line projection requires retained preparation");let n=[r.text];r7.freeze(n);let i=r7.freeze({...e,text:r.text,lines:n,lineBlocks:r7.freeze([r7.freeze({...r,baseline:.35*e.fontSize})]),breaks:r7.freeze([]),width:r.width,height:e.lineHeight});return r9.add(i),i}function nc(e,t){let r=t.top??0,n=0,i=0,o=e.map(e=>{let o=Math.max(t.minRowHeight??0,e.block.height),a={item:e,top:r,height:o,textY:r+("start"===t.align?e.block.height:o)/2};return n=Math.max(n,e.block.width,e.reservedWidth??0),i+=o,r+=o+t.gap,a}),a=Math.max(0,e.length-!t.trailingGap),s=r-(e.length&&!t.trailingGap?t.gap:0);return{width:n,height:i+a*t.gap,bottom:s,rows:o}}function nf(e,t){let r=nc(e,t),n={width:t.leadingWidth+r.width,height:r.height,columns:1,rows:r.rows};if(void 0===t.maxWidth||e.length<4)return n;let i=[0,0];for(let[r,o]of e.entries()){if(1!==o.block.lines.length)return n;let e=r%2;i[e]=Math.max(i[e],t.leadingWidth+o.block.width,t.leadingWidth+(o.reservedWidth??0))}let o=i[0]+t.columnGap+i[1];if(o>t.maxWidth+.01)return n;let a=[],s=t.top??0,l=0;for(let r=0;r<e.length;r+=2){let n=e.slice(r,r+2),o=Math.max(t.minRowHeight??0,...n.map(e=>e.block.height));for(let[e,r]of n.entries())a.push({item:r,x:e?i[0]+t.columnGap:0,top:s,height:o,textY:s+o/2});l+=o,s+=o+t.gap}return(l+=(Math.ceil(e.length/2)-1)*t.gap)<r.height?{width:o,height:l,columns:2,rows:a}:n}function nh(e){if(0!==e.length)return{x0:Math.min(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),x1:Math.max(...e.map(e=>e.x)),y1:Math.max(...e.map(e=>e.y))}}function np(e,t){return e?t?{x0:Math.min(e.x0,t.x0),y0:Math.min(e.y0,t.y0),x1:Math.max(e.x1,t.x1),y1:Math.max(e.y1,t.y1)}:e:t}function nm(e,t){let r=Number.isFinite(t)?Math.max(0,t):0;return{x0:e.x0-r,y0:e.y0-r,x1:e.x1+r,y1:e.y1+r}}function ng(e,t,r){let n=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y,i=0,o=0,a=0,s=0,l=0,d="",u="",c,f,h,p=!1,m=e=>{if(r){for(let t=0;t<e;t++)if(!r())return p=!0,!1}return!0},g=()=>{for(;i<e.length&&/[\s,]/.test(e[i]);){if(!m(1))return;i++}},y=(t=!1)=>{if(g(),p)return;if(t){let t=e[i];return("0"===t||"1"===t)&&m(1)?(i++,Number(t)):void 0}n.lastIndex=i;let r=n.exec(e);if(!r||!m(r[0].length))return;i=n.lastIndex;let o=Number(r[0]);return Number.isFinite(o)?o:void 0},b=(e,r)=>!!Number.isFinite(e)&&!!Number.isFinite(r)&&(f=np(f,{x0:e,y0:r,x1:e,y1:r}),t&&(h=np(h,{x0:e,y0:r,x1:e,y1:r})),!0);for(;;){if(g(),p)return;if(i>=e.length)return f;if(/[a-zA-Z]/.test(e[i])){if(!m(1)||(d=e[i++],!/[MmLlHhVvCcSsQqTtAaZz]/.test(d)||!f&&"M"!==d.toUpperCase()))return;if("Z"===d.toUpperCase()){if(t&&!t({bounds:{x0:Math.min(o,s),y0:Math.min(a,l),x1:Math.max(o,s),y1:Math.max(a,l)},line:[{x:o,y:a},{x:s,y:l}]}))return;o=s,a=l,u="Z",c=void 0,d="";continue}}if(!d)return;let r=d.toUpperCase(),n=d!==r;t&&(h={x0:o,y0:a,x1:o,y1:a});let x="A"===r?7:"C"===r?6:"S"===r||"Q"===r?4:"H"===r||"V"===r?1:2,k=[];for(let e=0;e<x;e++){let t=y("A"===r&&(3===e||4===e));if(void 0===t)return;k.push(t)}let v=e=>k[e]+(n?o:0),w=e=>k[e]+(n?a:0),$,M,z;if("H"===r)$=v(0),M=a;else if("V"===r)$=o,M=w(0);else if("C"===r||"S"===r||"Q"===r||"T"===r){let e=c&&("S"===r?"C"===u||"S"===u:"Q"===u||"T"===u)?{x:2*o-c.x,y:2*a-c.y}:{x:o,y:a};if(("S"===r||"T"===r)&&!b(e.x,e.y))return;for(let e=0;e<x-2;e+=2)if(!b(v(e),w(e+1)))return;$=v(x-2),M=w(x-1),z="T"===r?e:{x:v(x-4),y:w(x-3)}}else if("A"===r){$=v(5),M=w(6);let e=Math.abs(k[0]),t=Math.abs(k[1]);if(e>0&&t>0&&($!==o||M!==a)){let r=k[2]%360*Math.PI/180,n=Math.cos(r),i=Math.sin(r),s=(o-$)/2,l=(a-M)/2,d=n*s+i*l,u=-i*s+n*l,c=Math.hypot(d/e,u/t);c>1&&(e*=c,t*=c);let f=(d/e)**2+(u/t)**2,h=(k[3]===k[4]?-1:1)*Math.sqrt(Math.max(0,(1-f)/f)),p=h*e*u/t,m=-h*t*d/e,g=n*p-i*m+(o+$)/2,y=i*p+n*m+(a+M)/2,x=Math.hypot(e*n,t*i),v=Math.hypot(e*i,t*n);if(!b(g-x,y-v)||!b(g+x,y+v))return}}else $=v(0),M=w(1),"M"===r&&(s=$,l=M,d=n?"l":"L");if(!b($,M)||t&&"M"!==r&&!t({bounds:h,...["L","H","V"].includes(r)?{line:[{x:o,y:a},{x:$,y:M}]}:{}}))return;o=$,a=M,c=z,u=r}}function ny(e,t,r){return void 0!==ng(e,t,r)}function nb(e){switch(e.kind){case"rect":return{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height};case"circle":return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};case"ellipse":return{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry};case"line":return{x0:Math.min(e.x1,e.x2),y0:Math.min(e.y1,e.y2),x1:Math.max(e.x1,e.x2),y1:Math.max(e.y1,e.y2)};case"polygon":case"polyline":return nh(e.points);case"compound":{let t;for(let r of e.children){let e=nb(r);if(!e)return;t=np(t,e)}return t}case"path":return ng(e.d)}}function nx(e,t,r,n=!1,i){if(!e||!t)return;let o=e.geometry?nb(e.geometry):void 0;if(n&&e.geometry&&!o)return;let a=e.bounds??o??(e.viewBox?{x0:e.viewBox.x,y0:e.viewBox.y,x1:e.viewBox.x+e.viewBox.width,y1:e.viewBox.y+e.viewBox.height}:void 0)??(e.size?{x0:0,y0:0,x1:e.size.width,y1:e.size.height}:void 0);if(!a)return;if(n){a=np(a,o);let t=nT(e.paint??{},!0);if(void 0===t)return;a=nm(a,t)}let s=e.ref?.x??0,l=e.ref?.y??0,d=a;if(e.viewBox&&e.size){let t=Math.min(e.size.width/e.viewBox.width,e.size.height/e.viewBox.height),r=(e.size.width-e.viewBox.width*t)/2,n=(e.size.height-e.viewBox.height*t)/2,i=n=>r+(n-e.viewBox.x)*t,o=r=>n+(r-e.viewBox.y)*t;d={x0:i(a.x0),y0:o(a.y0),x1:i(a.x1),y1:o(a.y1)},s=i(s),l=o(l)}let u=(e.units??"strokeWidth")==="strokeWidth"?r:1,c=Math.max(+!!n,e.scale??1)*u;if(void 0!==i){let e=i*Math.PI/180,r=Math.cos(e),n=Math.sin(e),o=[[d.x0,d.y0],[d.x0,d.y1],[d.x1,d.y0],[d.x1,d.y1]].map(([e,i])=>({x:t.x+((e-s)*r-(i-l)*n)*c,y:t.y+((e-s)*n+(i-l)*r)*c}));return o.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))?nh(o):void 0}let f=Math.max(Math.abs(d.x0-s),Math.abs(d.x1-s)),h=Math.max(Math.abs(d.y0-l),Math.abs(d.y1-l)),p=(n?Math.hypot(f,h):Math.max(f,h))*c;return{x0:t.x-p,y0:t.y-p,x1:t.x+p,y1:t.y+p}}function nk(e,t){let r="number"==typeof e.orient?e.orient:180*("start"===t&&"auto-start-reverse"===e.orient),n=nx(e,{x:0,y:0},1,!0,r);if(!n)throw TypeError(`Unmeasured terminal marker ${e.id}`);return Math.max(0,"start"===t?n.x1:-n.x0)}function nv(e,t){let r=e.route.geometry,n=t8(r,e.route.closed),i=t7(r,e.route.closed),o=nj(t,e.transform),a=[],s=(t,n,i,s)=>{if(!n||!i)return;let l="number"==typeof n.orient?n.orient:s?180*Math.atan2(s.y,s.x)/Math.PI+180*("start"===t&&"auto-start-reverse"===n.orient):void 0,d=nw(e.stroke.width),u=nx(n,i,d,!0,l),c=rE(o),f=JSON.stringify([{...n,orient:n.orient??"auto"},l??["unknown",r],"userSpaceOnUse"===n.units?1:d,c.slice(0,4)]),h,p;if(void 0!==l&&n.geometry?.kind==="polygon"&&n.geometry.points.length<=64){let e=(n.viewBox&&n.size?Math.min(n.size.width/n.viewBox.width,n.size.height/n.viewBox.height):1)*Math.max(1,n.scale??1)*("userSpaceOnUse"===n.units?1:d),t=l*Math.PI/180,r=Math.cos(t),o=Math.sin(t);h=n.geometry.points.map(t=>{let a=(t.x-(n.ref?.x??0))*e,s=(t.y-(n.ref?.y??0))*e;return rO({x:i.x+a*r-s*o,y:i.y+a*o+s*r},c)});let[a,s,u,f]=c,m=(Math.hypot(a+f,s-u)+Math.hypot(a-f,s+u))/2,g=nT(n.paint??{},!0);void 0!==(p=void 0===g?void 0:g*e*m)&&Number.isFinite(p)&&h.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))||(h=void 0)}a.push({position:t,resource:n.id,anchor:rO(i,c),repaint:f,...h?{hull:h,padding:p}:{},...u?{bounds:nS(u,o)}:{}})};if(n.starts.forEach((t,r)=>s("start",e.markers.start,t,e.route.contours[r]?.startTangent)),n.ends.forEach((t,r)=>s("end",e.markers.end,t,e.route.contours[r]?.endTangent)),1===e.markers.mid.length)for(let t of i)s("mid",e.markers.mid[0],t);else e.markers.mid.forEach((e,t)=>s("mid",e,i[t]));return a}function nw(e){let t="number"==typeof e?e:parseFloat(e);return Number.isFinite(t)?Math.max(0,t):1}var n$=new WeakMap;function nM(e){let t=eY(e.text,e.textContent),r="string"==typeof t?t:t.source;if(e.block){let t=e.block;if(t.prepared.source!==r||void 0!==e.fontSize&&e.fontSize!==t.fontSize||void 0!==e.fontWeight&&e.fontWeight!==t.fontWeight||void 0!==e.letterSpacing&&e.letterSpacing!==t.letterSpacing||void 0!==e.display&&e.display!==t.prepared.display)throw TypeError("Connector inline label typography and source must agree with its prepared block");return t}let n=e.fontSize??12,i=e.fontWeight??400,o=e.letterSpacing??0,a=e.display??"literal",s=n$.get(e);if(s&&("string"==typeof t?s.prepared.source===r:s.prepared===t)&&s.fontSize===n&&s.fontWeight===i&&s.letterSpacing===o&&s.prepared.display===a)return s;let l=nd(t,{display:a,fontSize:n,fontWeight:i,letterSpacing:o});return n$.set(e,l),l}function nz(e){if(e.visual?.kind!=="inline"||!e.anchor||void 0===e.fontSize||void 0===e.textAnchor)return;let t=nM(e),r=t.width,n="middle"===e.textAnchor?e.anchor.x-r/2:"end"===e.textAnchor?e.anchor.x-r:e.anchor.x,i=e.anchor.y-Math.max(0,e.clearance??0),o=Math.max(0,e.halo?.width??0)/2;return nm({x0:n,y0:i-.35*t.fontSize-t.height/2,x1:n+r,y1:i-.35*t.fontSize+t.height/2},o)}function nS(e,t){if(![e.x0,e.y0,e.x1,e.y1].every(Number.isFinite))return;if(!t)return e;if("rotate"===t.kind)return r4(e,{x:t.cx,y:t.cy},t.angle);let r=rE(t),n=e.x0,i=e.y0,o=e.x0,a=e.y1,s=e.x1,l=e.y0,d=e.x1,u=e.y1;if(1===r[0]&&0===r[1]&&0===r[2]&&1===r[3]&&n===o&&i===l&&s===d&&a===u&&0!==n&&0!==i&&0!==s&&0!==a&&Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(a)){let e=rO({x:n,y:i},r),t=rO({x:d,y:u},r);return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(t.x)&&Number.isFinite(t.y)?{x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)}:void 0}let c=[[n,i],[o,a],[s,l],[d,u]].map(([e,t])=>rO({x:e,y:t},r));return c.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))?nh(c):void 0}function nj(e,t){if(!e)return t;if(!t)return e;let[r,n,i,o,a,s]=rT(rE(e),rE(t));return{kind:"matrix",a:r,b:n,c:i,d:o,e:a,f:s}}function nE(e){return"line"!==e.geometry.kind&&!("polyline"===e.geometry.kind&&2===e.geometry.points.length&&!e.closed)}function nT(e,t){if(void 0===e.stroke||"none"===e.stroke||"transparent"===e.stroke||rk(e.stroke)?.[3]===0)return 0;let r=e.strokeWidth??"1";if(!/^\s*(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:px)?\s*$/.test(r))return;let n=Number.parseFloat(r)/2;if(!Number.isFinite(n))return;let i=e.strokeLinejoin??"miter",o=Number(e.strokeMiterlimit??4);if(!Number.isFinite(o)||o<1)return;let a=Math.max(t&&("miter"===i||"miter-clip"===i)?n*o:n,"square"===e.strokeLinecap?n*Math.SQRT2:n);return Number.isFinite(a)?a:void 0}function nO(e,t,r,n){if(!r)return nS(nm(e,t),n);let i=nS(e,n);return i?nm(i,t):void 0}function nC(e,t,r,n,i,o){return"line"!==e.kind||i?nO(t,r,i,o):nS(function(e,t,r){let n=nb(e),i=Math.hypot(e.x2-e.x1,e.y2-e.y1);if(void 0!==r&&"butt"!==r||0===i)return nm(n,t);let o=t*Math.abs(e.y2-e.y1)/i,a=t*Math.abs(e.x2-e.x1)/i;return{x0:n.x0-o,y0:n.y0-a,x1:n.x1+o,y1:n.y1+a}}(e,r,n),o)}function nW(e,t,r,n){let i=0;for(let o=0;o<32;o++){let a,s=o/32,l=(o+1)/32,d=e=>Math.min(l,Math.max(s,e)),u=r=>e*(1-r)**2+t*(1+r+r*r),c=6*r*Math.min(s*(1-s),l*(1-l)),f=6*n*r*l/Math.hypot((a=d(e/(e+t)),3*(e*(1-a)**2+t*a*a)),c)-u(d((2*e-t)/(2*(e+t))));f>0&&(i=Math.max(i,(1-s)*f))}return Math.min(n,i)}function nF(e,t){return function e(t,r){let n,i=nj(r,t.transform);if(!i||rC(rE(i))){if("shape"===t.kind){if(!(n=nb(t.geometry)))return;let e=["polygon","polyline","path","compound"].includes(t.geometry.kind),r;for(let o of[t.paint,...t.childPaints??[]]){let a=nT(o,e),s=void 0===a?void 0:nC(t.geometry,n,a,o.strokeLinecap,"non-scaling-stroke"===o.vectorEffect,i);if(!s)return;r=r?np(r,s):s}if(!t.conditionalPaint)return r;let o=nT(t.conditionalPaint,["polygon","polyline","path","compound"].includes(t.geometry.kind));if(!r||void 0===o)return;let a=nC(t.geometry,n,o,t.conditionalPaint.strokeLinecap,"non-scaling-stroke"===t.conditionalPaint.vectorEffect,i);return a?np(r,a):void 0}if("connector"===t.kind)return function(e,t){let r=e.route.geometry,n=nb(r),i=nT({stroke:e.stroke.color,strokeWidth:String(e.stroke.width),strokeLinecap:e.stroke.lineCap,strokeLinejoin:e.stroke.lineJoin,strokeMiterlimit:String(e.stroke.miterLimit)},nE(e.route));if(!n||void 0===i)return;let o="path"!==r.kind||"butt"!==e.stroke.lineCap||e.stroke.nonScaling?void 0:function(e,t){if(!/^[\s,0-9eE.+\-MC]+$/.test(e))return;let r=e.match(/[MC]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g);if(!r||10!==r.length||"M"!==r[0]||"C"!==r[3])return;let n=r.filter(e=>"M"!==e&&"C"!==e).map(Number);if(!n.every(Number.isFinite))return;let[i,o,a,s,l,d,u,c]=n;if(a!==l||s!==o||d!==c||!((a-i)*(u-a)>0))return;let f=Math.abs(a-i),h=Math.abs(u-a),p=Math.abs(c-o),m=Math.sign(u-i),g=[i-m*nW(h,f,p,t),u+m*nW(f,h,p,t)];return{x0:Math.min(...g),y0:Math.min(o,c)-t,x1:Math.max(...g),y1:Math.max(o,c)+t}}(r.d,nw(e.stroke.width)/2),a=o?nS(o,t):nO(n,i,e.stroke.nonScaling,t);if(!a)return;let s=nw(e.stroke.width),l=t8(r,e.route.closed),d=t7(r,e.route.closed);for(let{marker:r,anchor:n}of[...l.starts.flatMap(t=>e.markers.start?[{marker:e.markers.start,anchor:t}]:[]),...l.ends.flatMap(t=>e.markers.end?[{marker:e.markers.end,anchor:t}]:[]),...1===e.markers.mid.length?d.map(t=>({marker:e.markers.mid[0],anchor:t})):e.markers.mid.map((e,t)=>({marker:e,anchor:d[t]}))]){let e=nx(r,n,s,!0),i=e&&nS(e,t);if(!i)return;a=np(a,i)}for(let r of e.labels){let e=np(r.bounds,nz(r));if(r.visual?.kind==="inline"&&!e)return;if(e){let r=nS(e,t);if(!r)return;a=np(a,r)}}return a}(t,i);if("text"===t.kind){n=function(e){let t;if("shape"===e.kind)t=nb(e.geometry);else if("connector"===e.kind)t=function(e){let t=e.route.geometry,r="path"===t.kind?nh(t.points):nb(t);if(!r)return;let n=nw(e.stroke.width),i=n/2;r=nm(r,"miter"===e.stroke.lineJoin||"miter-clip"===e.stroke.lineJoin?i*Math.max(1,e.stroke.miterLimit):i);let o=t8(t,e.route.closed);for(let t of o.starts)r=np(r,nx(e.markers.start,t,n));for(let t of o.ends)r=np(r,nx(e.markers.end,t,n));let a=t7(t,e.route.closed);if(1===e.markers.mid.length)for(let t of a)r=np(r,nx(e.markers.mid[0],t,n));else for(let t=0;t<e.markers.mid.length;t++)r=np(r,nx(e.markers.mid[t],a[t],n));for(let t of e.labels)t.bounds&&(r=np(r,t.bounds)),r=np(r,nz(t));return r}(e);else{if("text"!==e.kind)return;let r=e.textLayout??nd(e.text,{display:e.display,fontSize:e.fontSize,fontWeight:e.fontWeight??500,letterSpacing:e.letterSpacing}),n=r.width,i="middle"===e.anchor?e.x-n/2:"end"===e.anchor?e.x-n:e.x,o="offsetY"in r?r.offsetY:-(.35*e.fontSize);t={x0:i,y0:e.y+o-r.height/2,x1:i+n,y1:e.y+o+r.height/2}}return t?nS(t,e.transform):void 0}({...t,transform:void 0});let e=nT(t.paint,!1);return n&&void 0!==e?nO(n,e,"non-scaling-stroke"===t.paint.vectorEffect,i):void 0}if("group"!==t.kind)return;for(let r of t.children){if("document"===r.node.kind&&r.node.nonPaint)continue;let t=e(r.node,i);if(!t)return;n=np(n,t)}return n}}(e,t)}var nN=class{value="";raw(e){this.value+=e}attribute(e,t){this.value+=` ${e}="${"number"==typeof t?tL(t):tz(tP(e,t))}"`}},nI=new Set(["id","role","from","to","relationship","direction","prepared-text","font-metrics","text-fragment","connector-label-for"]),nA=/^[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*$/,nL=/^[a-z][a-z0-9-]*$/;function nP(e,t){if(t){if(t.className&&e.attribute("class",t.className),t.data)for(let r of Object.keys(t.data))e.attribute(`data-${r}`,t.data[r]);t.ariaHidden&&e.attribute("aria-hidden","true"),0===t.tabIndex&&e.attribute("tabindex",0),void 0!==t.ariaLabel&&e.attribute("aria-label",t.ariaLabel)}}function nq(e,t){void 0!==t.fill&&e.attribute("fill",t.fill),void 0!==t.fillOpacity&&e.attribute("fill-opacity",t.fillOpacity),void 0!==t.stroke&&e.attribute("stroke",t.stroke),void 0!==t.strokeOpacity&&e.attribute("stroke-opacity",t.strokeOpacity),void 0!==t.strokeWidth&&e.attribute("stroke-width",t.strokeWidth),void 0!==t.strokeDasharray&&e.attribute("stroke-dasharray",t.strokeDasharray),void 0!==t.strokeDashoffset&&e.attribute("stroke-dashoffset",t.strokeDashoffset),void 0!==t.strokeLinecap&&e.attribute("stroke-linecap",t.strokeLinecap),void 0!==t.strokeLinejoin&&e.attribute("stroke-linejoin",t.strokeLinejoin),void 0!==t.strokeMiterlimit&&e.attribute("stroke-miterlimit",t.strokeMiterlimit),void 0!==t.vectorEffect&&e.attribute("vector-effect",t.vectorEffect),void 0!==t.paintOrder&&e.attribute("paint-order",t.paintOrder),void 0!==t.opacity&&e.attribute("opacity",t.opacity)}function nB(e,t){t&&e.attribute("transform",rW(t))}function nH(e,t,r){t&&tD(t.role)&&(e.attribute("data-id",t.id),e.attribute("data-role",t.role),void 0!==t.from&&e.attribute("data-from",t.from),void 0!==t.to&&e.attribute("data-to",t.to)),r&&(e.attribute("role",r.role),e.attribute("aria-roledescription",r.roleDescription),e.attribute("aria-label",r.label))}function nR(e,t){switch(t.kind){case"rect":e.attribute("x",t.x),e.attribute("y",t.y),e.attribute("width",t.width),e.attribute("height",t.height),void 0!==t.rx&&e.attribute("rx",t.rx),void 0!==t.ry&&e.attribute("ry",t.ry);return;case"circle":e.attribute("cx",t.cx),e.attribute("cy",t.cy),e.attribute("r",t.r);return;case"ellipse":e.attribute("cx",t.cx),e.attribute("cy",t.cy),e.attribute("rx",t.rx),e.attribute("ry",t.ry);return;case"line":e.attribute("x1",t.x1),e.attribute("y1",t.y1),e.attribute("x2",t.x2),e.attribute("y2",t.y2);return;case"polygon":case"polyline":{let r="";for(let e=0;e<t.points.length;e++){let n=t.points[e];r+=`${e?" ":""}${n.x},${n.y}`}e.attribute("points",r);return}case"path":e.attribute("d",t.d)}}function nD(e,t,r,n,i){let o=Math.max(0,Math.min(i,r/2,n));return 0===o?`M${e},${t} H${e+r} V${t+n} H${e} Z`:`M${e+o},${t} H${e+r-o} A${o},${o} 0 0 1 ${e+r},${t+o} V${t+n} H${e} V${t+o} A${o},${o} 0 0 1 ${e+o},${t} Z`}var nG=new WeakMap,nZ=new WeakSet,n_=new WeakMap,nJ=/<\s*text/i;function nU(e){if(!e.includes("<svg"))return e;let t="",r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n<0)return t+e.slice(r);if(t+=e.slice(r,n),e.startsWith("\x3c!--",n)){let i=e.indexOf("--\x3e",n+4);if(i<0)return t+e.slice(n);t+=e.slice(n,i+3),r=i+3;continue}let i,o=n+1;for(;o<e.length;o++){let t=e[o];if(i)t===i&&(i=void 0);else if('"'===t||"'"===t)i=t;else if(">"===t)break}if(o>=e.length)return t+e.slice(n);t+=function(e){let t=e.match(/^<([A-Za-z_][A-Za-z0-9_.:-]*)/);if(!t||e.startsWith("</")||e.startsWith("<!")||e.startsWith("<?"))return e;let r=t[1];if("svg"!==r)return e;let n=/\/\s*>$/.test(e),i=n?e.lastIndexOf("/"):e.length-1,o=[],a=t[0].length;for(;a<i;){for(;/\s/.test(e[a]??"");)a++;if(a>=i)break;let t=e.slice(a).match(/^([^\s=<>/]+)/);if(!t)return e;let r=t[1];for(a+=t[0].length;/\s/.test(e[a]??"");)a++;if("="!==e[a])return e;for(a++;/\s/.test(e[a]??"");)a++;let n=e[a];if('"'!==n&&"'"!==n)return e;let s=++a;for(;a<i&&e[a]!==n;)a++;if(e[a]!==n)return e;let l=e.slice(s,a);a++,o.push({name:r,value:'"'===n?l:l.replaceAll('"',"&quot;"),index:o.length})}let s=new Map([["xmlns",0],["width",1],["height",2],["viewBox",3],["style",4]]);o.sort((e,t)=>(s.get(e.name)??100)-(s.get(t.name)??100)||r3(e.name,t.name)||e.index-t.index);let l=o.map(e=>`${e.name}="${e.value}"`).join(" ");return`<${r}${l?` ${l}`:""}${n?" /":""}>`}(e.slice(n,o+1)),r=o+1}return t}function nV(e,t){if("document"!==e.kind)throw TypeError(`Scene ${e.kind} "${e.id}" is written from its fields, not stored markup`);return nG.set(e,nU(t)),e}function nX(e){return nZ.add(e),e}function nY(e){let t=nG.get(e);if(void 0!==t)return t;if(!nZ.has(e))throw TypeError(`Scene node "${e.id}" has no admitted SVG serialization`);let r=n_.get(e);if(void 0!==r)return r;let n=function(e){switch(e.kind){case"shape":return function(e){let t=new nN,r="compound"===e.geometry.kind,n="compound"===e.geometry.kind?e.geometry.children:[e.geometry];for(let i=0;i<n.length;i++){let o=n[i];if("compound"===o.kind)throw TypeError(`Shape "${e.id}" nests compound geometry`);i&&t.raw(`
16
- `),t.raw(`<${o.kind}`),0===i&&nP(t,e.attributes),nR(t,o),nq(t,r?e.childPaints?.[i]??e.paint:e.paint),nB(t,e.transform),0===i&&nH(t,e.identity,e.accessibility),t.raw(" />")}return t.value}(e);case"text":return function(e){let t=new nN;nP(t,e.attributes),t.attribute("text-anchor",e.anchor),e.dominantBaseline&&t.attribute("dominant-baseline",e.dominantBaseline),e.block?.fontFamily&&t.attribute("font-family",e.block.fontFamily),t.attribute("font-size",e.fontSize),t.attribute("font-weight",e.fontWeight??e.block?.fontWeight??400),(e.letterSpacing??0)!==0&&t.attribute("letter-spacing",e.letterSpacing),e.fontStyle&&t.attribute("font-style",e.fontStyle),e.textDecoration&&t.attribute("text-decoration",e.textDecoration),nq(t,e.paint),nB(t,e.transform),nH(t,e.identity,e.accessibility);let r=t.value.slice(1),n="prepared"===e.measurement&&e.block,i=tO(n?e.block:e.text,e.x,e.y,e.fontSize,r,e.baselineShift??.35,"literal"===e.display);if(!e.spans)return i;let o=n?e.block.text:e.text,a=`>${tM(o)}</text>`;if(!i.endsWith(a))throw TypeError(`Text "${e.id}" spans require a one-line label`);let s="";for(let t of e.spans)s+=`<tspan fill="${tz(t.fill)}">${tM(t.text)}</tspan>`;return`${i.slice(0,-a.length)}>${s}</text>`}(e);case"connector":return function(e){let t=new nN,{stroke:r,markers:n}=e,i=r.dash,o=n.mid[0];if("invisible"!==e.lineStyle){let a=e.route.geometry;t.raw(`<${a.kind}`),nP(t,e.attributes),nR(t,a),"line"!==a.kind&&t.attribute("fill","none"),t.attribute("stroke",r.color),void 0!==r.opacity&&t.attribute("stroke-opacity",r.opacity),t.attribute("stroke-width",r.width),i&&t.attribute("stroke-dasharray","string"==typeof i.array?i.array:i.array.join(" ")),i?.offset!==void 0&&t.attribute("stroke-dashoffset",i.offset),"butt"!==r.lineCap&&t.attribute("stroke-linecap",r.lineCap),"miter"!==r.lineJoin&&t.attribute("stroke-linejoin",r.lineJoin),4!==r.miterLimit&&t.attribute("stroke-miterlimit",r.miterLimit),void 0!==r.pathLength&&t.attribute("pathLength",r.pathLength),void 0!==r.paintOrder&&t.attribute("paint-order",r.paintOrder),r.nonScaling&&t.attribute("vector-effect","non-scaling-stroke"),r.mixBlendMode&&t.attribute("style",`mix-blend-mode:${r.mixBlendMode}`),n.start&&t.attribute("marker-start",`url(#${n.start.id})`),o&&t.attribute("marker-mid",`url(#${o.id})`),n.end&&t.attribute("marker-end",`url(#${n.end.id})`),"none"===e.hit.pointerEvents&&t.attribute("pointer-events","none"),nB(t,e.transform),t.attribute("data-relationship",e.relationship.kind),t.attribute("data-direction",e.relationship.direction),nH(t,e.identity,e.accessibility),t.raw(" />")}for(let r=0;r<e.labels.length;r++){let n=function(e,t,r){if(t.visual?.kind!=="inline")return;if(!t.anchor||!t.paint||void 0===t.fontSize||void 0===t.textAnchor)throw TypeError(`Connector "${e.id}" inline label ${r+1} requires anchor, paint, fontSize, and textAnchor`);let n=nM(t),i={...t.paint,...t.halo?{stroke:t.halo.color??"var(--bg)",strokeWidth:String(t.halo.width),paintOrder:"stroke fill"}:{}},o=new nN;return o.attribute("data-id",t.id??`${e.id}-label-${r+1}`),o.attribute("data-role","label"),o.attribute("data-connector-label-for",e.id),o.attribute("font-size",n.fontSize),o.attribute("font-weight",n.fontWeight),n.letterSpacing&&o.attribute("letter-spacing",n.letterSpacing),o.attribute("text-anchor",t.textAnchor),nB(o,e.transform),nq(o,i),tO(n,t.anchor.x,t.anchor.y-Math.max(0,t.clearance??0),n.fontSize,o.value.slice(1),0)}(e,e.labels[r],r);void 0!==n&&(t.value&&t.raw(`
17
- `),t.raw(n))}return t.value}(e);case"group":return[e.open,...e.children.map(e=>nQ(nY(e.node),e.indent)),e.close].join(e.join);case"document":throw TypeError(`Scene node "${e.id}" has no admitted SVG serialization`)}}(e);return"group"!==e.kind&&Object.isFrozen(e)&&n_.set(e,n),n}function nQ(e,t){if(t<=0||""===e)return e;let r=" ".repeat(t);return r+e.replace(/\n/g,`
18
- ${r}`)}function nK(e,t){let r=nG.get(e);void 0!==r&&nG.set(t,r),nZ.has(e)&&nZ.add(t)}function n0(e){let t=e=>{if("document"===e.kind){let t=nG.get(e);return void 0!==t&&!nJ.test(t)}if(!nZ.has(e))return!1;switch(e.kind){case"text":return"prepared"===e.measurement&&void 0!==e.block;case"shape":case"connector":return!0;case"group":return!nJ.test(e.open)&&!nJ.test(e.close)&&e.children.every(e=>t(e.node))}};return e.parts.every(t)}var n1={};function n2(e,t){if(!ev(e.role).relation||void 0===e.from||void 0===e.to)return;let r={from:e.from,to:e.to,...t?{label:t}:{}};return{label:`${r.from} to ${r.to}${r.label?`: ${r.label}`:""}`,role:"graphics-symbol",roleDescription:"relation",relation:r}}function n5(e,t,r){return!r||Object.hasOwn(e,t)?e[t]:void 0}function n3(e,t){return e?{...e,...n5(e,"geometry",t)?{geometry:n5(e,"geometry",t)}:{},...n5(e,"size",t)?{size:{...n5(e,"size",t)}}:{},...n5(e,"viewBox",t)?{viewBox:{...n5(e,"viewBox",t)}}:{},...n5(e,"ref",t)?{ref:{...n5(e,"ref",t)}}:{},...n5(e,"bounds",t)?{bounds:{...n5(e,"bounds",t)}}:{},...n5(e,"paint",t)?{paint:{...n5(e,"paint",t)}}:{}}:void 0}function n6(e,t){let r=n5(e,"owner",t),n=n5(e,"point",t);return{...e,...r?{owner:{...r}}:{},...n?{point:{...n}}:{}}}function n4(e,t=!1){if(t&&"path"===e.geometry.kind)throw TypeError("Deferred terminal projections require line or polyline geometry");let r=function(e,t,r=!1){let n=["continuous-geometry","stroke-width","stroke-cap","stroke-join"];e.bendRadius>0&&n.push("bend-radius"),void 0!==n5(t,"opacity",r)&&n.push("stroke-opacity"),("miter"===t.lineJoin||"miter-clip"===t.lineJoin)&&n.push("stroke-miter"),n5(t,"dash",r)&&n.push("dash-pattern");let i=n5(t,"dash",r);return i&&void 0!==n5(i,"offset",r)&&n.push("dash-offset"),void 0!==n5(t,"pathLength",r)&&n.push("path-length"),void 0!==n5(t,"paintOrder",r)&&n.push("paint-order"),/^url\(#[A-Za-z_][A-Za-z0-9_.:-]*\)$/.test(t.color)&&n.push("gradient-paint"),void 0!==n5(t,"mixBlendMode",r)&&"normal"!==n5(t,"mixBlendMode",r)&&n.push("mix-blend-mode"),n5(t,"nonScaling",r)&&n.push("non-scaling-stroke"),n}(e.route,e.stroke,t),n=function(e,t=!1){let r=[],n=[];return t3(e,t).forEach((e,t)=>{let i=e.points[0],o=e.closed?i:e.points.at(-1);i&&r.push({point:{...i},contourIndex:t}),o&&n.push({point:{...o},contourIndex:t})}),{starts:r,ends:n}}(e.geometry,e.route.closed),i=function(e,t=!1){if("line"===e.kind)return[];let r=t3(e,t);return"path"===e.kind?(e.markerMidpoints??[]).map(e=>{if(1===r.length)return{point:{...e},contourIndex:0};let t=r.flatMap((t,r)=>t.points.some(t=>tZ(t,e))?[r]:[]);if(1!==t.length)throw TypeError("Path marker-mid vertices on multiple subpaths must belong to exactly one typed contour");return{point:{...e},contourIndex:t[0]}}):r.flatMap((e,t)=>{if(e.points.length<2)return[];let r=e.closed&&tZ(e.points[0],e.points.at(-1))?e.points.slice(0,-1):e.points;return(e.closed?r.slice(1):r.slice(1,-1)).map(e=>({point:{...e},contourIndex:t}))})}(e.geometry,e.route.closed),o=n5(e.stroke,"dash",t),a={start:n5(e.markers,"start",t)?n.starts.map(r=>({markerId:n5(e.markers,"start",t).id,point:{...r.point},contourIndex:r.contourIndex})):[],mid:0===e.markers.mid.length?[]:i.map((t,r)=>({markerId:(1===e.markers.mid.length?e.markers.mid[0]:e.markers.mid[r]).id,point:{...t.point},contourIndex:t.contourIndex})),end:n5(e.markers,"end",t)?n.ends.map(r=>({markerId:n5(e.markers,"end",t).id,point:{...r.point},contourIndex:r.contourIndex})):[]};return{realization:"invisible"===e.lineStyle?"unsupported":"projected",topology:e.geometry.kind,geometry:e.geometry,direction:e.relationship.direction,relationship:e.relationship.kind,markers:{...n5(e.markers,"start",t)?{start:n3(n5(e.markers,"start",t),t)}:{},mid:e.markers.mid.map(e=>n3(e,t)),...n5(e.markers,"end",t)?{end:n3(n5(e.markers,"end",t),t)}:{}},markerPlacements:a,endpoints:{...e.endpoints,...n5(e.endpoints,"start",t)?{start:n6(n5(e.endpoints,"start",t),t)}:{},...n5(e.endpoints,"end",t)?{end:n6(n5(e.endpoints,"end",t),t)}:{}},route:{ownership:e.route.ownership,closed:e.route.closed,bendRadius:e.route.bendRadius,contours:e.route.contours.map(e=>({...e,start:{...e.start},end:{...e.end},...n5(e,"startTangent",t)?{startTangent:{...n5(e,"startTangent",t)}}:{},...n5(e,"endTangent",t)?{endTangent:{...n5(e,"endTangent",t)}}:{}})),...n5(e.route,"startTangent",t)?{startTangent:{...n5(e.route,"startTangent",t)}}:{},...n5(e.route,"endTangent",t)?{endTangent:{...n5(e.route,"endTangent",t)}}:{},labelAnchors:e.route.labelAnchors.map(e=>({...e}))},stroke:{...e.stroke,...o?{dash:{...o,array:Array.isArray(o.array)?[...o.array]:o.array}}:{}},hit:{...e.hit,geometry:e.hit.geometry},...n5(e,"transform",t)?{transform:{...n5(e,"transform",t)}}:{},labels:e.labels.map(e=>({...e,...n5(e,"anchor",t)?{anchor:{...n5(e,"anchor",t)}}:{},...n5(e,"bounds",t)?{bounds:{...n5(e,"bounds",t)}}:{},...n5(e,"halo",t)?{halo:{...n5(e,"halo",t)}}:{},...n5(e,"paint",t)?{paint:{...n5(e,"paint",t)}}:{},...n5(e,"visual",t)?{visual:{...n5(e,"visual",t)}}:{}})),lineStyle:e.lineStyle,strokeLosses:r,diagnostics:["invisible"===e.lineStyle?"This connector affects layout but is intentionally absent from terminal output.":`The terminal grid preserves connector semantics while projecting continuous stroke fields: ${r.join(", ")}.`,...n5(e,"additionalDiagnostics",t)??[]]}}t(n1,{connector:()=>ik,definitions:()=>iM,documentClose:()=>iz,documentContent:()=>iw,documentOpen:()=>ij,documentText:()=>i$,drawPathArtwork:()=>iT,group:()=>iS,indentLines:()=>nQ,pathArtwork:()=>iE,retainedGroupEmission:()=>ih,shape:()=>im,text:()=>iv});var n8=new WeakMap,n9=0;function n7(e){n9++;try{return e()}finally{n9--}}var ie={enumerable:!0,configurable:!0,get(){let e=n8.get(this);if(Object.hasOwn(e,"projection"))return e.projection;let t=n4(e,!0);return n8.set(this,{projection:t}),t},set(e){if(Object.isFrozen(this))throw TypeError("Cannot assign to readonly terminalProjection");Object.defineProperty(this,"terminalProjection",{value:e,enumerable:!0,configurable:!0,writable:!0}),n8.delete(this)}};function it(e,t){n8.set(e,t),Object.defineProperty(e,"terminalProjection",ie)}function ir(e){let t=n8.get(e);return!t||Object.hasOwn(t,"projection")?void 0:Object.getOwnPropertyDescriptor(e,"terminalProjection")?.get===ie.get?t:void 0}function ii(e,t,r){let n=n8.get(e);return"terminalProjection"===t&&n&&r.get===ie.get?ie.get.call(e):void 0}function io(e,t){let r=ir(e);return!!r&&(it(t,r),!0)}var ia=/^(?:class|data-[a-z][a-z0-9-]*|role|aria-[a-z]+|tabindex|pointer-events|transform|style)$/,is=/^\s*<g\b[^>]*>(?:<title>[^<]*<\/title>)?$/,il=/^\s*(?:--[A-Za-z0-9_-]+\s*:[^;]*(?:;\s*|$))*$/;function id({id:t,open:r,close:n,join:i,transform:o,paint:a}){let s;if("</g>"!==n||!/^\s*$/.test(i))throw TypeError(`Group "${t}" close and join must not add artwork`);let l=new Set,d,u=is.test(r)?(rJ(r,void 0,void 0,s={attribute:(r,n)=>{if(l.has(r))throw TypeError(`Group "${t}" open has a duplicate "${r}"`);if(l.add(r),"opacity"!==r&&"fill"!==r||a?.[r]===void 0||e(n)!==a[r]){if(!ia.test(r))throw TypeError(`Group "${t}" open sets "${r}"; paint and geometry belong to typed marks`);if("style"===r&&!il.test(e(n)))throw TypeError(`Group "${t}" open style may only set custom properties; paint belongs to typed marks`);"transform"===r&&(d=n)}},expectedName:"g",name:void 0}),s.name):void 0;if(["opacity","fill"].some(e=>l.has(e)!==(a?.[e]!==void 0)))throw TypeError(`Group "${t}" open disagrees with its typed paint`);if("g"!==u)throw TypeError(`Group "${t}" open must be one <g> tag with an optional <title>`);let c=void 0===d?void 0:e(d),f=void 0===c?void 0:function(e){let t=rj,r=0;for(let n of e.matchAll(/([A-Za-z]+)\s*\(([^()]*)\)/g)){let i;if(e.slice(r,n.index).trim())return;r=n.index+n[0].length;let o=n[2].trim();if(!o||/^(?:,)|(?:,)$|,\s*,/.test(o)||!/^[-+\d.eE,\s]+$/.test(o))return;let a=o.split(/[\s,]+/).map(Number);if(!a.every(Number.isFinite))return;if("matrix"===n[1]&&6===a.length)i=a;else if("translate"===n[1]&&(1===a.length||2===a.length))i=[1,0,0,1,a[0],a[1]??0];else if("scale"===n[1]&&(1===a.length||2===a.length))i=[a[0],0,0,a[1]??a[0],0,0];else{if("rotate"!==n[1]||1!==a.length&&3!==a.length)return;i=rE({kind:"rotate",angle:a[0],cx:a[1]??0,cy:a[2]??0})}t=rT(t,i)}return r>0&&!e.slice(r).trim()?t:void 0}(c),h=o?rE(o):void 0;if(void 0!==c&&!f)throw TypeError(`Group "${t}" open has an unsupported transform`);if(!!f!=!!h||f&&h&&f.some((e,t)=>Math.abs(e-h[t])>1e-9*Math.max(1,Math.abs(e))))throw TypeError(`Group "${t}" open transform disagrees with its typed transform`);return{matrix:f&&Object.freeze(f),style:l.has("style")}}function iu(e,t){if(t){for(let r of Object.keys(t))if("className"!==r&&"data"!==r&&"ariaHidden"!==r&&"tabIndex"!==r&&"ariaLabel"!==r)throw TypeError(`Mark "${e}" has unknown attribute hook "${r}"`);if(void 0!==t.className&&!nA.test(t.className))throw TypeError(`Mark "${e}" class must be space-separated CSS tokens`);for(let[r,n]of Object.entries(t.data??{})){if(!nL.test(r))throw TypeError(`Mark "${e}" has an invalid data attribute key "${r}"`);if(nI.has(r))throw TypeError(`Mark "${e}" data-${r} belongs to its typed fields`);if("string"!=typeof n)throw TypeError(`Mark "${e}" data-${r} must be a string`)}if(void 0!==t.ariaHidden&&!0!==t.ariaHidden)throw TypeError(`Mark "${e}" ariaHidden must be true when present`);if(void 0!==t.tabIndex&&0!==t.tabIndex)throw TypeError(`Mark "${e}" tabIndex must be 0 when present`);if(void 0!==t.ariaLabel&&"string"!=typeof t.ariaLabel)throw TypeError(`Mark "${e}" ariaLabel must be a string`)}}var ic=new WeakMap;function ih(e){return ic.get(e)}function ip(e){if(e.identity)return{...e.identity,role:e.role};let t=e.attributes?.className?.split(" ");return{id:e.id,role:e.role,...t?{classNames:t}:{}}}function im(e){if(iu(e.id,e.attributes),e.childPaints&&("compound"!==e.geometry.kind||e.childPaints.length!==e.geometry.children.length))throw TypeError(`Shape "${e.id}" child paints must match its compound geometry`);if(!1===e.identity&&e.owner?.role!==e.role)throw TypeError(`Shape "${e.id}" without DOM identity requires an explicit owner with the same role`);let t=!1===e.identity?void 0:ip(e),r=t?n2(t,e.attributes?.data?.label):void 0;if(r&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Shape "${e.id}" takes its aria-label from typed relation accessibility`);return nX({kind:"shape",id:e.id,role:e.role,...t?{identity:t}:{},...e.owner?{owner:e.owner}:{},...e.visibility?{visibility:e.visibility}:{},...r?{accessibility:r}:{},geometry:e.geometry,paint:e.paint,...e.childPaints?{childPaints:e.childPaints}:{},...e.conditionalPaint?{conditionalPaint:e.conditionalPaint}:{},...void 0!==e.surfaceFragment?{surfaceFragment:e.surfaceFragment}:{},...e.channels?{channels:e.channels}:{},...e.transform?{transform:e.transform}:{},...e.attributes?{attributes:e.attributes}:{}})}var ig={id:!0,role:!0,geometry:!0,lineStyle:!0,paint:!0,identity:!0,owner:!0,visibility:!0,endpoints:!0,relationship:!0,route:!0,stroke:!0,markers:!0,labels:!0,hit:!0,terminalProjection:!0,channels:!0,transform:!0,attributes:!0},iy={start:!0,mid:!0,end:!0};function ib(e,t,r){if(!e||"object"!=typeof e||Array.isArray(e))throw TypeError(`${r} fields must be an object`);for(let n of Reflect.ownKeys(e))if(!Object.hasOwn(t,n))throw TypeError(`unknown ${r} field "${String(n)}"`)}function ix(e,t){return t?{...e,...t,...t.owner?{owner:{...t.owner}}:{},...t.point?{point:{...t.point}}:{}}:e??{}}function ik(e){var t;let r;if(ib(e,ig,"connector"),void 0!==e.markers&&ib(e.markers,iy,"marker"),"path"!==e.geometry.kind&&e.route?.closed===!0)throw TypeError(`Connector "${e.id}" closed route topology requires path geometry`);if("path"===e.geometry.kind){let r=e.geometry,n=r.subpaths,i=(t=r.d,t.match(/[Mm](?=\s*[-+.]?\d)/g)?.length??0);if(i>1&&!n)throw TypeError(`Connector "${e.id}" path has multiple SVG subpaths but no typed subpaths`);if(n){if(0===n.length||n.some(e=>e.points.length<2))throw TypeError(`Connector "${e.id}" typed subpaths must each contain at least two points`);if(i!==n.length)throw TypeError(`Connector "${e.id}" typed subpath count disagrees with SVG path moves`);let t=n.flatMap(e=>e.points);if(t.length!==r.points.length||t.some((e,t)=>{let n=r.points[t];return!n||n.x!==e.x||n.y!==e.y}))throw TypeError(`Connector "${e.id}" typed subpaths disagree with the canonical point projection`)}}let n=t3(e.geometry,e.route?.closed??!1),i=1===n.length&&n[0].closed;if("path"===e.geometry.kind&&e.geometry.subpaths&&e.route?.closed!==void 0&&e.route.closed!==i)throw TypeError(`Connector "${e.id}" route.closed disagrees with typed subpath topology`);let o="path"===e.geometry.kind&&e.geometry.subpaths?i:e.route?.closed??!1;if("path"===e.geometry.kind&&(e.geometry.d.match(/[Zz]/g)?.length??0)!==(e.geometry.subpaths?e.geometry.subpaths.filter(e=>e.closed).length:+!!o))throw TypeError(`Connector "${e.id}" SVG close commands disagree with typed closed-contour semantics`);let a=e.markers?.start,s=e.markers?.end,l=e.markers?.mid??[];for(let t of[a,...l,s])if(t?.geometry?.kind==="path"&&!t.bounds&&!t.viewBox&&!t.size)throw TypeError(`Connector "${e.id}" path marker "${t.id}" requires bounds, viewBox, or size`);!function(e,t,r,n){if(0===n.length)return;let i=t7(t,r).length;if(0===i)throw RangeError(`Connector "${e}" has mid markers but no typed interior route points`);if(1!==n.length&&n.length!==i)throw RangeError(`Connector "${e}" mid markers must contain one repeated descriptor or one descriptor per interior route point`);if(1!==new Set(n.map(e=>e.id)).size)throw RangeError(`Connector "${e}" uses distinct mid markers that one SVG marker-mid carrier cannot represent`);n[0].id}(e.id,e.geometry,o,l);let d=function(e,t){if("line"===e.kind)return{start:{point:{x:e.x1,y:e.y1}},end:{point:{x:e.x2,y:e.y2}}};let r=t3(e,t),n=r[0]?.points[0],i=r.at(-1),o=i?.closed?i.points[0]:i?.points.at(-1);return{...n?{start:{point:{...n}}}:{},...o?{end:{point:{...o}}}:{}}}(e.geometry,o);for(let t of["start","end"]){let r=e.endpoints?.[t]?.point,n=d[t]?.point;if(r&&n&&!tZ(r,n))throw TypeError(`Connector "${e.id}" endpoints.${t}.point disagrees with typed route geometry`)}let u={...e.endpoints??{},start:ix(d.start,e.endpoints?.start),end:ix(d.end,e.endpoints?.end)},c={kind:e.relationship?.kind??e.role,direction:e.relationship?.direction??(void 0!==u.from&&u.from===u.to?"self":a&&s?"bidirectional":a?"reverse":s?"forward":"undirected")},f=(e.labels??[]).map(e=>{let t=eY(e.text,e.textContent),r=eZ(e.text);return{...e,text:r,..."string"!=typeof t?{textContent:{...e.textContent,value:r}}:{}}}),h={id:e.identity?.id??e.id,role:e.role,...e.identity?.classNames?{classNames:e.identity.classNames}:{},...e.identity?.from??u.from?{from:e.identity?.from??u.from}:{},...e.identity?.to??u.to?{to:e.identity?.to??u.to}:{}},p=f[0],m=n2(h,p?.visual?.kind==="inline"?nM(p).lineBlocks.map(e=>e.runs.map(e=>e.text).join("")).join(`
19
- `):p?tv(eY(p.text,p.textContent),p.display??"literal"):void 0);if(iu(e.id,e.attributes),m&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Connector "${e.id}" takes its aria-label from typed relation accessibility`);for(let[t,r]of f.entries())if(r.visual?.kind==="inline"&&(!r.anchor||!r.paint||void 0===r.fontSize||void 0===r.textAnchor))throw TypeError(`Connector "${e.id}" inline label ${t+1} requires anchor, paint, fontSize, and textAnchor`);let g=e.stroke?.width??e.paint.strokeWidth??"1",y=e.stroke?.dash??(e.paint.strokeDasharray?{array:e.paint.strokeDasharray,...void 0!==e.paint.strokeDashoffset?{offset:e.paint.strokeDashoffset}:{}}:void 0),b=e.stroke?.opacity??e.paint.opacity,x=e.stroke?.paintOrder??e.paint.paintOrder,k=e.stroke?.mixBlendMode,v={color:e.stroke?.color??e.paint.stroke??"var(--_line)",width:g,...void 0!==b?{opacity:b}:{},...y?{dash:y}:{},lineCap:e.stroke?.lineCap??e.paint.strokeLinecap??"butt",lineJoin:e.stroke?.lineJoin??e.paint.strokeLinejoin??"miter",miterLimit:e.stroke?.miterLimit??Number(e.paint.strokeMiterlimit??4),...e.stroke?.pathLength!==void 0?{pathLength:e.stroke.pathLength}:{},...void 0!==x?{paintOrder:x}:{},...void 0!==k?{mixBlendMode:k}:{},nonScaling:e.stroke?.nonScaling??"non-scaling-stroke"===e.paint.vectorEffect,...e.stroke?.encodesValue?{encodesValue:!0}:{}},w=t4(e.geometry,o),$=e.route?.contours;if($&&($.length!==w.length||$.some((e,t)=>{let r=w[t];return!r||e.start.x!==r.start.x||e.start.y!==r.start.y||e.end.x!==r.end.x||e.end.y!==r.end.y||e.closed!==r.closed})))throw TypeError(`Connector "${e.id}" route contours disagree with typed subpath endpoint topology`);if(!t6(e.geometry)&&$)for(let[t,r]of $.entries()){let n=w[t];for(let i of["startTangent","endTangent"]){let o=r[i],a=n[i];if(o&&(!a||!tZ(o,a,1e-9)))throw TypeError(`Connector "${e.id}" route.contours[${t}].${i} disagrees with linear route geometry`)}}let M=$?w.map((e,t)=>{let r=$?.[t],n=r?.startTangent??e.startTangent,i=r?.endTangent??e.endTangent;return{start:{...e.start},end:{...e.end},closed:e.closed,...n?{startTangent:n}:{},...i?{endTangent:i}:{}}}):w;for(let t of M)for(let r of[t.startTangent,t.endTangent]){if(!r)continue;let t=Math.hypot(r.x,r.y);if(!Number.isFinite(t)||Math.abs(t-1)>1e-9)throw TypeError(`Connector "${e.id}" contour tangents must be finite unit vectors`)}for(let t of[e.route?.startTangent,e.route?.endTangent]){if(!t)continue;let r=Math.hypot(t.x,t.y);if(!Number.isFinite(r)||Math.abs(r-1)>1e-9)throw TypeError(`Connector "${e.id}" route tangents must be finite unit vectors`)}for(let[t,r,n]of[["startTangent",e.route?.startTangent,M[0]?.startTangent],["endTangent",e.route?.endTangent,M.at(-1)?.endTangent]])if(r&&n&&!tZ(r,n,1e-9))throw TypeError(`Connector "${e.id}" route.${t} disagrees with its contour tangent authority`);let z={geometry:e.geometry,ownership:e.route?.ownership??"family",closed:o,bendRadius:e.route?.bendRadius??0,contours:M,...e.route?.startTangent??M[0]?.startTangent?{startTangent:e.route?.startTangent??M[0]?.startTangent}:{},...e.route?.endTangent??M.at(-1)?.endTangent?{endTangent:e.route?.endTangent??M.at(-1)?.endTangent}:{},labelAnchors:e.route?.labelAnchors??f.flatMap(e=>e.anchor?[e.anchor]:[])};if(e.hit?.closed!==void 0&&e.hit.closed!==o)throw TypeError(`Connector "${e.id}" hit.closed must match route.closed topology`);let S={geometry:e.hit?.geometry??e.geometry,closed:e.hit?.closed??o,strokeWidth:e.hit?.strokeWidth??Math.max(6,Number.isFinite(r="number"==typeof g?g:parseFloat(g))?Math.max(0,r):1),pointerEvents:e.hit?.pointerEvents??("invisible"===e.lineStyle?"none":"stroke")},j={geometry:e.geometry,lineStyle:e.lineStyle,endpoints:u,relationship:c,route:z,stroke:v,markers:{...a?{start:a}:{},mid:l,...s?{end:s}:{}},labels:f,hit:S,...e.transform?{transform:e.transform}:{},additionalDiagnostics:e.terminalProjection?.diagnostics},E={kind:"connector",id:e.id,role:e.role,lineStyle:e.lineStyle,endpoints:u,relationship:c,route:z,stroke:v,markers:{...a?{start:a}:{},mid:l,...s?{end:s}:{}},labels:f,hit:S,terminalProjection:void 0,identity:h,...e.owner?{owner:e.owner}:{},...e.visibility?{visibility:e.visibility}:{},...m?{accessibility:m}:{},...e.channels?{channels:e.channels}:{},...e.transform?{transform:e.transform}:{},...e.attributes?{attributes:e.attributes}:{}};return function(e,t){if(0===n9||"path"===t.geometry.kind||void 0!==t.additionalDiagnostics&&!t.additionalDiagnostics.every(e=>"string"==typeof e)){e.terminalProjection=n4(t);return}t.additionalDiagnostics&&Object.defineProperty(t,"additionalDiagnostics",{value:Object.freeze([...t.additionalDiagnostics])}),it(e,Object.freeze(t))}(E,j),nX(E)}function iv(e){let{block:t,...r}=e;if(t){for(let r of["fontSize","fontWeight","letterSpacing"])if(void 0!==e[r]&&e[r]!==t[r])throw TypeError(`Text "${e.id}" ${r} differs from its retained prepared block`)}iu(e.id,e.attributes);let n=e.fontWeight??t?.fontWeight??400,i=e.letterSpacing??t?.letterSpacing??0,o=e.display??t?.prepared.display??"formatted",a=t??nd(e.text,{display:o,fontSize:e.fontSize,fontWeight:n,letterSpacing:i});if(e.spans&&(1!==a.lines.length||e.spans.map(e=>e.text).join("")!==a.text))throw TypeError(`Text "${e.id}" spans must spell its one displayed line`);let s=e.baselineShift??.35,l=a.lines.length,d=t?t.lineHeight:e.fontSize*tp,u=(1===l?0:-((l-1)/2)*d)+e.fontSize*s,c="hanging"===e.dominantBaseline?a.lineHeight/2:"middle"===e.dominantBaseline||"central"===e.dominantBaseline?0:-(.35*e.fontSize),f=u+(l-1)*a.lineHeight/2+c,h=ip(e),p=n2(h,e.attributes?.data?.label);if(p&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Text "${e.id}" takes its aria-label from typed relation accessibility`);return nX({kind:"text",...r,identity:h,accessibility:p,block:a,measurement:t?"prepared":"fallback",...t?{prepared:!0,preparedLines:t.lineBlocks.map(e=>e.runs)}:{},fontWeight:n,letterSpacing:i,display:o,textLayout:{width:a.width,height:a.height,lineHeight:a.lineHeight,offsetY:f}})}function iw(e,t){return nV({kind:"document",element:"content",...e},t)}function i$(e){let t="title"===e.element?"title":"desc",r=e.domId?` id="${tz(e.domId)}"`:"";return nV({kind:"document",role:"chrome",...e},`<${t}${r}>${tM(e.text)}</${t}>`)}function iM(e,t){return nV({kind:"document",role:"defs",element:"definitions",...e},t)}function iz(){return nV({kind:"document",id:"svg-close",role:"chrome",element:"close"},"</svg>")}function iS(t){let r,n,i,o,a,s=t.open,l=t.close,d=t.join??`
20
- `,u=id({id:t.id,open:s,close:l,join:d,transform:t.transform}),c=(r=s.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0]??"",i=((n=t=>{let n=r.match(RegExp(`\\s${t}="([^"]*)"`))?.[1];return void 0===n?void 0:e(n)})("class")??"").split(/\s+/).filter(Boolean),o=n("data-from"),a=n("data-to"),{id:n("data-id")??t.id,role:t.role,...void 0!==o?{from:o}:{},...void 0!==a?{to:a}:{},...i.length>0?{classNames:i}:{}}),f=t.paint,h=f?.opacity,p=f?.fill,m=f&&[...void 0!==h?[`opacity="${tz(h)}"`]:[],...void 0!==p?[`fill="${tz(p)}"`]:[]].join(" "),g=m?s.replace(/^(\s*<g)\b/,`$1 ${m}`):s,y=t.owner??{id:c.id,role:c.role},b=t.children.map(e=>{var t;let r;if(e.node.owner||"document"===e.node.kind||"group"===e.node.kind)return e;if(ir(e.node)){let t={};for(let r of Object.keys(e.node))t[r]="terminalProjection"===r?void 0:e.node[r];t.owner=y,r=t,io(e.node,r)}else r={...e.node,owner:y};return t=e.node,(nG.has(t)||nZ.has(t))&&nK(e.node,r),{...e,node:r}}),x=nU(tG(g,c)),k=nX({kind:"group",id:t.id,role:t.role,open:x,close:l,children:b,join:d,channels:t.channels,identity:c,owner:y,...t.visibility?{visibility:t.visibility}:{},...t.transform?{transform:t.transform}:{},...f?{paint:f}:{}});return ic.set(k,Object.freeze({open:x,opacity:h,...u,style:u.style||void 0!==p})),k}function ij(e,t){return nV({kind:"document",element:"open",id:e.id,role:"prelude"},t)}function iE(e){return iT({shape:im,group:iS},e)}function iT(e,t){return e.group({id:t.id,role:"icon",open:t.open,close:"</g>",...t.transform?{transform:t.transform}:{},...t.owner?{owner:t.owner}:{},...t.channels?{channels:t.channels}:{},join:t.join??"",children:t.paths.map((r,n)=>({indent:t.indent??0,node:e.shape({id:tH(t.id,"path",n),role:"icon",geometry:{kind:"path",d:r},paint:t.paint,...t.owner?{owner:t.owner}:{}})}))})}export{eZ as a,S as b,L as c,D as d,G as e,Z as f,J as g,U as h,es as i,el as j,ed as k,eb as l,ek as m,ev as n,ew as o,eA as p,eR as q,eM as r,ez as s,eS as t,tu as u,tf as v,th as w,tp as x,tm as y,eO as z,eN as A,eI as B,eY as C,eQ as D,eK as E,e0 as F,e1 as G,tg as H,ty as I,tb as J,tk as K,tv as L,tM as M,tz as N,tS as O,tW as P,tL as Q,tP as R,tB as S,tH as T,tR as U,tD as V,tG as W,ne as X,nt as Y,nr as Z,nd as _,nu as $,nc as aa,nf as ba,tZ as ca,tQ as da,t5 as ea,t3 as fa,t6 as ga,t4 as ha,t8 as ia,t9 as ja,re as ka,rr as la,rn as ma,ri as na,ro as oa,rs as pa,ru as qa,rc as ra,rf as sa,rh as ta,rp as ua,rm as va,rg as wa,ry as xa,rb as ya,rx as za,rk as Aa,r$ as Ba,rz as Ca,rS as Da,r4 as Ea,rj as Fa,rE as Ga,rT as Ha,rO as Ia,rC as Ja,rW as Ka,np as La,nm as Ma,ny as Na,nb as Oa,nk as Pa,nv as Qa,nz as Ra,nS as Sa,nE as Ta,nT as Ua,nW as Va,nF as Wa,n4 as Xa,n7 as Ya,ir as Za,ii as _a,io as $a,rA as ab,rL as bb,rH as cb,rR as db,rD as eb,r_ as fb,rU as gb,rV as hb,rX as ib,rQ as jb,r0 as kb,r1 as lb,r2 as mb,r5 as nb,id as ob,r3 as pb,nI as qb,nA as rb,nL as sb,nD as tb,nU as ub,nY as vb,nQ as wb,nK as xb,n0 as yb,ih as zb,im as Ab,ik as Bb,iv as Cb,iw as Db,i$ as Eb,iM as Fb,iz as Gb,iS as Hb,ij as Ib,iT as Jb,n1 as Kb,l as Lb,d as Mb,u as Nb,o as Ob,c as Pb,f as Qb,h as Rb,p as Sb,m as Tb,g as Ub,b as Vb,x as Wb,k as Xb,w as Yb,$ as Zb,M as _b,z as $b};
13
+ `):tv(l,u);/(?:^ | $| {2}|\t)/m.test(m)&&!i.includes("xml:space=")&&(i+=' xml:space="preserve"'),s&&(i+=' data-prepared-text="true"');let g=e=>!s||h||s.lineBlocks[e].fragments?"":` textLength="${tL(s.lineBlocks[e].width)}" lengthAdjust="spacingAndGlyphs" data-font-metrics="deterministic-fit"`;if(1===d.length){let e=n*o;return f?`<text x="${tL(t)}" y="${tL(r)}" ${i}>${tT(s,0,t,c,r+e)}</text>`:`<text x="${tL(t)}" y="${tL(r)}" ${i} dy="${tL(e)}"${g(0)}>${p(l,0)}</text>`}let y=s?.lineHeight??n*tp,b=-((d.length-1)/2)*y+n*o,x=d.map((e,n)=>{let i=f?`y="${tL(r+b+n*y)}"`:`dy="${tL(0===n?b:y)}"`;return`<tspan x="${tL(t)}" ${i}${g(n)}>${p(e,n)}</tspan>`}).join("");return`<text x="${tL(t)}" y="${tL(r)}" ${i}>${x}</text>`}var tC=/[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?/g,tW=/\.\d{12}/,tF=/^[-+]?(?:\d+\.?\d*|\.\d+)(?:[eE][-+]?\d+)?(?:%|px|pt|pc|em|ex|rem|cm|mm|in)?$/,tI=new Set(["x","y","x1","y1","x2","y2","cx","cy","r","rx","ry","dx","dy","width","height","refX","refY","markerWidth","markerHeight","stroke-width","stroke-dashoffset","stroke-miterlimit","pathLength","font-size","font-weight","letter-spacing","textLength","opacity","fill-opacity","stroke-opacity","stop-opacity","offset"]),tN=new Map,tA=new Map;function tL(e){let t=tN.get(e);if(void 0!==t)return t;let r=String(e),n=r.length>=14&&tW.test(r)&&Number.isFinite(e)?String(Number(e.toPrecision(12))):r;return tN.size>=1024&&tN.clear(),tN.set(e,n),n}function tP(e,t){if(t.length<13||!tW.test(t))return t;let r=t.length<=512?`${e}\0${t}`:void 0,n=void 0===r?void 0:tA.get(r);if(void 0!==n)return n;if(!(tI.has(e)&&tF.test(t)||("viewBox"===e||"points"===e||"stroke-dasharray"===e)&&/^[-+\d.eE,\s]+$/.test(t)||"d"===e&&/^[MmZzLlHhVvCcSsQqTtAa\d.eE,+\s-]+$/.test(t)||("transform"===e||"gradientTransform"===e||"patternTransform"===e)&&/^(?:(?:matrix|translate|scale|rotate|skewX|skewY)\s*\([-+\d.eE,\s]+\)\s*)+$/.test(t)))return t;let i=t.replace(tC,(e,r)=>{if(!tW.test(e))return e;let n=Number(e);if(!Number.isFinite(n))return e;let i=tL(n);return e.startsWith(".")&&r>0&&/[\d.]/.test(t[r-1])?` ${i}`:i});return void 0!==r&&(tA.size>=256&&tA.clear(),tA.set(r,i)),i}function tq(e){return!e.includes("->")&&!/[#:"\[\],\u0000-\u001f]/.test(e)}function tB(e,t,r=""){let n=tq(e)&&tq(t)?`${e}->${t}`:`relation:${JSON.stringify([e,t])}`;return r?`${r}:${n}`:n}function tR(e,...t){let r=t.map(String);return tq(e)&&r.every(tq)?[e,...r].join(":"):`part:${JSON.stringify([e,...r])}`}function tH(e,t,...r){let n=r.map(String);return tq(t)&&n.every(tq)?[e,t,...n].join(":"):`${e}:${JSON.stringify([t,...n])}`}function tD(e){return ev(e).domIdentity}function tG(e,t){if(!tD(t.role))return e;let r=e.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0];if(!r||r.startsWith("<style")||r.startsWith("<defs")||r.startsWith("<svg"))return e;let n=(e,t,r)=>{let n=tz(r),i=RegExp(`\\s${t}="[^"]*"`);if(i.test(e))return e.replace(i,` ${t}="${n}"`);let o=e.endsWith("/>")?"/>":">";return`${e.slice(0,-o.length).trimEnd()} ${t}="${n}"${"/>"===o?" /":""}>`},i=n(n(r,"data-id",t.id),"data-role",t.role);return void 0!==t.from&&(i=n(i,"data-from",t.from)),void 0!==t.to&&(i=n(i,"data-to",t.to)),i===r?e:e.replace(r,i)}function tZ(e,t,r=0){return Math.abs(e.x-t.x)<=r&&Math.abs(e.y-t.y)<=r}function t_(e,t){let r=t.x-e.x,n=t.y-e.y,i=Math.hypot(r,n);return Number.isFinite(i)&&i>0?{x:r/i,y:n/i}:void 0}function tJ(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function tV(e,t){return Math.hypot(t.x-e.x,t.y-e.y)}function tU(e,t,r){let n=tV(t,r);return 0===n?tV(e,t):Math.abs((r.x-t.x)*(t.y-e.y)-(t.x-e.x)*(r.y-t.y))/n}function tY(e,t,r,n,i=.5,o=12){if(!Number.isFinite(i)||i<=0)throw TypeError("Cubic flattening tolerance must be positive and finite");if(!Number.isSafeInteger(o)||o<0)throw TypeError("Cubic flattening maxDepth must be a non-negative safe integer");for(let i of[e,t,r,n])if(!Number.isFinite(i.x)||!Number.isFinite(i.y))throw TypeError("Cubic flattening points must be finite");let a=[{...e}],s=(e,t,r,n,l)=>{let d=tV(e,n),u=tV(e,t)+tV(t,r)+tV(r,n)-d;if(Math.max(tU(t,e,n),tU(r,e,n))<=i&&u<=i||l>=o)return void a.push({...n});let c=tJ(e,t),f=tJ(t,r),h=tJ(r,n),p=tJ(c,f),m=tJ(f,h),g=tJ(p,m);s(e,c,p,g,l+1),s(g,m,h,n,l+1)};return s(e,t,r,n,0),a}function tX(...e){let t=e[0];if(t)for(let r=1;r<e.length;r++){let n=t_(t,e[r]);if(n)return n}}function tQ(e,t,r,n=.5){var i,o,a,s,l,d,u;let c,f;for(let e of[t,...r.flatMap(e=>"line"===e.kind?[e.end]:"quadratic"===e.kind?[e.control,e.end]:[e.control1,e.control2,e.end])])if(!Number.isFinite(e.x)||!Number.isFinite(e.y))throw TypeError("Connector path projection points must be finite");let h=[{...t}],p=[],m=t;for(let e of r){if(p.push(m),"line"===e.kind)h.push({...e.end});else if("quadratic"===e.kind){let[t,r]=(i=m,o=e.control,a=e.end,[{x:i.x+(o.x-i.x)*2/3,y:i.y+(o.y-i.y)*2/3},{x:a.x+(o.x-a.x)*2/3,y:a.y+(o.y-a.y)*2/3}]);h.push(...tY(m,t,r,e.end,n).slice(1))}else h.push(...tY(m,e.control1,e.control2,e.end,n).slice(1));m=e.end}for(let e=0;e<r.length&&!c;e++)s=p[e],c="line"===(l=r[e]).kind?tX(s,l.end):"quadratic"===l.kind?tX(s,l.control,l.end):tX(s,l.control1,l.control2,l.end);for(let e=r.length-1;e>=0&&!f;e--)d=p[e],f="line"===(u=r[e]).kind?tX(d,u.end):"quadratic"===u.kind?tX(u.control,u.end)??tX(d,u.end):tX(u.control2,u.end)??tX(u.control1,u.end)??tX(d,u.end);return{geometry:{kind:"path",d:e,points:h},contours:[{start:{...t},end:{...m},closed:!1,...c?{startTangent:c}:{},...f?{endTangent:f}:{}}]}}function tK(e,t,r){return"manhattan"===r?Math.abs(t.x-e.x)+Math.abs(t.y-e.y):tV(e,t)}function t0(e,t){if(void 0===t)return e;if(!Number.isSafeInteger(t)||t<0)throw TypeError("Rounded connector precision must be a non-negative safe integer");let r=10**t;return Math.round(e*r)/r}function t1(e,t,r,n,i){let o=tK(e,t,n);if(0===o)return{...e};let a=r/o;return{x:t0(e.x+(t.x-e.x)*a,i),y:t0(e.y+(t.y-e.y)*a,i)}}function t2(e,t){for(let r=1;r<e.length-1;r++){let n=t?r:e.length-1-r,i=e[n-1],o=e[n],a=e[n+1],s=o.x-i.x,l=o.y-i.y,d=a.x-o.x,u=a.y-o.y;if(s*u!=l*d||s*d+l*u<0)return n}return -1}function t5(e,t,r={}){if(0===e.length)throw RangeError("Rounded connector paths require at least one point");if(!Number.isFinite(t))throw TypeError("Rounded connector radius must be finite");let n=r.metric??"euclidean",i=r.terminalClearance;if(i&&(!Number.isFinite(i.start??0)||(i.start??0)<0||!Number.isFinite(i.end??0)||(i.end??0)<0))throw TypeError("Terminal clearance must be finite and non-negative");let o=e[0],a=[];if(t<=0||e.length<3){for(let t=1;t<e.length;t++)a.push({kind:"line",end:e[t]});return tQ(`M${e.map(e=>`${e.x},${e.y}`).join(" L")}`,o,a,r.tolerance)}let s=i?.start?t2(e,!0):-1,l=i?.end?t2(e,!1):-1,d=[`M${o.x},${o.y}`];for(let u=1;u<e.length-1;u++){let c=e[u-1],f=e[u],h=e[u+1],p=Math.max(0,Math.min(t,tK(c,f,n)/2,tK(f,h,n)/2,u===s?tK(o,f,n)-i.start:1/0,u===l?tK(e.at(-1),f,n)-i.end:1/0));if(p<=0){d.push(`L${f.x},${f.y}`),a.push({kind:"line",end:f});continue}let m=t1(f,c,p,n,r.precision),g=t1(f,h,p,n,r.precision);d.push(`L${m.x},${m.y}`),d.push(`Q${f.x},${f.y} ${g.x},${g.y}`),a.push({kind:"line",end:m}),a.push({kind:"quadratic",control:f,end:g})}let u=e.at(-1);return d.push(`L${u.x},${u.y}`),a.push({kind:"line",end:u}),tQ(d.join(" "),o,a,r.tolerance)}function t3(e,t=!1){return"line"===e.kind?[{points:[{x:e.x1,y:e.y1},{x:e.x2,y:e.y2}],closed:!1}]:"path"===e.kind&&void 0!==e.subpaths?e.subpaths:[{points:e.points,closed:t}]}function t6(e){return"path"===e.kind&&/[AaCcQqSsTt]/.test(e.d)}function t4(e,t=!1){let r=[];for(let n of t3(e,t)){let t,i=n.points[0],o=n.points.at(-1);if(!i||!o)continue;for(let e=1;e<n.points.length&&!t;e++)t=t_(n.points[e-1],n.points[e]);let a=n.closed&&!tZ(i,o);!t&&a&&(t=t_(o,i));let s=a?t_(o,i):void 0;for(let e=n.points.length-1;e>0&&!s;e--)s=t_(n.points[e-1],n.points[e]);r.push({start:"line"===e.kind?i:{...i},end:"line"===e.kind?o:{...n.closed?i:o},closed:n.closed,...t?{startTangent:t}:{},...s?{endTangent:s}:{}})}return r}function t8(e,t=!1){let r=[],n=[];for(let i of t3(e,t)){let e=i.points[0],t=i.closed?e:i.points.at(-1);e&&r.push(e),t&&n.push(t)}return{starts:r,ends:n}}function t9(e,t=!1){let r=[];for(let[n,i]of t3(e,t).entries()){for(let e=1;e<i.points.length;e++)r.push({start:i.points[e-1],end:i.points[e],subpathIndex:n,closing:!1});let e=i.points[0],t=i.points.at(-1);i.closed&&e&&t&&!tZ(e,t)&&r.push({start:t,end:e,subpathIndex:n,closing:!0})}return r}function t7(e,t=!1){return"line"===e.kind?[]:"path"===e.kind?e.markerMidpoints??[]:t3(e,t).flatMap(e=>{if(e.points.length<2)return[];let t=e.closed&&tZ(e.points[0],e.points.at(-1))?e.points.slice(0,-1):e.points;return e.closed?t.slice(1):t.slice(1,-1)})}var re=Object.assign(Object.create(null),{aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"}),rt=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/;function rr(e){let t=e.replace("#",""),r=3===t.length||4===t.length?t[0]+t[0]+t[1]+t[1]+t[2]+t[2]:t;return[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16)]}function rn(e){return ry(e)?rr(e):null}function ri(e,t,r){return"#"+[e,t,r].map(e=>Math.round(Math.max(0,Math.min(255,e))).toString(16).padStart(2,"0")).join("")}function ro(e,t,r){return ri(...ra(rr(e),rr(t),r))}function ra(e,t,r,n=[0,0,0]){let i=r/100;for(let r=0;r<3;r++)n[r]=Math.round(Math.max(0,Math.min(255,e[r]*i+t[r]*(1-i))));return n}function rs(e){return e<=.04045?e/12.92:((e+.055)/1.055)**2.4}function rl(e){return .2126*rs(e[0]/255)+.7152*rs(e[1]/255)+.0722*rs(e[2]/255)}function rd(e,t){return(Math.max(e,t)+.05)/(Math.min(e,t)+.05)}function ru(e){let t=rk(e);return t?rl(t):null}function rc(e,t){let r=ru(e),n=ru(t);return null===r||null===n?null:rd(r,n)}function rf(e,t,r,n){let i=rc(e,t);if(null===i||i>=r)return e;let o=rc("#000000",t)??0,a=rc("#ffffff",t)??0,s=(n?rc(n,t)??0:0)>=r?n:o>=a?"#000000":"#ffffff";if((rc(s,t)??0)<r)return e;let l=ru(t),d=rr(s),u=rr(e),c=[0,0,0];for(let e=1;e<=1e3;e++)if(ra(d,u,e/10,c),rd(rl(c),l)>=r)return ri(...c);return s}var rh=4.5,rp=3,rm=3;function rg(e,t,r=rh){return rf(e,t,r)}function ry(e){return rt.test(e)}function rb(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function rx(e,t,r){return(299*e+587*t+114*r)/1e3}function rk(e){let t=e.trim().toLowerCase(),r=Object.hasOwn(re,t)?re[t]:void 0;if(r){let e=rr(r);return[e[0],e[1],e[2],1]}if("transparent"===t)return[0,0,0,0];let n=ry(t)?t.slice(1):void 0;if(n){let e=n.length<=4?[...n].map(e=>e+e).join(""):n;return[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16),8===e.length?Number.parseInt(e.slice(6,8),16)/255:1]}let i=t.match(/^rgba?\((.*)\)$/);if(i){let e=i[1].trim(),t=e.split("/").map(e=>e.trim());if(t.length>2||2===t.length&&e.includes(","))return null;let r=(e.includes(",")?e.split(","):t[0].split(/\s+/)).map(e=>e.trim()),n=t[1];if(e.includes(",")&&4===r.length&&void 0===n&&(n=r.pop()),3!==r.length||e.includes(",")&&r.some(e=>e.endsWith("%"))&&!r.every(e=>e.endsWith("%")))return null;let o=r.map(e=>{let t=e.endsWith("%"),r=rw(e,t);return null===r?null:Math.max(0,Math.min(255,t?2.55*r:r))});if(o.some(e=>null===e))return null;let a=rv(n);return null===a?null:[o[0],o[1],o[2],a]}let o=t.match(/^hsla?\((.*)\)$/);if(o){let e=o[1].trim(),t=e.split("/").map(e=>e.trim());if(t.length>2||2===t.length&&e.includes(","))return null;let r=(e.includes(",")?e.split(","):t[0].split(/\s+/)).map(e=>e.trim()),n=t[1];if(e.includes(",")&&4===r.length&&void 0===n&&(n=r.pop()),3!==r.length||e.includes(",")&&(!r[1].endsWith("%")||!r[2].endsWith("%")))return null;let i=function(e){let t=e.trim().match(/^([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)(deg|grad|rad|turn)?$/i);if(!t)return null;let r=Number(t[1]);if(!Number.isFinite(r))return null;let n=r;switch(t[2]?.toLowerCase()){case"grad":n*=.9;break;case"rad":n*=180/Math.PI;break;case"turn":n*=360}return Number.isFinite(n)?n:null}(r[0]),a=rw(r[1],r[1].endsWith("%")),s=rw(r[2],r[2].endsWith("%")),l=rv(n);if(null===i||null===a||null===s||null===l)return null;let d=s/100,u=Math.max(0,a)/100*(1-Math.abs(2*d-1)),c=(i%360+360)%360/60,f=u*(1-Math.abs(c%2-1)),[h,p,m]=c<1?[u,f,0]:c<2?[f,u,0]:c<3?[0,u,f]:c<4?[0,f,u]:c<5?[f,0,u]:[u,0,f],g=d-u/2,y=[(h+g)*255,(p+g)*255,(m+g)*255];return y.some(e=>!Number.isFinite(e))?null:[Math.max(0,Math.min(255,y[0])),Math.max(0,Math.min(255,y[1])),Math.max(0,Math.min(255,y[2])),l]}return null}function rv(e){if(void 0===e)return 1;let t=e.endsWith("%"),r=rw(e,t);return null===r?null:Math.max(0,Math.min(1,t?r/100:r))}function rw(e,t){if(!(t?/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?%$/i:/^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?$/i).test(e))return null;let r=Number(t?e.slice(0,-1):e);return Number.isFinite(r)?r:null}function r$(e,t){let r=rk(e);if(!r)return null;if(1===r[3])return[r[0],r[1],r[2]];let n=rk(t);if(!n)return null;let i=n[3],o=r[3]+i*(1-r[3]);return o<=0?null:[0,1,2].map(e=>Math.min(255,Math.max(0,(r[e]*r[3]+n[e]*i*(1-r[3]))/o)))}function rM(e){let t=rn(e);return t?rl(t):null}function rz(e,t){let r=rM(e),n=rM(t);return null===r||null===n?null:rd(r,n)}function rS(e,t,r="#ffffff"){let n=r$(t,r);if(!n)return null;let i=ri(...n),o=r$(e,i);return o?rz(ri(...o),i):null}var rj=[1,0,0,1,0,0];function rE(e){if(!e)return rj;if("matrix"===e.kind)return[e.a,e.b,e.c,e.d,e.e,e.f];let t=e.angle*Math.PI/180,r=Math.cos(t),n=Math.sin(t);return[r,n,-n,r,e.cx-r*e.cx+n*e.cy,e.cy-n*e.cx-r*e.cy]}function rT(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}function rO(e,t){return{x:t[0]*e.x+t[2]*e.y+t[4],y:t[1]*e.x+t[3]*e.y+t[5]}}function rC(e){let t=e[0]*e[3]-e[1]*e[2];if(!(!Number.isFinite(t)||0===t))return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[3]*e[4])/t,(e[1]*e[4]-e[0]*e[5])/t]}function rW(e){return"rotate"===e.kind?`rotate(${e.angle} ${e.cx} ${e.cy})`:`matrix(${e.a} ${e.b} ${e.c} ${e.d} ${e.e} ${e.f})`}var rF=Symbol.for("agentic-mermaid.performance-observer.v1"),rI=globalThis;function rN(e,t){try{e(Object.freeze(t))}catch{}}function rA(e,t,r,n){let i=rI[rF];"function"==typeof i&&rN(i,{version:1,kind:"cache",owner:e,outcome:t,...r?{reason:r}:{},...n?{detail:n}:{}})}function rL(e,t,r){let n=rI[rF];"function"==typeof n&&rN(n,{version:1,kind:"fallback",owner:e,reason:t,...void 0!==r?{attempt:r}:{}})}var rP,rq=0,rB=0;function rR(e){let t;"function"==typeof(t=rI[rF])&&rN(t,{version:1,kind:"scope",owner:"graphical"});let r=rP,n=rq,i=rB;rP=new Map,rq=0,rB=0;try{return e()}finally{rP=r,rq=n,rB=i}}function rH(e,t,r){if(!rP)return rA("svg-inspection","bypass","outside-graphical-scope",e),r();let n=rP.get(e);if(n?.has(t))return rA("svg-inspection","hit",void 0,e),n.get(t);rA("svg-inspection","miss",void 0,e);let i=r();return rB<512&&rq+t.length<=524288?(n||(n=new Map,rP.set(e,n)),n.set(t,i),rq+=t.length,rB++):rA("svg-inspection","store-skipped",rB>=512?"entry-limit":"character-limit",e),i}function rD(e){if(void 0===e)return!1;let t=e.charCodeAt(0),r=32|t;return r>=97&&r<=122||t>=48&&t<=57||95===t||46===t||58===t||45===t}function rG(e){if(void 0===e)return!1;let t=e.charCodeAt(0);return t<128?32===t||t>=9&&t<=13:/\s/.test(e)}function rZ(e,t){let r=e.indexOf(">",t);if(r<0)return -1;for(let n=t;n<r;n++){let t=e[n];if('"'!==t&&"'"!==t)continue;let i=e.indexOf(t,n+1);if(i<0||(n=i,i>r&&(r=e.indexOf(">",i+1))<0))return -1}return r+1}function r_(e){return rH("start-tags",e,()=>rJ(e))}function rJ(e,t,r,n){let i=t||r||n?void 0:[];for(let o=e.indexOf("<");o>=0;o=e.indexOf("<",o+1)){if(e.startsWith("\x3c!--",o)){let t=e.indexOf("--\x3e",o+4);if(t<0)break;o=t+2;continue}let a=e[o+1];if(!a||"/"===a||"!"===a||"?"===a)continue;let s=o+1;for(;rD(e[s]);)s++;if(s===o+1)continue;let l=rZ(e,s);if(l<0)break;let d=l-2;for(;d>o&&rG(e[d]);)d--;let u=e.slice(o+1,s);n&&(n.name=u);let c="/"===e[d],f=i?[]:void 0;if(i||t||n){let i=s;for(;i<l-1;){for(;rG(e[i]);)i++;if(">"===e[i]||"/"===e[i]&&">"===e[i+1])break;let o=i;for(;rD(e[i]);)i++;if(i===o)break;let a=e.slice(o,i);for(;rG(e[i]);)i++;if("="!==e[i])break;for(i++;rG(e[i]);)i++;let s=e[i];if('"'!==s&&"'"!==s)break;let d=++i,u=e.indexOf(s,i);if(u<0||u>=l-1)break;if(i=u,f)f.push(Object.freeze({name:a,value:e.slice(d,i),quote:s,nameStart:o,valueStart:d,valueEnd:i}));else if(n&&n.name===n.expectedName)n.attribute(a,e.slice(d,i));else if(t&&rK.has(a)){let e={start:d,end:i};t.push(e),"style"===a&&r.push(e)}i++}}if(i&&i.push(Object.freeze({name:u,start:o,end:l,attributes:Object.freeze(f),selfClosing:c})),n)return;if(r&&"style"===u&&!c){let n=e.indexOf("</style",l);if(n>=0){let e={start:l,end:n};t?.push(e),r.push(e)}}o=l-1}return i&&Object.freeze(i)}function rV(e){let t=e.search(/\S/);if(t<0)return;let r=rZ(e,t);if(r<0)return;let n=r_(e.slice(0,r))[0];return n?.start===t&&"svg"===n.name?n:void 0}function rU(e,t){return e.attributes.find(e=>e.name===t)}function rY(t,r){let n=rU(t,r);return n?e(n.value):void 0}function rX(e,t){if(0===t.length)return e;let r=[...t].sort((e,t)=>t.start-e.start),n=[],i=e.length;for(let t of r){if(t.end>i){let t=e;for(let e of r)t=`${t.slice(0,e.start)}${e.value}${t.slice(e.end)}`;return t}n.push(e.slice(t.end,i),t.value),i=t.start}return n.push(e.slice(0,i)),n.reverse().join("")}function rQ(e,t){let r=[];for(let n of r_(e))for(let e of n.attributes){let i=t(e,n);void 0!==i&&i!==e.value&&r.push({start:e.valueStart,end:e.valueEnd,value:i})}return rX(e,r)}var rK=new Set(["clip-path","color","cursor","fill","filter","flood-color","lighting-color","marker-end","marker-mid","marker-start","mask","stop-color","stroke","style"]);function r0(e){let t=[],r=[];return rJ(e,t,r),{source:e,cssRanges:t,styleContexts:r}}function r1(e){let t=[];return rJ(e,void 0,t),t}function r2(e,t,r=r0(e)){if(r.source!==e)throw Error("SVG CSS projection does not match its source");return rX(e,r.cssRanges.map(r=>({...r,value:t(e.slice(r.start,r.end))})))}function r5(e,t,r){return`${e.slice(0,t.start)}${r}${e.slice(t.end)}`}function r3(e,t){let r=[...e].map(e=>e.codePointAt(0)),n=[...t].map(e=>e.codePointAt(0)),i=Math.min(r.length,n.length);for(let e=0;e<i;e++){let t=r[e]-n[e];if(0!==t)return t}return r.length-n.length}function r6(e,t,r){let n=r*Math.PI/180,i=Math.cos(n),o=Math.sin(n),a=e.x-t.x,s=e.y-t.y;return{x:t.x+a*i-s*o,y:t.y+a*o+s*i}}function r4(e,t,r){if(r%360==0)return{...e};let n=[r6({x:e.x0,y:e.y0},t,r),r6({x:e.x1,y:e.y0},t,r),r6({x:e.x0,y:e.y1},t,r),r6({x:e.x1,y:e.y1},t,r)];return{x0:Math.min(...n.map(e=>e.x)),y0:Math.min(...n.map(e=>e.y)),x1:Math.max(...n.map(e=>e.x)),y1:Math.max(...n.map(e=>e.y))}}function r8(e){return"­"===e?"hyphen":"​"===e?"wrap":void 0}function r9(e){return e.replace(/[\u00ad\u200b]/g,"")}var r7=new eN(256,8388608),ne=new WeakSet,nt=eD(function(e){return eV.has(e)});function nr(e){return nt.has(e)}function nn(e){return ne.has(e)}function ni(e,t){ne.has(e)&&ne.add(t)}function no(e,t){return e.bold===t.bold&&e.italic===t.italic&&e.underline===t.underline&&e.strikethrough===t.strikethrough}function na(e){let t=[],r;for(let n of e.flatMap(e=>e.fragments??e)){let e=r9(n.text);if(!e)continue;let i=e===n.text?n:{...n,text:e,...n.clusters?{clusters:n.clusters.filter(e=>!r8(e.text))}:{}};r&&no(r,i)?(r.text+=i.text,r.clusters=r.clusters&&i.clusters?[...r.clusters,...i.clusters]:void 0,r.sourceEnd=i.sourceEnd):(r={...i},t.push(r))}return t}function ns(e,t){if(0===e.length)return 0;let r=t.safeFont?tc:tu,n=1!==e.length||e[0].fragments||r9(e[0].text)!==e[0].text?na(e):e,i=1===n.length?n[0].text:n.map(e=>e.text).join("");if((t.letterSpacing??0)!==0&&!/[^\x20-\x7e]/u.test(i))return nd(n,t).width;let o=t.monospace?eS()?n.reduce((e,r)=>e+tf(r.text,t.fontSize,0,r.bold?Math.max(700,t.fontWeight):t.fontWeight,r.italic?"italic":"normal",t.fontFamily),0):tf(i,t.fontSize):n.reduce((e,n)=>e+r(n.text,t.fontSize,n.bold?Math.max(700,t.fontWeight):t.fontWeight,n.italic?"italic":"normal",t.fontFamily),0);if(!eS()&&/[^\x20-\x7e]/u.test(i))return Math.max(o,n.reduce((e,r)=>e+[...r.text].reduce((e,n)=>e+(0===ts(n)?0:/[^\x20-\x7e]/u.test(n)?1.2*t.fontSize:tc(n,t.fontSize,r.bold?Math.max(700,t.fontWeight):t.fontWeight)),0),0)+eH(i).filter(e=>/\p{M}/u.test(e)&&[...e].every(e=>0===ts(e))).length*t.fontSize*1.2)+Math.max(0,[...i].length-1)*Math.abs(t.letterSpacing??0);if((t.letterSpacing??0)<0)return nd(n,t).width;let a=t.letterSpacing??0;return Math.max(0,o+(0===a?0:Math.max(0,eH(i).length-1)*a))}function nl(e,t,r,n){let i=t.bold?Math.max(700,n.fontWeight):n.fontWeight,o=t.italic?"italic":"normal",a=n.safeFont?tc:tu;return n.monospace?tf(e,n.fontSize,0,i,o,n.fontFamily):a(e,n.fontSize,i,o,n.fontFamily)-(r||eS()?0:.15*n.fontSize)}function nd(e,t){let r=0,n=0,i=0;for(let o of e){let e=eH(o.text);for(let[a,s]of e.entries()){let l=nl(s,o,a===e.length-1,t);n=Math.min(n,r),i=Math.max(i,r+l),r+=l+(t.letterSpacing??0)}}return{width:i-n,originX:-n}}function nu(e){let{fragments:t,...r}=e.fragments?.at(-1)??e;return{...r,text:"-",clusters:void 0}}function nc(e,t){if(eI("text-spans")&&(t={display:t.display,transform:t.transform,fontSize:t.fontSize,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,maxWidth:t.maxWidth,safeFont:t.safeFont,monospace:t.monospace,fontFamily:t.fontFamily}),!Number.isFinite(t.fontSize)||t.fontSize<=0||!Number.isFinite(t.fontWeight)||!Number.isFinite(t.letterSpacing??0))throw RangeError("Prepared text requires finite typography and a positive font size");let r=eI("text-spans")&&!eS()&&"string"==typeof e&&e.length<=16384?JSON.stringify([e,t]):void 0;if(void 0!==r){let e=r7.get(r);if(e)return e}let n=e1(e,t.display,t.transform),i=t.maxWidth,o=[],a=[];for(let[e,r]of n.lines.entries()){if(e>0&&a.push({kind:"authored",sourceOffset:n.lineStarts[e]-1}),0===r.length){o.push([]);continue}if(!i||!Number.isFinite(i)||i<=0||ns(r,t)<=i){o.push(r.some(e=>r9(e.text)!==e.text)?na(r):[...r]);continue}let s=function(e){let t=e.flatMap(e=>(e.clusters??eH(e.text).map(t=>({text:t,sourceStart:e.sourceStart,sourceEnd:e.sourceEnd}))).map(t=>({...e,...t,clusters:void 0}))),r=0,n=0;return eH(t.map(e=>e.text).join("")).map(e=>{let i=e.length,o=[];for(;i>0;){let e=t[r],a=Math.min(i,e.text.length-n);o.push({...e,text:e.text.slice(n,n+a)}),i-=a,(n+=a)===e.text.length&&(r++,n=0)}return{...o[0],text:e,sourceEnd:o.at(-1).sourceEnd,...o.length>1?{fragments:o}:{}}})}(r),l=eI("text-spans"),d=l&&!eS()?function(e,t){if(1!==e.length||t.monospace||t.letterSpacing||e[0].bold||e[0].italic||e[0].underline||e[0].strikethrough||/[^\x20-\x7e]/u.test(e[0].text))return;let r=e[0],n=e=>Number.isInteger(e)&&e>=0&&e<=0xffffffff;if(!r.clusters||r.clusters.length!==r.text.length||!n(r.sourceEnd)||r.clusters.some((e,t)=>e.text!==r.text[t]||!n(e.sourceStart)))return;let i=new Float64Array(r.text.length+1),o=new Uint32Array(r.text.length+1),a=t.fontWeight>=600?.6:t.fontWeight>=500?.57:.54;for(let e=0;e<r.text.length;e++){let n=ts(r.text[e]);t.safeFont&&("W"===r.text[e]||"M"===r.text[e])&&(n+=.35),i[e+1]=i[e]+n,o[e]=r.clusters[e].sourceStart}return o[r.text.length]=r.sourceEnd,{offsets:o,width:(e,r)=>(i[r]-i[e])*t.fontSize*a+.15*t.fontSize}}(r,t):void 0,u=l?(e,r)=>{let n=d?.width(e,r);return void 0!==n&&Math.abs(n-i)>1e-8*Math.max(1,Math.abs(n),Math.abs(i))?n<i:ns(s.slice(e,r),t)<=i}:void 0,c=0;for(;c<s.length;){for(;c<s.length&&r8(s[c].text);)c++;if(c===s.length)break;let e=c,r=-1,l=-1,f=e=>{let r=r8(s[e].text);r&&e>c&&ns([...s.slice(c,e),..."hyphen"===r?[nu(s[e])]:[]],t)<=i&&(l=e+1)};if(u)for(;e<s.length&&u(c,e+1);)/\s/u.test(s[e].text)&&(r=e+1),f(e),e++;else for(;e<s.length&&ns(s.slice(c,e+1),t)<=i;)/\s/u.test(s[e].text)&&(r=e+1),f(e),e++;if(e===s.length){o.push(na(s.slice(c)));break}if(e>c&&!/\s/u.test(s[e-1].text)&&/\s/u.test(s[e]?.text??""))for(r=e;r<s.length&&/\s/u.test(s[r].text);)r++;let h=!1,p,m;if(l>c&&l>=r)p=(e=l)-1,h="hyphen"===r8(m=s[e-1].text);else if(r>c){if(s.slice(c,r).some(e=>!/\s/u.test(e.text)))for(;r<s.length&&/\s/u.test(s[r].text);)r++;for(p=e=r;p>c&&/\s/u.test(s[p-1].text);)p--;p===c?p=e:m=s.slice(p,e).map(e=>e.text).join("")}else{let r;if(r=e=Math.max(c+1,e),/[\p{Script=Latin}\p{Script=Greek}\p{Script=Cyrillic}]/u.test(s[r-1]?.text??"")&&/\p{L}/u.test(s[r]?.text??"")){for(;e>c+1&&ns([...s.slice(c,e),nu(s[e-1])],t)>i;)e--;h=ns([...s.slice(c,e),nu(s[e-1])],t)<=i}}let g=na(s.slice(c,p??e)),y=d?.offsets[e]??s[e]?.sourceStart??n.source.length;if(h){let t=e===l?s[e-1]:void 0;g.push({...nu(s[e-1]),sourceStart:t?.sourceStart??y,sourceEnd:t?.sourceEnd??y})}o.push(g),e<s.length&&a.push({kind:h?"hyphen":"wrap",sourceOffset:y,...m?{replacedText:m}:{}}),c=e}0===s.length&&o.push([])}let s=n.lines.map(e=>e.map(e=>e.text).join("")).join(`
14
+ `),l=/\p{M}/u.test(s.normalize("NFD").replace(/[\uFE0E\uFE0F]/g,""))?eH(s.normalize("NFD")).reduce((e,t)=>Math.max(e,(t.replace(/[\uFE0E\uFE0F]/g,"").match(/\p{M}/gu)??[]).length),0):0,d=t.fontSize*Math.max(tp,2.4*!!/[\p{Script=Arabic}\p{Script=Hebrew}]/u.test(s),l?tp+.6*l:0),u=o.map((e,r)=>{var i;let o,a,s,l,u,c=e.map(e=>{let t;return"literal"===n.display?e.text:(t=e.text,e.strikethrough&&(t=`<s>${t}</s>`),e.underline&&(t=`<u>${t}</u>`),e.italic&&(t=`<i>${t}</i>`),e.bold&&(t=`<b>${t}</b>`),t)}).join("");e.forEach(nt.freeze);let f=!/[^\x20-\x7e]/u.test(c),h=e.some(e=>e.bold||e.italic||e.underline||e.strikethrough),p=f?(t.letterSpacing??0)!==0?(i=t,o=e.flatMap((e,t)=>eH(e.text).map(e=>({runIndex:t,text:e}))),a=0,s=0,l=0,u=o.map((t,r)=>{let n=e[t.runIndex],d=o[r+1],u=!d||!no(n,e[d.runIndex]),c=nl(t.text,n,u,i),f=nt.freeze({...t,x:a,width:c});return s=Math.min(s,a),l=Math.max(l,a+c),a+=c+(i.letterSpacing??0),f}),{width:l-s,originX:-s,fragments:nt.freeze(u)}):h?function(e,t){let r=[];for(let[t,n]of e.entries()){let i=r.at(-1);i&&no(e[i.runIndex],n)?i.text+=n.text:r.push({runIndex:t,text:n.text})}let n=0,i=r.map(({runIndex:r,text:i})=>{let o=ns([{...e[r],text:i}],t),a=nt.freeze({runIndex:r,text:i,x:n,width:o});return n+=o,a});return{width:n,originX:0,fragments:nt.freeze(i)}}(e,t):void 0:void 0;return nt.freeze({runs:nt.freeze(e),text:c,width:p?.width??ns(e,t),baseline:r*d+.35*t.fontSize,originX:p?.originX??0,...p?{fragments:p.fragments}:{}})}),c=u.map(e=>e.text);nt.freeze(c),a.forEach(nt.freeze);let f=u.reduce((e,t)=>Math.max(e,t.width),0),h=nt.freeze({unit:"px",prepared:n,text:c.join(`
15
+ `),lines:c,lineBlocks:nt.freeze(u),breaks:nt.freeze(a),width:f,height:c.length*d,lineHeight:d,fontSize:t.fontSize,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing??0,monospace:t.monospace??!1,safeFont:t.safeFont??!1,...t.fontFamily?{fontFamily:t.fontFamily}:{}});return ne.add(h),void 0!==r&&r7.set(r,h,2*r.length+128*h.prepared.source.length+256*h.lines.length+512),h}function nf(e,t){let r=e?.lineBlocks[t];if(!e||!r)return;if(!nn(e))throw TypeError("Pixel line projection requires retained preparation");let n=[r.text];nt.freeze(n);let i=nt.freeze({...e,text:r.text,lines:n,lineBlocks:nt.freeze([nt.freeze({...r,baseline:.35*e.fontSize})]),breaks:nt.freeze([]),width:r.width,height:e.lineHeight});return ne.add(i),i}function nh(e,t){let r=t.top??0,n=0,i=0,o=e.map(e=>{let o=Math.max(t.minRowHeight??0,e.block.height),a={item:e,top:r,height:o,textY:r+("start"===t.align?e.block.height:o)/2};return n=Math.max(n,e.block.width,e.reservedWidth??0),i+=o,r+=o+t.gap,a}),a=Math.max(0,e.length-!t.trailingGap),s=r-(e.length&&!t.trailingGap?t.gap:0);return{width:n,height:i+a*t.gap,bottom:s,rows:o}}function np(e,t){let r=nh(e,t),n={width:t.leadingWidth+r.width,height:r.height,columns:1,rows:r.rows};if(void 0===t.maxWidth||e.length<4)return n;let i=[0,0];for(let[r,o]of e.entries()){if(1!==o.block.lines.length)return n;let e=r%2;i[e]=Math.max(i[e],t.leadingWidth+o.block.width,t.leadingWidth+(o.reservedWidth??0))}let o=i[0]+t.columnGap+i[1];if(o>t.maxWidth+.01)return n;let a=[],s=t.top??0,l=0;for(let r=0;r<e.length;r+=2){let n=e.slice(r,r+2),o=Math.max(t.minRowHeight??0,...n.map(e=>e.block.height));for(let[e,r]of n.entries())a.push({item:r,x:e?i[0]+t.columnGap:0,top:s,height:o,textY:s+o/2});l+=o,s+=o+t.gap}return(l+=(Math.ceil(e.length/2)-1)*t.gap)<r.height?{width:o,height:l,columns:2,rows:a}:n}function nm(e){if(0!==e.length)return{x0:Math.min(...e.map(e=>e.x)),y0:Math.min(...e.map(e=>e.y)),x1:Math.max(...e.map(e=>e.x)),y1:Math.max(...e.map(e=>e.y))}}function ng(e,t){return e?t?{x0:Math.min(e.x0,t.x0),y0:Math.min(e.y0,t.y0),x1:Math.max(e.x1,t.x1),y1:Math.max(e.y1,t.y1)}:e:t}function ny(e,t){let r=Number.isFinite(t)?Math.max(0,t):0;return{x0:e.x0-r,y0:e.y0-r,x1:e.x1+r,y1:e.y1+r}}function nb(e,t,r){let n=/[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/y,i=0,o=0,a=0,s=0,l=0,d="",u="",c,f,h,p=!1,m=e=>{if(r){for(let t=0;t<e;t++)if(!r())return p=!0,!1}return!0},g=()=>{for(;i<e.length&&/[\s,]/.test(e[i]);){if(!m(1))return;i++}},y=(t=!1)=>{if(g(),p)return;if(t){let t=e[i];return("0"===t||"1"===t)&&m(1)?(i++,Number(t)):void 0}n.lastIndex=i;let r=n.exec(e);if(!r||!m(r[0].length))return;i=n.lastIndex;let o=Number(r[0]);return Number.isFinite(o)?o:void 0},b=(e,r)=>!!Number.isFinite(e)&&!!Number.isFinite(r)&&(f=ng(f,{x0:e,y0:r,x1:e,y1:r}),t&&(h=ng(h,{x0:e,y0:r,x1:e,y1:r})),!0);for(;;){if(g(),p)return;if(i>=e.length)return f;if(/[a-zA-Z]/.test(e[i])){if(!m(1)||(d=e[i++],!/[MmLlHhVvCcSsQqTtAaZz]/.test(d)||!f&&"M"!==d.toUpperCase()))return;if("Z"===d.toUpperCase()){if(t&&!t({bounds:{x0:Math.min(o,s),y0:Math.min(a,l),x1:Math.max(o,s),y1:Math.max(a,l)},line:[{x:o,y:a},{x:s,y:l}]}))return;o=s,a=l,u="Z",c=void 0,d="";continue}}if(!d)return;let r=d.toUpperCase(),n=d!==r;t&&(h={x0:o,y0:a,x1:o,y1:a});let x="A"===r?7:"C"===r?6:"S"===r||"Q"===r?4:"H"===r||"V"===r?1:2,k=[];for(let e=0;e<x;e++){let t=y("A"===r&&(3===e||4===e));if(void 0===t)return;k.push(t)}let v=e=>k[e]+(n?o:0),w=e=>k[e]+(n?a:0),$,M,z;if("H"===r)$=v(0),M=a;else if("V"===r)$=o,M=w(0);else if("C"===r||"S"===r||"Q"===r||"T"===r){let e=c&&("S"===r?"C"===u||"S"===u:"Q"===u||"T"===u)?{x:2*o-c.x,y:2*a-c.y}:{x:o,y:a};if(("S"===r||"T"===r)&&!b(e.x,e.y))return;for(let e=0;e<x-2;e+=2)if(!b(v(e),w(e+1)))return;$=v(x-2),M=w(x-1),z="T"===r?e:{x:v(x-4),y:w(x-3)}}else if("A"===r){$=v(5),M=w(6);let e=Math.abs(k[0]),t=Math.abs(k[1]);if(e>0&&t>0&&($!==o||M!==a)){let r=k[2]%360*Math.PI/180,n=Math.cos(r),i=Math.sin(r),s=(o-$)/2,l=(a-M)/2,d=n*s+i*l,u=-i*s+n*l,c=Math.hypot(d/e,u/t);c>1&&(e*=c,t*=c);let f=(d/e)**2+(u/t)**2,h=(k[3]===k[4]?-1:1)*Math.sqrt(Math.max(0,(1-f)/f)),p=h*e*u/t,m=-h*t*d/e,g=n*p-i*m+(o+$)/2,y=i*p+n*m+(a+M)/2,x=Math.hypot(e*n,t*i),v=Math.hypot(e*i,t*n);if(!b(g-x,y-v)||!b(g+x,y+v))return}}else $=v(0),M=w(1),"M"===r&&(s=$,l=M,d=n?"l":"L");if(!b($,M)||t&&"M"!==r&&!t({bounds:h,...["L","H","V"].includes(r)?{line:[{x:o,y:a},{x:$,y:M}]}:{}}))return;o=$,a=M,c=z,u=r}}function nx(e,t,r){return void 0!==nb(e,t,r)}function nk(e){switch(e.kind){case"rect":return{x0:e.x,y0:e.y,x1:e.x+e.width,y1:e.y+e.height};case"circle":return{x0:e.cx-e.r,y0:e.cy-e.r,x1:e.cx+e.r,y1:e.cy+e.r};case"ellipse":return{x0:e.cx-e.rx,y0:e.cy-e.ry,x1:e.cx+e.rx,y1:e.cy+e.ry};case"line":return{x0:Math.min(e.x1,e.x2),y0:Math.min(e.y1,e.y2),x1:Math.max(e.x1,e.x2),y1:Math.max(e.y1,e.y2)};case"polygon":case"polyline":return nm(e.points);case"compound":{let t;for(let r of e.children){let e=nk(r);if(!e)return;t=ng(t,e)}return t}case"path":return nb(e.d)}}function nv(e,t,r,n=!1,i){if(!e||!t)return;let o=e.geometry?nk(e.geometry):void 0;if(n&&e.geometry&&!o)return;let a=e.bounds??o??(e.viewBox?{x0:e.viewBox.x,y0:e.viewBox.y,x1:e.viewBox.x+e.viewBox.width,y1:e.viewBox.y+e.viewBox.height}:void 0)??(e.size?{x0:0,y0:0,x1:e.size.width,y1:e.size.height}:void 0);if(!a)return;if(n){a=ng(a,o);let t=nC(e.paint??{},!0);if(void 0===t)return;a=ny(a,t)}let s=e.ref?.x??0,l=e.ref?.y??0,d=a;if(e.viewBox&&e.size){let t=Math.min(e.size.width/e.viewBox.width,e.size.height/e.viewBox.height),r=(e.size.width-e.viewBox.width*t)/2,n=(e.size.height-e.viewBox.height*t)/2,i=n=>r+(n-e.viewBox.x)*t,o=r=>n+(r-e.viewBox.y)*t;d={x0:i(a.x0),y0:o(a.y0),x1:i(a.x1),y1:o(a.y1)},s=i(s),l=o(l)}let u=(e.units??"strokeWidth")==="strokeWidth"?r:1,c=Math.max(+!!n,e.scale??1)*u;if(void 0!==i){let e=i*Math.PI/180,r=Math.cos(e),n=Math.sin(e),o=[[d.x0,d.y0],[d.x0,d.y1],[d.x1,d.y0],[d.x1,d.y1]].map(([e,i])=>({x:t.x+((e-s)*r-(i-l)*n)*c,y:t.y+((e-s)*n+(i-l)*r)*c}));return o.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))?nm(o):void 0}let f=Math.max(Math.abs(d.x0-s),Math.abs(d.x1-s)),h=Math.max(Math.abs(d.y0-l),Math.abs(d.y1-l)),p=(n?Math.hypot(f,h):Math.max(f,h))*c;return{x0:t.x-p,y0:t.y-p,x1:t.x+p,y1:t.y+p}}function nw(e,t){let r="number"==typeof e.orient?e.orient:180*("start"===t&&"auto-start-reverse"===e.orient),n=nv(e,{x:0,y:0},1,!0,r);if(!n)throw TypeError(`Unmeasured terminal marker ${e.id}`);return Math.max(0,"start"===t?n.x1:-n.x0)}function n$(e,t){let r=e.route.geometry,n=t8(r,e.route.closed),i=t7(r,e.route.closed),o=nT(t,e.transform),a=[],s=(t,n,i,s)=>{if(!n||!i)return;let l="number"==typeof n.orient?n.orient:s?180*Math.atan2(s.y,s.x)/Math.PI+180*("start"===t&&"auto-start-reverse"===n.orient):void 0,d=nM(e.stroke.width),u=nv(n,i,d,!0,l),c=rE(o),f=JSON.stringify([{...n,orient:n.orient??"auto"},l??["unknown",r],"userSpaceOnUse"===n.units?1:d,c.slice(0,4)]),h,p;if(void 0!==l&&n.geometry?.kind==="polygon"&&n.geometry.points.length<=64){let e=(n.viewBox&&n.size?Math.min(n.size.width/n.viewBox.width,n.size.height/n.viewBox.height):1)*Math.max(1,n.scale??1)*("userSpaceOnUse"===n.units?1:d),t=l*Math.PI/180,r=Math.cos(t),o=Math.sin(t);h=n.geometry.points.map(t=>{let a=(t.x-(n.ref?.x??0))*e,s=(t.y-(n.ref?.y??0))*e;return rO({x:i.x+a*r-s*o,y:i.y+a*o+s*r},c)});let[a,s,u,f]=c,m=(Math.hypot(a+f,s-u)+Math.hypot(a-f,s+u))/2,g=nC(n.paint??{},!0);void 0!==(p=void 0===g?void 0:g*e*m)&&Number.isFinite(p)&&h.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))||(h=void 0)}a.push({position:t,resource:n.id,anchor:rO(i,c),repaint:f,...h?{hull:h,padding:p}:{},...u?{bounds:nE(u,o)}:{}})};if(n.starts.forEach((t,r)=>s("start",e.markers.start,t,e.route.contours[r]?.startTangent)),n.ends.forEach((t,r)=>s("end",e.markers.end,t,e.route.contours[r]?.endTangent)),1===e.markers.mid.length)for(let t of i)s("mid",e.markers.mid[0],t);else e.markers.mid.forEach((e,t)=>s("mid",e,i[t]));return a}function nM(e){let t="number"==typeof e?e:parseFloat(e);return Number.isFinite(t)?Math.max(0,t):1}var nz=new WeakMap;function nS(e){let t=eX(e.text,e.textContent),r="string"==typeof t?t:t.source;if(e.block){let t=e.block;if(t.prepared.source!==r||void 0!==e.fontSize&&e.fontSize!==t.fontSize||void 0!==e.fontWeight&&e.fontWeight!==t.fontWeight||void 0!==e.letterSpacing&&e.letterSpacing!==t.letterSpacing||void 0!==e.display&&e.display!==t.prepared.display)throw TypeError("Connector inline label typography and source must agree with its prepared block");return t}let n=e.fontSize??12,i=e.fontWeight??400,o=e.letterSpacing??0,a=e.display??"literal",s=nz.get(e);if(s&&("string"==typeof t?s.prepared.source===r:s.prepared===t)&&s.fontSize===n&&s.fontWeight===i&&s.letterSpacing===o&&s.prepared.display===a)return s;let l=nc(t,{display:a,fontSize:n,fontWeight:i,letterSpacing:o});return nz.set(e,l),l}function nj(e){if(e.visual?.kind!=="inline"||!e.anchor||void 0===e.fontSize||void 0===e.textAnchor)return;let t=nS(e),r=t.width,n="middle"===e.textAnchor?e.anchor.x-r/2:"end"===e.textAnchor?e.anchor.x-r:e.anchor.x,i=e.anchor.y-Math.max(0,e.clearance??0),o=Math.max(0,e.halo?.width??0)/2;return ny({x0:n,y0:i-.35*t.fontSize-t.height/2,x1:n+r,y1:i-.35*t.fontSize+t.height/2},o)}function nE(e,t){if(![e.x0,e.y0,e.x1,e.y1].every(Number.isFinite))return;if(!t)return e;if("rotate"===t.kind)return r4(e,{x:t.cx,y:t.cy},t.angle);let r=rE(t),n=e.x0,i=e.y0,o=e.x0,a=e.y1,s=e.x1,l=e.y0,d=e.x1,u=e.y1;if(1===r[0]&&0===r[1]&&0===r[2]&&1===r[3]&&n===o&&i===l&&s===d&&a===u&&0!==n&&0!==i&&0!==s&&0!==a&&Number.isFinite(n)&&Number.isFinite(i)&&Number.isFinite(s)&&Number.isFinite(a)){let e=rO({x:n,y:i},r),t=rO({x:d,y:u},r);return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(t.x)&&Number.isFinite(t.y)?{x0:Math.min(e.x,t.x),y0:Math.min(e.y,t.y),x1:Math.max(e.x,t.x),y1:Math.max(e.y,t.y)}:void 0}let c=[[n,i],[o,a],[s,l],[d,u]].map(([e,t])=>rO({x:e,y:t},r));return c.every(e=>Number.isFinite(e.x)&&Number.isFinite(e.y))?nm(c):void 0}function nT(e,t){if(!e)return t;if(!t)return e;let[r,n,i,o,a,s]=rT(rE(e),rE(t));return{kind:"matrix",a:r,b:n,c:i,d:o,e:a,f:s}}function nO(e){return"line"!==e.geometry.kind&&!("polyline"===e.geometry.kind&&2===e.geometry.points.length&&!e.closed)}function nC(e,t){if(void 0===e.stroke||"none"===e.stroke||"transparent"===e.stroke||rk(e.stroke)?.[3]===0)return 0;let r=e.strokeWidth??"1";if(!/^\s*(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?(?:px)?\s*$/.test(r))return;let n=Number.parseFloat(r)/2;if(!Number.isFinite(n))return;let i=e.strokeLinejoin??"miter",o=Number(e.strokeMiterlimit??4);if(!Number.isFinite(o)||o<1)return;let a=Math.max(t&&("miter"===i||"miter-clip"===i)?n*o:n,"square"===e.strokeLinecap?n*Math.SQRT2:n);return Number.isFinite(a)?a:void 0}function nW(e,t,r,n){if(!r)return nE(ny(e,t),n);let i=nE(e,n);return i?ny(i,t):void 0}function nF(e,t,r,n,i,o){return"line"!==e.kind||i?nW(t,r,i,o):nE(function(e,t,r){let n=nk(e),i=Math.hypot(e.x2-e.x1,e.y2-e.y1);if(void 0!==r&&"butt"!==r||0===i)return ny(n,t);let o=t*Math.abs(e.y2-e.y1)/i,a=t*Math.abs(e.x2-e.x1)/i;return{x0:n.x0-o,y0:n.y0-a,x1:n.x1+o,y1:n.y1+a}}(e,r,n),o)}function nI(e,t,r,n){let i=0;for(let o=0;o<32;o++){let a,s=o/32,l=(o+1)/32,d=e=>Math.min(l,Math.max(s,e)),u=r=>e*(1-r)**2+t*(1+r+r*r),c=6*r*Math.min(s*(1-s),l*(1-l)),f=6*n*r*l/Math.hypot((a=d(e/(e+t)),3*(e*(1-a)**2+t*a*a)),c)-u(d((2*e-t)/(2*(e+t))));f>0&&(i=Math.max(i,(1-s)*f))}return Math.min(n,i)}function nN(e,t){return function e(t,r){let n,i=nT(r,t.transform);if(!i||rC(rE(i))){if("shape"===t.kind){if(!(n=nk(t.geometry)))return;let e=["polygon","polyline","path","compound"].includes(t.geometry.kind),r;for(let o of[t.paint,...t.childPaints??[]]){let a=nC(o,e),s=void 0===a?void 0:nF(t.geometry,n,a,o.strokeLinecap,"non-scaling-stroke"===o.vectorEffect,i);if(!s)return;r=r?ng(r,s):s}if(!t.conditionalPaint)return r;let o=nC(t.conditionalPaint,["polygon","polyline","path","compound"].includes(t.geometry.kind));if(!r||void 0===o)return;let a=nF(t.geometry,n,o,t.conditionalPaint.strokeLinecap,"non-scaling-stroke"===t.conditionalPaint.vectorEffect,i);return a?ng(r,a):void 0}if("connector"===t.kind)return function(e,t){let r=e.route.geometry,n=nk(r),i=nC({stroke:e.stroke.color,strokeWidth:String(e.stroke.width),strokeLinecap:e.stroke.lineCap,strokeLinejoin:e.stroke.lineJoin,strokeMiterlimit:String(e.stroke.miterLimit)},nO(e.route));if(!n||void 0===i)return;let o="path"!==r.kind||"butt"!==e.stroke.lineCap||e.stroke.nonScaling?void 0:function(e,t){if(!/^[\s,0-9eE.+\-MC]+$/.test(e))return;let r=e.match(/[MC]|[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/g);if(!r||10!==r.length||"M"!==r[0]||"C"!==r[3])return;let n=r.filter(e=>"M"!==e&&"C"!==e).map(Number);if(!n.every(Number.isFinite))return;let[i,o,a,s,l,d,u,c]=n;if(a!==l||s!==o||d!==c||!((a-i)*(u-a)>0))return;let f=Math.abs(a-i),h=Math.abs(u-a),p=Math.abs(c-o),m=Math.sign(u-i),g=[i-m*nI(h,f,p,t),u+m*nI(f,h,p,t)];return{x0:Math.min(...g),y0:Math.min(o,c)-t,x1:Math.max(...g),y1:Math.max(o,c)+t}}(r.d,nM(e.stroke.width)/2),a=o?nE(o,t):nW(n,i,e.stroke.nonScaling,t);if(!a)return;let s=nM(e.stroke.width),l=t8(r,e.route.closed),d=t7(r,e.route.closed);for(let{marker:r,anchor:n}of[...l.starts.flatMap(t=>e.markers.start?[{marker:e.markers.start,anchor:t}]:[]),...l.ends.flatMap(t=>e.markers.end?[{marker:e.markers.end,anchor:t}]:[]),...1===e.markers.mid.length?d.map(t=>({marker:e.markers.mid[0],anchor:t})):e.markers.mid.map((e,t)=>({marker:e,anchor:d[t]}))]){let e=nv(r,n,s,!0),i=e&&nE(e,t);if(!i)return;a=ng(a,i)}for(let r of e.labels){let e=ng(r.bounds,nj(r));if(r.visual?.kind==="inline"&&!e)return;if(e){let r=nE(e,t);if(!r)return;a=ng(a,r)}}return a}(t,i);if("text"===t.kind){n=function(e){let t;if("shape"===e.kind)t=nk(e.geometry);else if("connector"===e.kind)t=function(e){let t=e.route.geometry,r="path"===t.kind?nm(t.points):nk(t);if(!r)return;let n=nM(e.stroke.width),i=n/2;r=ny(r,"miter"===e.stroke.lineJoin||"miter-clip"===e.stroke.lineJoin?i*Math.max(1,e.stroke.miterLimit):i);let o=t8(t,e.route.closed);for(let t of o.starts)r=ng(r,nv(e.markers.start,t,n));for(let t of o.ends)r=ng(r,nv(e.markers.end,t,n));let a=t7(t,e.route.closed);if(1===e.markers.mid.length)for(let t of a)r=ng(r,nv(e.markers.mid[0],t,n));else for(let t=0;t<e.markers.mid.length;t++)r=ng(r,nv(e.markers.mid[t],a[t],n));for(let t of e.labels)t.bounds&&(r=ng(r,t.bounds)),r=ng(r,nj(t));return r}(e);else{if("text"!==e.kind)return;let r=e.textLayout??nc(e.text,{display:e.display,fontSize:e.fontSize,fontWeight:e.fontWeight??500,letterSpacing:e.letterSpacing}),n=r.width,i="middle"===e.anchor?e.x-n/2:"end"===e.anchor?e.x-n:e.x,o="offsetY"in r?r.offsetY:-(.35*e.fontSize);t={x0:i,y0:e.y+o-r.height/2,x1:i+n,y1:e.y+o+r.height/2}}return t?nE(t,e.transform):void 0}({...t,transform:void 0});let e=nC(t.paint,!1);return n&&void 0!==e?nW(n,e,"non-scaling-stroke"===t.paint.vectorEffect,i):void 0}if("group"!==t.kind)return;for(let r of t.children){if("document"===r.node.kind&&r.node.nonPaint)continue;let t=e(r.node,i);if(!t)return;n=ng(n,t)}return n}}(e,t)}var nA=class{value="";raw(e){this.value+=e}attribute(e,t){this.value+=` ${e}="${"number"==typeof t?tL(t):tz(tP(e,t))}"`}},nL=new Set(["id","role","from","to","relationship","direction","prepared-text","font-metrics","text-fragment","connector-label-for"]),nP=/^[A-Za-z0-9_-]+(?: [A-Za-z0-9_-]+)*$/,nq=/^[a-z][a-z0-9-]*$/;function nB(e,t){if(t){if(t.className&&e.attribute("class",t.className),t.data)for(let r of Object.keys(t.data))e.attribute(`data-${r}`,t.data[r]);t.ariaHidden&&e.attribute("aria-hidden","true"),0===t.tabIndex&&e.attribute("tabindex",0),void 0!==t.ariaLabel&&e.attribute("aria-label",t.ariaLabel)}}function nR(e,t){void 0!==t.fill&&e.attribute("fill",t.fill),void 0!==t.fillOpacity&&e.attribute("fill-opacity",t.fillOpacity),void 0!==t.stroke&&e.attribute("stroke",t.stroke),void 0!==t.strokeOpacity&&e.attribute("stroke-opacity",t.strokeOpacity),void 0!==t.strokeWidth&&e.attribute("stroke-width",t.strokeWidth),void 0!==t.strokeDasharray&&e.attribute("stroke-dasharray",t.strokeDasharray),void 0!==t.strokeDashoffset&&e.attribute("stroke-dashoffset",t.strokeDashoffset),void 0!==t.strokeLinecap&&e.attribute("stroke-linecap",t.strokeLinecap),void 0!==t.strokeLinejoin&&e.attribute("stroke-linejoin",t.strokeLinejoin),void 0!==t.strokeMiterlimit&&e.attribute("stroke-miterlimit",t.strokeMiterlimit),void 0!==t.vectorEffect&&e.attribute("vector-effect",t.vectorEffect),void 0!==t.paintOrder&&e.attribute("paint-order",t.paintOrder),void 0!==t.opacity&&e.attribute("opacity",t.opacity)}function nH(e,t){t&&e.attribute("transform",rW(t))}function nD(e,t,r){t&&tD(t.role)&&(e.attribute("data-id",t.id),e.attribute("data-role",t.role),void 0!==t.from&&e.attribute("data-from",t.from),void 0!==t.to&&e.attribute("data-to",t.to)),r&&(e.attribute("role",r.role),e.attribute("aria-roledescription",r.roleDescription),e.attribute("aria-label",r.label))}function nG(e,t){switch(t.kind){case"rect":e.attribute("x",t.x),e.attribute("y",t.y),e.attribute("width",t.width),e.attribute("height",t.height),void 0!==t.rx&&e.attribute("rx",t.rx),void 0!==t.ry&&e.attribute("ry",t.ry);return;case"circle":e.attribute("cx",t.cx),e.attribute("cy",t.cy),e.attribute("r",t.r);return;case"ellipse":e.attribute("cx",t.cx),e.attribute("cy",t.cy),e.attribute("rx",t.rx),e.attribute("ry",t.ry);return;case"line":e.attribute("x1",t.x1),e.attribute("y1",t.y1),e.attribute("x2",t.x2),e.attribute("y2",t.y2);return;case"polygon":case"polyline":{let r="";for(let e=0;e<t.points.length;e++){let n=t.points[e];r+=`${e?" ":""}${n.x},${n.y}`}e.attribute("points",r);return}case"path":e.attribute("d",t.d)}}function nZ(e,t,r,n,i){let o=Math.max(0,Math.min(i,r/2,n));return 0===o?`M${e},${t} H${e+r} V${t+n} H${e} Z`:`M${e+o},${t} H${e+r-o} A${o},${o} 0 0 1 ${e+r},${t+o} V${t+n} H${e} V${t+o} A${o},${o} 0 0 1 ${e+o},${t} Z`}var n_=new WeakMap,nJ=new WeakSet,nV=new WeakMap,nU=/<\s*text/i;function nY(e){if(!e.includes("<svg"))return e;let t="",r=0;for(;r<e.length;){let n=e.indexOf("<",r);if(n<0)return t+e.slice(r);if(t+=e.slice(r,n),e.startsWith("\x3c!--",n)){let i=e.indexOf("--\x3e",n+4);if(i<0)return t+e.slice(n);t+=e.slice(n,i+3),r=i+3;continue}let i,o=n+1;for(;o<e.length;o++){let t=e[o];if(i)t===i&&(i=void 0);else if('"'===t||"'"===t)i=t;else if(">"===t)break}if(o>=e.length)return t+e.slice(n);t+=function(e){let t=e.match(/^<([A-Za-z_][A-Za-z0-9_.:-]*)/);if(!t||e.startsWith("</")||e.startsWith("<!")||e.startsWith("<?"))return e;let r=t[1];if("svg"!==r)return e;let n=/\/\s*>$/.test(e),i=n?e.lastIndexOf("/"):e.length-1,o=[],a=t[0].length;for(;a<i;){for(;/\s/.test(e[a]??"");)a++;if(a>=i)break;let t=e.slice(a).match(/^([^\s=<>/]+)/);if(!t)return e;let r=t[1];for(a+=t[0].length;/\s/.test(e[a]??"");)a++;if("="!==e[a])return e;for(a++;/\s/.test(e[a]??"");)a++;let n=e[a];if('"'!==n&&"'"!==n)return e;let s=++a;for(;a<i&&e[a]!==n;)a++;if(e[a]!==n)return e;let l=e.slice(s,a);a++,o.push({name:r,value:'"'===n?l:l.replaceAll('"',"&quot;"),index:o.length})}let s=new Map([["xmlns",0],["width",1],["height",2],["viewBox",3],["style",4]]);o.sort((e,t)=>(s.get(e.name)??100)-(s.get(t.name)??100)||r3(e.name,t.name)||e.index-t.index);let l=o.map(e=>`${e.name}="${e.value}"`).join(" ");return`<${r}${l?` ${l}`:""}${n?" /":""}>`}(e.slice(n,o+1)),r=o+1}return t}function nX(e,t){if("document"!==e.kind)throw TypeError(`Scene ${e.kind} "${e.id}" is written from its fields, not stored markup`);return n_.set(e,nY(t)),e}function nQ(e){return nJ.add(e),e}function nK(e){let t=n_.get(e);if(void 0!==t)return t;if(!nJ.has(e))throw TypeError(`Scene node "${e.id}" has no admitted SVG serialization`);let r=nV.get(e);if(void 0!==r)return r;let n=function(e){switch(e.kind){case"shape":return function(e){let t=new nA,r="compound"===e.geometry.kind,n="compound"===e.geometry.kind?e.geometry.children:[e.geometry];for(let i=0;i<n.length;i++){let o=n[i];if("compound"===o.kind)throw TypeError(`Shape "${e.id}" nests compound geometry`);i&&t.raw(`
16
+ `),t.raw(`<${o.kind}`),0===i&&nB(t,e.attributes),nG(t,o),nR(t,r?e.childPaints?.[i]??e.paint:e.paint),nH(t,e.transform),0===i&&nD(t,e.identity,e.accessibility),t.raw(" />")}return t.value}(e);case"text":return function(e){let t=new nA;nB(t,e.attributes),t.attribute("text-anchor",e.anchor),e.dominantBaseline&&t.attribute("dominant-baseline",e.dominantBaseline),e.block?.fontFamily&&t.attribute("font-family",e.block.fontFamily),t.attribute("font-size",e.fontSize),t.attribute("font-weight",e.fontWeight??e.block?.fontWeight??400),(e.letterSpacing??0)!==0&&t.attribute("letter-spacing",e.letterSpacing),e.fontStyle&&t.attribute("font-style",e.fontStyle),e.textDecoration&&t.attribute("text-decoration",e.textDecoration),nR(t,e.paint),nH(t,e.transform),nD(t,e.identity,e.accessibility);let r=t.value.slice(1),n="prepared"===e.measurement&&e.block,i=tO(n?e.block:e.text,e.x,e.y,e.fontSize,r,e.baselineShift??.35,"literal"===e.display);if(!e.spans)return i;let o=n?e.block.text:e.text,a=`>${tM(o)}</text>`;if(!i.endsWith(a))throw TypeError(`Text "${e.id}" spans require a one-line label`);let s="";for(let t of e.spans)s+=`<tspan fill="${tz(t.fill)}">${tM(t.text)}</tspan>`;return`${i.slice(0,-a.length)}>${s}</text>`}(e);case"connector":return function(e){let t=new nA,{stroke:r,markers:n}=e,i=r.dash,o=n.mid[0];if("invisible"!==e.lineStyle){let a=e.route.geometry;t.raw(`<${a.kind}`),nB(t,e.attributes),nG(t,a),"line"!==a.kind&&t.attribute("fill","none"),t.attribute("stroke",r.color),void 0!==r.opacity&&t.attribute("stroke-opacity",r.opacity),t.attribute("stroke-width",r.width),i&&t.attribute("stroke-dasharray","string"==typeof i.array?i.array:i.array.join(" ")),i?.offset!==void 0&&t.attribute("stroke-dashoffset",i.offset),"butt"!==r.lineCap&&t.attribute("stroke-linecap",r.lineCap),"miter"!==r.lineJoin&&t.attribute("stroke-linejoin",r.lineJoin),4!==r.miterLimit&&t.attribute("stroke-miterlimit",r.miterLimit),void 0!==r.pathLength&&t.attribute("pathLength",r.pathLength),void 0!==r.paintOrder&&t.attribute("paint-order",r.paintOrder),r.nonScaling&&t.attribute("vector-effect","non-scaling-stroke"),r.mixBlendMode&&t.attribute("style",`mix-blend-mode:${r.mixBlendMode}`),n.start&&t.attribute("marker-start",`url(#${n.start.id})`),o&&t.attribute("marker-mid",`url(#${o.id})`),n.end&&t.attribute("marker-end",`url(#${n.end.id})`),"none"===e.hit.pointerEvents&&t.attribute("pointer-events","none"),nH(t,e.transform),t.attribute("data-relationship",e.relationship.kind),t.attribute("data-direction",e.relationship.direction),nD(t,e.identity,e.accessibility),t.raw(" />")}for(let r=0;r<e.labels.length;r++){let n=function(e,t,r){if(t.visual?.kind!=="inline")return;if(!t.anchor||!t.paint||void 0===t.fontSize||void 0===t.textAnchor)throw TypeError(`Connector "${e.id}" inline label ${r+1} requires anchor, paint, fontSize, and textAnchor`);let n=nS(t),i={...t.paint,...t.halo?{stroke:t.halo.color??"var(--bg)",strokeWidth:String(t.halo.width),paintOrder:"stroke fill"}:{}},o=new nA;return o.attribute("data-id",t.id??`${e.id}-label-${r+1}`),o.attribute("data-role","label"),o.attribute("data-connector-label-for",e.id),o.attribute("font-size",n.fontSize),o.attribute("font-weight",n.fontWeight),n.letterSpacing&&o.attribute("letter-spacing",n.letterSpacing),o.attribute("text-anchor",t.textAnchor),nH(o,e.transform),nR(o,i),tO(n,t.anchor.x,t.anchor.y-Math.max(0,t.clearance??0),n.fontSize,o.value.slice(1),0)}(e,e.labels[r],r);void 0!==n&&(t.value&&t.raw(`
17
+ `),t.raw(n))}return t.value}(e);case"group":return[e.open,...e.children.map(e=>n0(nK(e.node),e.indent)),e.close].join(e.join);case"document":throw TypeError(`Scene node "${e.id}" has no admitted SVG serialization`)}}(e);return"group"!==e.kind&&Object.isFrozen(e)&&nV.set(e,n),n}function n0(e,t){if(t<=0||""===e)return e;let r=" ".repeat(t);return r+e.replace(/\n/g,`
18
+ ${r}`)}function n1(e,t){let r=n_.get(e);void 0!==r&&n_.set(t,r),nJ.has(e)&&nJ.add(t)}function n2(e){let t=e=>{if("document"===e.kind){let t=n_.get(e);return void 0!==t&&!nU.test(t)}if(!nJ.has(e))return!1;switch(e.kind){case"text":return"prepared"===e.measurement&&void 0!==e.block;case"shape":case"connector":return!0;case"group":return!nU.test(e.open)&&!nU.test(e.close)&&e.children.every(e=>t(e.node))}};return e.parts.every(t)}var n5={};function n3(e,t){if(!ev(e.role).relation||void 0===e.from||void 0===e.to)return;let r={from:e.from,to:e.to,...t?{label:t}:{}};return{label:`${r.from} to ${r.to}${r.label?`: ${r.label}`:""}`,role:"graphics-symbol",roleDescription:"relation",relation:r}}function n6(e,t,r){return!r||Object.hasOwn(e,t)?e[t]:void 0}function n4(e,t){return e?{...e,...n6(e,"geometry",t)?{geometry:n6(e,"geometry",t)}:{},...n6(e,"size",t)?{size:{...n6(e,"size",t)}}:{},...n6(e,"viewBox",t)?{viewBox:{...n6(e,"viewBox",t)}}:{},...n6(e,"ref",t)?{ref:{...n6(e,"ref",t)}}:{},...n6(e,"bounds",t)?{bounds:{...n6(e,"bounds",t)}}:{},...n6(e,"paint",t)?{paint:{...n6(e,"paint",t)}}:{}}:void 0}function n8(e,t){let r=n6(e,"owner",t),n=n6(e,"point",t);return{...e,...r?{owner:{...r}}:{},...n?{point:{...n}}:{}}}function n9(e,t=!1){if(t&&"path"===e.geometry.kind)throw TypeError("Deferred terminal projections require line or polyline geometry");let r=function(e,t,r=!1){let n=["continuous-geometry","stroke-width","stroke-cap","stroke-join"];e.bendRadius>0&&n.push("bend-radius"),void 0!==n6(t,"opacity",r)&&n.push("stroke-opacity"),("miter"===t.lineJoin||"miter-clip"===t.lineJoin)&&n.push("stroke-miter"),n6(t,"dash",r)&&n.push("dash-pattern");let i=n6(t,"dash",r);return i&&void 0!==n6(i,"offset",r)&&n.push("dash-offset"),void 0!==n6(t,"pathLength",r)&&n.push("path-length"),void 0!==n6(t,"paintOrder",r)&&n.push("paint-order"),/^url\(#[A-Za-z_][A-Za-z0-9_.:-]*\)$/.test(t.color)&&n.push("gradient-paint"),void 0!==n6(t,"mixBlendMode",r)&&"normal"!==n6(t,"mixBlendMode",r)&&n.push("mix-blend-mode"),n6(t,"nonScaling",r)&&n.push("non-scaling-stroke"),n}(e.route,e.stroke,t),n=function(e,t=!1){let r=[],n=[];return t3(e,t).forEach((e,t)=>{let i=e.points[0],o=e.closed?i:e.points.at(-1);i&&r.push({point:{...i},contourIndex:t}),o&&n.push({point:{...o},contourIndex:t})}),{starts:r,ends:n}}(e.geometry,e.route.closed),i=function(e,t=!1){if("line"===e.kind)return[];let r=t3(e,t);return"path"===e.kind?(e.markerMidpoints??[]).map(e=>{if(1===r.length)return{point:{...e},contourIndex:0};let t=r.flatMap((t,r)=>t.points.some(t=>tZ(t,e))?[r]:[]);if(1!==t.length)throw TypeError("Path marker-mid vertices on multiple subpaths must belong to exactly one typed contour");return{point:{...e},contourIndex:t[0]}}):r.flatMap((e,t)=>{if(e.points.length<2)return[];let r=e.closed&&tZ(e.points[0],e.points.at(-1))?e.points.slice(0,-1):e.points;return(e.closed?r.slice(1):r.slice(1,-1)).map(e=>({point:{...e},contourIndex:t}))})}(e.geometry,e.route.closed),o=n6(e.stroke,"dash",t),a={start:n6(e.markers,"start",t)?n.starts.map(r=>({markerId:n6(e.markers,"start",t).id,point:{...r.point},contourIndex:r.contourIndex})):[],mid:0===e.markers.mid.length?[]:i.map((t,r)=>({markerId:(1===e.markers.mid.length?e.markers.mid[0]:e.markers.mid[r]).id,point:{...t.point},contourIndex:t.contourIndex})),end:n6(e.markers,"end",t)?n.ends.map(r=>({markerId:n6(e.markers,"end",t).id,point:{...r.point},contourIndex:r.contourIndex})):[]};return{realization:"invisible"===e.lineStyle?"unsupported":"projected",topology:e.geometry.kind,geometry:e.geometry,direction:e.relationship.direction,relationship:e.relationship.kind,markers:{...n6(e.markers,"start",t)?{start:n4(n6(e.markers,"start",t),t)}:{},mid:e.markers.mid.map(e=>n4(e,t)),...n6(e.markers,"end",t)?{end:n4(n6(e.markers,"end",t),t)}:{}},markerPlacements:a,endpoints:{...e.endpoints,...n6(e.endpoints,"start",t)?{start:n8(n6(e.endpoints,"start",t),t)}:{},...n6(e.endpoints,"end",t)?{end:n8(n6(e.endpoints,"end",t),t)}:{}},route:{ownership:e.route.ownership,closed:e.route.closed,bendRadius:e.route.bendRadius,contours:e.route.contours.map(e=>({...e,start:{...e.start},end:{...e.end},...n6(e,"startTangent",t)?{startTangent:{...n6(e,"startTangent",t)}}:{},...n6(e,"endTangent",t)?{endTangent:{...n6(e,"endTangent",t)}}:{}})),...n6(e.route,"startTangent",t)?{startTangent:{...n6(e.route,"startTangent",t)}}:{},...n6(e.route,"endTangent",t)?{endTangent:{...n6(e.route,"endTangent",t)}}:{},labelAnchors:e.route.labelAnchors.map(e=>({...e}))},stroke:{...e.stroke,...o?{dash:{...o,array:Array.isArray(o.array)?[...o.array]:o.array}}:{}},hit:{...e.hit,geometry:e.hit.geometry},...n6(e,"transform",t)?{transform:{...n6(e,"transform",t)}}:{},labels:e.labels.map(e=>({...e,...n6(e,"anchor",t)?{anchor:{...n6(e,"anchor",t)}}:{},...n6(e,"bounds",t)?{bounds:{...n6(e,"bounds",t)}}:{},...n6(e,"halo",t)?{halo:{...n6(e,"halo",t)}}:{},...n6(e,"paint",t)?{paint:{...n6(e,"paint",t)}}:{},...n6(e,"visual",t)?{visual:{...n6(e,"visual",t)}}:{}})),lineStyle:e.lineStyle,strokeLosses:r,diagnostics:["invisible"===e.lineStyle?"This connector affects layout but is intentionally absent from terminal output.":`The terminal grid preserves connector semantics while projecting continuous stroke fields: ${r.join(", ")}.`,...n6(e,"additionalDiagnostics",t)??[]]}}t(n5,{connector:()=>iw,definitions:()=>iS,documentClose:()=>ij,documentContent:()=>iM,documentOpen:()=>iT,documentText:()=>iz,drawPathArtwork:()=>iC,group:()=>iE,indentLines:()=>n0,pathArtwork:()=>iO,retainedGroupEmission:()=>im,shape:()=>iy,text:()=>i$});var n7=new WeakMap,ie=0;function it(e){ie++;try{return e()}finally{ie--}}var ir={enumerable:!0,configurable:!0,get(){let e=n7.get(this);if(Object.hasOwn(e,"projection"))return e.projection;let t=n9(e,!0);return n7.set(this,{projection:t}),t},set(e){if(Object.isFrozen(this))throw TypeError("Cannot assign to readonly terminalProjection");Object.defineProperty(this,"terminalProjection",{value:e,enumerable:!0,configurable:!0,writable:!0}),n7.delete(this)}};function ii(e,t){n7.set(e,t),Object.defineProperty(e,"terminalProjection",ir)}function io(e){let t=n7.get(e);return!t||Object.hasOwn(t,"projection")?void 0:Object.getOwnPropertyDescriptor(e,"terminalProjection")?.get===ir.get?t:void 0}function ia(e,t,r){let n=n7.get(e);return"terminalProjection"===t&&n&&r.get===ir.get?ir.get.call(e):void 0}function is(e,t){let r=io(e);return!!r&&(ii(t,r),!0)}var il=/^(?:class|data-[a-z][a-z0-9-]*|role|aria-[a-z]+|tabindex|pointer-events|transform|style)$/,id=/^\s*<g\b[^>]*>(?:<title>[^<]*<\/title>)?$/,iu=/^\s*(?:--[A-Za-z0-9_-]+\s*:[^;]*(?:;\s*|$))*$/;function ic({id:t,open:r,close:n,join:i,transform:o,paint:a}){let s;if("</g>"!==n||!/^\s*$/.test(i))throw TypeError(`Group "${t}" close and join must not add artwork`);let l=new Set,d,u=id.test(r)?(rJ(r,void 0,void 0,s={attribute:(r,n)=>{if(l.has(r))throw TypeError(`Group "${t}" open has a duplicate "${r}"`);if(l.add(r),"opacity"!==r&&"fill"!==r||a?.[r]===void 0||e(n)!==a[r]){if(!il.test(r))throw TypeError(`Group "${t}" open sets "${r}"; paint and geometry belong to typed marks`);if("style"===r&&!iu.test(e(n)))throw TypeError(`Group "${t}" open style may only set custom properties; paint belongs to typed marks`);"transform"===r&&(d=n)}},expectedName:"g",name:void 0}),s.name):void 0;if(["opacity","fill"].some(e=>l.has(e)!==(a?.[e]!==void 0)))throw TypeError(`Group "${t}" open disagrees with its typed paint`);if("g"!==u)throw TypeError(`Group "${t}" open must be one <g> tag with an optional <title>`);let c=void 0===d?void 0:e(d),f=void 0===c?void 0:function(e){let t=rj,r=0;for(let n of e.matchAll(/([A-Za-z]+)\s*\(([^()]*)\)/g)){let i;if(e.slice(r,n.index).trim())return;r=n.index+n[0].length;let o=n[2].trim();if(!o||/^(?:,)|(?:,)$|,\s*,/.test(o)||!/^[-+\d.eE,\s]+$/.test(o))return;let a=o.split(/[\s,]+/).map(Number);if(!a.every(Number.isFinite))return;if("matrix"===n[1]&&6===a.length)i=a;else if("translate"===n[1]&&(1===a.length||2===a.length))i=[1,0,0,1,a[0],a[1]??0];else if("scale"===n[1]&&(1===a.length||2===a.length))i=[a[0],0,0,a[1]??a[0],0,0];else{if("rotate"!==n[1]||1!==a.length&&3!==a.length)return;i=rE({kind:"rotate",angle:a[0],cx:a[1]??0,cy:a[2]??0})}t=rT(t,i)}return r>0&&!e.slice(r).trim()?t:void 0}(c),h=o?rE(o):void 0;if(void 0!==c&&!f)throw TypeError(`Group "${t}" open has an unsupported transform`);if(!!f!=!!h||f&&h&&f.some((e,t)=>Math.abs(e-h[t])>1e-9*Math.max(1,Math.abs(e))))throw TypeError(`Group "${t}" open transform disagrees with its typed transform`);return{matrix:f&&Object.freeze(f),style:l.has("style")}}function ih(e,t){if(t){for(let r of Object.keys(t))if("className"!==r&&"data"!==r&&"ariaHidden"!==r&&"tabIndex"!==r&&"ariaLabel"!==r)throw TypeError(`Mark "${e}" has unknown attribute hook "${r}"`);if(void 0!==t.className&&!nP.test(t.className))throw TypeError(`Mark "${e}" class must be space-separated CSS tokens`);for(let[r,n]of Object.entries(t.data??{})){if(!nq.test(r))throw TypeError(`Mark "${e}" has an invalid data attribute key "${r}"`);if(nL.has(r))throw TypeError(`Mark "${e}" data-${r} belongs to its typed fields`);if("string"!=typeof n)throw TypeError(`Mark "${e}" data-${r} must be a string`)}if(void 0!==t.ariaHidden&&!0!==t.ariaHidden)throw TypeError(`Mark "${e}" ariaHidden must be true when present`);if(void 0!==t.tabIndex&&0!==t.tabIndex)throw TypeError(`Mark "${e}" tabIndex must be 0 when present`);if(void 0!==t.ariaLabel&&"string"!=typeof t.ariaLabel)throw TypeError(`Mark "${e}" ariaLabel must be a string`)}}var ip=new WeakMap;function im(e){return ip.get(e)}function ig(e){if(e.identity)return{...e.identity,role:e.role};let t=e.attributes?.className?.split(" ");return{id:e.id,role:e.role,...t?{classNames:t}:{}}}function iy(e){if(ih(e.id,e.attributes),e.childPaints&&("compound"!==e.geometry.kind||e.childPaints.length!==e.geometry.children.length))throw TypeError(`Shape "${e.id}" child paints must match its compound geometry`);if(!1===e.identity&&e.owner?.role!==e.role)throw TypeError(`Shape "${e.id}" without DOM identity requires an explicit owner with the same role`);let t=!1===e.identity?void 0:ig(e),r=t?n3(t,e.attributes?.data?.label):void 0;if(r&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Shape "${e.id}" takes its aria-label from typed relation accessibility`);return nQ({kind:"shape",id:e.id,role:e.role,...t?{identity:t}:{},...e.owner?{owner:e.owner}:{},...e.visibility?{visibility:e.visibility}:{},...r?{accessibility:r}:{},geometry:e.geometry,paint:e.paint,...e.childPaints?{childPaints:e.childPaints}:{},...e.conditionalPaint?{conditionalPaint:e.conditionalPaint}:{},...void 0!==e.surfaceFragment?{surfaceFragment:e.surfaceFragment}:{},...e.channels?{channels:e.channels}:{},...e.transform?{transform:e.transform}:{},...e.attributes?{attributes:e.attributes}:{}})}var ib={id:!0,role:!0,geometry:!0,lineStyle:!0,paint:!0,identity:!0,owner:!0,visibility:!0,endpoints:!0,relationship:!0,route:!0,stroke:!0,markers:!0,labels:!0,hit:!0,terminalProjection:!0,channels:!0,transform:!0,attributes:!0},ix={start:!0,mid:!0,end:!0};function ik(e,t,r){if(!e||"object"!=typeof e||Array.isArray(e))throw TypeError(`${r} fields must be an object`);for(let n of Reflect.ownKeys(e))if(!Object.hasOwn(t,n))throw TypeError(`unknown ${r} field "${String(n)}"`)}function iv(e,t){return t?{...e,...t,...t.owner?{owner:{...t.owner}}:{},...t.point?{point:{...t.point}}:{}}:e??{}}function iw(e){var t;let r;if(ik(e,ib,"connector"),void 0!==e.markers&&ik(e.markers,ix,"marker"),"path"!==e.geometry.kind&&e.route?.closed===!0)throw TypeError(`Connector "${e.id}" closed route topology requires path geometry`);if("path"===e.geometry.kind){let r=e.geometry,n=r.subpaths,i=(t=r.d,t.match(/[Mm](?=\s*[-+.]?\d)/g)?.length??0);if(i>1&&!n)throw TypeError(`Connector "${e.id}" path has multiple SVG subpaths but no typed subpaths`);if(n){if(0===n.length||n.some(e=>e.points.length<2))throw TypeError(`Connector "${e.id}" typed subpaths must each contain at least two points`);if(i!==n.length)throw TypeError(`Connector "${e.id}" typed subpath count disagrees with SVG path moves`);let t=n.flatMap(e=>e.points);if(t.length!==r.points.length||t.some((e,t)=>{let n=r.points[t];return!n||n.x!==e.x||n.y!==e.y}))throw TypeError(`Connector "${e.id}" typed subpaths disagree with the canonical point projection`)}}let n=t3(e.geometry,e.route?.closed??!1),i=1===n.length&&n[0].closed;if("path"===e.geometry.kind&&e.geometry.subpaths&&e.route?.closed!==void 0&&e.route.closed!==i)throw TypeError(`Connector "${e.id}" route.closed disagrees with typed subpath topology`);let o="path"===e.geometry.kind&&e.geometry.subpaths?i:e.route?.closed??!1;if("path"===e.geometry.kind&&(e.geometry.d.match(/[Zz]/g)?.length??0)!==(e.geometry.subpaths?e.geometry.subpaths.filter(e=>e.closed).length:+!!o))throw TypeError(`Connector "${e.id}" SVG close commands disagree with typed closed-contour semantics`);let a=e.markers?.start,s=e.markers?.end,l=e.markers?.mid??[];for(let t of[a,...l,s])if(t?.geometry?.kind==="path"&&!t.bounds&&!t.viewBox&&!t.size)throw TypeError(`Connector "${e.id}" path marker "${t.id}" requires bounds, viewBox, or size`);!function(e,t,r,n){if(0===n.length)return;let i=t7(t,r).length;if(0===i)throw RangeError(`Connector "${e}" has mid markers but no typed interior route points`);if(1!==n.length&&n.length!==i)throw RangeError(`Connector "${e}" mid markers must contain one repeated descriptor or one descriptor per interior route point`);if(1!==new Set(n.map(e=>e.id)).size)throw RangeError(`Connector "${e}" uses distinct mid markers that one SVG marker-mid carrier cannot represent`);n[0].id}(e.id,e.geometry,o,l);let d=function(e,t){if("line"===e.kind)return{start:{point:{x:e.x1,y:e.y1}},end:{point:{x:e.x2,y:e.y2}}};let r=t3(e,t),n=r[0]?.points[0],i=r.at(-1),o=i?.closed?i.points[0]:i?.points.at(-1);return{...n?{start:{point:{...n}}}:{},...o?{end:{point:{...o}}}:{}}}(e.geometry,o);for(let t of["start","end"]){let r=e.endpoints?.[t]?.point,n=d[t]?.point;if(r&&n&&!tZ(r,n))throw TypeError(`Connector "${e.id}" endpoints.${t}.point disagrees with typed route geometry`)}let u={...e.endpoints??{},start:iv(d.start,e.endpoints?.start),end:iv(d.end,e.endpoints?.end)},c={kind:e.relationship?.kind??e.role,direction:e.relationship?.direction??(void 0!==u.from&&u.from===u.to?"self":a&&s?"bidirectional":a?"reverse":s?"forward":"undirected")},f=(e.labels??[]).map(e=>{let t=eX(e.text,e.textContent),r=eZ(e.text);return{...e,text:r,..."string"!=typeof t?{textContent:{...e.textContent,value:r}}:{}}}),h={id:e.identity?.id??e.id,role:e.role,...e.identity?.classNames?{classNames:e.identity.classNames}:{},...e.identity?.from??u.from?{from:e.identity?.from??u.from}:{},...e.identity?.to??u.to?{to:e.identity?.to??u.to}:{}},p=f[0],m=n3(h,p?.visual?.kind==="inline"?nS(p).lineBlocks.map(e=>e.runs.map(e=>e.text).join("")).join(`
19
+ `):p?tv(eX(p.text,p.textContent),p.display??"literal"):void 0);if(ih(e.id,e.attributes),m&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Connector "${e.id}" takes its aria-label from typed relation accessibility`);for(let[t,r]of f.entries())if(r.visual?.kind==="inline"&&(!r.anchor||!r.paint||void 0===r.fontSize||void 0===r.textAnchor))throw TypeError(`Connector "${e.id}" inline label ${t+1} requires anchor, paint, fontSize, and textAnchor`);let g=e.stroke?.width??e.paint.strokeWidth??"1",y=e.stroke?.dash??(e.paint.strokeDasharray?{array:e.paint.strokeDasharray,...void 0!==e.paint.strokeDashoffset?{offset:e.paint.strokeDashoffset}:{}}:void 0),b=e.stroke?.opacity??e.paint.opacity,x=e.stroke?.paintOrder??e.paint.paintOrder,k=e.stroke?.mixBlendMode,v={color:e.stroke?.color??e.paint.stroke??"var(--_line)",width:g,...void 0!==b?{opacity:b}:{},...y?{dash:y}:{},lineCap:e.stroke?.lineCap??e.paint.strokeLinecap??"butt",lineJoin:e.stroke?.lineJoin??e.paint.strokeLinejoin??"miter",miterLimit:e.stroke?.miterLimit??Number(e.paint.strokeMiterlimit??4),...e.stroke?.pathLength!==void 0?{pathLength:e.stroke.pathLength}:{},...void 0!==x?{paintOrder:x}:{},...void 0!==k?{mixBlendMode:k}:{},nonScaling:e.stroke?.nonScaling??"non-scaling-stroke"===e.paint.vectorEffect,...e.stroke?.encodesValue?{encodesValue:!0}:{}},w=t4(e.geometry,o),$=e.route?.contours;if($&&($.length!==w.length||$.some((e,t)=>{let r=w[t];return!r||e.start.x!==r.start.x||e.start.y!==r.start.y||e.end.x!==r.end.x||e.end.y!==r.end.y||e.closed!==r.closed})))throw TypeError(`Connector "${e.id}" route contours disagree with typed subpath endpoint topology`);if(!t6(e.geometry)&&$)for(let[t,r]of $.entries()){let n=w[t];for(let i of["startTangent","endTangent"]){let o=r[i],a=n[i];if(o&&(!a||!tZ(o,a,1e-9)))throw TypeError(`Connector "${e.id}" route.contours[${t}].${i} disagrees with linear route geometry`)}}let M=$?w.map((e,t)=>{let r=$?.[t],n=r?.startTangent??e.startTangent,i=r?.endTangent??e.endTangent;return{start:{...e.start},end:{...e.end},closed:e.closed,...n?{startTangent:n}:{},...i?{endTangent:i}:{}}}):w;for(let t of M)for(let r of[t.startTangent,t.endTangent]){if(!r)continue;let t=Math.hypot(r.x,r.y);if(!Number.isFinite(t)||Math.abs(t-1)>1e-9)throw TypeError(`Connector "${e.id}" contour tangents must be finite unit vectors`)}for(let t of[e.route?.startTangent,e.route?.endTangent]){if(!t)continue;let r=Math.hypot(t.x,t.y);if(!Number.isFinite(r)||Math.abs(r-1)>1e-9)throw TypeError(`Connector "${e.id}" route tangents must be finite unit vectors`)}for(let[t,r,n]of[["startTangent",e.route?.startTangent,M[0]?.startTangent],["endTangent",e.route?.endTangent,M.at(-1)?.endTangent]])if(r&&n&&!tZ(r,n,1e-9))throw TypeError(`Connector "${e.id}" route.${t} disagrees with its contour tangent authority`);let z={geometry:e.geometry,ownership:e.route?.ownership??"family",closed:o,bendRadius:e.route?.bendRadius??0,contours:M,...e.route?.startTangent??M[0]?.startTangent?{startTangent:e.route?.startTangent??M[0]?.startTangent}:{},...e.route?.endTangent??M.at(-1)?.endTangent?{endTangent:e.route?.endTangent??M.at(-1)?.endTangent}:{},labelAnchors:e.route?.labelAnchors??f.flatMap(e=>e.anchor?[e.anchor]:[])};if(e.hit?.closed!==void 0&&e.hit.closed!==o)throw TypeError(`Connector "${e.id}" hit.closed must match route.closed topology`);let S={geometry:e.hit?.geometry??e.geometry,closed:e.hit?.closed??o,strokeWidth:e.hit?.strokeWidth??Math.max(6,Number.isFinite(r="number"==typeof g?g:parseFloat(g))?Math.max(0,r):1),pointerEvents:e.hit?.pointerEvents??("invisible"===e.lineStyle?"none":"stroke")},j={geometry:e.geometry,lineStyle:e.lineStyle,endpoints:u,relationship:c,route:z,stroke:v,markers:{...a?{start:a}:{},mid:l,...s?{end:s}:{}},labels:f,hit:S,...e.transform?{transform:e.transform}:{},additionalDiagnostics:e.terminalProjection?.diagnostics},E={kind:"connector",id:e.id,role:e.role,lineStyle:e.lineStyle,endpoints:u,relationship:c,route:z,stroke:v,markers:{...a?{start:a}:{},mid:l,...s?{end:s}:{}},labels:f,hit:S,terminalProjection:void 0,identity:h,...e.owner?{owner:e.owner}:{},...e.visibility?{visibility:e.visibility}:{},...m?{accessibility:m}:{},...e.channels?{channels:e.channels}:{},...e.transform?{transform:e.transform}:{},...e.attributes?{attributes:e.attributes}:{}};return function(e,t){if(0===ie||"path"===t.geometry.kind||void 0!==t.additionalDiagnostics&&!t.additionalDiagnostics.every(e=>"string"==typeof e)){e.terminalProjection=n9(t);return}t.additionalDiagnostics&&Object.defineProperty(t,"additionalDiagnostics",{value:Object.freeze([...t.additionalDiagnostics])}),ii(e,Object.freeze(t))}(E,j),nQ(E)}function i$(e){let{block:t,...r}=e;if(t){for(let r of["fontSize","fontWeight","letterSpacing"])if(void 0!==e[r]&&e[r]!==t[r])throw TypeError(`Text "${e.id}" ${r} differs from its retained prepared block`)}ih(e.id,e.attributes);let n=e.fontWeight??t?.fontWeight??400,i=e.letterSpacing??t?.letterSpacing??0,o=e.display??t?.prepared.display??"formatted",a=t??nc(e.text,{display:o,fontSize:e.fontSize,fontWeight:n,letterSpacing:i});if(e.spans&&(1!==a.lines.length||e.spans.map(e=>e.text).join("")!==a.text))throw TypeError(`Text "${e.id}" spans must spell its one displayed line`);let s=e.baselineShift??.35,l=a.lines.length,d=t?t.lineHeight:e.fontSize*tp,u=(1===l?0:-((l-1)/2)*d)+e.fontSize*s,c="hanging"===e.dominantBaseline?a.lineHeight/2:"middle"===e.dominantBaseline||"central"===e.dominantBaseline?0:-(.35*e.fontSize),f=u+(l-1)*a.lineHeight/2+c,h=ig(e),p=n3(h,e.attributes?.data?.label);if(p&&e.attributes?.ariaLabel!==void 0)throw TypeError(`Text "${e.id}" takes its aria-label from typed relation accessibility`);return nQ({kind:"text",...r,identity:h,accessibility:p,block:a,measurement:t?"prepared":"fallback",...t?{prepared:!0,preparedLines:t.lineBlocks.map(e=>e.runs)}:{},fontWeight:n,letterSpacing:i,display:o,textLayout:{width:a.width,height:a.height,lineHeight:a.lineHeight,offsetY:f}})}function iM(e,t){return nX({kind:"document",element:"content",...e},t)}function iz(e){let t="title"===e.element?"title":"desc",r=e.domId?` id="${tz(e.domId)}"`:"";return nX({kind:"document",role:"chrome",...e},`<${t}${r}>${tM(e.text)}</${t}>`)}function iS(e,t){return nX({kind:"document",role:"defs",element:"definitions",...e},t)}function ij(){return nX({kind:"document",id:"svg-close",role:"chrome",element:"close"},"</svg>")}function iE(t){let r,n,i,o,a,s=t.open,l=t.close,d=t.join??`
20
+ `,u=ic({id:t.id,open:s,close:l,join:d,transform:t.transform}),c=(r=s.match(/^\s*<([A-Za-z][\w:-]*)\b[^>]*>/)?.[0]??"",i=((n=t=>{let n=r.match(RegExp(`\\s${t}="([^"]*)"`))?.[1];return void 0===n?void 0:e(n)})("class")??"").split(/\s+/).filter(Boolean),o=n("data-from"),a=n("data-to"),{id:n("data-id")??t.id,role:t.role,...void 0!==o?{from:o}:{},...void 0!==a?{to:a}:{},...i.length>0?{classNames:i}:{}}),f=t.paint,h=f?.opacity,p=f?.fill,m=f&&[...void 0!==h?[`opacity="${tz(h)}"`]:[],...void 0!==p?[`fill="${tz(p)}"`]:[]].join(" "),g=m?s.replace(/^(\s*<g)\b/,`$1 ${m}`):s,y=t.owner??{id:c.id,role:c.role},b=t.children.map(e=>{var t;let r;if(e.node.owner||"document"===e.node.kind||"group"===e.node.kind)return e;if(io(e.node)){let t={};for(let r of Object.keys(e.node))t[r]="terminalProjection"===r?void 0:e.node[r];t.owner=y,r=t,is(e.node,r)}else r={...e.node,owner:y};return t=e.node,(n_.has(t)||nJ.has(t))&&n1(e.node,r),{...e,node:r}}),x=nY(tG(g,c)),k=nQ({kind:"group",id:t.id,role:t.role,open:x,close:l,children:b,join:d,channels:t.channels,identity:c,owner:y,...t.visibility?{visibility:t.visibility}:{},...t.transform?{transform:t.transform}:{},...f?{paint:f}:{}});return ip.set(k,Object.freeze({open:x,opacity:h,...u,style:u.style||void 0!==p})),k}function iT(e,t){return nX({kind:"document",element:"open",id:e.id,role:"prelude"},t)}function iO(e){return iC({shape:iy,group:iE},e)}function iC(e,t){return e.group({id:t.id,role:"icon",open:t.open,close:"</g>",...t.transform?{transform:t.transform}:{},...t.owner?{owner:t.owner}:{},...t.channels?{channels:t.channels}:{},join:t.join??"",children:t.paths.map((r,n)=>({indent:t.indent??0,node:e.shape({id:tR(t.id,"path",n),role:"icon",geometry:{kind:"path",d:r},paint:t.paint,...t.owner?{owner:t.owner}:{}})}))})}export{eZ as a,S as b,L as c,D as d,G as e,Z as f,J as g,V as h,es as i,el as j,ed as k,eb as l,ek as m,ev as n,ew as o,eA as p,eH as q,eM as r,ez as s,eS as t,tu as u,tf as v,th as w,tp as x,tm as y,eO as z,eI as A,eN as B,eX as C,eQ as D,eK as E,e0 as F,e1 as G,tg as H,ty as I,tb as J,tk as K,tv as L,tM as M,tz as N,tS as O,tW as P,tL as Q,tP as R,tB as S,tR as T,tH as U,tD as V,tG as W,nr as X,nn as Y,ni as Z,nc as _,nf as $,nh as aa,np as ba,tZ as ca,tQ as da,t5 as ea,t3 as fa,t6 as ga,t4 as ha,t8 as ia,t9 as ja,re as ka,rr as la,rn as ma,ri as na,ro as oa,rs as pa,ru as qa,rc as ra,rf as sa,rh as ta,rp as ua,rm as va,rg as wa,ry as xa,rb as ya,rx as za,rk as Aa,r$ as Ba,rz as Ca,rS as Da,r4 as Ea,rj as Fa,rE as Ga,rT as Ha,rO as Ia,rC as Ja,rW as Ka,ng as La,ny as Ma,nx as Na,nk as Oa,nw as Pa,n$ as Qa,nj as Ra,nE as Sa,nO as Ta,nC as Ua,nI as Va,nN as Wa,n9 as Xa,it as Ya,io as Za,ia as _a,is as $a,rA as ab,rL as bb,rR as cb,rH as db,rD as eb,r_ as fb,rV as gb,rU as hb,rY as ib,rQ as jb,r0 as kb,r1 as lb,r2 as mb,r5 as nb,ic as ob,r3 as pb,nL as qb,nP as rb,nq as sb,nZ as tb,nY as ub,nK as vb,n0 as wb,n1 as xb,n2 as yb,im as zb,iy as Ab,iw as Bb,i$ as Cb,iM as Db,iz as Eb,iS as Fb,ij as Gb,iE as Hb,iT as Ib,iC as Jb,n5 as Kb,l as Lb,d as Mb,u as Nb,o as Ob,c as Pb,f as Qb,h as Rb,p as Sb,m as Tb,g as Ub,b as Vb,x as Wb,k as Xb,w as Yb,$ as Zb,M as _b,z as $b};