agentic-mermaid 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -0
- package/dist/agent-core.d.ts +7 -7
- package/dist/agent-core.js +1 -1
- package/dist/agent.d.ts +7 -7
- package/dist/agent.js +1 -1
- package/dist/agentic-mermaid-mcp.js +1 -1
- package/dist/am.js +1 -1
- package/dist/browser-lazy/chunks/{agentic-producer-core-CC6OOLDW.js → agentic-producer-core-ECZ3CMZM.js} +1 -1
- package/dist/browser-lazy/chunks/{architecture-QUFVKYJR.js → architecture-H5LTMKQW.js} +6 -6
- package/dist/browser-lazy/chunks/{block-6J3Q63BO.js → block-566X6FNV.js} +5 -5
- package/dist/browser-lazy/chunks/{builtin-backends-7SOZZHPF.js → builtin-backends-VAFEZXKY.js} +6 -6
- package/dist/browser-lazy/chunks/{c4-SQVBZAKJ.js → c4-ZXFDLBFK.js} +5 -5
- package/dist/browser-lazy/chunks/{chunk-5X6MJX3H.js → chunk-2JQXRKBC.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-E2WMJZNM.js → chunk-37FZNMPR.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-TYZOZXUJ.js → chunk-3JTYTXA6.js} +6 -6
- package/dist/browser-lazy/chunks/{chunk-PQGPS2YV.js → chunk-4NILRBC7.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-AMJLVPUB.js → chunk-5LKPDHPC.js} +2 -2
- package/dist/browser-lazy/chunks/{chunk-BY2CPG6B.js → chunk-62MR3LWJ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-J7FFAFQF.js → chunk-64JFHCJC.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +1 -0
- package/dist/browser-lazy/chunks/{chunk-VWVZGQE2.js → chunk-6UOOATQR.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-7TTFBJYA.js +1 -0
- package/dist/browser-lazy/chunks/chunk-7UFOFWBA.js +20 -0
- package/dist/browser-lazy/chunks/{chunk-5B2Z7575.js → chunk-A7V5VDKN.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-CPO5P4L2.js +1 -0
- package/dist/browser-lazy/chunks/chunk-EIYLJ4FI.js +20 -0
- package/dist/browser-lazy/chunks/{chunk-X2UYKWKM.js → chunk-G4JBA7HU.js} +3 -3
- package/dist/browser-lazy/chunks/{chunk-2UIA2IME.js → chunk-IUI4DYC3.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-QA6GJQ4X.js → chunk-J57YRC2M.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-BU5LHXNJ.js → chunk-LBXXKLIR.js} +3 -3
- package/dist/browser-lazy/chunks/chunk-NKW2ZNCD.js +1 -0
- package/dist/browser-lazy/chunks/{chunk-ICC7HBJX.js → chunk-O34YYEQV.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-UL6NDWLL.js → chunk-OBI5U5XU.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-YCEICNM6.js → chunk-OFOS57WQ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-OZ443IVJ.js → chunk-PSZEE64O.js} +7 -7
- package/dist/browser-lazy/chunks/{chunk-SZELX2EJ.js → chunk-PXTLV57R.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-HLWUNUCM.js → chunk-QVSZOF5M.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-2GPK4VFF.js → chunk-TT5GR5EJ.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-DF6765YX.js → chunk-V6I2VGNQ.js} +5 -5
- package/dist/browser-lazy/chunks/{chunk-CN7WTBWB.js → chunk-VRZKI33U.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-2SH76OTH.js → chunk-XHU3A432.js} +1 -1
- package/dist/browser-lazy/chunks/{chunk-NO7ZIVRU.js → chunk-YVNJDVQO.js} +1 -1
- package/dist/browser-lazy/chunks/chunk-Z7UHFVKN.js +6 -0
- package/dist/browser-lazy/chunks/{class-5QA4SCTS.js → class-XIFNVBFE.js} +8 -8
- package/dist/{zenuml/chunks/decode-BWERFDGK.js → browser-lazy/chunks/decode-5MFOG3AZ.js} +1 -1
- package/dist/browser-lazy/chunks/{elk.bundled-L4CADV5W.js → elk.bundled-RYWHIS5N.js} +8 -8
- package/dist/browser-lazy/chunks/er-VEUYJBGG.js +11 -0
- package/dist/browser-lazy/chunks/{eventmodeling-2BPLHWRN.js → eventmodeling-G7DITZX7.js} +10 -10
- package/dist/browser-lazy/chunks/{flowchart-NEIMZTB5.js → flowchart-SSFIU4EU.js} +1 -1
- package/dist/browser-lazy/chunks/{forest-implementation-AEP24AIP.js → forest-implementation-RWFF7XDV.js} +1 -1
- package/dist/browser-lazy/chunks/{gantt-RDPIFYAF.js → gantt-HQNVDX2B.js} +6 -6
- package/dist/browser-lazy/chunks/{gitgraph-N4Y5RYB7.js → gitgraph-Z5MN6M6L.js} +4 -4
- package/dist/browser-lazy/chunks/{ishikawa-LD3YBDJN.js → ishikawa-UEERNFQV.js} +2 -2
- package/dist/browser-lazy/chunks/{journey-6YQR5DJX.js → journey-3BEWWGB5.js} +6 -6
- package/dist/browser-lazy/chunks/{kanban-PLMJ7NBW.js → kanban-2WFNCWLB.js} +10 -10
- package/dist/browser-lazy/chunks/{mermaid-yaml-runtime-QVYX4EWK.js → mermaid-yaml-runtime-IK4ET4BT.js} +8 -8
- package/dist/browser-lazy/chunks/{mindmap-K2UBFO3Y.js → mindmap-R2C6SNYR.js} +4 -4
- package/dist/browser-lazy/chunks/{packet-CUW4QY6Y.js → packet-GMVCI5YZ.js} +3 -3
- package/dist/browser-lazy/chunks/{pie-7F7UUCG3.js → pie-WER45DKC.js} +7 -7
- package/dist/browser-lazy/chunks/{quadrant-TOONO2WC.js → quadrant-NCUPSFKN.js} +4 -4
- package/dist/browser-lazy/chunks/{radar-J6JVWVAX.js → radar-WLYS4YC5.js} +8 -8
- package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +3 -0
- package/dist/browser-lazy/chunks/{requirement-CMAKDJPO.js → requirement-AK3NWMJ6.js} +7 -7
- package/dist/browser-lazy/chunks/{sankey-AWXQEP3F.js → sankey-C2DY6WVU.js} +4 -4
- package/dist/browser-lazy/chunks/{sequence-Q2RJRB4L.js → sequence-D4WJB44W.js} +1 -1
- package/dist/browser-lazy/chunks/{state-WRBFQEDX.js → state-YUQVESE7.js} +2 -2
- package/dist/browser-lazy/chunks/{timeline-D2KILFXM.js → timeline-BMBJJXWR.js} +4 -4
- package/dist/browser-lazy/chunks/{treemap-N3VYX5D4.js → treemap-B66XBZZ6.js} +3 -3
- package/dist/browser-lazy/chunks/{xychart-G73OGK66.js → xychart-HAVFROGT.js} +6 -6
- package/dist/browser-lazy/chunks/{zenuml-H4BXNYXR.js → zenuml-62RLYFWP.js} +7 -7
- package/dist/browser-lazy/index.js +1 -1
- package/dist/browser.global.js +507 -507
- package/dist/{chunk-DQDKA5ND.js → chunk-2DNGDTJD.js} +2 -2
- package/dist/{chunk-GVCHLSHH.js → chunk-4F2UGYTM.js} +2 -2
- package/dist/{chunk-H3NCS2XZ.js → chunk-7XYB2LNC.js} +2 -2
- package/dist/chunk-DOFB572I.js +58 -0
- package/dist/chunk-EHJI3QYE.js +52 -0
- package/dist/{chunk-UA234O4M.js → chunk-HINRNKPO.js} +2 -2
- package/dist/{chunk-JZOJ4YGS.js → chunk-KXMANAST.js} +33 -33
- package/dist/{chunk-7CRDX2QR.js → chunk-U4MT3RRE.js} +2 -2
- package/dist/{chunk-NKNFOREZ.js → chunk-WYIB6BUR.js} +2 -2
- package/dist/{cli-YGGTJZH7.js → cli-ZYIDBYNS.js} +2 -2
- package/dist/{index-EeXqJXr5.d.ts → index-Bvhprdxz.d.ts} +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{mcp-cli-63DYXTVD.js → mcp-cli-YVDCORWA.js} +2 -2
- package/dist/{paint-certification-6rwQjIv_.d.ts → paint-certification-BoLyr006.d.ts} +2 -2
- package/dist/{server-5NEOHOFS.js → server-4JGAVXR3.js} +2 -2
- package/dist/{svg-styles-BdnoM7AT.d.ts → svg-styles-BnCoXyYe.d.ts} +1 -1
- package/dist/svg-styles.d.ts +1 -1
- package/dist/svg-styles.js +1 -1
- package/dist/svg.d.ts +4 -4
- package/dist/svg.js +1 -1
- package/dist/{types-BcS52Mjt.d.ts → types-CLVJCaH2.d.ts} +1 -1
- package/dist/zenuml/chunks/{appearance-UOQ5KA6O.js → appearance-5RM5MVM2.js} +1 -1
- package/dist/zenuml/chunks/{builtin-backends-KDKE7YHO.js → builtin-backends-UTNWL4N3.js} +11 -11
- package/dist/zenuml/chunks/{chunk-QWX77U7G.js → chunk-3A6S6GNB.js} +2 -2
- package/dist/zenuml/chunks/{chunk-OXQWRSBM.js → chunk-55WS466K.js} +11 -11
- package/dist/zenuml/chunks/chunk-6J4BGPB2.js +29 -0
- package/dist/zenuml/chunks/chunk-CNLL4BGF.js +1 -0
- package/dist/zenuml/chunks/{chunk-RZ6XK5CD.js → chunk-IARQ24W3.js} +13 -13
- package/dist/zenuml/chunks/{chunk-42DXZ5C6.js → chunk-ZNZRIISS.js} +2 -2
- package/dist/{browser-lazy/chunks/decode-63UIZGD2.js → zenuml/chunks/decode-LDNNXEAO.js} +1 -1
- package/dist/zenuml/chunks/{mermaid-yaml-runtime-KZVU74WU.js → mermaid-yaml-runtime-A5CNJ3IE.js} +8 -8
- package/dist/zenuml/chunks/render-core-ECIWU5ZS.js +3 -0
- package/dist/zenuml/chunks/{zenuml-EA2ZFRUX.js → zenuml-N3LZMB2G.js} +8 -8
- package/dist/zenuml.d.ts +2 -2
- package/dist/zenuml.js +1 -1
- package/docs/MCP-DIRECTORY-LISTINGS.md +81 -12
- package/docs/api.md +1 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +0 -1
- package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +0 -6
- package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +0 -1
- package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +0 -20
- package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +0 -1
- package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +0 -20
- package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +0 -11
- package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +0 -3
- package/dist/chunk-EHCMJUMD.js +0 -52
- package/dist/chunk-OMY6NRQD.js +0 -58
- package/dist/zenuml/chunks/chunk-7TVYPTDW.js +0 -1
- package/dist/zenuml/chunks/chunk-RLJEI7YN.js +0 -29
- package/dist/zenuml/chunks/render-core-V5RQ737O.js +0 -3
- /package/dist/browser-lazy/chunks/{chunk-5FQ534HP.js → chunk-BMZ24VPS.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-2I4UPL7Q.js → chunk-D6MQ7QSU.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-CQE4HQEW.js → chunk-HJVO5VC3.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-LH7HUDKW.js → chunk-L4UC3KGS.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-NMQQMRIR.js → chunk-MFTQWHUB.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-N5ELX7LR.js → chunk-PJJSDGLB.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-CSFUKSU6.js → chunk-QCU5G5PZ.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-VQYYGAXP.js → chunk-TLFX3U6S.js} +0 -0
- /package/dist/browser-lazy/chunks/{chunk-5UVGUSD6.js → chunk-YHMTSXIR.js} +0 -0
- /package/dist/zenuml/chunks/{chunk-EVPSMEKN.js → chunk-GC7IPQ5P.js} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
let e;import{a as t,c as i,d as n}from"./chunk-
|
|
1
|
+
let e;import{a as t,c as i,d as n}from"./chunk-CNLL4BGF.js";import{D as o,E as r,G as a,a as l,b as s,l as d,n as c,o as h,r as p,t as g,w as f,x as u,y as m}from"./chunk-55WS466K.js";import{h as b}from"./chunk-3A6S6GNB.js";import{fa as x,i as y,o as k,s as v}from"./chunk-6J4BGPB2.js";import{E as w,F as M,Ka as S,L as $,M as I,N as L,O as W,Q as C,R as z,S as _,g as P,h as E,i as F,o as H,p as T,pa as Y,q as q,qa as B,r as U,ra as R,ta as Z,xa as N}from"./chunk-IARQ24W3.js";import"./chunk-GC7IPQ5P.js";var O,X,A=Object.freeze({id:"zenuml",upstreamId:"zenuml",maturity:"experimental",label:"ZenUML",headers:["zenuml"],aliases:[],config:{section:"zenuml",keys:[],noopKeys:[]},identity:{id:"family:zenuml",kind:"family",version:"1.0.0",compatibility:{core:"0.5.4"},provenance:{owner:"agentic-mermaid",source:"built-in"}},collisionPriority:100,semanticChannels:["category"],semanticRoles:["prelude","title","defs","chrome","actor","lifeline","activation","message","block","note","label","icon"],scenePrimitiveEvidence:[{role:"prelude",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"title",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"defs",primitive:"marker",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"chrome",primitive:"document",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"actor",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"actor",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"lifeline",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"lifeline",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"activation",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"activation",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"message",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"message",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"block",primitive:"connector",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"note",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"note",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"label",primitive:"text",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"shape",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]},{role:"icon",primitive:"container",applicability:"applicable",realization:"native",evidence:["src/__tests__/section-a-family-descriptor-conformance.test.ts"]}],example:`zenuml
|
|
2
2
|
Alice->Bob: Hello
|
|
3
|
-
Bob->Alice: Reply`,detect:l,detectLoose:l});function
|
|
3
|
+
Bob->Alice: Reply`,detect:l,detectLoose:l});function j(e){return X?.family===e}function D(e,t){let i=X;if(!(!i||i.family!==e)){X=void 0;try{i.observer(t)}finally{X=i}}}function G(e,t,i,n){j(e)&&(X?.mutations&&!X.mutations.has(t)||D(e,{family:e,unit:"mutation",kind:t,value:function e(t,i=new Map,n="$"){let o;if(null==t)return null;if("number"==typeof t)return Number.isFinite(t)?t:{$number:String(t)};if("string"==typeof t||"boolean"==typeof t)return t;if("object"!=typeof t)return String(t);let r=i.get(t);if(void 0!==r)return{$ref:r};if(i.set(t,n),t instanceof Date)o=t.toISOString();else if(t instanceof Map)o=[...t].map(([t,o],r)=>[e(t,i,`${n}.${r}.0`),e(o,i,`${n}.${r}.1`)]);else if(t instanceof Set)o=[...t].map((t,o)=>e(t,i,`${n}.${o}`));else if(Array.isArray(t))o=t.map((t,o)=>e(t,i,`${n}.${o}`));else{let r=Object.create(null);for(let[o,a]of Object.entries(t))"function"!=typeof a&&void 0!==a&&(r[o]=e(a,i,`${n}.${o}`));o=r}return i.delete(t),o}(i),...n?{source:{...n}}:{}}))}var V=String.raw`(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|[\p{L}_$][\p{L}\p{N}_$-]*?)`,J=RegExp(`^${V}$`,"u"),K=RegExp(`^(${V})(?![\\p{L}\\p{N}_$-])`,"u"),Q=RegExp(`^(${V})\\s*(-->|->)\\s*(${V})\\s*:\\s*([\\s\\S]*)$`,"u"),ee=RegExp(`^(${V})(?:\\s+as\\s+(${V}))?$`,"u"),et=RegExp(`^(?:(${V})\\s*->\\s*)?(${V})\\s*\\.\\s*([\\s\\S]+)$`,"u");function ei(e){let t=e.trim();if(!J.test(t))throw Error(`Invalid ZenUML identity: ${e}`);return t.startsWith('"')?JSON.parse(t):t.startsWith("'")?t.slice(1,-1).replace(/\\'/g,"'").replace(/\\\\/g,"\\"):t}function en(e){if(!e||/[\r\n]/.test(e))throw Error("ZenUML identities must be non-empty single-line text");return/^[\p{L}_$][\p{L}\p{N}_$-]*$/u.test(e)&&!eo.has(e)?e:JSON.stringify(e)}var eo=new Set(["title","if","else","while","for","foreach","forEach","loop","par","opt","try","catch","finally","return","new","critical","group","ref","section","const","readonly","static","await","true","false","null","nil","as","in"]);function er(e){let t=[],i=0,n="",o=!1,r=0,a=0,l=!1,s=!1,d=!1,c=n=>{let o=e.slice(i,n).trim();o&&t.push({kind:"text",text:o,start:i+e.slice(i,n).indexOf(o),end:n-(e.slice(i,n).length-e.slice(i,n).trimEnd().length)})};for(let h=0;h<e.length;h++){let p=e[h],g=!s&&/\S/.test(p);if(g&&(s=!0,!r&&!a&&/^title(?:[ \t]|$)/.test(e.slice(h,h+6))&&(d="title")),n){o?o=!1:"\\"===p?o=!0:p===n&&(n="");continue}if(!d&&('"'===p||"'"===p)){n=p;continue}if(!d&&e.startsWith("//",h)){c(h);let n=e.indexOf(`
|
|
4
4
|
`,h),o=n<0?e.length:n;t.push({kind:"comment",text:e.slice(h+2,o).replace(/^ /,""),start:h,end:o}),h=o-1,i=o,s=!1,l=!1;continue}if(!d&&e.startsWith("%%",h)&&g){let t=e.indexOf(`
|
|
5
5
|
`,h);i=(h=t<0?e.length:t-1)+1,s=!1,l=!1;continue}if(!d){if("("===p&&r++,")"===p){if(!r)throw Error("Unmatched ZenUML parenthesis");r--}if("["===p&&a++,"]"===p){if(!a)throw Error("Unmatched ZenUML bracket");a--}">"!==p||"-"!==e[h-1]||r||a||(l=!0),":"!==p||r||a||!l||(d="event")}r||a||(d||"{"!==p&&"}"!==p)&&p!==`
|
|
6
6
|
`&&(";"!==p||"title"===d)||(c(h),("{"===p||"}"===p)&&t.push({kind:"{"===p?"open":"close",text:p,start:h,end:h+1}),i=h+1,d=!1,s=!1,l=!1)}if(n||r||a)throw Error("Unclosed ZenUML quote or parameter list");return c(e.length),t}function ea(e){let t=e.join(`
|
|
7
7
|
`),i=e.map((e,t)=>t);try{let e=0,n=0;for(let o of er(t)){for(;n<o.start;)t[n++]===`
|
|
8
8
|
`&&e++;let r=e;for(;n<o.end;)t[n++]===`
|
|
9
9
|
`&&e++;for(let t=r;t<e;t++)i[t]=e}}catch{}return i}function el(e){let t=e.trim();if(t){if(!t.startsWith("(")||!t.endsWith(")"))throw Error("ZenUML condition requires parentheses");return t.slice(1,-1).trim()}}function es(e){let t=P[e.toLowerCase()];if(t)return t;let i=E(e);if(i)return F(i[0],i[1],i[2]);let n=e.match(/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})/i);return n?F(Math.min(255,Number.parseInt(n[1],10)),Math.min(255,Number.parseInt(n[2],10)),Math.min(255,Number.parseInt(n[3],10))):null}new TextDecoder("windows-1252"),RegExp(`#\\w+;|${d.source}`,"g");var ed=new Map([["<<--\x3e>",["filled","filled"]],["<<->>",["filled","filled"]],["--\x3e>",["none","filled"]],["->>",["none","filled"]],["--\x3e",["none","none"]],["->",["none","none"]],["--x",["none","cross"]],["-x",["none","cross"]],["--)",["none","open"]],["-)",["none","open"]],["--|\\",["none","half-top"]],["-|\\",["none","half-top"]],["--|/",["none","half-bottom"]],["-|/",["none","half-bottom"]],["--\\\\",["none","stick-top"]],["-\\\\",["none","stick-top"]],["--//",["none","stick-bottom"]],["-//",["none","stick-bottom"]],["/|--",["half-bottom","none"]],["/|-",["half-bottom","none"]],["\\|--",["half-top","none"]],["\\|-",["half-top","none"]],["//--",["stick-bottom","none"]],["//-",["stick-bottom","none"]],["\\\\--",["stick-top","none"]],["\\\\-",["stick-top","none"]],["--|",["none","stick-top"]],["-|",["none","stick-top"]],["--/",["none","stick-bottom"]],["-/",["none","stick-bottom"]],["--\\",["none","stick-top"]],["-\\",["none","stick-top"]],["|--",["stick-top","none"]],["|-",["stick-top","none"]],["/--",["stick-bottom","none"]],["/-",["stick-bottom","none"]],["\\--",["stick-top","none"]],["\\-",["stick-top","none"]]]),ec=new Set(["--|","-|","--/","-/","--\\","-\\","|--","|-","/--","/-","\\--","\\-"]),eh=([...ec].map(e=>{let[t,i]=ed.get(e),n=[...ed].find(([n,o])=>!ec.has(n)&&o[0]===t&&o[1]===i&&n.includes("--")===e.includes("--"))[0];return[e,n]}),[...ed.keys()].sort((e,t)=>t.length-e.length)).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|");[...(new RegExp(String.raw`^(\S+?)(\(\))?\s*(${eh})`),new RegExp(String.raw`^(\S+?)\s+(\(\))\s*(${eh})`),new Set(["participant","actor","note","alt","else","loop","rect","opt","par","and","end","activate","deactivate","autonumber","box","create","destroy","link","links","critical","break","option","title","over","off","properties","details","sequencediagram","par_over"]))];var ep=new WeakMap,eg=new WeakMap,ef={nodeLabelFontSize:13,edgeLabelFontSize:11,groupHeaderFontSize:12,nodeLabelFontWeight:500,edgeLabelFontWeight:400,groupHeaderFontWeight:600,nodePaddingX:20,nodePaddingY:10,diamondExtraPadding:24,edgeLineWidth:1,groupCornerRadius:0,groupPaddingX:16,groupPaddingY:16,groupLabelPaddingX:12,groupLineWidth:1};function eu(e){return"number"==typeof e&&Number.isFinite(e)?e:void 0}function em(e,...t){for(let e of t){let t=eu(e);if(null!=t&&t>0)return t}return e}function eb(e,...t){for(let e of t){let t=eu(e);if(null!=t&&t>=0)return t}return e}function ex(...e){for(let t of e)if("string"==typeof t&&t.trim().length>0)return t}function ey(...e){for(let t of e){let e=ex(t)?.toLowerCase();if("uppercase"===e||"lowercase"===e||"capitalize"===e)return e}}function ek(e,t){if("string"!=typeof e)return L(e,e.display,t);if(!t)return e;let i=L(e,"formatted",t),n=0,o="";for(let t of i.lines)for(let i of t)o+=e.slice(n,i.sourceStart)+i.text,n=i.sourceEnd;return o+e.slice(n)}function ev(e={},t=ef,i){let n=i??e.styleFace,o=n?.text,r=n?.node,a=n?.edge,l=n?.group,s=eb(void 0,l?.paddingX),d=null==t.nodeCornerRadius?eb(void 0,r?.cornerRadius):eb(t.nodeCornerRadius,r?.cornerRadius);return{nodeLabelFontSize:em(t.nodeLabelFontSize,r?.fontSize,o?.fontSize),edgeLabelFontSize:em(t.edgeLabelFontSize,a?.fontSize,o?.fontSize),groupHeaderFontSize:em(t.groupHeaderFontSize,l?.fontSize,o?.fontSize),nodeLabelFontWeight:em(t.nodeLabelFontWeight,r?.fontWeight,o?.fontWeight),edgeLabelFontWeight:em(t.edgeLabelFontWeight,a?.fontWeight,o?.fontWeight),groupHeaderFontWeight:em(t.groupHeaderFontWeight,l?.fontWeight,o?.fontWeight),nodeTextTransform:ey(r?.textTransform,o?.textTransform,t.nodeTextTransform),edgeTextTransform:ey(a?.textTransform,o?.textTransform,t.edgeTextTransform),nodeLetterSpacing:eu(r?.letterSpacing)??eu(o?.letterSpacing)??t.nodeLetterSpacing??0,edgeLetterSpacing:eu(a?.letterSpacing)??eu(o?.letterSpacing)??t.edgeLetterSpacing??0,groupLetterSpacing:eu(l?.letterSpacing)??eu(o?.letterSpacing)??t.groupLetterSpacing??0,nodePaddingX:eb(t.nodePaddingX,r?.paddingX),nodePaddingY:eb(t.nodePaddingY,r?.paddingY),diamondExtraPadding:t.diamondExtraPadding??24,cornerRadius:d,nodeLineWidth:em(t.nodeLineWidth??.75,r?.lineWidth),nodeFillColor:ex(r?.fillColor,t.nodeFillColor),nodeBorderColor:ex(r?.borderColor,t.nodeBorderColor),nodeTextColor:ex(r?.textColor,o?.textColor,t.nodeTextColor),lineWidth:em(t.edgeLineWidth,a?.lineWidth),edgeBendRadius:eb(t.edgeBendRadius??0,a?.bendRadius),edgeStrokeColor:ex(a?.strokeColor,t.edgeStrokeColor),edgeTextColor:ex(a?.textColor,o?.textColor,t.edgeTextColor),groupFont:ex(l?.fontFamily,t.groupFont),groupTextTransform:ey(l?.textTransform,o?.textTransform,t.groupTextTransform),groupCornerRadius:eb(t.groupCornerRadius,l?.cornerRadius),groupBorderColor:ex(l?.borderColor,t.groupBorderColor),groupFillColor:ex(l?.fillColor,t.groupFillColor),groupHeaderFillColor:ex(l?.headerFillColor,t.groupHeaderFillColor),groupTextColor:ex(l?.textColor,o?.textColor,t.groupTextColor),groupPaddingX:s??t.groupPaddingX,groupPaddingY:eb(t.groupPaddingY,l?.paddingY),groupLabelPaddingX:s??t.groupLabelPaddingX??t.groupPaddingX,groupLineWidth:em(t.groupLineWidth??1,l?.lineWidth)}}function ew(e,t,i){return{text:e.text,x:t/2,y:i+(e.height-12)/2,...e.block?{block:e.block}:{}}}function eM(e,t,i,n,o,r,a=0,l=v(e,{fontSize:o,fontWeight:r,letterSpacing:a})){let s="middle"===n?t-l.width/2:"start"===n?t:t-l.width;return{text:l.text,block:l,x:t,y:i,anchor:n,fontSize:o,fontWeight:r,letterSpacing:a,bounds:{x:s,y:i-l.height/2,width:l.width,height:l.height},metrics:l}}function eS(e,t){let i=Math.min(e.x,t.x),n=Math.min(e.y,t.y);return{x:i,y:n,width:Math.max(e.x+e.width,t.x+t.width)-i,height:Math.max(e.y+e.height,t.y+t.height)-n}}function e$(e,t,i){return{x:e.x+t,y:e.y+i,width:e.width,height:e.height}}function eI(e,t,i){return{...e,x:e.x+t,y:e.y+i,bounds:e$(e.bounds,t,i)}}function eL(e,t,i,n){if("participant"===e.type){let o=eM(t.displayLabel,i,n+t.height/2,"middle",t.fontSize,t.fontWeight,t.letterSpacing,t.block),r={x:i-t.width/2,y:n,width:t.width,height:t.height};return{id:e.id,label:e.label,type:e.type,...e.links?{links:{...e.links}}:{},...t.menuBlock?{menuBlock:t.menuBlock}:{},x:i,y:n,width:t.width,height:t.height,bounds:r,labelPosition:o}}let o="actor"===e.type?n+t.height:Math.max(n+t.height,n+26),r=o+Math.max(14,t.labelMetrics.lineHeight/2+5.5)+(t.labelMetrics.lines.length-1)/2*t.labelMetrics.lineHeight,a=eM(t.displayLabel,i,r,"middle",t.fontSize,t.fontWeight,t.letterSpacing,t.block),l=eS({x:i-t.width/2,y:n,width:t.width,height:o-n},a.bounds),s={x:l.x,y:l.y,width:l.width,height:l.height+4};return{id:e.id,label:e.label,type:e.type,...e.links?{links:{...e.links}}:{},...t.menuBlock?{menuBlock:t.menuBlock}:{},x:i,y:n,width:t.width,height:t.height,bounds:s,labelPosition:a}}function eW(e,t,i,n){let o=t.dividerNoteIndices[n]??-1,r=t.dividerNoteIndices[n+1]??t.endNoteExclusive;return o>=0&&o<r&&i.notes[o].afterIndex<e.dividers[n].index?o:void 0}function eC(e,t,i,n,o,r,a,l,s,d,c,h,p){let g,f,u=e.startIndex<i.endMessageExclusive?a[e.startIndex]:void 0,m=e.startIndex<i.endMessageExclusive?a[i.endMessageExclusive-1]:void 0,b=new Set;for(let t=e.startIndex;t<i.endMessageExclusive;t++){let e=n.messages[t];e&&(b.add(o.get(e.from)??0),b.add(o.get(e.to)??0))}for(let e of i.noteIndices){let t=n.notes[e];if(t)for(let e of t.actorIds){let t=o.get(e);void 0!==t&&b.add(t)}}if(0===b.size)for(let e=0;e<n.actors.length;e++)b.add(e);let x=1/0,y=-1/0;for(let e of b){let t=r[e];if(!t)continue;let i=t.bounds;x=Math.min(x,i.x-d.groupPaddingX),y=Math.max(y,i.x+i.width+d.groupPaddingX)}for(let t=e.startIndex;t<i.endMessageExclusive;t++){let e=a[t];e&&(x=Math.min(x,e.bounds.x-d.groupPaddingX),y=Math.max(y,e.bounds.x+e.bounds.width+d.groupPaddingX))}for(let e of i.noteIndices){let t=l[e];t&&(x=Math.min(x,t.x-d.groupPaddingX),y=Math.max(y,t.x+t.width+d.groupPaddingX))}for(let e of i.childBlockIndices){let t=s[e];t&&(x=Math.min(x,t.x-d.groupPaddingX),y=Math.max(y,t.x+t.width+d.groupPaddingX))}for(let i of("rect"!==e.type&&(y=Math.max(y,x+t.tabWidth+d.groupPaddingX)),t.dividers))i.label&&(y=Math.max(y,x+8+i.metrics.width+d.groupPaddingX));let k=u&&!u.isSelf&&u.labelPosition.text.includes(`
|
|
10
|
-
`)?Math.ceil(Math.max(0,u.labelPosition.y-u.labelPosition.bounds.y-d.edgeLabelFontSize*w/2-1e-6)):0,v=i.noteIndices.length>0?t.contentTopPadding:t.blockPadTop,M=p?.top??(u?u.y-(t.blockPadTop+k):h-v),S=(m?.y??h)+d.groupPaddingY+12;for(let n=e.startIndex;n<i.endMessageExclusive;n++){let e=a[n];if(!e)continue;M=Math.min(M,e.bounds.y-Math.max(t.tabHeight,d.groupPaddingY));let i=e.isSelf?d.groupPaddingY+4:d.groupPaddingY;S=Math.max(S,e.bounds.y+e.bounds.height+i)}for(let o of b){let l=n.actors[o],s=r[o];if(!(!s||l?.createMessageIndex===void 0||!a[l.createMessageIndex])&&l.createMessageIndex>=e.startIndex&&l.createMessageIndex<i.endMessageExclusive){let e=t.contentTopPadding;M=Math.min(M,s.bounds.y-e),S=Math.max(S,s.bounds.y+s.bounds.height+d.groupPaddingY)}}for(let e of i.noteIndices){let i=l[e];if(!i)continue;let n=t.contentTopPadding;M=Math.min(M,i.y-n),S=Math.max(S,i.y+i.height+d.groupPaddingY)}for(let e of i.childBlockIndices){let i=s[e];i&&(M=Math.min(M,i.y-t.enclosingHeaderStep),S=Math.max(S,i.y+i.height+d.groupPaddingY))}let $=t.dividers.map((o,r)=>{let g=eW(e,i,n,r),f=void 0===g?void 0:l[g],u=o.index<i.endMessageExclusive?a[o.index]:void 0;if("par_over"===e.type){if(!o.label)return{y:M+t.tabHeight,label:""};let e=f??u?.bounds;for(let[t,a]of i.childBlockIndices.entries()){let l=s[a];l&&i.childSectionIndices[t]===r+1&&n.blocks[a].startIndex===o.index&&(!e||l.y<e.y)&&(e=l)}let a=e?.x??x+8,l=e?e.y-o.metrics.height-8:M+t.tabHeight+8+r*(o.metrics.height+8),c=eM(o.displayLabel,a,l+o.metrics.height/2,"start",d.edgeLabelFontSize,d.edgeLabelFontWeight,d.edgeLetterSpacing,o.block);return y=Math.max(y,c.bounds.x+c.bounds.width+d.groupPaddingX),S=Math.max(S,c.bounds.y+c.bounds.height+d.groupPaddingY),{y:l,label:o.label,labelPosition:c}}let m=u?.y??h,b=28+o.extraLinesHeight+o.extraFontOffset;if(o.label&&u?.label){let e=x+8,t=e+o.metrics.width,i=u.labelPosition.bounds,n=i.x,r=i.x+i.width;if(t+8>n&&e-8<r){let e=Math.max(0,Math.ceil(m-10-(i.y+i.height/2)));b=Math.max(36+o.extraLinesHeight+o.extraFontOffset+e,Math.ceil(24+c+o.extraLinesHeight+o.extraFontOffset+e))}}let k=p?.dividerY[r],v=k??(f?f.y-o.noteContentOffset:m-b);for(let[e,t]of i.childBlockIndices.entries()){let a=s[t],l=n.blocks[t];if(void 0===k&&a&&l?.startIndex===o.index&&i.childSectionIndices[e]===r+1){let e=o.noteContentOffset;v=Math.min(v,a.y-e)}}if(!o.label)return{y:v,label:o.label};let w=v+o.firstLineOffset+(o.metrics.lines.length-1)/2*o.metrics.lineHeight,$=eM(o.displayLabel,x+8,w,"start",d.edgeLabelFontSize,d.edgeLabelFontWeight,d.edgeLetterSpacing,o.block);return S=Math.max(S,$.bounds.y+$.bounds.height+d.groupPaddingY),{y:v,label:o.label,labelPosition:{...$,text:o.displayLabel}}}),I="rect"===e.type?void 0:(g=M+t.tabHeight/2,f=eM(t.headerText,x+d.groupLabelPaddingX,g,"start",d.groupHeaderFontSize,d.groupHeaderFontWeight,d.groupLetterSpacing,t.block),{x,y:M,width:t.tabWidth,height:t.tabHeight,label:{...f,text:t.headerText}}),L={x,y:M,width:y-x,height:S-M};return{type:e.type,label:e.label,...e.color?{color:e.color}:{},x:L.x,y:L.y,width:L.width,height:L.height,dividers:$,...I?{header:I}:{},bounds:L}}function ez(e,t,i){for(let n of e.actors)n.x+=t,n.y+=i,n.bounds=e$(n.bounds,t,i),n.labelPosition=eI(n.labelPosition,t,i);for(let n of e.messages)!function(e,t,i){e.x1+=t,e.x2+=t,e.y+=i,e.points=e.points.map(e=>({x:e.x+t,y:e.y+i})),e.labelPosition=eI(e.labelPosition,t,i),e.bounds=e$(e.bounds,t,i)}(n,t,i);for(let n of e.blocks)for(let e of(n.x+=t,n.y+=i,n.bounds=e$(n.bounds,t,i),n.header&&(n.header={...n.header,x:n.header.x+t,y:n.header.y+i,label:eI(n.header.label,t,i)}),n.dividers))e.y+=i,e.labelPosition&&(e.labelPosition=eI(e.labelPosition,t,i));for(let n of e.notes)n.x+=t,n.y+=i;for(let n of e.boxes)n.x+=t,n.y+=i,void 0!==n.labelY&&(n.labelY+=i);for(let n of e.activations)n.x+=t,n.topY+=i,n.bottomY+=i;for(let n of e.lifelines)n.x+=t,n.topY+=i,n.bottomY+=i;for(let n of e.destructions)n.x+=t,n.y+=i}var e_={nodeLabelFontSize:13,edgeLabelFontSize:11,groupHeaderFontSize:11,nodeLabelFontWeight:500,edgeLabelFontWeight:400,groupHeaderFontWeight:600,nodePaddingX:16,nodePaddingY:6,nodeCornerRadius:4,nodeLineWidth:1,edgeLineWidth:1,groupCornerRadius:0,groupPaddingX:10,groupPaddingY:8,groupLabelPaddingX:6,groupLineWidth:1};function eP(e,t,i,n,o){let r=function(e,t){if(void 0===e)return;let i=v(e,{display:"formatted",transform:t.groupTextTransform,fontSize:18,fontWeight:600,letterSpacing:t.groupLetterSpacing,fontFamily:t.groupFont});return{text:i.text,width:i.width,height:i.height+12,block:i}}(t,i);if(!r)return e;if(0===e.width&&0===e.height)return{...e,...function(e,t,i=t){let n=e.width+2*t;return{width:n,height:e.height-12+2*i,title:ew(e,n,i)}}(r,n,o)};let a=r.height;ez(e,0,a);let l=Math.max(e.width,r.width+2*n);return{...e,width:l,height:e.height+a,title:ew(r,l,o)}}function eE(e,t){var i;let n,a,l,s,{positioned:d,colors:c,resolved:h}=t,p=h.renderOptions,g=c.font??"Inter",f=p.transparent??!1,u=[],m=ev(p,e_,h.styleFace),b=`seq-${y(d.width,d.height,d.actors.length,d.messages.length)}`,v=`${b}-title`,w=`${b}-desc`,M=N(d.accessibilityTitle,d.accessibilityDescription,v,w);u.push(e.documentOpen({id:"prelude",width:d.width,height:d.height,colors:c,transparent:f,font:g,hasMonoFont:!1},
|
|
11
|
-
`+
|
|
12
|
-
`))),d.accessibilityTitle&&u.push(e.documentContent({id:"a11y-title",role:"chrome",nonPaint:"accessibility"},`<title id="${v}">${C(d.accessibilityTitle)}</title>`)),d.accessibilityDescription&&u.push(e.documentContent({id:"a11y-desc",role:"chrome",nonPaint:"accessibility"},`<desc id="${w}">${C(d.accessibilityDescription)}</desc>`));let W=d.blocks.some(e=>"rect"===e.type),P=W?[...d.blocks].reverse().sort((e,t)=>t.width*t.height-e.width*e.height):d.blocks,E=function(e,t,i,n){let r=(e,t,i)=>t>=e.x&&t<=e.x+e.width&&i>=e.y&&i<=e.y+e.height,a=e.flatMap(e=>{let t=e.color&&"transparent"!==e.color.toLowerCase()?es(e.color):void 0;return t?[{x:e.x,y:e.y,width:e.width,height:e.height,hex:t,authored:!0}]:[]}),l=Z("var(--bg)",n)??"#ffffff";for(let e of t){let t=eY(e,i),o=void 0===t?void 0:Z(t,n)??t,s=void 0===o?null:q(o);if(!s||0===s[3])continue;let d=e.x+e.width/2,c=e.y+e.height/2,h=B(o,a.findLast(e=>r(e,d,c))?.hex??l);h&&a.push({x:e.x,y:e.y,width:e.width,height:e.height,hex:F(...h),authored:"rect"===e.type})}return(e,t)=>{let i=a.findLastIndex(t=>r(t,e.x,e.y)),l=a[i],s=void 0!==l&&!(r(l,e.x-e.width/2,e.y-e.height/2)&&r(l,e.x+e.width/2,e.y+e.height/2))||a.some((t,n)=>n>i&&t.hex!==l?.hex&&e.x-e.width/2<t.x+t.width&&e.x+e.width/2>t.x&&e.y-e.height/2<t.y+t.height&&e.y+e.height/2>t.y);if(!l)return s?{ink:t,halo:"var(--bg)"}:{ink:t};let d=Z(t,n),c=d?H(d,l.hex):o(l.hex)??t;return l.authored||s?{ink:c,halo:l.hex}:{ink:c}}}(d.boxes,P,m,c);d.title&&u.push(e.text((i=d.title,s=m.groupTextColor??"var(--_text)",{id:"diagram-title",role:"title",text:i.text,block:i.block,x:i.x,y:i.y,fontSize:18,fontWeight:600,letterSpacing:m.groupLetterSpacing,anchor:"middle",paint:{fill:s},attributes:{className:"diagram-title"}})));let X=new Map;for(let t of d.boxes){let i=t.label??"",n=X.get(i)??0;X.set(i,n+1),u.push(function(e,t,i,n){let r=[],a=`<g class="box"${t.label?` data-label="${_(t.label)}"`:""}>`,l=t.color?.toLowerCase()==="transparent"?"none":t.color,s=l??"color-mix(in srgb, var(--fg) 5%, var(--bg))";if(r.push({indent:2,node:e.shape({id:`${n}:rect`,role:"group",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:i.groupCornerRadius,ry:i.groupCornerRadius},paint:{fill:s,stroke:"none"}})}),t.label){let a=t.block?.text??ek(t.label,i.groupTextTransform),s=function(e,t){let i=t.groupTextColor??"var(--_text-sec)";if(!e||"none"===e)return i;let n=es(e);if(!n)return i;let r=t.groupTextColor;if(r){let e=R(r,n);if(null!==e&&e>=4.5)return r}return o(n)??i}(l,i),d=t.x+t.width/2,c=t.labelY??t.y+13;r.push({indent:2,node:e.text({id:`${n}:title`,role:"label",text:a,block:t.block,x:d,y:c,fontSize:i.groupHeaderFontSize,fontWeight:i.groupHeaderFontWeight,letterSpacing:i.groupLetterSpacing,anchor:"middle",paint:{fill:s}})})}return e.group({id:n,role:"group",open:a,close:"</g>",children:r})}(e,t,m,`box:${i}#${n}`))}let O=new Map,j=new Map;for(let e of d.blocks){let t=O.get(e.type)??0;O.set(e.type,t+1),j.set(e,e.id??`block:${e.type}#${t}`)}for(let t of P)u.push(eq(e,t,m,j.get(t),W?"background":"all"));if(W){for(let t of P)"rect"!==t.type&&u.push(eq(e,t,m,j.get(t),"frame"));for(let t of d.blocks)t.dividers.length>0&&u.push(eq(e,t,m,j.get(t),"dividers"))}let A=function(e){let t=new Map,i=[];for(let n of e){let e=`${n.from}->${n.to}`,o=t.get(e)??0;if(t.set(e,o+1),!n.labelPosition.text.trim())continue;let r=n.labelPosition.bounds;i.push({key:`${e}#${o}`,x:r.x-2,y:r.y-2,width:r.width+4,height:r.height+4})}let n=e=>{let t="x"===e?"width":"height",n=[...i].sort((t,i)=>t[e]-i[e]),o=(i,r)=>{if(i>=r)return;let a=i+r>>>1,l=n[a],s=o(i,a),d=o(a+1,r);return{area:l,left:s,right:d,end:Math.max(l[e]+l[t],s?.end??-1/0,d?.end??-1/0)}},r=o(0,n.length);return i=>{let n=[],o=r=>{if(!r||r.end<i[e])return;o(r.left);let a=r.area;a[e]>i[e]+i[t]||(a.x<=i.x+i.width&&a.x+a.width>=i.x&&a.y<=i.y+i.height&&a.y+a.height>=i.y&&n.push(a),o(r.right))};return o(r),n}},o=n("x"),r=n("y");return(e,t)=>{let i=("x"===t?o:r)(e).sort((e,t)=>e.y-t.y),n=[],a=e.y+e.height,l=e.y,s;for(let t of i){let i=Math.max(e.y,t.y);i>l&&n.push({top:l,bottom:i,after:s});let o=Math.min(a,t.y+t.height);o>l&&(l=o,s=t.key)}return l<a&&n.push({top:l,bottom:a,after:s}),n}}(d.messages),D=new Set(d.actors.filter(e=>e.external).map(e=>e.id));for(let t of d.lifelines){if(D.has(t.actorId))continue;let i=Math.max(.75,.75*m.lineWidth);u.push(function(e,t,i,n){let o=i.edgeStrokeColor??"var(--_line)",r=Math.max(.75,.75*i.lineWidth),a=`lifeline:${t.actorId}`;return 1!==n.length||n[0].top!==t.topY||n[0].bottom!==t.bottomY?e.group({id:a,role:"lifeline",open:`<g class="lifeline" data-actor="${z(t.actorId)}">`,close:"</g>",children:n.map(i=>{let n=(i.top-t.topY)%10;return{indent:2,node:e.connector({id:i.after?k(a,"after",i.after):k(a,"start"),role:"lifeline",geometry:{kind:"line",x1:t.x,y1:i.top,x2:t.x,y2:i.bottom},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(r),strokeDasharray:"6 4",strokeDashoffset:String(n)}})}})}):e.connector({id:a,role:"lifeline",geometry:{kind:"line",x1:t.x,y1:t.topY,x2:t.x,y2:t.bottomY},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(r),strokeDasharray:"6 4"},attributes:{className:"lifeline",data:{actor:t.actorId}}})}(e,t,m,A({x:t.x-i/2,y:t.topY,width:i,height:t.bottomY-t.topY},"x")))}let V=new Map;for(let t of d.activations){let i=V.get(t.actorId)??0;V.set(t.actorId,i+1),u.push(function(e,t,i,n,o){let r=i.nodeFillColor??"var(--_node-fill)",a=i.nodeBorderColor??"var(--_node-stroke)";if(1!==o.length||o[0].top!==t.topY||o[0].bottom!==t.bottomY){let i=[],l=[],s=[];for(let e of o)for(let i of(l.push(`M ${t.x} ${e.top} h ${t.width} V ${e.bottom} h ${-t.width} Z`),[{x1:t.x,y1:e.top,x2:t.x,y2:e.bottom},{x1:t.x+t.width,y1:e.top,x2:t.x+t.width,y2:e.bottom},...e.top===t.topY?[{x1:t.x,y1:e.top,x2:t.x+t.width,y2:e.top}]:[],...e.bottom===t.bottomY?[{x1:t.x,y1:e.bottom,x2:t.x+t.width,y2:e.bottom}]:[]]))s.push(`M ${i.x1} ${i.y1} L ${i.x2} ${i.y2}`);if(l.length){let t=l.join(" "),o=s.join(" ");i.push({indent:2,node:e.shape({id:k(n,"fill"),role:"activation",surfaceFragment:!0,geometry:{kind:"path",d:t},paint:{fill:r,stroke:"none"}})}),i.push({indent:2,node:e.shape({id:k(n,"border"),role:"activation",geometry:{kind:"path",d:o},paint:{fill:"none",stroke:a,strokeWidth:String(.75)}})})}return e.group({id:n,role:"activation",open:`<g class="activation" data-actor="${z(t.actorId)}">`,close:"</g>",children:i})}return e.shape({id:n,role:"activation",geometry:{kind:"rect",x:t.x,y:t.topY,width:t.width,height:t.bottomY-t.topY},paint:{fill:r,stroke:a,strokeWidth:String(.75)},attributes:{className:"activation",data:{actor:t.actorId}}})}(e,t,m,`activation:${t.actorId}#${i}`,A({x:t.x-.375,y:t.topY,width:t.width+.75,height:t.bottomY-t.topY},"y")))}let J=new Map;for(let t of d.blocks){let i=J.get(t.type)??0;J.set(t.type,i+1),"rect"!==t.type&&t.header&&u.push(function(e,t,i,n){let{x:o,y:r,width:a,height:l,label:s}=t,{text:d,x:c,y:h}=s,p=i.groupHeaderFillColor??"var(--_group-hdr)",g=i.groupBorderColor??"var(--_node-stroke)",f=i.groupTextColor??"var(--_text-sec)";return e.group({id:`${n}:header-overlay`,role:"block",open:'<g class="sequence-block-header-overlay" pointer-events="none" aria-hidden="true">',close:"</g>",children:[{indent:0,node:e.shape({id:`${n}:tab`,role:"block",geometry:{kind:"rect",x:o,y:r,width:a,height:l},paint:{fill:p,stroke:g,strokeWidth:String(i.groupLineWidth)}})},{indent:0,node:e.text({id:`${n}:label`,role:"label",text:d,block:s.block,x:c,y:h,fontSize:i.groupHeaderFontSize,fontWeight:i.groupHeaderFontWeight,letterSpacing:i.groupLetterSpacing,anchor:"start",paint:{fill:f}})}]})}(e,t.header,m,j.get(t)))}let G=new Map;for(let t of d.blocks){let i=G.get(t.type)??0;G.set(t.type,i+1),t.dividers.some(e=>e.label)&&u.push(function(e,t,i,n,o){let r=i.edgeTextColor??"var(--_text-muted)",a=[];return t.dividers.forEach((t,l)=>{if(!t.label||!t.labelPosition)return;let{text:s,x:d,y:c,bounds:h}=t.labelPosition,p=o(eT(h),r),g={ink:p.ink,halo:p.halo??i.groupFillColor??"var(--bg)"};a.push({indent:2,node:e.text({id:`${n}:divider#${l}:label`,role:"label",text:s,block:t.labelPosition.block,x:d,y:c,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"start",paint:{fill:g.ink,...eF(g)}})})}),e.group({id:`${n}:divider-labels`,role:"block",open:'<g class="sequence-block-divider-labels" pointer-events="none">',close:"</g>",children:a})}(e,t,m,j.get(t),E))}let K=new Map;for(let t of d.messages){let i=`${t.from}->${t.to}`,n=K.get(i)??0;K.set(i,n+1),u.push(function(e,t,i,n,o,r){let a=[],l=eH(r,t.startHead),s=eH(r,t.endHead),d=i.edgeStrokeColor??"var(--_line)",c=i.edgeTextColor??"var(--_text-muted)",{text:h,x:p,y:g,bounds:f}=t.labelPosition,u={stroke:d,strokeWidth:String(i.lineWidth),..."dashed"===t.lineStyle?{strokeDasharray:"6 4"}:{}},m={endpoints:{from:t.from,to:t.to},relationship:{kind:"sequence-message",direction:t.isSelf?"self":l&&s?"bidirectional":l?"reverse":s?"forward":"undirected"},route:{ownership:"layout"},labels:t.label?[{text:t.label,...t.labelContent?{textContent:t.labelContent}:{}}]:[]},b=`<g class="message" data-label="${_(t.label)}" data-line-style="${t.lineStyle}" data-start-head="${t.startHead}" data-end-head="${t.endHead}" data-central-start="${t.centralStart}" data-central-end="${t.centralEnd}" data-self="${t.isSelf}"${void 0===t.parentId?"":` data-parent-id="${z(t.parentId)}"`}>`;if(t.isSelf){a.push({indent:2,node:e.connector({id:`${n}:line`,role:"message",geometry:{kind:"polyline",points:t.points},lineStyle:t.lineStyle,paint:u,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...m})});let r=o(eT(f),c);a.push({indent:2,node:e.text({id:`${n}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"start",paint:{fill:r.ink,...eF(r)}})})}else{let r=t.points[0],d=t.points[t.points.length-1];a.push({indent:2,node:e.connector({id:`${n}:line`,role:"message",geometry:{kind:"line",x1:r.x,y1:r.y,x2:d.x,y2:d.y},lineStyle:t.lineStyle,paint:u,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...m})});let b=o(eT(f),c);a.push({indent:2,node:e.text({id:`${n}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"middle",paint:{fill:b.ink,...eF(b)}})})}return t.centralStart&&a.push({indent:2,node:e.shape({id:`${n}:central-start`,role:"chrome",geometry:{kind:"circle",cx:t.x1,cy:t.y,r:4},paint:{fill:"var(--bg)",stroke:d,strokeWidth:"1.5"},attributes:{className:"sequence-central-connection",data:{side:"start"}}})}),t.centralEnd&&a.push({indent:2,node:e.shape({id:`${n}:central-end`,role:"chrome",geometry:{kind:"circle",cx:t.x2,cy:t.y,r:4},paint:{fill:"var(--bg)",stroke:d,strokeWidth:"1.5"},attributes:{className:"sequence-central-connection",data:{side:"end"}}})}),e.group({id:n,role:"message",open:b,close:"</g>",children:a})}(e,t,m,t.id??`message:${i}#${n}`,E,I))}let Q=new Map;for(let t of d.notes){let i=`${(t.actors??[]).join(",")}@${t.position??"over"}`,n=Q.get(i)??0;Q.set(i,n+1),u.push(function(e,t,i,n,o){let{x:a,y:l,width:s,height:d}=t,c=t.actors&&t.actors.length>0?` data-actors="${t.actors.map(z).join(",")}"`:"",h=t.position?` data-position="${z(t.position)}"`:"",p=i.nodeFillColor??"var(--bg)",g=i.nodeBorderColor??"var(--_node-stroke)",f=i.nodeTextColor??r("var(--_text-muted)",p,n),u=i.cornerRadius??0,m=t.block?.text??ek(t.text,i.nodeTextTransform);return e.group({id:o,role:"note",open:`<g class="note"${h}${c}${void 0===t.parentId?"":` data-parent-id="${z(t.parentId)}"`}>`,close:"</g>",children:[{indent:2,node:e.shape({id:`${o}:rect`,role:"note",geometry:{kind:"rect",x:a,y:l,width:s,height:d,rx:u,ry:u},paint:{fill:p,stroke:g,strokeWidth:String(.75)}})},{indent:2,node:e.text({id:`${o}:text`,role:"label",text:m,block:t.block,x:a+s/2,y:l+d/2,fontSize:i.nodeLabelFontSize,fontWeight:i.nodeLabelFontWeight,letterSpacing:i.nodeLetterSpacing,anchor:"middle",paint:{fill:f}})}]})}(e,t,m,c,t.id??`note:${i}#${n}`))}for(let t of d.destructions)u.push(function(e,t,i){let n=i.edgeStrokeColor??"var(--_line)",o=Math.max(1.5,i.lineWidth),r=`M ${t.x-8} ${t.y-8} L ${t.x+8} ${t.y+8} M ${t.x-8} ${t.y+8} L ${t.x+8} ${t.y-8}`;return e.shape({id:`destroy:${t.actorId}`,role:"icon",geometry:{kind:"path",d:r},paint:{fill:"none",stroke:n,strokeWidth:String(o)},channels:{category:t.actorId},attributes:{className:"destroy-cross",data:{actor:t.actorId}}})}(e,t,m));for(let t of d.actors)t.external||u.push(function(e,t,i,n,o,a,l){let{id:s,x:d,y:c,width:h,height:p,label:g,type:f}=t,u=[],m=S(o,"actor",{category:s},{includeFallback:!1}),b=m?.fontSize??i.nodeLabelFontSize,x=m?.fontWeight??i.nodeLabelFontWeight,y=m?.letterSpacing??i.nodeLetterSpacing,v=(m?.textTransform??i.nodeTextTransform,m?.lineWidth??i.nodeLineWidth),w=m?.fillColor??i.nodeFillColor??"var(--_node-fill)",M=m?.borderColor??i.nodeBorderColor??"var(--_node-stroke)",$=m?.textColor??i.nodeTextColor??"var(--_text)",I=m?.textColor??i.nodeTextColor??r("var(--_text)",w,n),L=a&&t.links?` data-links="${z(JSON.stringify(t.links))}" role="link" tabindex="0"`:"",W=`<g class="actor" data-id="${z(s)}" data-label="${_(g)}" data-type="${f}"${L}>`,{text:C,x:P,y:E,bounds:F}=t.labelPosition,T=l(eT(F),$);if("actor"===f){let n=p/24*.9,o=d-12*n,r=c+(p-24*n)/2,a=v/n;u.push({indent:2,node:e.pathArtwork({id:`actor:${s}:icon`,owner:{id:s,role:"actor"},channels:{category:s},open:`<g transform="translate(${o},${r}) scale(${n})">`,transform:{kind:"matrix",a:n,b:0,c:0,d:n,e:o,f:r},paint:{fill:"none",stroke:m?.borderColor??i.edgeStrokeColor??"var(--_line)",strokeWidth:String(a)},join:`
|
|
13
|
-
`,indent:2,paths:["M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z","M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z","M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563"]})}),u.push({indent:2,node:e.text({id:`actor:${s}:label`,role:"label",text:C,block:t.labelPosition.block,x:P,y:E,fontSize:b,fontWeight:x,letterSpacing:y,anchor:"middle",paint:{fill:
|
|
10
|
+
`)?Math.ceil(Math.max(0,u.labelPosition.y-u.labelPosition.bounds.y-d.edgeLabelFontSize*w/2-1e-6)):0,v=i.noteIndices.length>0?t.contentTopPadding:t.blockPadTop,M=p?.top??(u?u.y-(t.blockPadTop+k):h-v),S=(m?.y??h)+d.groupPaddingY+12;for(let n=e.startIndex;n<i.endMessageExclusive;n++){let e=a[n];if(!e)continue;M=Math.min(M,e.bounds.y-Math.max(t.tabHeight,d.groupPaddingY));let i=e.isSelf?d.groupPaddingY+4:d.groupPaddingY;S=Math.max(S,e.bounds.y+e.bounds.height+i)}for(let o of b){let l=n.actors[o],s=r[o];if(!(!s||l?.createMessageIndex===void 0||!a[l.createMessageIndex])&&l.createMessageIndex>=e.startIndex&&l.createMessageIndex<i.endMessageExclusive){let e=t.contentTopPadding;M=Math.min(M,s.bounds.y-e),S=Math.max(S,s.bounds.y+s.bounds.height+d.groupPaddingY)}}for(let e of i.noteIndices){let i=l[e];if(!i)continue;let n=t.contentTopPadding;M=Math.min(M,i.y-n),S=Math.max(S,i.y+i.height+d.groupPaddingY)}for(let e of i.childBlockIndices){let i=s[e];i&&(M=Math.min(M,i.y-t.enclosingHeaderStep),S=Math.max(S,i.y+i.height+d.groupPaddingY))}let $=t.dividers.map((o,r)=>{let g=eW(e,i,n,r),f=void 0===g?void 0:l[g],u=o.index<i.endMessageExclusive?a[o.index]:void 0;if("par_over"===e.type){if(!o.label)return{y:M+t.tabHeight,label:""};let e=f??u?.bounds;for(let[t,a]of i.childBlockIndices.entries()){let l=s[a];l&&i.childSectionIndices[t]===r+1&&n.blocks[a].startIndex===o.index&&(!e||l.y<e.y)&&(e=l)}let a=e?.x??x+8,l=e?e.y-o.metrics.height-8:M+t.tabHeight+8+r*(o.metrics.height+8),c=eM(o.displayLabel,a,l+o.metrics.height/2,"start",d.edgeLabelFontSize,d.edgeLabelFontWeight,d.edgeLetterSpacing,o.block);return y=Math.max(y,c.bounds.x+c.bounds.width+d.groupPaddingX),S=Math.max(S,c.bounds.y+c.bounds.height+d.groupPaddingY),{y:l,label:o.label,labelPosition:c}}let m=u?.y??h,b=28+o.extraLinesHeight+o.extraFontOffset;if(o.label&&u?.label){let e=x+8,t=e+o.metrics.width,i=u.labelPosition.bounds,n=i.x,r=i.x+i.width;if(t+8>n&&e-8<r){let e=Math.max(0,Math.ceil(m-10-(i.y+i.height/2)));b=Math.max(36+o.extraLinesHeight+o.extraFontOffset+e,Math.ceil(24+c+o.extraLinesHeight+o.extraFontOffset+e))}}let k=p?.dividerY[r],v=k??(f?f.y-o.noteContentOffset:m-b);for(let[e,t]of i.childBlockIndices.entries()){let a=s[t],l=n.blocks[t];if(void 0===k&&a&&l?.startIndex===o.index&&i.childSectionIndices[e]===r+1){let e=o.noteContentOffset;v=Math.min(v,a.y-e)}}if(!o.label)return{y:v,label:o.label};let w=v+o.firstLineOffset+(o.metrics.lines.length-1)/2*o.metrics.lineHeight,$=eM(o.displayLabel,x+8,w,"start",d.edgeLabelFontSize,d.edgeLabelFontWeight,d.edgeLetterSpacing,o.block);return S=Math.max(S,$.bounds.y+$.bounds.height+d.groupPaddingY),{y:v,label:o.label,labelPosition:{...$,text:o.displayLabel}}}),I="rect"===e.type?void 0:(g=M+t.tabHeight/2,f=eM(t.headerText,x+d.groupLabelPaddingX,g,"start",d.groupHeaderFontSize,d.groupHeaderFontWeight,d.groupLetterSpacing,t.block),{x,y:M,width:t.tabWidth,height:t.tabHeight,label:{...f,text:t.headerText}}),L={x,y:M,width:y-x,height:S-M};return{type:e.type,label:e.label,...e.color?{color:e.color}:{},x:L.x,y:L.y,width:L.width,height:L.height,dividers:$,...I?{header:I}:{},bounds:L}}function ez(e,t,i){for(let n of e.actors)n.x+=t,n.y+=i,n.bounds=e$(n.bounds,t,i),n.labelPosition=eI(n.labelPosition,t,i);for(let n of e.messages)!function(e,t,i){e.x1+=t,e.x2+=t,e.y+=i,e.points=e.points.map(e=>({x:e.x+t,y:e.y+i})),e.labelPosition=eI(e.labelPosition,t,i),e.bounds=e$(e.bounds,t,i)}(n,t,i);for(let n of e.blocks)for(let e of(n.x+=t,n.y+=i,n.bounds=e$(n.bounds,t,i),n.header&&(n.header={...n.header,x:n.header.x+t,y:n.header.y+i,label:eI(n.header.label,t,i)}),n.dividers))e.y+=i,e.labelPosition&&(e.labelPosition=eI(e.labelPosition,t,i));for(let n of e.notes)n.x+=t,n.y+=i;for(let n of e.boxes)n.x+=t,n.y+=i,void 0!==n.labelY&&(n.labelY+=i);for(let n of e.activations)n.x+=t,n.topY+=i,n.bottomY+=i;for(let n of e.lifelines)n.x+=t,n.topY+=i,n.bottomY+=i;for(let n of e.destructions)n.x+=t,n.y+=i}var e_={nodeLabelFontSize:13,edgeLabelFontSize:11,groupHeaderFontSize:11,nodeLabelFontWeight:500,edgeLabelFontWeight:400,groupHeaderFontWeight:600,nodePaddingX:16,nodePaddingY:6,nodeCornerRadius:4,nodeLineWidth:1,edgeLineWidth:1,groupCornerRadius:0,groupPaddingX:10,groupPaddingY:8,groupLabelPaddingX:6,groupLineWidth:1};function eP(e,t,i,n,o){let r=function(e,t){if(void 0===e)return;let i=v(e,{display:"formatted",transform:t.groupTextTransform,fontSize:18,fontWeight:600,letterSpacing:t.groupLetterSpacing,fontFamily:t.groupFont});return{text:i.text,width:i.width,height:i.height+12,block:i}}(t,i);if(!r)return e;if(0===e.width&&0===e.height)return{...e,...function(e,t,i=t){let n=e.width+2*t;return{width:n,height:e.height-12+2*i,title:ew(e,n,i)}}(r,n,o)};let a=r.height;ez(e,0,a);let l=Math.max(e.width,r.width+2*n);return{...e,width:l,height:e.height+a,title:ew(r,l,o)}}function eE(e,t){var i;let n,a,l,s,{positioned:d,colors:c,resolved:h}=t,p=h.renderOptions,g=c.font??"Inter",f=p.transparent??!1,u=[],m=ev(p,e_,h.styleFace),b=`seq-${y(d.width,d.height,d.actors.length,d.messages.length)}`,v=`${b}-title`,w=`${b}-desc`,M=N(d.accessibilityTitle,d.accessibilityDescription,v,w);u.push(e.documentOpen({id:"prelude",width:d.width,height:d.height,colors:c,transparent:f,font:g,hasMonoFont:!1},R(d.width,d.height,c,f,M)+`
|
|
11
|
+
`+B(g,!1,c.shadow,c.embedFontImport)));let $=[];$.push("<defs>");let I=(n=m.edgeStrokeColor??"var(--_arrow)",l=[{x:0,y:0},{x:8,y:2.5},{x:0,y:5}],[{...a={size:{width:8,height:5},orient:"auto-start-reverse"},id:"seq-arrow",shape:"arrow",ref:{x:8,y:2.5},geometry:{kind:"polygon",points:l},paint:{fill:n}},{...a,id:"seq-arrow-open",shape:"open-arrow",ref:{x:8,y:2.5},geometry:{kind:"polyline",points:l},paint:{fill:"none",stroke:n,strokeWidth:"1"}},{...a,id:"seq-arrow-cross",shape:"cross",ref:{x:4,y:2.5},orient:"auto",geometry:{kind:"path",d:"M1 1 L7 4 M1 4 L7 1"},paint:{fill:"none",stroke:n,strokeWidth:"1.5"}},{...a,id:"seq-arrow-half-top",shape:"arrow",ref:{x:8,y:2.5},geometry:{kind:"polygon",points:[{x:0,y:0},{x:8,y:2.5},{x:0,y:2.5}]},paint:{fill:n}},{...a,id:"seq-arrow-half-bottom",shape:"arrow",ref:{x:8,y:2.5},geometry:{kind:"polygon",points:[{x:0,y:2.5},{x:8,y:2.5},{x:0,y:5}]},paint:{fill:n}},{...a,id:"seq-arrow-stick-top",shape:"open-arrow",ref:{x:8,y:2.5},geometry:{kind:"path",d:"M0 0 L8 2.5"},paint:{fill:"none",stroke:n,strokeWidth:"1.5"}},{...a,id:"seq-arrow-stick-bottom",shape:"open-arrow",ref:{x:8,y:2.5},geometry:{kind:"path",d:"M0 5 L8 2.5"},paint:{fill:"none",stroke:n,strokeWidth:"1.5"}}]);$.push(x(I));let L=Y(c);L&&$.push(L),$.push("</defs>"),u.push(e.definitions({id:"defs",markerResources:I},$.join(`
|
|
12
|
+
`))),d.accessibilityTitle&&u.push(e.documentContent({id:"a11y-title",role:"chrome",nonPaint:"accessibility"},`<title id="${v}">${C(d.accessibilityTitle)}</title>`)),d.accessibilityDescription&&u.push(e.documentContent({id:"a11y-desc",role:"chrome",nonPaint:"accessibility"},`<desc id="${w}">${C(d.accessibilityDescription)}</desc>`));let W=d.blocks.some(e=>"rect"===e.type),P=W?[...d.blocks].reverse().sort((e,t)=>t.width*t.height-e.width*e.height):d.blocks,E=function(e,t,i,n){let r=(e,t,i)=>t>=e.x&&t<=e.x+e.width&&i>=e.y&&i<=e.y+e.height,a=e.flatMap(e=>{let t=e.color&&"transparent"!==e.color.toLowerCase()?es(e.color):void 0;return t?[{x:e.x,y:e.y,width:e.width,height:e.height,hex:t,authored:!0}]:[]}),l=Z("var(--bg)",n)??"#ffffff";for(let e of t){let t=eY(e,i),o=void 0===t?void 0:Z(t,n)??t,s=void 0===o?null:T(o);if(!s||0===s[3])continue;let d=e.x+e.width/2,c=e.y+e.height/2,h=q(o,a.findLast(e=>r(e,d,c))?.hex??l);h&&a.push({x:e.x,y:e.y,width:e.width,height:e.height,hex:F(...h),authored:"rect"===e.type})}return(e,t)=>{let i=a.findLastIndex(t=>r(t,e.x,e.y)),l=a[i],s=void 0!==l&&!(r(l,e.x-e.width/2,e.y-e.height/2)&&r(l,e.x+e.width/2,e.y+e.height/2))||a.some((t,n)=>n>i&&t.hex!==l?.hex&&e.x-e.width/2<t.x+t.width&&e.x+e.width/2>t.x&&e.y-e.height/2<t.y+t.height&&e.y+e.height/2>t.y);if(!l)return s?{ink:t,halo:"var(--bg)"}:{ink:t};let d=Z(t,n),c=d?H(d,l.hex):o(l.hex)??t;return l.authored||s?{ink:c,halo:l.hex}:{ink:c}}}(d.boxes,P,m,c);d.title&&u.push(e.text((i=d.title,s=m.groupTextColor??"var(--_text)",{id:"diagram-title",role:"title",text:i.text,block:i.block,x:i.x,y:i.y,fontSize:18,fontWeight:600,letterSpacing:m.groupLetterSpacing,anchor:"middle",paint:{fill:s},attributes:{className:"diagram-title"}})));let O=new Map;for(let t of d.boxes){let i=t.label??"",n=O.get(i)??0;O.set(i,n+1),u.push(function(e,t,i,n){let r=[],a=`<g class="box"${t.label?` data-label="${_(t.label)}"`:""}>`,l=t.color?.toLowerCase()==="transparent"?"none":t.color,s=l??"color-mix(in srgb, var(--fg) 5%, var(--bg))";if(r.push({indent:2,node:e.shape({id:`${n}:rect`,role:"group",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:i.groupCornerRadius,ry:i.groupCornerRadius},paint:{fill:s,stroke:"none"}})}),t.label){let a=t.block?.text??ek(t.label,i.groupTextTransform),s=function(e,t){let i=t.groupTextColor??"var(--_text-sec)";if(!e||"none"===e)return i;let n=es(e);if(!n)return i;let r=t.groupTextColor;if(r){let e=U(r,n);if(null!==e&&e>=4.5)return r}return o(n)??i}(l,i),d=t.x+t.width/2,c=t.labelY??t.y+13;r.push({indent:2,node:e.text({id:`${n}:title`,role:"label",text:a,block:t.block,x:d,y:c,fontSize:i.groupHeaderFontSize,fontWeight:i.groupHeaderFontWeight,letterSpacing:i.groupLetterSpacing,anchor:"middle",paint:{fill:s}})})}return e.group({id:n,role:"group",open:a,close:"</g>",children:r})}(e,t,m,`box:${i}#${n}`))}let X=new Map,A=new Map;for(let e of d.blocks){let t=X.get(e.type)??0;X.set(e.type,t+1),A.set(e,e.id??`block:${e.type}#${t}`)}for(let t of P)u.push(eq(e,t,m,A.get(t),W?"background":"all"));if(W){for(let t of P)"rect"!==t.type&&u.push(eq(e,t,m,A.get(t),"frame"));for(let t of d.blocks)t.dividers.length>0&&u.push(eq(e,t,m,A.get(t),"dividers"))}let j=function(e){let t=new Map,i=[];for(let n of e){let e=`${n.from}->${n.to}`,o=t.get(e)??0;if(t.set(e,o+1),!n.labelPosition.text.trim())continue;let r=n.labelPosition.bounds;i.push({key:`${e}#${o}`,x:r.x-2,y:r.y-2,width:r.width+4,height:r.height+4})}let n=e=>{let t="x"===e?"width":"height",n=[...i].sort((t,i)=>t[e]-i[e]),o=(i,r)=>{if(i>=r)return;let a=i+r>>>1,l=n[a],s=o(i,a),d=o(a+1,r);return{area:l,left:s,right:d,end:Math.max(l[e]+l[t],s?.end??-1/0,d?.end??-1/0)}},r=o(0,n.length);return i=>{let n=[],o=r=>{if(!r||r.end<i[e])return;o(r.left);let a=r.area;a[e]>i[e]+i[t]||(a.x<=i.x+i.width&&a.x+a.width>=i.x&&a.y<=i.y+i.height&&a.y+a.height>=i.y&&n.push(a),o(r.right))};return o(r),n}},o=n("x"),r=n("y");return(e,t)=>{let i=("x"===t?o:r)(e).sort((e,t)=>e.y-t.y),n=[],a=e.y+e.height,l=e.y,s;for(let t of i){let i=Math.max(e.y,t.y);i>l&&n.push({top:l,bottom:i,after:s});let o=Math.min(a,t.y+t.height);o>l&&(l=o,s=t.key)}return l<a&&n.push({top:l,bottom:a,after:s}),n}}(d.messages),D=new Set(d.actors.filter(e=>e.external).map(e=>e.id));for(let t of d.lifelines){if(D.has(t.actorId))continue;let i=Math.max(.75,.75*m.lineWidth);u.push(function(e,t,i,n){let o=i.edgeStrokeColor??"var(--_line)",r=Math.max(.75,.75*i.lineWidth),a=`lifeline:${t.actorId}`;return 1!==n.length||n[0].top!==t.topY||n[0].bottom!==t.bottomY?e.group({id:a,role:"lifeline",open:`<g class="lifeline" data-actor="${z(t.actorId)}">`,close:"</g>",children:n.map(i=>{let n=(i.top-t.topY)%10;return{indent:2,node:e.connector({id:i.after?k(a,"after",i.after):k(a,"start"),role:"lifeline",geometry:{kind:"line",x1:t.x,y1:i.top,x2:t.x,y2:i.bottom},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(r),strokeDasharray:"6 4",strokeDashoffset:String(n)}})}})}):e.connector({id:a,role:"lifeline",geometry:{kind:"line",x1:t.x,y1:t.topY,x2:t.x,y2:t.bottomY},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(r),strokeDasharray:"6 4"},attributes:{className:"lifeline",data:{actor:t.actorId}}})}(e,t,m,j({x:t.x-i/2,y:t.topY,width:i,height:t.bottomY-t.topY},"x")))}let G=new Map;for(let t of d.activations){let i=G.get(t.actorId)??0;G.set(t.actorId,i+1),u.push(function(e,t,i,n,o){let r=i.nodeFillColor??"var(--_node-fill)",a=i.nodeBorderColor??"var(--_node-stroke)";if(1!==o.length||o[0].top!==t.topY||o[0].bottom!==t.bottomY){let i=[],l=[],s=[];for(let e of o)for(let i of(l.push(`M ${t.x} ${e.top} h ${t.width} V ${e.bottom} h ${-t.width} Z`),[{x1:t.x,y1:e.top,x2:t.x,y2:e.bottom},{x1:t.x+t.width,y1:e.top,x2:t.x+t.width,y2:e.bottom},...e.top===t.topY?[{x1:t.x,y1:e.top,x2:t.x+t.width,y2:e.top}]:[],...e.bottom===t.bottomY?[{x1:t.x,y1:e.bottom,x2:t.x+t.width,y2:e.bottom}]:[]]))s.push(`M ${i.x1} ${i.y1} L ${i.x2} ${i.y2}`);if(l.length){let t=l.join(" "),o=s.join(" ");i.push({indent:2,node:e.shape({id:k(n,"fill"),role:"activation",surfaceFragment:!0,geometry:{kind:"path",d:t},paint:{fill:r,stroke:"none"}})}),i.push({indent:2,node:e.shape({id:k(n,"border"),role:"activation",geometry:{kind:"path",d:o},paint:{fill:"none",stroke:a,strokeWidth:String(.75)}})})}return e.group({id:n,role:"activation",open:`<g class="activation" data-actor="${z(t.actorId)}">`,close:"</g>",children:i})}return e.shape({id:n,role:"activation",geometry:{kind:"rect",x:t.x,y:t.topY,width:t.width,height:t.bottomY-t.topY},paint:{fill:r,stroke:a,strokeWidth:String(.75)},attributes:{className:"activation",data:{actor:t.actorId}}})}(e,t,m,`activation:${t.actorId}#${i}`,j({x:t.x-.375,y:t.topY,width:t.width+.75,height:t.bottomY-t.topY},"y")))}let V=new Map;for(let t of d.blocks){let i=V.get(t.type)??0;V.set(t.type,i+1),"rect"!==t.type&&t.header&&u.push(function(e,t,i,n){let{x:o,y:r,width:a,height:l,label:s}=t,{text:d,x:c,y:h}=s,p=i.groupHeaderFillColor??"var(--_group-hdr)",g=i.groupBorderColor??"var(--_node-stroke)",f=i.groupTextColor??"var(--_text-sec)";return e.group({id:`${n}:header-overlay`,role:"block",open:'<g class="sequence-block-header-overlay" pointer-events="none" aria-hidden="true">',close:"</g>",children:[{indent:0,node:e.shape({id:`${n}:tab`,role:"block",geometry:{kind:"rect",x:o,y:r,width:a,height:l},paint:{fill:p,stroke:g,strokeWidth:String(i.groupLineWidth)}})},{indent:0,node:e.text({id:`${n}:label`,role:"label",text:d,block:s.block,x:c,y:h,fontSize:i.groupHeaderFontSize,fontWeight:i.groupHeaderFontWeight,letterSpacing:i.groupLetterSpacing,anchor:"start",paint:{fill:f}})}]})}(e,t.header,m,A.get(t)))}let J=new Map;for(let t of d.blocks){let i=J.get(t.type)??0;J.set(t.type,i+1),t.dividers.some(e=>e.label)&&u.push(function(e,t,i,n,o){let r=i.edgeTextColor??"var(--_text-muted)",a=[];return t.dividers.forEach((t,l)=>{if(!t.label||!t.labelPosition)return;let{text:s,x:d,y:c,bounds:h}=t.labelPosition,p=o(eH(h),r),g={ink:p.ink,halo:p.halo??i.groupFillColor??"var(--bg)"};a.push({indent:2,node:e.text({id:`${n}:divider#${l}:label`,role:"label",text:s,block:t.labelPosition.block,x:d,y:c,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"start",paint:{fill:g.ink,...eF(g)}})})}),e.group({id:`${n}:divider-labels`,role:"block",open:'<g class="sequence-block-divider-labels" pointer-events="none">',close:"</g>",children:a})}(e,t,m,A.get(t),E))}let K=new Map;for(let t of d.messages){let i=`${t.from}->${t.to}`,n=K.get(i)??0;K.set(i,n+1),u.push(function(e,t,i,n,o,r){let a=[],l=eT(r,t.startHead),s=eT(r,t.endHead),d=i.edgeStrokeColor??"var(--_line)",c=i.edgeTextColor??"var(--_text-muted)",{text:h,x:p,y:g,bounds:f}=t.labelPosition,u={stroke:d,strokeWidth:String(i.lineWidth),..."dashed"===t.lineStyle?{strokeDasharray:"6 4"}:{}},m={endpoints:{from:t.from,to:t.to},relationship:{kind:"sequence-message",direction:t.isSelf?"self":l&&s?"bidirectional":l?"reverse":s?"forward":"undirected"},route:{ownership:"layout"},labels:t.label?[{text:t.label,...t.labelContent?{textContent:t.labelContent}:{}}]:[]},b=`<g class="message" data-label="${_(t.label)}" data-line-style="${t.lineStyle}" data-start-head="${t.startHead}" data-end-head="${t.endHead}" data-central-start="${t.centralStart}" data-central-end="${t.centralEnd}" data-self="${t.isSelf}"${void 0===t.parentId?"":` data-parent-id="${z(t.parentId)}"`}>`;if(t.isSelf){a.push({indent:2,node:e.connector({id:`${n}:line`,role:"message",geometry:{kind:"polyline",points:t.points},lineStyle:t.lineStyle,paint:u,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...m})});let r=o(eH(f),c);a.push({indent:2,node:e.text({id:`${n}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"start",paint:{fill:r.ink,...eF(r)}})})}else{let r=t.points[0],d=t.points[t.points.length-1];a.push({indent:2,node:e.connector({id:`${n}:line`,role:"message",geometry:{kind:"line",x1:r.x,y1:r.y,x2:d.x,y2:d.y},lineStyle:t.lineStyle,paint:u,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...m})});let b=o(eH(f),c);a.push({indent:2,node:e.text({id:`${n}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:i.edgeLabelFontSize,fontWeight:i.edgeLabelFontWeight,letterSpacing:i.edgeLetterSpacing,anchor:"middle",paint:{fill:b.ink,...eF(b)}})})}return t.centralStart&&a.push({indent:2,node:e.shape({id:`${n}:central-start`,role:"chrome",geometry:{kind:"circle",cx:t.x1,cy:t.y,r:4},paint:{fill:"var(--bg)",stroke:d,strokeWidth:"1.5"},attributes:{className:"sequence-central-connection",data:{side:"start"}}})}),t.centralEnd&&a.push({indent:2,node:e.shape({id:`${n}:central-end`,role:"chrome",geometry:{kind:"circle",cx:t.x2,cy:t.y,r:4},paint:{fill:"var(--bg)",stroke:d,strokeWidth:"1.5"},attributes:{className:"sequence-central-connection",data:{side:"end"}}})}),e.group({id:n,role:"message",open:b,close:"</g>",children:a})}(e,t,m,t.id??`message:${i}#${n}`,E,I))}let Q=new Map;for(let t of d.notes){let i=`${(t.actors??[]).join(",")}@${t.position??"over"}`,n=Q.get(i)??0;Q.set(i,n+1),u.push(function(e,t,i,n,o){let{x:a,y:l,width:s,height:d}=t,c=t.actors&&t.actors.length>0?` data-actors="${t.actors.map(z).join(",")}"`:"",h=t.position?` data-position="${z(t.position)}"`:"",p=i.nodeFillColor??"var(--bg)",g=i.nodeBorderColor??"var(--_node-stroke)",f=i.nodeTextColor??r("var(--_text-muted)",p,n),u=i.cornerRadius??0,m=t.block?.text??ek(t.text,i.nodeTextTransform);return e.group({id:o,role:"note",open:`<g class="note"${h}${c}${void 0===t.parentId?"":` data-parent-id="${z(t.parentId)}"`}>`,close:"</g>",children:[{indent:2,node:e.shape({id:`${o}:rect`,role:"note",geometry:{kind:"rect",x:a,y:l,width:s,height:d,rx:u,ry:u},paint:{fill:p,stroke:g,strokeWidth:String(.75)}})},{indent:2,node:e.text({id:`${o}:text`,role:"label",text:m,block:t.block,x:a+s/2,y:l+d/2,fontSize:i.nodeLabelFontSize,fontWeight:i.nodeLabelFontWeight,letterSpacing:i.nodeLetterSpacing,anchor:"middle",paint:{fill:f}})}]})}(e,t,m,c,t.id??`note:${i}#${n}`))}for(let t of d.destructions)u.push(function(e,t,i){let n=i.edgeStrokeColor??"var(--_line)",o=Math.max(1.5,i.lineWidth),r=`M ${t.x-8} ${t.y-8} L ${t.x+8} ${t.y+8} M ${t.x-8} ${t.y+8} L ${t.x+8} ${t.y-8}`;return e.shape({id:`destroy:${t.actorId}`,role:"icon",geometry:{kind:"path",d:r},paint:{fill:"none",stroke:n,strokeWidth:String(o)},channels:{category:t.actorId},attributes:{className:"destroy-cross",data:{actor:t.actorId}}})}(e,t,m));for(let t of d.actors)t.external||u.push(function(e,t,i,n,o,a,l){let{id:s,x:d,y:c,width:h,height:p,label:g,type:f}=t,u=[],m=S(o,"actor",{category:s},{includeFallback:!1}),b=m?.fontSize??i.nodeLabelFontSize,x=m?.fontWeight??i.nodeLabelFontWeight,y=m?.letterSpacing??i.nodeLetterSpacing,v=(m?.textTransform??i.nodeTextTransform,m?.lineWidth??i.nodeLineWidth),w=m?.fillColor??i.nodeFillColor??"var(--_node-fill)",M=m?.borderColor??i.nodeBorderColor??"var(--_node-stroke)",$=m?.textColor??i.nodeTextColor??"var(--_text)",I=m?.textColor??i.nodeTextColor??r("var(--_text)",w,n),L=a&&t.links?` data-links="${z(JSON.stringify(t.links))}" role="link" tabindex="0"`:"",W=`<g class="actor" data-id="${z(s)}" data-label="${_(g)}" data-type="${f}"${L}>`,{text:C,x:P,y:E,bounds:F}=t.labelPosition,H=l(eH(F),$);if("actor"===f){let n=p/24*.9,o=d-12*n,r=c+(p-24*n)/2,a=v/n;u.push({indent:2,node:e.pathArtwork({id:`actor:${s}:icon`,owner:{id:s,role:"actor"},channels:{category:s},open:`<g transform="translate(${o},${r}) scale(${n})">`,transform:{kind:"matrix",a:n,b:0,c:0,d:n,e:o,f:r},paint:{fill:"none",stroke:m?.borderColor??i.edgeStrokeColor??"var(--_line)",strokeWidth:String(a)},join:`
|
|
13
|
+
`,indent:2,paths:["M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3C16.9706 3 21 7.02944 21 12Z","M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z","M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563"]})}),u.push({indent:2,node:e.text({id:`actor:${s}:label`,role:"label",text:C,block:t.labelPosition.block,x:P,y:E,fontSize:b,fontWeight:x,letterSpacing:y,anchor:"middle",paint:{fill:H.ink,...eF(H)},channels:{category:s}})})}else if("participant"!==f){let n=d-h/2,o=c+2,r=Math.max(24,p-4),a=[],l={id:s,role:"actor"},g={fill:w,stroke:m?.borderColor??i.edgeStrokeColor??"var(--_line)",strokeWidth:String(v)},M=t=>{a.push(e.shape({id:k(`actor:${s}:icon`,"part",a.length),role:"icon",owner:l,geometry:t,paint:g}))},S=e=>M({kind:"path",d:e}),$=(e,t,i)=>M({kind:"circle",cx:e,cy:t,r:i}),I=(e,t,i,n)=>M({kind:"line",x1:e,y1:t,x2:i,y2:n}),L=(e,t,i,n,o)=>M({kind:"rect",x:e,y:t,width:i,height:n,...void 0===o?{}:{rx:o}});"database"===f?(M({kind:"ellipse",cx:d,cy:o+5,rx:h/2,ry:5}),S(`M${n} ${o+5}V${o+r-5}A${h/2} 5 0 0 0 ${n+h} ${o+r-5}V${o+5}`),M({kind:"ellipse",cx:d,cy:o+r-5,rx:h/2,ry:5})):"collections"===f?(L(n+6,o,h-6,r-6),L(n,o+6,h-6,r-6)):"queue"===f?(L(n,o,h,r,r/2),I(n+8,o+r/2,n+h-8,o+r/2)):"entity"===f?($(d,o+r/2-3,Math.min(h,r)/2-3),I(n+5,o+r,n+h-5,o+r)):"boundary"===f?($(d+3,o+r/2,Math.min(h,r)/2-3),I(n+3,o+2,n+3,o+r-2)):"control"===f?($(d,o+r/2,Math.min(h,r)/2-3),S(`M${d-4} ${o+4}L${d+4} ${o}L${d+2} ${o+8}`)):$(d,o+r/2,Math.min(h,r)/2-3),u.push({indent:2,node:e.group({id:`actor:${s}:icon`,role:"icon",owner:l,channels:{category:s},open:`<g class="sequence-actor-glyph sequence-actor-${f}">`,close:"</g>",join:"",children:a.map(e=>({node:e,indent:0}))})}),u.push({indent:2,node:e.text({id:`actor:${s}:label`,role:"label",text:C,block:t.labelPosition.block,x:P,y:E,fontSize:b,fontWeight:x,letterSpacing:y,anchor:"middle",paint:{fill:H.ink,...eF(H)},channels:{category:s}})})}else{let n=d-h/2,o=m?.cornerRadius??i.cornerRadius??4;u.push({indent:2,node:e.shape({id:`actor:${s}:box`,role:"actor",geometry:{kind:"rect",x:n,y:c,width:h,height:p,rx:o,ry:o},paint:{fill:w,stroke:M,strokeWidth:String(v)},channels:{category:s}})}),u.push({indent:2,node:e.text({id:`actor:${s}:label`,role:"label",text:C,block:t.labelPosition.block,x:P,y:E,fontSize:b,fontWeight:x,letterSpacing:y,anchor:"middle",paint:{fill:I},channels:{category:s}})})}let T="participant"===f?I:$;return t.links&&u.push({indent:2,node:e.text({id:`actor:${s}:menu`,role:"icon",text:"⋯",block:t.menuBlock,x:d+h/2-7,y:c+10,fontSize:10,anchor:"middle",paint:{fill:T},channels:{category:s},baselineShift:0,attributes:{className:"sequence-actor-menu"}})}),e.group({id:`actor:${s}`,role:"actor",open:W,close:"</g>",children:u,channels:{category:s}})}(e,t,m,c,h.styleFace,"strict"!==p.security,E));return u.push(e.documentClose()),{family:"sequence",width:d.width,height:d.height,colors:c,transparent:f,parts:u}}function eF(e){return e.halo?{stroke:e.halo,strokeWidth:"3",strokeLinejoin:"round",paintOrder:"stroke"}:{}}function eH(e){return{x:e.x+e.width/2,y:e.y+e.height/2,width:e.width,height:e.height}}function eT(e,t){if("none"===t)return;let i="filled"===t?"seq-arrow":"cross"===t?"seq-arrow-cross":"half-top"===t?"seq-arrow-half-top":"half-bottom"===t?"seq-arrow-half-bottom":"stick-top"===t?"seq-arrow-stick-top":"stick-bottom"===t?"seq-arrow-stick-bottom":"seq-arrow-open";return e.find(e=>e.id===i)}function eY(e,t){return"rect"===e.type?e.color??t.groupFillColor??"rgba(128, 128, 128, 0.5)":t.groupFillColor}function eq(e,t,i,n,o="all"){let r=[],a=t.label?` data-label="${_(t.label)}"`:"",l="dividers"===o?`<g class="sequence-block-divider-overlay" data-owner="${z(n)}">`:"frame"===o?`<g class="sequence-block-frame-overlay" data-owner="${z(n)}">`:`<g class="block" data-type="${z(t.type)}"${a}${void 0===t.parentId?"":` data-parent-id="${z(t.parentId)}"`}>`,s=eY(t,i)??"none",d="rect"===t.type?"none":i.groupBorderColor??"var(--_node-stroke)";"dividers"!==o&&r.push({indent:2,node:e.shape({id:"frame"===o?`${n}:frame`:`${n}:rect`,role:"block",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:i.groupCornerRadius,ry:i.groupCornerRadius},paint:{fill:"frame"===o?"none":s,stroke:"background"===o?"none":d,strokeWidth:String(i.groupLineWidth)}})});let c=i.edgeStrokeColor??"var(--_line)",h=0;for(let a of"background"===o||"frame"===o||"par_over"===t.type?[]:t.dividers){let o=`${n}:divider#${h}`;h++;let l=Math.max(.75,.75*i.lineWidth);r.push({indent:2,node:e.connector({id:o,role:"block",geometry:{kind:"line",x1:t.x,y1:a.y,x2:t.x+t.width,y2:a.y},lineStyle:"dashed",paint:{stroke:c,strokeWidth:String(l),strokeDasharray:"6 4"}})})}return e.group({id:"dividers"===o?`${n}:divider-overlay`:"frame"===o?`${n}:frame-overlay`:n,role:"block",open:l,close:"</g>",children:r})}function eB(e){if(!Number.isFinite(e))throw RangeError(`expected a finite number, got ${String(e)}`);return e}function eU(e,t){for(let i of e)if(t(i,e),("call"===i.kind||"create"===i.kind)&&eU(i.children,t),"fragment"===i.kind)for(let e of i.branches)eU(e.statements,t)}i(eE),b.error.code,b.error.severity,b.warn.code,b.warn.severity,b.error.code,b.error.tier,b.warn.code,b.warn.tier;var eR={actor:"actor",boundary:"boundary",control:"control",entity:"entity",database:"database",collections:"collections",queue:"queue",participant:"participant"},eZ=e=>({value:e,prepared:L(e,"literal")});function eN(e){return void 0===e.type?e.name:`${e.name}:${e.type}`}function eO(e){return e.assignment?`${e.assignment.name}:${e.constructor}`:e.constructor}var eX=i((e,t)=>({...eE(e,t),family:"zenuml"})),eA=e=>({x:eB(e.x),y:eB(e.y),w:eB(e.width),h:eB(e.height)});function ej(e){return eB(Math.round(e))}var eD={statementEnds:ea,layout:e=>{let t=function(e,t){let i=Array.isArray(e)?e.join(`
|
|
14
14
|
`):e,n=i.replace(/\r\n?/g,`
|
|
15
15
|
`),o=c(i),r=0,l,d=s(n);if(d){let e=f(d.yaml);if(!e.ok)throw Error(e.message);e.value&&"object"==typeof e.value&&"title"in e.value&&"string"==typeof e.value.title&&(l=e.value.title),n=n.slice(d.source.length),r=d.source.split(`
|
|
16
16
|
`).length-1}let u=p(n.split(`
|
|
17
17
|
`),ea(n.split(`
|
|
18
18
|
`))),m=(n=u.familyLines.join(`
|
|
19
|
-
`)).match(/^(?:(?:[^\S\n]*(?:%%[^\n]*)?\n))*[^\S\n]*zenuml\b/);if(!m)throw Error("Expected zenuml header");let b=er(n.slice(m[0].length)),x=c(n),y=e=>{let t=h(x,e+m[0].length);return(o[(u.familyOrigins[t.line-1]??t.line-1)+r]??i.length)+t.col-1},k=(e,t,i)=>{},v={kind:"zenuml",participants:[],statements:[],...g(u.accessibility),...void 0===l?{}:{title:l}},w=0,M=0,S=0,$=!0,I=()=>`statement:${++M}`,L=e=>({offset:y(e.start),endOffset:y(e.end),unit:"physical"}),W=()=>{let e=b[w++];if(e&&A("zenuml")){var t,n,o;let r=L(e);t="zenuml",n=e.kind,o=i.slice(r.offset,r.endOffset),A(t)&&D(t,{family:t,unit:"statement",kind:n,text:o,...r?{source:{...r}}:{}})}return e},C=(e,t,i)=>{e.push(t),A("zenuml")&&V("zenuml","append-statement",t,L(i))},z=e=>{if(++S>128)throw Error("ZenUML nesting exceeds 128 scopes");let t=[];for(;w<b.length;){let n=W();if("close"===n.kind){if(!e)throw Error("Unmatched ZenUML closing brace");return S--,t}if("open"===n.kind)throw Error("ZenUML scope has no owner");if("comment"===n.kind){let e={kind:"comment",id:I(),text:n.text};C(t,e,n),k("labels",e.id,n);continue}let o=n.text;if(!e&&("title"===o||o.startsWith("title "))){v.title=o.slice(5).trim(),A("zenuml")&&V("zenuml","set-title",v.title,L(n)),k("labels","title",n);continue}let r=o.match(RegExp(`^@Starter\\(\\s*(${J})\\s*\\)$`,"u"));if(!e&&r&&$){v.starter=ei(r[1]),A("zenuml")&&V("zenuml","set-starter",v.starter,L(n));continue}if(!e&&$){let e=function(e){let t=[],i=e,n;for(;/^@[\w]+\s+/.test(i);){let e=i.match(/^@([\w]+)\s+/);t.push(e[1]),i=i.slice(e[0].length)}if(i.startsWith("<<")){let e=i.indexOf(">>");if(e<0)return;n=ei(i.slice(2,e).trim()),i=i.slice(e+2).trim()}let o=i.match(ee);if(!o||!i.startsWith('"')&&eo.has(o[1]))return;let r=ei(o[1]);return{id:r,label:o[2]?ei(o[2]):r,annotations:t,...n?{stereotype:n}:{}}}(o);if(e){if(v.participants.some(t=>t.id===e.id))throw Error(`Duplicate ZenUML participant: ${e.id}`);let o=[];for(;t.at(-1)?.kind==="comment";){let i=t.pop();o.unshift(i.text),A("zenuml")&&V("zenuml","claim-participant-comment",{participant:e.id,comment:i})}o.length&&(e.comments=o),e.annotations.length>1&&(v.unsupportedSource=i),k("nodes",e.id,n),v.participants.push(e),A("zenuml")&&V("zenuml","append-participant",e,L(n));continue}}$=!1;let a=I();k("edges",a,n);let l=!1;if(/^@(return|reply)(?:\s|$)/.test(o)&&(l=!0,!(o=o.replace(/^@(return|reply)\s*/,"")))){let e=W();if(!e||"text"!==e.kind)throw Error("ZenUML reply annotation requires a message");o=e.text}let s=o.match(Q);if(s){k("nodes",ei(s[1]),n),k("nodes",ei(s[3]),n),C(t,{kind:"message",id:a,from:ei(s[1]),to:ei(s[3]),label:s[4],reply:l||"--\x3e"===s[2]},n);continue}if(l)throw Error("ZenUML reply annotation requires a directed message");let d=o.match(/^(if|while|for|forEach|foreach|loop|par|opt|try|critical)\b([\s\S]*)$/);if(d){k("groups",a,n);let e=d[1],i=el(d[2]);if(b[w]?.kind!=="open")throw Error(`ZenUML ${e} requires a brace-delimited scope`);W();let o=[{kind:"body",statements:z(!0)}];for(;b[w]?.kind==="text";){let t=b[w].text.match(/^(else\s+if|else|catch|finally)\b([\s\S]*)$/);if(!t)break;let i="else if"===t[1]?"else-if":t[1];if("if"===e?!["else-if","else"].includes(i):"try"!==e||!["catch","finally"].includes(i))break;W();let n=el(t[2]);if(W()?.kind!=="open")throw Error("ZenUML branch requires a brace-delimited scope");o.push({kind:i,...void 0===n?{}:{condition:n},statements:z(!0)})}C(t,{kind:"fragment",id:a,type:e,...void 0===i?{}:{condition:i},branches:o},n);continue}if(/^return\b/.test(o)){C(t,{kind:"return",id:a,label:o.slice(6).trim()},n);continue}let c=function(e){let t=e.match(RegExp(`^(?:(${J})\\s+)?(${J})\\s*=\\s*(?!=)([\\s\\S]+)$`,"u"));return t?{assignment:{name:ei(t[2]),...t[1]?{type:ei(t[1])}:{}},rest:t[3].trim()}:{rest:e}}(o),h=c.rest.match(RegExp(`^new\\s+(${J})(?:\\s*\\(([\\s\\S]*)\\))?$`,"u")),p=()=>b[w]?.kind!=="open"?[]:(W(),z(!0));if(h){k("nodes",c.assignment?`${c.assignment.name}:${ei(h[1])}`:ei(h[1]),n),C(t,{kind:"create",id:a,constructor:ei(h[1]),...void 0===h[2]?{}:{arguments:h[2]},...c.assignment?{assignment:c.assignment}:{},children:p()},n);continue}let g=c.rest.match(et),f=g?g[3]:c.rest;if(K.test(f)&&function(e){let t=0,i="",n=!1,o="";for(let r of e){if(i){n?n=!1:"\\"===r?n=!0:r===i&&(i="");continue}if('"'===r||"'"===r){if(!t)return!1;i=r;continue}if("("===r){1==++t&&(o+="()");continue}if(")"===r){t--;continue}t||(o+=r)}return/^[\p{L}_$][\p{L}\p{N}_$-]*(?:\(\))?(?:\s*\.\s*[\p{L}_$][\p{L}\p{N}_$-]*(?:\(\))?)*$/u.test(o.trim())}(f)&&(null!==g||!eo.has(K.exec(f)[1]))){g?.[1]&&k("nodes",ei(g[1]),n),g?.[2]&&k("nodes",ei(g[2]),n),C(t,{kind:"call",id:a,...g?.[1]?{from:ei(g[1])}:{},...g?.[2]?{to:ei(g[2])}:{},label:f,...c.assignment?{assignment:c.assignment}:{},children:p()},n);continue}C(t,{kind:"opaque",id:a,source:o},n),v.unsupportedSource=i,b[w]?.kind==="open"&&(W(),z(!0))}if(S--,e)throw Error("Unclosed ZenUML scope");return t};v.statements=z(!1);let _=new Set(v.participants.map(e=>e.id));v.starter&&_.add(v.starter);let P=[],E=e=>{for(let t of e)if(P.push(t),("call"===t.kind||"message"===t.kind)&&(t.from&&_.add(t.from),t.to&&_.add(t.to)),"create"===t.kind&&_.add(t.assignment?`${t.assignment.name}:${t.constructor}`:t.constructor),("call"===t.kind||"create"===t.kind)&&E(t.children),"fragment"===t.kind)for(let e of t.branches)E(e.statements)};E(v.statements);let F=new Map,T=0;for(let e of P){let t=e.id;do e.id=`statement:${++T}`;while(_.has(e.id))F.set(t,e.id),t!==e.id&&A("zenuml")&&V("zenuml","readdress-statement",{from:t,to:e.id})}for(let e of[])"nodes"!==e.kind&&"title"!==e.id&&(e.id=F.get(e.id)??e.id);return a("nodes",_.size),a("edges",M),v}(m(e.source));return t.title??=u(e.source.frontmatter),t.accessibilityTitle=e.source.accessibility.title??t.accessibilityTitle,t.accessibilityDescription=e.source.accessibility.descr??t.accessibilityDescription,function(e,t={}){return{positioned:e,...t}}(function(e,t={},i,n={}){return function(e,t={},i={},n){let o=ev(t,e_,n),r=i.diagramMarginX??30,a=i.diagramMarginY??30,l=i.width??80,s=i.noteMargin??10,d=i.activationWidth??10,c=e.actors.map(e=>S(n,"actor",{category:e.id},{includeFallback:!1})),h=Math.max(i.height??40,...c.map(e=>M("Mg",e?.fontSize??o.nodeLabelFontSize,e?.fontWeight??o.nodeLabelFontWeight).height+(e?.paddingY??o.nodePaddingY)*2)),p=M("Mg",e_.edgeLabelFontSize,e_.edgeLabelFontWeight).height,g=M("Mg",o.edgeLabelFontSize,o.edgeLabelFontWeight).height,f=i.messageMargin??40,u=Math.max(f,f+g-p),m=Math.max(30,u-10),b=Math.max(40,40+(o.groupHeaderFontSize-e_.groupHeaderFontSize)+(o.groupPaddingY-e_.groupPaddingY)*2),x=Math.max(28,b+o.groupPaddingY+20-u);if(0===e.actors.length)return eP({width:0,height:0,accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[],destructions:[]},void 0===e.title?void 0:$(e.title,e.titleContent),o,r,a);let y=e.actors.map((e,t)=>{var n,r;let a,s,d,p,g,f,u,m,b,x;return n=void 0===e.wrap&&void 0!==i.wrap?{...e,wrap:i.wrap}:e,r=c[t],a=r?.textTransform??o.nodeTextTransform,s=r?.fontSize??o.nodeLabelFontSize,d=r?.fontWeight??o.nodeLabelFontWeight,p=r?.letterSpacing??o.nodeLetterSpacing,g=r?.paddingX??o.nodePaddingX,f=r?.paddingY??o.nodePaddingY,m=(u=v($(n.label,n.labelContent),{transform:a,fontSize:s,fontWeight:d,letterSpacing:p,...n.wrap?{maxWidth:240}:{}})).text,b=Math.max(u.width+2*g,l),x="participant"===n.type?Math.max(h,Math.ceil(u.height+2*f)):h,{fontSize:s,fontWeight:d,letterSpacing:p,paddingX:g,paddingY:f,displayLabel:m,block:u,...n.links?{menuBlock:v("⋯",{display:"literal",fontSize:10,fontWeight:400})}:{},labelMetrics:u,width:b,height:x}}),k=y.map(e=>e.width),W=new Map;for(let t=0;t<e.actors.length;t++)W.set(e.actors[t].id,t);let C=e.messages.map(e=>{var t;let n,r,a,l,s,c,h,p,g,f,u,m,b,x,y;return s=(l=v((a=Object.freeze({value:r=void 0!==(t=void 0===e.wrap&&void 0!==i.wrap?{...e,wrap:i.wrap}:e).number?`${t.number}. ${t.label}`:t.label,prepared:L((n=$(t.label,t.labelContent),void 0!==t.number?I([`${t.number}. `,"string"==typeof n?L(n):n]):n))})).prepared,{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...t.wrap?{maxWidth:240}:{}})).text,c=o.edgeLabelFontSize*w,h=r?l:{width:0,height:0,lines:[],lineHeight:c},p=Math.max(8*("none"!==t.startHead),5*!!t.centralStart),g=Math.max(8*("none"!==t.endHead),5*!!t.centralEnd),f=Math.max(o.lineWidth/2,2.5*("none"!==t.startHead||"none"!==t.endHead),t.centralStart||t.centralEnd?4.75:0),u=Math.max(16,p+g+8),m=h.width+u,x=(b=30+(h.width>0?8+h.width:0))+Math.max(12,d/2+8),y=t.from===t.to?0:Math.ceil(Math.max(0,h.height-c)),{label:r,labelContent:a,displayLabel:s,block:l,labelMetrics:h,startPad:p,endPad:g,markerHalfHeight:f,requiredSpanWidth:m,selfRightExtent:b,requiredSelfNeighborGap:x,extraAboveHeight:y}}),z=Array.from({length:Math.max(0,e.actors.length-1)},()=>0);for(let t=0;t<e.messages.length;t++){let i=e.messages[t],n=C[t],o=W.get(i.from),r=W.get(i.to);if(void 0===o||void 0===r)continue;if(o===r){o<e.actors.length-1&&(z[o]=Math.max(z[o],n.requiredSelfNeighborGap));continue}let a=Math.min(o,r),l=Math.max(o,r),s=l-a,d=e.actors[r].createMessageIndex===t&&"participant"===e.actors[r].type?k[r]/2:0,c=(n.requiredSpanWidth+d)/s;for(let e=a;e<l;e++)z[e]=Math.max(z[e],c)}let _=[],P=r+k[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=(k[t-1]+k[t])/2;P+=Math.max(void 0!==i.actorMargin?e+i.actorMargin:Math.max(140,e+40),z[t-1]??0)}_.push(P)}let E=(e.boxes??[]).flatMap((t,n)=>{let r=e.actors.flatMap((e,t)=>e.box===n?[t]:[]),a=t.label?v($(t.label,t.labelContent),{transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing,fontFamily:o.groupFont,...t.wrap??i.wrap?{maxWidth:240}:{}}):void 0;return r.length>0?[{box:t,memberIdxs:r,block:a}]:[]}),F=Math.max(22,...E.map(e=>(e.block?.height??0)+8)),T=a+(E.length>0?F+6:0),H=e.actors.map((e,t)=>eL(e,y[t],_[t],T)),Y=e.actors.flatMap((t,i)=>{if(void 0!==t.createMessageIndex&&t.createMessageIndex<e.messages.length)return[];let n=H[i].bounds;return[n.y+n.height]}),q=Y.length>0?Math.max(...Y):T+h,U=q+26,B=[],R=e.blocks.map((t,i)=>{let n=ep.get(t);if(n)return n;let o=[];for(let i=0;i<e.notes.length;i++){let n=e.notes[i];n.afterIndex>=t.startIndex&&n.afterIndex<=t.endIndex&&o.push(i)}let r=[];for(let n=0;n<i;n++){let o=e.blocks[n];o.startIndex>=t.startIndex&&o.endIndex<=t.endIndex&&(e.blocks.some((e,r)=>r>n&&r<i&&o.startIndex>=e.startIndex&&o.endIndex<=e.endIndex&&e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex)||r.push(n))}return{endMessageExclusive:Math.min(t.endIndex+1,e.messages.length),dividerNoteIndices:t.dividers.map(()=>-1),endNoteExclusive:o.length>0?o.at(-1)+1:e.notes.filter(e=>e.afterIndex<=t.endIndex).length,noteIndices:o,childBlockIndices:r,childSectionIndices:r.map(i=>t.dividers.filter(t=>e.blocks[i].startIndex>=t.index).length)}}),Z=e.blocks.map(e=>{var t;let n,r,a,l,s,d,c,h,p,f,u;return r=(n=v("rect"===(t={...e,wrap:e.wrap??i.wrap,dividers:e.dividers.map(e=>({...e,wrap:e.wrap??i.wrap}))}).type?"":t.label?I([`${t.type} [`,L($(t.label,t.labelContent)),"]"]):t.type,{transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing,fontFamily:o.groupFont,...t.wrap?{maxWidth:240}:{}})).text,a=o.groupHeaderFontSize*w,s=Math.ceil(Math.max(0,((l=r?n:{width:0,height:0,lines:[],lineHeight:a}).lines.length-1)*l.lineHeight)),d=Math.max(2*o.groupPaddingX,2*o.groupLabelPaddingX),c="rect"===t.type?0:l.width+d,h="rect"===t.type?0:Math.max(18,o.groupHeaderFontSize+o.groupPaddingY)+s,p=b+s,f="rect"===t.type?o.groupPaddingY:h+o.groupPaddingY,u=t.dividers.map(e=>{let t=v(e.label?I(["[",L($(e.label,e.labelContent)),"]"]):"",{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...e.wrap?{maxWidth:240}:{}}),i=t.text,n=e.label?t:{width:0,height:0,lines:[],lineHeight:g},r=Math.max(14,Math.ceil(n.lineHeight/2+6)),a=Math.max(0,r-14),l=Math.ceil(Math.max(0,(n.lines.length-1)*n.lineHeight));return{index:e.index,label:e.label,displayLabel:i,block:t,metrics:n,firstLineOffset:r,extraFontOffset:a,extraLinesHeight:l,requiredExtraBefore:24+l+a,noteContentOffset:Math.ceil(Math.max(28+l+a,r+(n.lines.length-1)/2*n.lineHeight+n.height/2+o.groupPaddingY))}}),{headerText:r,block:n,headerMetrics:l,tabWidth:c,tabHeight:h,extraHeaderLinesHeight:s,blockPadTop:p,blockHeaderExtra:x+s,enclosingHeaderStep:f,contentTopPadding:"rect"===t.type?o.groupPaddingY:Math.max(p,h+o.groupPaddingY),dividers:u}}),N=eg.get(e),X=new Map,O=new Map,j=new Map,A=new Map,D=new Map;for(let t=0;t<e.blocks.length;t++){let i=e.blocks[t],n=O.get(i.startIndex)??[];n.push(t),O.set(i.startIndex,n);let o=R[t],r=o.noteIndices[0];if(void 0!==r){let e=j.get(r)??[];e.push(t),j.set(r,e)}for(let e of o.childBlockIndices)A.set(e,t)}let V=new Set,J=new Set;if(N){let t=new Map(N.filter(e=>"open"===e.kind).map(e=>[e.blockIndex,e.noteIndex]));for(let i=0;i<e.blocks.length;i++){let n=e.blocks[i],o=R[i],r=new Set(o.childSectionIndices),a=n.startIndex,l=t.get(i);for(let e=0;e<=n.dividers.length;e++){let t=n.dividers[e]?.index??o.endMessageExclusive,s=o.dividerNoteIndices[e]??o.endNoteExclusive;a!==t||l!==s||r.has(e)||J.add(i),a=t,l=s}o.childBlockIndices.some(t=>e.blocks[t].startIndex===R[t].endMessageExclusive&&0===R[t].noteIndices.length)&&J.add(i)}for(let t=0;t<e.blocks.length;t++){let e=A.get(t);J.has(t)&&void 0!==e&&J.add(e)}}let G=e=>(O.get(e)??[]).filter(t=>!V.has(t)&&R[t].endMessageExclusive>e),K=e=>0===e.length?0:Z[e[0]].blockHeaderExtra+e.slice(1).reduce((e,t)=>e+Z[t].enclosingHeaderStep,0);for(let t=0;t<e.blocks.length;t++){if(J.has(t)||"par_over"===e.blocks[t].type)continue;let i=Z[t],n=R[t];for(let[o,r]of i.dividers.entries()){let i=eW(e.blocks[t],n,e,o);if(void 0!==i){D.set(i,Math.max(D.get(i)??0,r.noteContentOffset));continue}if(r.index>=n.endMessageExclusive)continue;let a=r.requiredExtraBefore;for(let t of n.childBlockIndices)e.blocks[t]?.startIndex===r.index&&(a+=Z[t].blockHeaderExtra);let l=X.get(r.index)??0;X.set(r.index,Math.max(l,a))}}let Q=new Map,ee=new Map,et=new Map;for(let t=0;t<e.actors.length;t++){let i=e.actors[t];if(void 0!==i.createMessageIndex&&i.createMessageIndex<e.messages.length){let e=Q.get(i.createMessageIndex)??[];e.push(t),Q.set(i.createMessageIndex,e)}if(void 0!==i.destroyMessageIndex&&i.destroyMessageIndex<e.messages.length){let e=ee.get(i.destroyMessageIndex)??[];e.push(i.id),ee.set(i.destroyMessageIndex,e)}}let ei=new Map;for(let t=0;t<e.notes.length;t++){let i=e.notes[t],n=ei.get(i.afterIndex)??[];n.push({note:i,index:t}),ei.set(i.afterIndex,n)}let en=Array(e.notes.length),eo=new Map,er=[],ea=new Map;for(let t of e.activationEvents??[]){let e=ea.get(t.messageIndex)??[];e.push(t),ea.set(t.messageIndex,e)}let el=(e,t)=>{let i=eo.get(e)??[];i.push({startY:t,depth:i.length}),eo.set(e,i)},es=(e,t)=>{let i=eo.get(e);if(!i||0===i.length)return;let{startY:n,depth:o}=i.pop(),r=W.get(e);void 0===r||t<=n||er.push({actorId:e,x:_[r]-d/2+4*o,topY:n,bottomY:t,width:d})},ed=(e,t)=>{for(let i of ea.get(e)??[])"activate"===i.kind?el(i.actorId,t):es(i.actorId,t)},ec=(e,t)=>{let n=v($(e.text,e.textContent),{transform:o.nodeTextTransform,fontSize:o.nodeLabelFontSize,fontWeight:o.nodeLabelFontWeight,letterSpacing:o.nodeLetterSpacing,...e.wrap??i.wrap?{maxWidth:240}:{}}),r=Math.max(60,n.width+2*o.nodePaddingX),a=n.height+2*o.nodePaddingY,l=W.get(e.actorIds[0]??"")??0,d;if("left"===e.position)d=_[l]-k[l]/2-r-s;else if("right"===e.position)d=_[l]+k[l]/2+s;else if(e.actorIds.length>1){let t=W.get(e.actorIds[e.actorIds.length-1]??"")??l;d=(_[l]+_[t])/2-r/2}else d=_[l]-r/2;return{text:e.text,block:n,x:d,y:t,width:r,height:a,position:e.position,actors:e.actorIds}},eh=Array(e.blocks.length),ef=[],eu=-1/0,em=q,eb=-1/0,ex=0,ey=0,ek=0,ew=0,e$=new Map,eI=(t,i,n)=>{let o=0,r=[];for(let[o,a]of e$){let l=e.blocks[o];for(let e=l.startIndex;e<a.messageEnd;e++)B[e]&&r.push(B[e].bounds);for(let e of R[o].noteIndices)e<a.noteEnd&&en[e]&&r.push(en[e]);for(let e of a.priorChildren)eh[e]&&r.push(eh[e]);for(let[s,d]of l.dividers.entries()){let c=Z[o].dividers[s];if(!d.label)continue;let h=eW(l,R[o],e,s),p=void 0!==h&&h<a.noteEnd?en[h]:void 0===h&&d.index<a.messageEnd?B[d.index]?.bounds:void 0;if(p&&r.push({x:p.x,y:p.y-c.metrics.height-8,width:c.metrics.width,height:c.metrics.height}),void 0===h&&i===d.index||void 0!==h&&n===h){let e=c.metrics.height+8;t={x:t.x,y:t.y-e,width:Math.max(t.width,c.metrics.width),height:t.height+e}}}}for(let e=0;e<=r.length;e++){let e=r.find(e=>t.x<e.x+e.width+8&&t.x+t.width+8>e.x&&t.y+o<e.y+e.height+8&&t.y+t.height+o+8>e.y);if(!e)break;o=e.y+e.height+8-t.y}return o},eE=e=>{let t=[];for(let i=e;void 0!==i&&!V.has(i);i=A.get(i))t.push(i);for(let e=t.length-1;e>=0;e--){let i=t[e],n=Math.max(em,eu,eb)+8;ef[i]={top:n,dividerY:[]},V.add(i),em=eb=n+Z[i].enclosingHeaderStep}},eF=t=>{let i=e.blocks[t],n=R[t],r=ef[t]?.top,a=void 0!==r&&i.startIndex===n.endMessageExclusive&&0===n.noteIndices.length?r+Z[t].blockPadTop:en[n.noteIndices[0]??-1]?.y??U;V.add(t);let l=eC(i,Z[t],n,e,W,H,B,en,eh,o,g,a,ef[t]);eh[t]=l,eu=Math.max(eu,l.y+l.height);let s=e$.get(t);s&&(em=Math.max(em,s.bottom,eu),U=Math.max(U,em+u/2),e$.delete(t))},eT=()=>{if(N){for(;ek<N.length;){let t=N[ek];if(t.messageIndex>B.length||t.noteIndex>ex)break;let i=t.blockIndex;if("open"===t.kind&&J.has(i)&&eE(i),"open"===t.kind&&"par_over"===e.blocks[i].type){eE(i);let n=Math.max(0,...Z[i].dividers.map(e=>e.noteContentOffset));eb+=n,em=eb,U=Math.max(U,eb+u/2),e$.set(i,{messageY:U,contentBottom:em,completedBottom:eu,reservedBottom:eb,bottom:em,messageEnd:e.blocks[i].startIndex,noteEnd:t.noteIndex,priorChildren:[]}),ew++}if("divider"===t.kind){let e=e$.get(i);if(e){e.bottom=Math.max(e.bottom,em,eu,eb),e.messageEnd=t.messageIndex,e.noteEnd=t.noteIndex,e.priorChildren=R[i].childBlockIndices.filter(e=>eh[e]),({messageY:U,contentBottom:em,completedBottom:eu,reservedBottom:eb}=e),ew++,ek++;continue}let n=Z[i].dividers[t.dividerIndex],o=Math.max(em,eu,eb)+8;J.has(i)?(ef[i].dividerY[t.dividerIndex]=o,em=eb=o+n.noteContentOffset):eb=o+n.noteContentOffset}"close"===t.kind&&eF(i),ek++}return}for(;ey<e.blocks.length;){let e=ey,t=R[e];if(t.endMessageExclusive>B.length||t.endNoteExclusive>ex)break;eF(e),ey++}},eH=(e,t)=>{let i=t;for(let{note:t,index:n}of ei.get(e)??[]){let e=ew;for(let t of(eT(),e!==ew&&(i=U),i=Math.max(i,eu+8,eb),j.get(n)??[])){let e=ef[t]?.top;void 0!==e&&(i=Math.max(i,e+Z[t].contentTopPadding))}let o=(j.get(n)??[]).filter(e=>!V.has(e)),r=D.get(n)??0;if(o.length>0||r>0){let e=r+(o.length>0?Z[o[0]].contentTopPadding+o.slice(1).reduce((e,t)=>e+Z[t].enclosingHeaderStep,0):0);for(let t of(i=Math.max(i,Math.max(em,eu)+8+e),o))V.add(t)}let a=ec(t,i),l=eI(a,void 0,n);l>0&&(i+=l,a=ec(t,i)),en[n]=a,em=Math.max(em,a.y+a.height),ex=n+1,i=a.y+a.height+4}ei.has(e)&&(U=Math.max(U,i+u/2))};eH(-1,U);for(let t=0;t<e.messages.length;t++){let i=e.messages[t],n=C[t],r=W.get(i.from)??0,a=W.get(i.to)??0,l=i.from===i.to;eT();let s=G(t),d=Math.max(X.get(t)??0,K(s));for(let e of Q.get(t)??[]){let t=H[e].height/2;d=d>0?d+Math.max(0,t-12):t+8}U+=d+n.extraAboveHeight;let c=_[r],h=_[a],p=e.actors[a].createMessageIndex!==t||"participant"!==e.actors[a].type||l?h:h-Math.sign(h-c)*k[a]/2,f=()=>{let r=function(e,t,i,n,o,r){let a=e.from===e.to;if(a){let l=r+Math.max(20,t.labelMetrics.height)/2,s=eM(t.displayLabel,n+30+8,l,"start",i.edgeLabelFontSize,i.edgeLabelFontWeight,i.edgeLetterSpacing,t.block),d={x:n-t.startPad,y:r-t.markerHalfHeight,width:30+t.startPad+i.lineWidth/2,height:20+2*t.markerHalfHeight},c=t.label?eS(d,s.bounds):d;return{from:e.from,to:e.to,label:t.label,labelContent:t.labelContent,lineStyle:e.lineStyle,startHead:e.startHead,endHead:e.endHead,centralStart:e.centralStart??!1,centralEnd:e.centralEnd??!1,x1:n,x2:o,y:r,isSelf:a,points:[{x:n,y:r},{x:n+30,y:r},{x:n+30,y:r+20},{x:o,y:r+20}],labelPosition:s,bounds:c}}let l=Math.max(2.85,i.lineWidth/2+2),s=Math.max(10,t.labelMetrics.height/2+l),d=eM(t.displayLabel,(n+o)/2,r-s,"middle",i.edgeLabelFontSize,i.edgeLabelFontWeight,i.edgeLetterSpacing,t.block),c=n<=o?t.startPad:t.endPad,h=n<=o?t.endPad:t.startPad,p=Math.min(n,o)-c,g=Math.max(n,o)+h,f={x:p,y:r-t.markerHalfHeight,width:g-p,height:2*t.markerHalfHeight},u=t.label?eS(f,d.bounds):f;return{from:e.from,to:e.to,label:t.label,labelContent:t.labelContent,lineStyle:e.lineStyle,startHead:e.startHead,endHead:e.endHead,centralStart:e.centralStart??!1,centralEnd:e.centralEnd??!1,x1:n,x2:o,y:r,isSelf:a,points:[{x:n,y:r},{x:o,y:r}],labelPosition:d,bounds:u}}(i,n,o,c,p,U);for(let i of(B[t]=r,Q.get(t)??[]))H[i]=eL(e.actors[i],y[i],_[i],U-H[i].height/2);return r},b=f(),x=b.bounds.y,v=0,w=new Set(s),M=(O.get(t)??[]).filter(e=>w.has(e)||ef[e]?.top!==void 0&&!eh[e]);if(M.length>0){let t=[];for(let i of M){for(let e of R[i].childBlockIndices)eh[e]&&(t[e]=eh[e]);t[i]=eC(e.blocks[i],Z[i],R[i],e,W,H,B,en,t,o,g,U,ef[i]);let n=ef[i]?.top;void 0!==n?v=Math.max(v,n-t[i].y):x=Math.min(x,t[i].y)}}let S=Math.max(0,v,(s.length>0?Math.max(em,eu,eb):Math.max(eu,eb))+8*(s.length>0)-x);S>0&&(U+=S,b=f());let $=eI(b.bounds,t);for(let e of($>0&&(U+=$,b=f()),s))V.add(e);em=Math.max(em,b.bounds.y+b.bounds.height,...(Q.get(t)??[]).map(e=>H[e].bounds.y+H[e].bounds.height)),ed(t,U);let I=ee.get(t);if(I)for(let e of I)et.set(e,U);i.activate&&el(i.to,U),i.deactivate&&es(i.from,U);let L=l?Math.max(m,Math.ceil(n.labelMetrics.height)+10):0;U+=l?L+u:u;let z=Q.get(t);if(z){let e=Math.max(...z.map(e=>{let t=H[e];return t.bounds.height-t.height/2}));U+=e}let P=z?em+8:b.y+L+14;eH(t,P)}eT();let eY=Math.max(B[B.length-1]?.y??U,U-u/2);for(let[t,i]of(ed(e.messages.length,eY),eo))for(;i.length>0;)es(t,eY);for(let t of H)e.actors[W.get(t.id)]?.external&&(t.external=!0);for(let[t,i]of B.entries()){let n=e.messages[t];void 0!==n.id&&(i.id=n.id),void 0!==n.parentId&&(i.parentId=n.parentId)}for(let[t,i]of eh.entries()){let n=e.blocks[t];void 0!==n.id&&(i.id=n.id),void 0!==n.parentId&&(i.parentId=n.parentId)}for(let[t,i]of en.entries()){let n=e.notes[t];i&&n?.id!==void 0&&(i.id=n.id),i&&n?.parentId!==void 0&&(i.parentId=n.parentId)}let eq=en.filter(e=>void 0!==e),eU=eh.reduce((e,t)=>Math.max(e,t.y+t.height),0);eU>0&&(U=Math.max(U,eU+8));let eB=U,eR=E.map(({box:e,memberIdxs:t,block:i})=>{let n=Math.min(...t.map(e=>H[e].bounds.x))-8,o=Math.max(...t.map(e=>H[e].bounds.x+H[e].bounds.width))+8;return e.label&&(o=Math.max(o,n+i.width+16)),{label:e.label,block:i,labelY:a+F/2,color:e.color,x:n,y:a,width:o-n,height:eB+8-a}}),eZ=U+a,eN=r,eX=0;for(let e of H){let t=e.bounds;eN=Math.min(eN,t.x),eX=Math.max(eX,t.x+t.width)}for(let e of eh)eN=Math.min(eN,e.x),eX=Math.max(eX,e.x+e.width);for(let e of eq)eN=Math.min(eN,e.x),eX=Math.max(eX,e.x+e.width);for(let e of eR)eN=Math.min(eN,e.x),eX=Math.max(eX,e.x+e.width);for(let e of er)eN=Math.min(eN,e.x),eX=Math.max(eX,e.x+e.width);for(let e of B){eN=Math.min(eN,e.bounds.x);let t=e.isSelf&&e.label?8:0;eX=Math.max(eX,e.bounds.x+e.bounds.width+t)}let eO=eN<r?r-eN:0;if(eO>0){ez({actors:H,messages:B,blocks:eh,notes:eq,boxes:eR,activations:er,lifelines:[],destructions:[]},eO,0);for(let e=0;e<_.length;e++)_[e]+=eO}let ej=e.actors.map((e,t)=>{let i=H[t],n=i.bounds.y+i.bounds.height;return{actorId:e.id,x:_[t],topY:n,bottomY:et.get(e.id)??eZ-a}}),eA=e.actors.filter(e=>et.has(e.id)).map(e=>({actorId:e.id,x:_[W.get(e.id)],y:et.get(e.id)}));return eP({width:Math.max(eX+eO+r,200),height:Math.max(eZ,100),accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:H,lifelines:ej,messages:B,activations:er,blocks:eh,notes:eq,boxes:eR,destructions:eA},void 0===e.title?void 0:$(e.title,e.titleContent),o,r,a)}(function(e,t){!function(e,t=!1){let i;if(!e||"zenuml"!==e.kind||!Array.isArray(e.participants)||!Array.isArray(e.statements))throw Error("Invalid ZenUML body");for(let t of[e.title,e.accessibilityTitle,e.accessibilityDescription])if(void 0!==t&&"string"!=typeof t)throw Error("ZenUML metadata must be text");void 0!==e.starter&&en(e.starter);let n=new Set;for(let i of e.participants){if(en(i.id),"string"!=typeof i.label||/[\r\n]/.test(i.label))throw Error("ZenUML aliases must be single-line text");if(n.has(i.id))throw Error(`Duplicate ZenUML participant: ${i.id}`);if(n.add(i.id),!Array.isArray(i.annotations)||i.annotations.some(e=>"string"!=typeof e||!/^\w+$/.test(e)))throw Error("Invalid ZenUML annotator");if(i.annotations.length>1&&(t||void 0===e.unsupportedSource))throw Error("ZenUML declarations accept one participant annotator");if(void 0!==i.stereotype&&("string"!=typeof i.stereotype||!i.stereotype||/[<>\r\n]/.test(i.stereotype)))throw Error("Invalid ZenUML stereotype");if(void 0!==i.comments&&(!Array.isArray(i.comments)||i.comments.some(e=>"string"!=typeof e)))throw Error("Invalid ZenUML participant comments")}let o=new Set,r=new Set,l=e=>{if("string"!=typeof e)throw Error("ZenUML content must be text")},s=e=>{e&&(en(e.name),void 0!==e.type&&en(e.type))},d=(i,n)=>{if(!Array.isArray(i)||n>128)throw Error("Invalid or excessive ZenUML scope nesting");for(let a of i){if(!a||"object"!=typeof a||r.has(a))throw Error("Cyclic or shared ZenUML statement");if(r.add(a),"string"!=typeof a.id||!a.id||o.has(a.id))throw Error("ZenUML statement identities must be unique");switch(o.add(a.id),a.kind){case"call":if(void 0!==a.from&&en(a.from),void 0!==a.to&&en(a.to),void 0!==a.from&&void 0===a.to)throw Error("An explicit ZenUML caller requires a target");l(a.label),s(a.assignment),d(a.children,n+1);break;case"create":en(a.constructor),void 0!==a.arguments&&l(a.arguments),s(a.assignment),d(a.children,n+1);break;case"message":if(en(a.from),en(a.to),l(a.label),"boolean"!=typeof a.reply)throw Error("ZenUML message reply flag must be boolean");break;case"return":l(a.label);break;case"comment":l(a.text);break;case"fragment":{if(!["if","opt","while","for","forEach","foreach","loop","par","try","critical"].includes(a.type)||!Array.isArray(a.branches)||!a.branches.length||a.branches[0]?.kind!=="body")throw Error("Invalid ZenUML fragment");void 0!==a.condition&&l(a.condition);let e=!1;for(let[t,i]of a.branches.entries()){if(t&&(e||("if"===a.type?!["else-if","else"].includes(i.kind):"try"!==a.type||!["catch","finally"].includes(i.kind))))throw Error("Invalid ZenUML branch order");("else"===i.kind||"finally"===i.kind)&&(e=!0),void 0!==i.condition&&l(i.condition),d(i.statements,n+1)}break}case"opaque":if(l(a.source),t||void 0===e.unsupportedSource)throw Error("Unsupported ZenUML syntax is retained; typed editing and rendering require a fully modelled document");break;default:throw Error("Unknown ZenUML statement kind")}}};if(d(e.statements,0),t&&void 0!==e.unsupportedSource)throw Error("Unsupported ZenUML source cannot be rewritten through typed editing");a("nodes",(i=new Set(e.participants.map(e=>e.id)),void 0!==e.starter&&i.add(e.starter),eB(e.statements,e=>{("call"===e.kind||"message"===e.kind)&&(void 0!==e.from&&i.add(e.from),void 0!==e.to&&i.add(e.to)),"create"===e.kind&&i.add(e.assignment?`${e.assignment.name}:${e.constructor}`:e.constructor)}),i).size),a("edges",o.size)}(e,!0);let i={actors:[],messages:[],blocks:[],notes:[],activationEvents:[],boxes:[],...void 0===e.title?{}:{title:e.title,titleContent:eZ(e.title)},...void 0===e.accessibilityTitle?{}:{accessibilityTitle:e.accessibilityTitle},...void 0===e.accessibilityDescription?{}:{accessibilityDescription:e.accessibilityDescription}},n=new Map,o=new Set(e.participants.map(e=>e.id));e.starter&&o.add(e.starter),eB(e.statements,e=>{o.add(e.id),("call"===e.kind||"message"===e.kind)&&(e.from&&o.add(e.from),e.to&&o.add(e.to)),"create"===e.kind&&o.add(eX(e))});let r="zenuml:outside";for(;o.has(r);)r+=":";let l=e=>{let t=e;for(;o.has(t);)t+=":";return o.add(t),t},s=e=>{let t=e??r;if(!n.has(t)){let o={id:t,label:void 0===e?"":e,type:"participant",labelContent:eZ(e??""),...void 0===e?{external:!0}:{}};i.actors.push(o),n.set(t,o)}return t};for(let t of e.participants){s(t.id);let e=n.get(t.id);e.type=t.annotations.map(e=>eR[e.toLowerCase()]).find(Boolean)??"participant",e.label=[...[...t.annotations.filter(e=>!eR[e.toLowerCase()]).map(e=>`@${e}`),...t.stereotype?[t.stereotype]:[]].map(e=>`\xab${e}\xbb`),t.label].join(`
|
|
20
|
-
`),e.labelContent=eZ(e.label)}let d=e.starter;if(void 0===d)for(let t of e.statements){if("message"===t.kind||"call"===t.kind&&void 0!==t.from){d=t.from;break}if("comment"!==t.kind)break}void 0!==d&&s(d);let c=[],h=new Map,p=[],g=(e,t,n,o,r,a,l=!1,d=e)=>{let c=s(t),h=s(n),p="reply"===a,g={id:e,...r.parentId?{parentId:r.parentId}:{},from:c,to:h,label:o,labelContent:eZ(o),lineStyle:p?"dashed":"solid",startHead:"none",endHead:p?"open":"filled",centralStart:!1,centralEnd:!1,...l?{activate:!0}:{}};i.messages.push(g)},f=(e,t,n,o)=>{let r=W(t),a={id:e,...o.parentId?{parentId:o.parentId}:{},actorIds:[...new Set(n.length?n:[s(o.owner)])],text:r,textContent:{value:r,authored:t,prepared:L(r,"formatted")},position:"over",afterIndex:i.messages.length-1},l=i.notes.length;for(let e of(i.notes.push(a),p))h.get(e).noteIndices.push(l)},u=(e,t,i)=>e.some(e=>"return"===e.kind||"message"===e.kind&&e.reply&&e.from===t&&e.to===i||"fragment"===e.kind&&e.branches.some(e=>u(e.statements,t,i))),m=(e,t)=>{let o=[],r=e=>{for(let i of o)f(i.id,i.text,e,t);o=[]};for(let a of e){if("comment"===a.kind){o.push(a);continue}switch(a.kind){case"call":{let e=a.from??t.owner,n=a.to??t.owner,o=s(e),d=s(n);r([o,d]);let c=o===d,h=a.assignment&&!c&&u(a.children,n,e);g(a.id,e,n,a.assignment&&(c||h)?`${eN(a.assignment)} = ${a.label}`:a.label,t,"call",!0);let p={...t,owner:n,returnTo:e,callAncestors:t.callAncestors};m(a.children,p),!a.assignment||c||h||g(l(`${a.id}:reply`),n,e,eN(a.assignment),p,"reply",!1,a.id),i.activationEvents.push({actorId:d,kind:"deactivate",messageIndex:i.messages.length});break}case"create":{let e=
|
|
19
|
+
`)).match(/^(?:(?:[^\S\n]*(?:%%[^\n]*)?\n))*[^\S\n]*zenuml\b/);if(!m)throw Error("Expected zenuml header");let b=er(n.slice(m[0].length)),x=c(n),y=e=>{let t=h(x,e+m[0].length);return(o[(u.familyOrigins[t.line-1]??t.line-1)+r]??i.length)+t.col-1},k=(e,t,i)=>{},v={kind:"zenuml",participants:[],statements:[],...g(u.accessibility),...void 0===l?{}:{title:l}},w=0,M=0,S=0,$=!0,I=()=>`statement:${++M}`,L=e=>({offset:y(e.start),endOffset:y(e.end),unit:"physical"}),W=()=>{let e=b[w++];if(e&&j("zenuml")){var t,n,o;let r=L(e);t="zenuml",n=e.kind,o=i.slice(r.offset,r.endOffset),j(t)&&D(t,{family:t,unit:"statement",kind:n,text:o,...r?{source:{...r}}:{}})}return e},C=(e,t,i)=>{e.push(t),j("zenuml")&&G("zenuml","append-statement",t,L(i))},z=e=>{if(++S>128)throw Error("ZenUML nesting exceeds 128 scopes");let t=[];for(;w<b.length;){let n=W();if("close"===n.kind){if(!e)throw Error("Unmatched ZenUML closing brace");return S--,t}if("open"===n.kind)throw Error("ZenUML scope has no owner");if("comment"===n.kind){let e={kind:"comment",id:I(),text:n.text};C(t,e,n),k("labels",e.id,n);continue}let o=n.text;if(!e&&("title"===o||o.startsWith("title "))){v.title=o.slice(5).trim(),j("zenuml")&&G("zenuml","set-title",v.title,L(n)),k("labels","title",n);continue}let r=o.match(RegExp(`^@Starter\\(\\s*(${V})\\s*\\)$`,"u"));if(!e&&r&&$){v.starter=ei(r[1]),j("zenuml")&&G("zenuml","set-starter",v.starter,L(n));continue}if(!e&&$){let e=function(e){let t=[],i=e,n;for(;/^@[\w]+\s+/.test(i);){let e=i.match(/^@([\w]+)\s+/);t.push(e[1]),i=i.slice(e[0].length)}if(i.startsWith("<<")){let e=i.indexOf(">>");if(e<0)return;n=ei(i.slice(2,e).trim()),i=i.slice(e+2).trim()}let o=i.match(ee);if(!o||!i.startsWith('"')&&eo.has(o[1]))return;let r=ei(o[1]);return{id:r,label:o[2]?ei(o[2]):r,annotations:t,...n?{stereotype:n}:{}}}(o);if(e){if(v.participants.some(t=>t.id===e.id))throw Error(`Duplicate ZenUML participant: ${e.id}`);let o=[];for(;t.at(-1)?.kind==="comment";){let i=t.pop();o.unshift(i.text),j("zenuml")&&G("zenuml","claim-participant-comment",{participant:e.id,comment:i})}o.length&&(e.comments=o),e.annotations.length>1&&(v.unsupportedSource=i),k("nodes",e.id,n),v.participants.push(e),j("zenuml")&&G("zenuml","append-participant",e,L(n));continue}}$=!1;let a=I();k("edges",a,n);let l=!1;if(/^@(return|reply)(?:\s|$)/.test(o)&&(l=!0,!(o=o.replace(/^@(return|reply)\s*/,"")))){let e=W();if(!e||"text"!==e.kind)throw Error("ZenUML reply annotation requires a message");o=e.text}let s=o.match(Q);if(s){k("nodes",ei(s[1]),n),k("nodes",ei(s[3]),n),C(t,{kind:"message",id:a,from:ei(s[1]),to:ei(s[3]),label:s[4],reply:l||"--\x3e"===s[2]},n);continue}if(l)throw Error("ZenUML reply annotation requires a directed message");let d=o.match(/^(if|while|for|forEach|foreach|loop|par|opt|try|critical)\b([\s\S]*)$/);if(d){k("groups",a,n);let e=d[1],i=el(d[2]);if(b[w]?.kind!=="open")throw Error(`ZenUML ${e} requires a brace-delimited scope`);W();let o=[{kind:"body",statements:z(!0)}];for(;b[w]?.kind==="text";){let t=b[w].text.match(/^(else\s+if|else|catch|finally)\b([\s\S]*)$/);if(!t)break;let i="else if"===t[1]?"else-if":t[1];if("if"===e?!["else-if","else"].includes(i):"try"!==e||!["catch","finally"].includes(i))break;W();let n=el(t[2]);if(W()?.kind!=="open")throw Error("ZenUML branch requires a brace-delimited scope");o.push({kind:i,...void 0===n?{}:{condition:n},statements:z(!0)})}C(t,{kind:"fragment",id:a,type:e,...void 0===i?{}:{condition:i},branches:o},n);continue}if(/^return\b/.test(o)){C(t,{kind:"return",id:a,label:o.slice(6).trim()},n);continue}let c=function(e){let t=e.match(RegExp(`^(?:(${V})\\s+)?(${V})\\s*=\\s*(?!=)([\\s\\S]+)$`,"u"));return t?{assignment:{name:ei(t[2]),...t[1]?{type:ei(t[1])}:{}},rest:t[3].trim()}:{rest:e}}(o),h=c.rest.match(RegExp(`^new\\s+(${V})(?:\\s*\\(([\\s\\S]*)\\))?$`,"u")),p=()=>b[w]?.kind!=="open"?[]:(W(),z(!0));if(h){k("nodes",c.assignment?`${c.assignment.name}:${ei(h[1])}`:ei(h[1]),n),C(t,{kind:"create",id:a,constructor:ei(h[1]),...void 0===h[2]?{}:{arguments:h[2]},...c.assignment?{assignment:c.assignment}:{},children:p()},n);continue}let g=c.rest.match(et),f=g?g[3]:c.rest;if(K.test(f)&&function(e){let t=0,i="",n=!1,o="";for(let r of e){if(i){n?n=!1:"\\"===r?n=!0:r===i&&(i="");continue}if('"'===r||"'"===r){if(!t)return!1;i=r;continue}if("("===r){1==++t&&(o+="()");continue}if(")"===r){t--;continue}t||(o+=r)}return/^[\p{L}_$][\p{L}\p{N}_$-]*(?:\(\))?(?:\s*\.\s*[\p{L}_$][\p{L}\p{N}_$-]*(?:\(\))?)*$/u.test(o.trim())}(f)&&(null!==g||!eo.has(K.exec(f)[1]))){g?.[1]&&k("nodes",ei(g[1]),n),g?.[2]&&k("nodes",ei(g[2]),n),C(t,{kind:"call",id:a,...g?.[1]?{from:ei(g[1])}:{},...g?.[2]?{to:ei(g[2])}:{},label:f,...c.assignment?{assignment:c.assignment}:{},children:p()},n);continue}C(t,{kind:"opaque",id:a,source:o},n),v.unsupportedSource=i,b[w]?.kind==="open"&&(W(),z(!0))}if(S--,e)throw Error("Unclosed ZenUML scope");return t};v.statements=z(!1);let _=new Set(v.participants.map(e=>e.id));v.starter&&_.add(v.starter);let P=[],E=e=>{for(let t of e)if(P.push(t),("call"===t.kind||"message"===t.kind)&&(t.from&&_.add(t.from),t.to&&_.add(t.to)),"create"===t.kind&&_.add(t.assignment?`${t.assignment.name}:${t.constructor}`:t.constructor),("call"===t.kind||"create"===t.kind)&&E(t.children),"fragment"===t.kind)for(let e of t.branches)E(e.statements)};E(v.statements);let F=new Map,H=0;for(let e of P){let t=e.id;do e.id=`statement:${++H}`;while(_.has(e.id))F.set(t,e.id),t!==e.id&&j("zenuml")&&G("zenuml","readdress-statement",{from:t,to:e.id})}for(let e of[])"nodes"!==e.kind&&"title"!==e.id&&(e.id=F.get(e.id)??e.id);return a("nodes",_.size),a("edges",M),v}(m(e.source));return t.title??=u(e.source.frontmatter),t.accessibilityTitle=e.source.accessibility.title??t.accessibilityTitle,t.accessibilityDescription=e.source.accessibility.descr??t.accessibilityDescription,function(e,t={}){return{positioned:e,...t}}(function(e,t={},i,n={}){return function(e,t={},i={},n){let o=ev(t,e_,n),r=i.diagramMarginX??30,a=i.diagramMarginY??30,l=i.width??80,s=i.noteMargin??10,d=i.activationWidth??10,c=e.actors.map(e=>S(n,"actor",{category:e.id},{includeFallback:!1})),h=Math.max(i.height??40,...c.map(e=>M("Mg",e?.fontSize??o.nodeLabelFontSize,e?.fontWeight??o.nodeLabelFontWeight).height+(e?.paddingY??o.nodePaddingY)*2)),p=M("Mg",e_.edgeLabelFontSize,e_.edgeLabelFontWeight).height,g=M("Mg",o.edgeLabelFontSize,o.edgeLabelFontWeight).height,f=i.messageMargin??40,u=Math.max(f,f+g-p),m=Math.max(30,u-10),b=Math.max(40,40+(o.groupHeaderFontSize-e_.groupHeaderFontSize)+(o.groupPaddingY-e_.groupPaddingY)*2),x=Math.max(28,b+o.groupPaddingY+20-u);if(0===e.actors.length)return eP({width:0,height:0,accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[],destructions:[]},void 0===e.title?void 0:$(e.title,e.titleContent),o,r,a);let y=e.actors.map((e,t)=>{var n,r;let a,s,d,p,g,f,u,m,b,x;return n=void 0===e.wrap&&void 0!==i.wrap?{...e,wrap:i.wrap}:e,r=c[t],a=r?.textTransform??o.nodeTextTransform,s=r?.fontSize??o.nodeLabelFontSize,d=r?.fontWeight??o.nodeLabelFontWeight,p=r?.letterSpacing??o.nodeLetterSpacing,g=r?.paddingX??o.nodePaddingX,f=r?.paddingY??o.nodePaddingY,m=(u=v($(n.label,n.labelContent),{transform:a,fontSize:s,fontWeight:d,letterSpacing:p,...n.wrap?{maxWidth:240}:{}})).text,b=Math.max(u.width+2*g,l),x="participant"===n.type?Math.max(h,Math.ceil(u.height+2*f)):h,{fontSize:s,fontWeight:d,letterSpacing:p,paddingX:g,paddingY:f,displayLabel:m,block:u,...n.links?{menuBlock:v("⋯",{display:"literal",fontSize:10,fontWeight:400})}:{},labelMetrics:u,width:b,height:x}}),k=y.map(e=>e.width),W=new Map;for(let t=0;t<e.actors.length;t++)W.set(e.actors[t].id,t);let C=e.messages.map(e=>{var t;let n,r,a,l,s,c,h,p,g,f,u,m,b,x,y;return s=(l=v((a=Object.freeze({value:r=void 0!==(t=void 0===e.wrap&&void 0!==i.wrap?{...e,wrap:i.wrap}:e).number?`${t.number}. ${t.label}`:t.label,prepared:L((n=$(t.label,t.labelContent),void 0!==t.number?I([`${t.number}. `,"string"==typeof n?L(n):n]):n))})).prepared,{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...t.wrap?{maxWidth:240}:{}})).text,c=o.edgeLabelFontSize*w,h=r?l:{width:0,height:0,lines:[],lineHeight:c},p=Math.max(8*("none"!==t.startHead),5*!!t.centralStart),g=Math.max(8*("none"!==t.endHead),5*!!t.centralEnd),f=Math.max(o.lineWidth/2,2.5*("none"!==t.startHead||"none"!==t.endHead),t.centralStart||t.centralEnd?4.75:0),u=Math.max(16,p+g+8),m=h.width+u,x=(b=30+(h.width>0?8+h.width:0))+Math.max(12,d/2+8),y=t.from===t.to?0:Math.ceil(Math.max(0,h.height-c)),{label:r,labelContent:a,displayLabel:s,block:l,labelMetrics:h,startPad:p,endPad:g,markerHalfHeight:f,requiredSpanWidth:m,selfRightExtent:b,requiredSelfNeighborGap:x,extraAboveHeight:y}}),z=Array.from({length:Math.max(0,e.actors.length-1)},()=>0);for(let t=0;t<e.messages.length;t++){let i=e.messages[t],n=C[t],o=W.get(i.from),r=W.get(i.to);if(void 0===o||void 0===r)continue;if(o===r){o<e.actors.length-1&&(z[o]=Math.max(z[o],n.requiredSelfNeighborGap));continue}let a=Math.min(o,r),l=Math.max(o,r),s=l-a,d=e.actors[r].createMessageIndex===t&&"participant"===e.actors[r].type?k[r]/2:0,c=(n.requiredSpanWidth+d)/s;for(let e=a;e<l;e++)z[e]=Math.max(z[e],c)}let _=[],P=r+k[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=(k[t-1]+k[t])/2;P+=Math.max(void 0!==i.actorMargin?e+i.actorMargin:Math.max(140,e+40),z[t-1]??0)}_.push(P)}let E=(e.boxes??[]).flatMap((t,n)=>{let r=e.actors.flatMap((e,t)=>e.box===n?[t]:[]),a=t.label?v($(t.label,t.labelContent),{transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing,fontFamily:o.groupFont,...t.wrap??i.wrap?{maxWidth:240}:{}}):void 0;return r.length>0?[{box:t,memberIdxs:r,block:a}]:[]}),F=Math.max(22,...E.map(e=>(e.block?.height??0)+8)),H=a+(E.length>0?F+6:0),T=e.actors.map((e,t)=>eL(e,y[t],_[t],H)),Y=e.actors.flatMap((t,i)=>{if(void 0!==t.createMessageIndex&&t.createMessageIndex<e.messages.length)return[];let n=T[i].bounds;return[n.y+n.height]}),q=Y.length>0?Math.max(...Y):H+h,B=q+26,U=[],R=e.blocks.map((t,i)=>{let n=ep.get(t);if(n)return n;let o=[];for(let i=0;i<e.notes.length;i++){let n=e.notes[i];n.afterIndex>=t.startIndex&&n.afterIndex<=t.endIndex&&o.push(i)}let r=[];for(let n=0;n<i;n++){let o=e.blocks[n];o.startIndex>=t.startIndex&&o.endIndex<=t.endIndex&&(e.blocks.some((e,r)=>r>n&&r<i&&o.startIndex>=e.startIndex&&o.endIndex<=e.endIndex&&e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex)||r.push(n))}return{endMessageExclusive:Math.min(t.endIndex+1,e.messages.length),dividerNoteIndices:t.dividers.map(()=>-1),endNoteExclusive:o.length>0?o.at(-1)+1:e.notes.filter(e=>e.afterIndex<=t.endIndex).length,noteIndices:o,childBlockIndices:r,childSectionIndices:r.map(i=>t.dividers.filter(t=>e.blocks[i].startIndex>=t.index).length)}}),Z=e.blocks.map(e=>{var t;let n,r,a,l,s,d,c,h,p,f,u;return r=(n=v("rect"===(t={...e,wrap:e.wrap??i.wrap,dividers:e.dividers.map(e=>({...e,wrap:e.wrap??i.wrap}))}).type?"":t.label?I([`${t.type} [`,L($(t.label,t.labelContent)),"]"]):t.type,{transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing,fontFamily:o.groupFont,...t.wrap?{maxWidth:240}:{}})).text,a=o.groupHeaderFontSize*w,s=Math.ceil(Math.max(0,((l=r?n:{width:0,height:0,lines:[],lineHeight:a}).lines.length-1)*l.lineHeight)),d=Math.max(2*o.groupPaddingX,2*o.groupLabelPaddingX),c="rect"===t.type?0:l.width+d,h="rect"===t.type?0:Math.max(18,o.groupHeaderFontSize+o.groupPaddingY)+s,p=b+s,f="rect"===t.type?o.groupPaddingY:h+o.groupPaddingY,u=t.dividers.map(e=>{let t=v(e.label?I(["[",L($(e.label,e.labelContent)),"]"]):"",{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...e.wrap?{maxWidth:240}:{}}),i=t.text,n=e.label?t:{width:0,height:0,lines:[],lineHeight:g},r=Math.max(14,Math.ceil(n.lineHeight/2+6)),a=Math.max(0,r-14),l=Math.ceil(Math.max(0,(n.lines.length-1)*n.lineHeight));return{index:e.index,label:e.label,displayLabel:i,block:t,metrics:n,firstLineOffset:r,extraFontOffset:a,extraLinesHeight:l,requiredExtraBefore:24+l+a,noteContentOffset:Math.ceil(Math.max(28+l+a,r+(n.lines.length-1)/2*n.lineHeight+n.height/2+o.groupPaddingY))}}),{headerText:r,block:n,headerMetrics:l,tabWidth:c,tabHeight:h,extraHeaderLinesHeight:s,blockPadTop:p,blockHeaderExtra:x+s,enclosingHeaderStep:f,contentTopPadding:"rect"===t.type?o.groupPaddingY:Math.max(p,h+o.groupPaddingY),dividers:u}}),N=eg.get(e),O=new Map,X=new Map,A=new Map,j=new Map,D=new Map;for(let t=0;t<e.blocks.length;t++){let i=e.blocks[t],n=X.get(i.startIndex)??[];n.push(t),X.set(i.startIndex,n);let o=R[t],r=o.noteIndices[0];if(void 0!==r){let e=A.get(r)??[];e.push(t),A.set(r,e)}for(let e of o.childBlockIndices)j.set(e,t)}let G=new Set,V=new Set;if(N){let t=new Map(N.filter(e=>"open"===e.kind).map(e=>[e.blockIndex,e.noteIndex]));for(let i=0;i<e.blocks.length;i++){let n=e.blocks[i],o=R[i],r=new Set(o.childSectionIndices),a=n.startIndex,l=t.get(i);for(let e=0;e<=n.dividers.length;e++){let t=n.dividers[e]?.index??o.endMessageExclusive,s=o.dividerNoteIndices[e]??o.endNoteExclusive;a!==t||l!==s||r.has(e)||V.add(i),a=t,l=s}o.childBlockIndices.some(t=>e.blocks[t].startIndex===R[t].endMessageExclusive&&0===R[t].noteIndices.length)&&V.add(i)}for(let t=0;t<e.blocks.length;t++){let e=j.get(t);V.has(t)&&void 0!==e&&V.add(e)}}let J=e=>(X.get(e)??[]).filter(t=>!G.has(t)&&R[t].endMessageExclusive>e),K=e=>0===e.length?0:Z[e[0]].blockHeaderExtra+e.slice(1).reduce((e,t)=>e+Z[t].enclosingHeaderStep,0);for(let t=0;t<e.blocks.length;t++){if(V.has(t)||"par_over"===e.blocks[t].type)continue;let i=Z[t],n=R[t];for(let[o,r]of i.dividers.entries()){let i=eW(e.blocks[t],n,e,o);if(void 0!==i){D.set(i,Math.max(D.get(i)??0,r.noteContentOffset));continue}if(r.index>=n.endMessageExclusive)continue;let a=r.requiredExtraBefore;for(let t of n.childBlockIndices)e.blocks[t]?.startIndex===r.index&&(a+=Z[t].blockHeaderExtra);let l=O.get(r.index)??0;O.set(r.index,Math.max(l,a))}}let Q=new Map,ee=new Map,et=new Map;for(let t=0;t<e.actors.length;t++){let i=e.actors[t];if(void 0!==i.createMessageIndex&&i.createMessageIndex<e.messages.length){let e=Q.get(i.createMessageIndex)??[];e.push(t),Q.set(i.createMessageIndex,e)}if(void 0!==i.destroyMessageIndex&&i.destroyMessageIndex<e.messages.length){let e=ee.get(i.destroyMessageIndex)??[];e.push(i.id),ee.set(i.destroyMessageIndex,e)}}let ei=new Map;for(let t=0;t<e.notes.length;t++){let i=e.notes[t],n=ei.get(i.afterIndex)??[];n.push({note:i,index:t}),ei.set(i.afterIndex,n)}let en=Array(e.notes.length),eo=new Map,er=[],ea=new Map;for(let t of e.activationEvents??[]){let e=ea.get(t.messageIndex)??[];e.push(t),ea.set(t.messageIndex,e)}let el=(e,t)=>{let i=eo.get(e)??[];i.push({startY:t,depth:i.length}),eo.set(e,i)},es=(e,t)=>{let i=eo.get(e);if(!i||0===i.length)return;let{startY:n,depth:o}=i.pop(),r=W.get(e);void 0===r||t<=n||er.push({actorId:e,x:_[r]-d/2+4*o,topY:n,bottomY:t,width:d})},ed=(e,t)=>{for(let i of ea.get(e)??[])"activate"===i.kind?el(i.actorId,t):es(i.actorId,t)},ec=(e,t)=>{let n=v($(e.text,e.textContent),{transform:o.nodeTextTransform,fontSize:o.nodeLabelFontSize,fontWeight:o.nodeLabelFontWeight,letterSpacing:o.nodeLetterSpacing,...e.wrap??i.wrap?{maxWidth:240}:{}}),r=Math.max(60,n.width+2*o.nodePaddingX),a=n.height+2*o.nodePaddingY,l=W.get(e.actorIds[0]??"")??0,d;if("left"===e.position)d=_[l]-k[l]/2-r-s;else if("right"===e.position)d=_[l]+k[l]/2+s;else if(e.actorIds.length>1){let t=W.get(e.actorIds[e.actorIds.length-1]??"")??l;d=(_[l]+_[t])/2-r/2}else d=_[l]-r/2;return{text:e.text,block:n,x:d,y:t,width:r,height:a,position:e.position,actors:e.actorIds}},eh=Array(e.blocks.length),ef=[],eu=-1/0,em=q,eb=-1/0,ex=0,ey=0,ek=0,ew=0,e$=new Map,eI=(t,i,n)=>{let o=0,r=[];for(let[o,a]of e$){let l=e.blocks[o];for(let e=l.startIndex;e<a.messageEnd;e++)U[e]&&r.push(U[e].bounds);for(let e of R[o].noteIndices)e<a.noteEnd&&en[e]&&r.push(en[e]);for(let e of a.priorChildren)eh[e]&&r.push(eh[e]);for(let[s,d]of l.dividers.entries()){let c=Z[o].dividers[s];if(!d.label)continue;let h=eW(l,R[o],e,s),p=void 0!==h&&h<a.noteEnd?en[h]:void 0===h&&d.index<a.messageEnd?U[d.index]?.bounds:void 0;if(p&&r.push({x:p.x,y:p.y-c.metrics.height-8,width:c.metrics.width,height:c.metrics.height}),void 0===h&&i===d.index||void 0!==h&&n===h){let e=c.metrics.height+8;t={x:t.x,y:t.y-e,width:Math.max(t.width,c.metrics.width),height:t.height+e}}}}for(let e=0;e<=r.length;e++){let e=r.find(e=>t.x<e.x+e.width+8&&t.x+t.width+8>e.x&&t.y+o<e.y+e.height+8&&t.y+t.height+o+8>e.y);if(!e)break;o=e.y+e.height+8-t.y}return o},eE=e=>{let t=[];for(let i=e;void 0!==i&&!G.has(i);i=j.get(i))t.push(i);for(let e=t.length-1;e>=0;e--){let i=t[e],n=Math.max(em,eu,eb)+8;ef[i]={top:n,dividerY:[]},G.add(i),em=eb=n+Z[i].enclosingHeaderStep}},eF=t=>{let i=e.blocks[t],n=R[t],r=ef[t]?.top,a=void 0!==r&&i.startIndex===n.endMessageExclusive&&0===n.noteIndices.length?r+Z[t].blockPadTop:en[n.noteIndices[0]??-1]?.y??B;G.add(t);let l=eC(i,Z[t],n,e,W,T,U,en,eh,o,g,a,ef[t]);eh[t]=l,eu=Math.max(eu,l.y+l.height);let s=e$.get(t);s&&(em=Math.max(em,s.bottom,eu),B=Math.max(B,em+u/2),e$.delete(t))},eH=()=>{if(N){for(;ek<N.length;){let t=N[ek];if(t.messageIndex>U.length||t.noteIndex>ex)break;let i=t.blockIndex;if("open"===t.kind&&V.has(i)&&eE(i),"open"===t.kind&&"par_over"===e.blocks[i].type){eE(i);let n=Math.max(0,...Z[i].dividers.map(e=>e.noteContentOffset));eb+=n,em=eb,B=Math.max(B,eb+u/2),e$.set(i,{messageY:B,contentBottom:em,completedBottom:eu,reservedBottom:eb,bottom:em,messageEnd:e.blocks[i].startIndex,noteEnd:t.noteIndex,priorChildren:[]}),ew++}if("divider"===t.kind){let e=e$.get(i);if(e){e.bottom=Math.max(e.bottom,em,eu,eb),e.messageEnd=t.messageIndex,e.noteEnd=t.noteIndex,e.priorChildren=R[i].childBlockIndices.filter(e=>eh[e]),({messageY:B,contentBottom:em,completedBottom:eu,reservedBottom:eb}=e),ew++,ek++;continue}let n=Z[i].dividers[t.dividerIndex],o=Math.max(em,eu,eb)+8;V.has(i)?(ef[i].dividerY[t.dividerIndex]=o,em=eb=o+n.noteContentOffset):eb=o+n.noteContentOffset}"close"===t.kind&&eF(i),ek++}return}for(;ey<e.blocks.length;){let e=ey,t=R[e];if(t.endMessageExclusive>U.length||t.endNoteExclusive>ex)break;eF(e),ey++}},eT=(e,t)=>{let i=t;for(let{note:t,index:n}of ei.get(e)??[]){let e=ew;for(let t of(eH(),e!==ew&&(i=B),i=Math.max(i,eu+8,eb),A.get(n)??[])){let e=ef[t]?.top;void 0!==e&&(i=Math.max(i,e+Z[t].contentTopPadding))}let o=(A.get(n)??[]).filter(e=>!G.has(e)),r=D.get(n)??0;if(o.length>0||r>0){let e=r+(o.length>0?Z[o[0]].contentTopPadding+o.slice(1).reduce((e,t)=>e+Z[t].enclosingHeaderStep,0):0);for(let t of(i=Math.max(i,Math.max(em,eu)+8+e),o))G.add(t)}let a=ec(t,i),l=eI(a,void 0,n);l>0&&(i+=l,a=ec(t,i)),en[n]=a,em=Math.max(em,a.y+a.height),ex=n+1,i=a.y+a.height+4}ei.has(e)&&(B=Math.max(B,i+u/2))};eT(-1,B);for(let t=0;t<e.messages.length;t++){let i=e.messages[t],n=C[t],r=W.get(i.from)??0,a=W.get(i.to)??0,l=i.from===i.to;eH();let s=J(t),d=Math.max(O.get(t)??0,K(s));for(let e of Q.get(t)??[]){let t=T[e].height/2;d=d>0?d+Math.max(0,t-12):t+8}B+=d+n.extraAboveHeight;let c=_[r],h=_[a],p=e.actors[a].createMessageIndex!==t||"participant"!==e.actors[a].type||l?h:h-Math.sign(h-c)*k[a]/2,f=()=>{let r=function(e,t,i,n,o,r){let a=e.from===e.to;if(a){let l=r+Math.max(20,t.labelMetrics.height)/2,s=eM(t.displayLabel,n+30+8,l,"start",i.edgeLabelFontSize,i.edgeLabelFontWeight,i.edgeLetterSpacing,t.block),d={x:n-t.startPad,y:r-t.markerHalfHeight,width:30+t.startPad+i.lineWidth/2,height:20+2*t.markerHalfHeight},c=t.label?eS(d,s.bounds):d;return{from:e.from,to:e.to,label:t.label,labelContent:t.labelContent,lineStyle:e.lineStyle,startHead:e.startHead,endHead:e.endHead,centralStart:e.centralStart??!1,centralEnd:e.centralEnd??!1,x1:n,x2:o,y:r,isSelf:a,points:[{x:n,y:r},{x:n+30,y:r},{x:n+30,y:r+20},{x:o,y:r+20}],labelPosition:s,bounds:c}}let l=Math.max(2.85,i.lineWidth/2+2),s=Math.max(10,t.labelMetrics.height/2+l),d=eM(t.displayLabel,(n+o)/2,r-s,"middle",i.edgeLabelFontSize,i.edgeLabelFontWeight,i.edgeLetterSpacing,t.block),c=n<=o?t.startPad:t.endPad,h=n<=o?t.endPad:t.startPad,p=Math.min(n,o)-c,g=Math.max(n,o)+h,f={x:p,y:r-t.markerHalfHeight,width:g-p,height:2*t.markerHalfHeight},u=t.label?eS(f,d.bounds):f;return{from:e.from,to:e.to,label:t.label,labelContent:t.labelContent,lineStyle:e.lineStyle,startHead:e.startHead,endHead:e.endHead,centralStart:e.centralStart??!1,centralEnd:e.centralEnd??!1,x1:n,x2:o,y:r,isSelf:a,points:[{x:n,y:r},{x:o,y:r}],labelPosition:d,bounds:u}}(i,n,o,c,p,B);for(let i of(U[t]=r,Q.get(t)??[]))T[i]=eL(e.actors[i],y[i],_[i],B-T[i].height/2);return r},b=f(),x=b.bounds.y,v=0,w=new Set(s),M=(X.get(t)??[]).filter(e=>w.has(e)||ef[e]?.top!==void 0&&!eh[e]);if(M.length>0){let t=[];for(let i of M){for(let e of R[i].childBlockIndices)eh[e]&&(t[e]=eh[e]);t[i]=eC(e.blocks[i],Z[i],R[i],e,W,T,U,en,t,o,g,B,ef[i]);let n=ef[i]?.top;void 0!==n?v=Math.max(v,n-t[i].y):x=Math.min(x,t[i].y)}}let S=Math.max(0,v,(s.length>0?Math.max(em,eu,eb):Math.max(eu,eb))+8*(s.length>0)-x);S>0&&(B+=S,b=f());let $=eI(b.bounds,t);for(let e of($>0&&(B+=$,b=f()),s))G.add(e);em=Math.max(em,b.bounds.y+b.bounds.height,...(Q.get(t)??[]).map(e=>T[e].bounds.y+T[e].bounds.height)),ed(t,B);let I=ee.get(t);if(I)for(let e of I)et.set(e,B);i.activate&&el(i.to,B),i.deactivate&&es(i.from,B);let L=l?Math.max(m,Math.ceil(n.labelMetrics.height)+10):0;B+=l?L+u:u;let z=Q.get(t);if(z){let e=Math.max(...z.map(e=>{let t=T[e];return t.bounds.height-t.height/2}));B+=e}let P=z?em+8:b.y+L+14;eT(t,P)}eH();let eY=Math.max(U[U.length-1]?.y??B,B-u/2);for(let[t,i]of(ed(e.messages.length,eY),eo))for(;i.length>0;)es(t,eY);for(let t of T)e.actors[W.get(t.id)]?.external&&(t.external=!0);for(let[t,i]of U.entries()){let n=e.messages[t];void 0!==n.id&&(i.id=n.id),void 0!==n.parentId&&(i.parentId=n.parentId)}for(let[t,i]of eh.entries()){let n=e.blocks[t];void 0!==n.id&&(i.id=n.id),void 0!==n.parentId&&(i.parentId=n.parentId)}for(let[t,i]of en.entries()){let n=e.notes[t];i&&n?.id!==void 0&&(i.id=n.id),i&&n?.parentId!==void 0&&(i.parentId=n.parentId)}let eq=en.filter(e=>void 0!==e),eB=eh.reduce((e,t)=>Math.max(e,t.y+t.height),0);eB>0&&(B=Math.max(B,eB+8));let eU=B,eR=E.map(({box:e,memberIdxs:t,block:i})=>{let n=Math.min(...t.map(e=>T[e].bounds.x))-8,o=Math.max(...t.map(e=>T[e].bounds.x+T[e].bounds.width))+8;return e.label&&(o=Math.max(o,n+i.width+16)),{label:e.label,block:i,labelY:a+F/2,color:e.color,x:n,y:a,width:o-n,height:eU+8-a}}),eZ=B+a,eN=r,eO=0;for(let e of T){let t=e.bounds;eN=Math.min(eN,t.x),eO=Math.max(eO,t.x+t.width)}for(let e of eh)eN=Math.min(eN,e.x),eO=Math.max(eO,e.x+e.width);for(let e of eq)eN=Math.min(eN,e.x),eO=Math.max(eO,e.x+e.width);for(let e of eR)eN=Math.min(eN,e.x),eO=Math.max(eO,e.x+e.width);for(let e of er)eN=Math.min(eN,e.x),eO=Math.max(eO,e.x+e.width);for(let e of U){eN=Math.min(eN,e.bounds.x);let t=e.isSelf&&e.label?8:0;eO=Math.max(eO,e.bounds.x+e.bounds.width+t)}let eX=eN<r?r-eN:0;if(eX>0){ez({actors:T,messages:U,blocks:eh,notes:eq,boxes:eR,activations:er,lifelines:[],destructions:[]},eX,0);for(let e=0;e<_.length;e++)_[e]+=eX}let eA=e.actors.map((e,t)=>{let i=T[t],n=i.bounds.y+i.bounds.height;return{actorId:e.id,x:_[t],topY:n,bottomY:et.get(e.id)??eZ-a}}),ej=e.actors.filter(e=>et.has(e.id)).map(e=>({actorId:e.id,x:_[W.get(e.id)],y:et.get(e.id)}));return eP({width:Math.max(eO+eX+r,200),height:Math.max(eZ,100),accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:T,lifelines:eA,messages:U,activations:er,blocks:eh,notes:eq,boxes:eR,destructions:ej},void 0===e.title?void 0:$(e.title,e.titleContent),o,r,a)}(function(e,t){!function(e,t=!1){let i;if(!e||"zenuml"!==e.kind||!Array.isArray(e.participants)||!Array.isArray(e.statements))throw Error("Invalid ZenUML body");for(let t of[e.title,e.accessibilityTitle,e.accessibilityDescription])if(void 0!==t&&"string"!=typeof t)throw Error("ZenUML metadata must be text");void 0!==e.starter&&en(e.starter);let n=new Set;for(let i of e.participants){if(en(i.id),"string"!=typeof i.label||/[\r\n]/.test(i.label))throw Error("ZenUML aliases must be single-line text");if(n.has(i.id))throw Error(`Duplicate ZenUML participant: ${i.id}`);if(n.add(i.id),!Array.isArray(i.annotations)||i.annotations.some(e=>"string"!=typeof e||!/^\w+$/.test(e)))throw Error("Invalid ZenUML annotator");if(i.annotations.length>1&&(t||void 0===e.unsupportedSource))throw Error("ZenUML declarations accept one participant annotator");if(void 0!==i.stereotype&&("string"!=typeof i.stereotype||!i.stereotype||/[<>\r\n]/.test(i.stereotype)))throw Error("Invalid ZenUML stereotype");if(void 0!==i.comments&&(!Array.isArray(i.comments)||i.comments.some(e=>"string"!=typeof e)))throw Error("Invalid ZenUML participant comments")}let o=new Set,r=new Set,l=e=>{if("string"!=typeof e)throw Error("ZenUML content must be text")},s=e=>{e&&(en(e.name),void 0!==e.type&&en(e.type))},d=(i,n)=>{if(!Array.isArray(i)||n>128)throw Error("Invalid or excessive ZenUML scope nesting");for(let a of i){if(!a||"object"!=typeof a||r.has(a))throw Error("Cyclic or shared ZenUML statement");if(r.add(a),"string"!=typeof a.id||!a.id||o.has(a.id))throw Error("ZenUML statement identities must be unique");switch(o.add(a.id),a.kind){case"call":if(void 0!==a.from&&en(a.from),void 0!==a.to&&en(a.to),void 0!==a.from&&void 0===a.to)throw Error("An explicit ZenUML caller requires a target");l(a.label),s(a.assignment),d(a.children,n+1);break;case"create":en(a.constructor),void 0!==a.arguments&&l(a.arguments),s(a.assignment),d(a.children,n+1);break;case"message":if(en(a.from),en(a.to),l(a.label),"boolean"!=typeof a.reply)throw Error("ZenUML message reply flag must be boolean");break;case"return":l(a.label);break;case"comment":l(a.text);break;case"fragment":{if(!["if","opt","while","for","forEach","foreach","loop","par","try","critical"].includes(a.type)||!Array.isArray(a.branches)||!a.branches.length||a.branches[0]?.kind!=="body")throw Error("Invalid ZenUML fragment");void 0!==a.condition&&l(a.condition);let e=!1;for(let[t,i]of a.branches.entries()){if(t&&(e||("if"===a.type?!["else-if","else"].includes(i.kind):"try"!==a.type||!["catch","finally"].includes(i.kind))))throw Error("Invalid ZenUML branch order");("else"===i.kind||"finally"===i.kind)&&(e=!0),void 0!==i.condition&&l(i.condition),d(i.statements,n+1)}break}case"opaque":if(l(a.source),t||void 0===e.unsupportedSource)throw Error("Unsupported ZenUML syntax is retained; typed editing and rendering require a fully modelled document");break;default:throw Error("Unknown ZenUML statement kind")}}};if(d(e.statements,0),t&&void 0!==e.unsupportedSource)throw Error("Unsupported ZenUML source cannot be rewritten through typed editing");a("nodes",(i=new Set(e.participants.map(e=>e.id)),void 0!==e.starter&&i.add(e.starter),eU(e.statements,e=>{("call"===e.kind||"message"===e.kind)&&(void 0!==e.from&&i.add(e.from),void 0!==e.to&&i.add(e.to)),"create"===e.kind&&i.add(e.assignment?`${e.assignment.name}:${e.constructor}`:e.constructor)}),i).size),a("edges",o.size)}(e,!0);let i={actors:[],messages:[],blocks:[],notes:[],activationEvents:[],boxes:[],...void 0===e.title?{}:{title:e.title,titleContent:eZ(e.title)},...void 0===e.accessibilityTitle?{}:{accessibilityTitle:e.accessibilityTitle},...void 0===e.accessibilityDescription?{}:{accessibilityDescription:e.accessibilityDescription}},n=new Map,o=new Set(e.participants.map(e=>e.id));e.starter&&o.add(e.starter),eU(e.statements,e=>{o.add(e.id),("call"===e.kind||"message"===e.kind)&&(e.from&&o.add(e.from),e.to&&o.add(e.to)),"create"===e.kind&&o.add(eO(e))});let r="zenuml:outside";for(;o.has(r);)r+=":";let l=e=>{let t=e;for(;o.has(t);)t+=":";return o.add(t),t},s=e=>{let t=e??r;if(!n.has(t)){let o={id:t,label:void 0===e?"":e,type:"participant",labelContent:eZ(e??""),...void 0===e?{external:!0}:{}};i.actors.push(o),n.set(t,o)}return t};for(let t of e.participants){s(t.id);let e=n.get(t.id);e.type=t.annotations.map(e=>eR[e.toLowerCase()]).find(Boolean)??"participant",e.label=[...[...t.annotations.filter(e=>!eR[e.toLowerCase()]).map(e=>`@${e}`),...t.stereotype?[t.stereotype]:[]].map(e=>`\xab${e}\xbb`),t.label].join(`
|
|
20
|
+
`),e.labelContent=eZ(e.label)}let d=e.starter;if(void 0===d)for(let t of e.statements){if("message"===t.kind||"call"===t.kind&&void 0!==t.from){d=t.from;break}if("comment"!==t.kind)break}void 0!==d&&s(d);let c=[],h=new Map,p=[],g=(e,t,n,o,r,a,l=!1,d=e)=>{let c=s(t),h=s(n),p="reply"===a,g={id:e,...r.parentId?{parentId:r.parentId}:{},from:c,to:h,label:o,labelContent:eZ(o),lineStyle:p?"dashed":"solid",startHead:"none",endHead:p?"open":"filled",centralStart:!1,centralEnd:!1,...l?{activate:!0}:{}};i.messages.push(g)},f=(e,t,n,o)=>{let r=W(t),a={id:e,...o.parentId?{parentId:o.parentId}:{},actorIds:[...new Set(n.length?n:[s(o.owner)])],text:r,textContent:{value:r,authored:t,prepared:L(r,"formatted")},position:"over",afterIndex:i.messages.length-1},l=i.notes.length;for(let e of(i.notes.push(a),p))h.get(e).noteIndices.push(l)},u=(e,t,i)=>e.some(e=>"return"===e.kind||"message"===e.kind&&e.reply&&e.from===t&&e.to===i||"fragment"===e.kind&&e.branches.some(e=>u(e.statements,t,i))),m=(e,t)=>{let o=[],r=e=>{for(let i of o)f(i.id,i.text,e,t);o=[]};for(let a of e){if("comment"===a.kind){o.push(a);continue}switch(a.kind){case"call":{let e=a.from??t.owner,n=a.to??t.owner,o=s(e),d=s(n);r([o,d]);let c=o===d,h=a.assignment&&!c&&u(a.children,n,e);g(a.id,e,n,a.assignment&&(c||h)?`${eN(a.assignment)} = ${a.label}`:a.label,t,"call",!0);let p={...t,owner:n,returnTo:e,callAncestors:t.callAncestors};m(a.children,p),!a.assignment||c||h||g(l(`${a.id}:reply`),n,e,eN(a.assignment),p,"reply",!1,a.id),i.activationEvents.push({actorId:d,kind:"deactivate",messageIndex:i.messages.length});break}case"create":{let e=eO(a),o=s(t.owner);s(e),r([o,e]);let d=n.get(e);if(void 0!==d.createMessageIndex)throw Error(`Repeated creation of ZenUML object ${e} cannot share one sequence lifeline`);d.createMessageIndex=i.messages.length;let c=a.assignment&&u(a.children,e,t.owner),h=`\xab${a.arguments||"create"}\xbb`;g(a.id,t.owner,e,a.assignment&&c?`${eN(a.assignment)} = ${h}`:h,t,"creation",!0);let p={...t,owner:e,returnTo:t.owner,callAncestors:t.callAncestors};m(a.children,p),a.assignment&&!c&&g(l(`${a.id}:reply`),e,t.owner,eN(a.assignment),p,"reply",!1,a.id),i.activationEvents.push({actorId:e,kind:"deactivate",messageIndex:i.messages.length});break}case"message":r([s(a.from),s(a.to)]),g(a.id,a.from,a.to,a.label,t,a.reply?"reply":"async"),i.messages.at(-1).endHead="open";break;case"return":r([s(t.owner),s(t.returnTo)]),g(a.id,t.owner,t.returnTo,a.label,t,"reply");break;case"fragment":{o.length&&r([s(t.owner)]);let e=i.blocks.length,n="if"===a.type?"alt":"par"===a.type?"par":"opt"===a.type?"opt":"try"===a.type?"break":"critical"===a.type?"critical":"loop",l=["if","opt","par","critical"].includes(a.type)?a.condition??"":`${a.type}${void 0===a.condition?"":` (${a.condition})`}`,d={id:a.id,...t.parentId?{parentId:t.parentId}:{},type:n,label:l,labelContent:eZ(l),startIndex:i.messages.length,endIndex:i.messages.length-1,dividers:[]};i.blocks.push(d);let g={endMessageExclusive:0,endNoteExclusive:0,dividerNoteIndices:[],noteIndices:[],childBlockIndices:[],childSectionIndices:[]};if(h.set(e,g),void 0!==t.blockIndex){let i=h.get(t.blockIndex);i.childBlockIndices.push(e),i.childSectionIndices.push(t.section)}for(let[n,o]of(c.push({kind:"open",blockIndex:e,messageIndex:i.messages.length,noteIndex:i.notes.length}),p.push(e),("par"===a.type?function(e){let t=[],i=[];for(let n of e)i.push(n),"comment"!==n.kind&&(t.push({kind:"body",statements:i}),i=[]);return(i.length||!t.length)&&t.push({kind:"body",statements:i}),t}(a.branches[0].statements):a.branches).entries())){if(n){let t="else-if"===o.kind?`else if (${o.condition??""})`:"body"===o.kind?"":`${o.kind}${void 0===o.condition?"":` (${o.condition})`}`,n=d.dividers.length;d.dividers.push({index:i.messages.length,label:t,labelContent:eZ(t)}),g.dividerNoteIndices.push(i.notes.length),c.push({kind:"divider",blockIndex:e,dividerIndex:n,messageIndex:i.messages.length,noteIndex:i.notes.length})}0===n?a.condition:o.condition,m(o.statements,{...t,parentId:a.id,blockIndex:e,section:n,scopes:t.scopes})}p.pop(),d.endIndex=i.messages.length-1,g.endMessageExclusive=i.messages.length,g.endNoteExclusive=i.notes.length,ep.set(d,g),c.push({kind:"close",blockIndex:e,messageIndex:i.messages.length,noteIndex:i.notes.length});break}case"opaque":throw Error("Unsupported ZenUML syntax cannot be projected partially")}}o.length&&r([s(t.owner)])};return m(e.statements,{owner:d,section:0,callAncestors:[],scopes:[]}),!i.actors.length&&(i.blocks.length||i.notes.length)&&s(void 0),eg.set(i,c),i}(e),t,n,i)}(t,e.renderOptions,e.styleFace))},projectPositioned:(O=function(e){let t=function({positioned:e,options:t}){let i=new Map(e.lifelines.map(e=>[e.actorId,e.x])),n=new Map;for(let t of e.messages)for(let e of[t.from,t.to])n.has(e)||n.set(e,t.y);let o=new Map;for(let t of e.notes)if(void 0!==t.parentId&&void 0!==t.id){let e=o.get(t.parentId)??[];e.push(t.id),o.set(t.parentId,e)}return{version:1,nodes:[...e.actors.map(e=>({id:e.id,x:ej(e.external?e.x:e.bounds.x),y:ej(e.external?n.get(e.id)??e.y:e.bounds.y),w:ej(e.external?0:e.bounds.width),h:ej(e.external?0:e.bounds.height),shape:e.external?"external-anchor":"rectangle",label:e.label,labelBounds:eA(e.labelPosition.bounds),labelContainer:eA(e.bounds),...e.external?{labelVisibility:"semantic"}:{},role:e.external?"mark":"box"})),...e.notes.map((e,t)=>({id:e.id??`note#${t}`,...void 0===e.parentId?{}:{parentId:e.parentId},x:ej(e.x),y:ej(e.y),w:ej(e.width),h:ej(e.height),shape:"note",label:e.text,...function(e,t,i,n,o="middle"){let r=function(e,t,i,n="middle"){if(e)return{x:eB(t-("start"===n?0:"end"===n?e.width:e.width/2)),y:eB(i-e.height/2),w:eB(e.width),h:eB(e.height)}}(e,t,i,o);return r?{labelBounds:r,labelContainer:{x:eB(n.x),y:eB(n.y),w:eB(n.width),h:eB(n.height)}}:{}}(e.block,e.x+e.width/2,e.y+e.height/2,e),role:"box"}))],edges:e.messages.map((e,n)=>{var o;let r,a,l,s,d,c,h,p;return{id:e.id??`msg#${n}:${e.from}->${e.to}`,...void 0===e.parentId?{}:{parentId:e.parentId},from:e.from,to:e.to,path:e.points.map(e=>[ej(e.x),ej(e.y)]),label:e.label?{x:ej(e.labelPosition.x),y:ej(e.labelPosition.y),text:e.label,bounds:eA(e.labelPosition.bounds)}:void 0,route:t.debug?(o=e.points,r=i.get(e.from),a=i.get(e.to),l=o[0],s=o[o.length-1],d=void 0!==r&&void 0!==l&&1>=Math.abs(l.x-r),c=void 0!==a&&void 0!==s&&1>=Math.abs(s.x-a),h=!e.isSelf&&o.every(t=>1>=Math.abs(t.y-e.y)),p=function(e){for(let t=1;t<e.length;t++){let i=e[t-1],n=e[t];if(Math.abs(i.x-n.x)>.5&&Math.abs(i.y-n.y)>.5)return!1}return!0}(o),{family:"sequence",edgeIndex:n,routeClass:"family-layout",invariant:d&&c&&p?e.isSelf?"self-message":"lifeline-message":"unverified-family-route",bendCount:function(e){if(e.length<3)return 0;let t=0;for(let i=1;i<e.length-1;i++){let n=e[i-1],o=e[i],r=e[i+1],a=.5>=Math.abs(n.x-o.x)&&.5>=Math.abs(o.x-r.x),l=.5>=Math.abs(n.y-o.y)&&.5>=Math.abs(o.y-r.y);!a&&!l&&t++}return t}(o),horizontal:h,sourceLifeline:d,targetLifeline:c,selfMessage:e.isSelf}):void 0}}),groups:e.blocks.map((e,t)=>({id:e.id??`block#${t}:${e.type}`,...void 0===e.parentId?{}:{parentId:e.parentId},x:ej(e.bounds.x),y:ej(e.bounds.y),w:ej(e.bounds.width),h:ej(e.bounds.height),members:void 0===e.id?[]:o.get(e.id)??[],label:e.label})),bounds:{w:ej(e.width),h:ej(e.height)}}}(e);return{...t,edges:t.edges.map(e=>{let t=e.route;return t&&"family"in t&&"sequence"===t.family?{...e,route:{...t,family:"zenuml"}}:e})}},e=>O(e)),lowerScene:n(eX,e=>eX(e))},eG=(t(e=Object.freeze({...A,...eD,contractVersion:2,capabilityEvidence:Object.freeze([])})),e);export{eG as default};
|
package/dist/zenuml.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { R as RenderOptions } from './types-
|
|
2
|
-
import { S as StyleInput } from './svg-styles-
|
|
1
|
+
import { R as RenderOptions } from './types-CLVJCaH2.js';
|
|
2
|
+
import { S as StyleInput } from './svg-styles-BnCoXyYe.js';
|
|
3
3
|
|
|
4
4
|
/** Optional browser-only backend. No ZenUML dependency enters the default graph. */
|
|
5
5
|
declare class ZenUMLBackendError extends Error {
|
package/dist/zenuml.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./zenuml/chunks/chunk-
|
|
1
|
+
import{f as e}from"./zenuml/chunks/chunk-ZNZRIISS.js";import"./zenuml/chunks/chunk-55WS466K.js";import{e as t,j as n,k as r}from"./zenuml/chunks/chunk-3A6S6GNB.js";import"./zenuml/chunks/chunk-6J4BGPB2.js";import"./zenuml/chunks/chunk-IARQ24W3.js";import"./zenuml/chunks/chunk-GC7IPQ5P.js";var o=class extends Error{constructor(e,t){super(t),this.code=e,this.name="ZenUMLBackendError"}code},i=Object.freeze({maturity:"experimental",sourcePreservation:!0,nativeParse:!1,typedEditing:!1,rendering:"optional-browser-iframe",asynchronous:!0,terminal:!1,node:!1,cli:!1,mcp:!1,backend:"@zenuml/core@3.47.9",nativeScene:!1,styles:!1,palettes:!0,rolePaints:!0,reusableSession:!0});function s(e){try{return n(()=>{let n=r(e);return t(n,"ZenUML style",{allowUndefinedObjectProperties:!0}),n})}catch(e){throw new o("UNSUPPORTED_APPEARANCE",e instanceof Error?e.message:String(e))}}function a(e){let t;if(typeof document>"u"||typeof MessageChannel>"u")throw new o("UNSUPPORTED_RUNTIME","ZenUML rendering requires a browser document; use the optional browser backend.");try{t=new URL(e.backendURL,document.baseURI)}catch{throw new o("BACKEND_UNAVAILABLE","The ZenUML backend URL is invalid.")}if(!["http:","https:"].includes(t.protocol)||t.origin!==new URL(document.baseURI).origin)throw new o("BACKEND_UNAVAILABLE","The ZenUML frame script must be served from the same HTTP(S) origin.");let n=void 0===e.style?void 0:s(e.style),r=e.timeoutMs??3e4,i=!1,a=0,d=0,c,l,u,m=new Set,p=[],h=!1,f=e=>new o("BACKEND_UNAVAILABLE",e),U=()=>{c?.remove(),c=void 0,l=void 0,d=0},y=(e,n,r)=>new Promise((i,s)=>{d>=64&&U(),d++;let a=new MessageChannel,m=!1,p=()=>{m=!0,clearTimeout(y),a.port1.close(),a.port2.close(),u===h&&(u=void 0)},h=e=>{m||(p(),"INVALID_SOURCE"!==e.code&&U(),s(e))};u=h;let y=setTimeout(()=>h(f("ZenUML backend did not complete before its deadline.")),r);a.port1.onmessage=e=>{if(m)return;let t=e.data;t?.ok===!0&&"string"==typeof t.svg?(p(),i(t.svg)):h(new o(t?.code==="INVALID_SOURCE"?"INVALID_SOURCE":"RENDER_FAILED",String(t?.message??"ZenUML rendering failed.")))},Promise.resolve().then(()=>m?void 0:(()=>{if(l)return l;(c=document.createElement("iframe")).style.cssText="position:fixed;left:-100000px;top:0;width:1024px;height:768px;visibility:hidden;pointer-events:none;border:0",c.setAttribute("aria-hidden","true"),c.setAttribute("sandbox","allow-scripts allow-same-origin"),l=new Promise(e=>{c.onload=()=>e()});let e=t.href.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");return c.srcdoc=`<!doctype html><html><head><script src="${e}"></script></head><body></body></html>`,(document.body??document.documentElement).append(c),l})()).then(()=>{m||u!==h||c?.contentWindow?.postMessage({type:"agentic-zenuml",source:e,appearance:n},t.origin,[a.port2])}).catch(()=>h(f("The ZenUML frame could not be loaded.")))});return{async render(e,t={}){if(i)throw f("The ZenUML renderer has been disposed.");if("string"!=typeof e||!/^\s*zenuml\b/.test(e)||!e.replace(/^\s*zenuml\b/,"").trim())throw new o("INVALID_SOURCE","Expected a nonempty ZenUML document.");if(a>=32)throw f("The ZenUML renderer already has 32 pending requests.");a++;let d,c,l,u,U,w=new Promise((e,t)=>{u=e,U=t}),L,M=new Promise((e,t)=>{L=t});M.catch(()=>{});let b=!1,E=()=>{b=!0,a--,m.delete(A);let e=p.indexOf(Z);e>=0&&p.splice(e,1)},g=e=>{b||(E(),U(e))},A=e=>{L(e),g(e)},Z=async()=>{if(!b)try{let t;if(i)throw f("The ZenUML renderer has been disposed.");if(void 0===c)t=await y(e,void 0,d);else{let n=performance.now(),r,o=new Promise((e,t)=>{r=setTimeout(()=>t(f("ZenUML palette admission did not complete before its deadline.")),d)}),s;try{s=await Promise.race([l,M,o])}finally{clearTimeout(r)}if(i)throw f("The ZenUML renderer has been disposed.");t=await y(e,s,Math.max(0,d-(performance.now()-n)))}b||(E(),u(t))}catch(e){g(e)}};m.add(A),p.push(Z);try{if(d=t.timeoutMs??r,!Number.isFinite(d)||d<=0)throw f("timeoutMs must be positive and finite.");let e="style"in t?t.style:n;c=void 0===e?void 0:s(e),b||(l=void 0===c?Promise.resolve(void 0):import("./zenuml/chunks/appearance-5RM5MVM2.js").then(e=>{try{return e.resolveZenUMLAppearance(c)}catch(e){throw new o("UNSUPPORTED_APPEARANCE",e instanceof Error?e.message:String(e))}},()=>{throw f("The ZenUML palette module could not be loaded.")})).catch(()=>{})}catch(e){g(e)}return h||(h=!0,queueMicrotask(async()=>{try{for(;p.length;)await p.shift()()}finally{h=!1}})),w},dispose(){i=!0;let e=f("The ZenUML renderer has been disposed.");for(let t of(u?.(e),m))t(e);U()}}}async function d(e,t){let n=a(t);try{return await n.render(e)}finally{n.dispose()}}var c=Object.freeze({maturity:"experimental",sourcePreservation:!0,nativeParse:!0,typedEditing:!0,rendering:"native-scene",asynchronous:!0,terminal:!0,node:!0,cli:!0,mcp:!0,backend:"native-sequence-scene",nativeScene:!0,styles:!0,palettes:!0,rolePaints:!0,reusableSession:!0});function l(t,n={},r=3e4){if(!t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("ZenUML render options must be an object.");if("backendURL"in t)throw TypeError("backendURL belongs to createUpstreamZenUMLRenderer/renderUpstreamZenUMLSVG; native ZenUML needs no backend URL.");let{timeoutMs:o=r,...i}=t;if(!Number.isFinite(o)||o<=0)throw TypeError("timeoutMs must be positive and finite.");return{timeout:o,options:e({...n,...i})}}function u(e={}){let t=l(e),n=[],r=new Set,i=!1,s=0,a=!1,d=e=>new o("BACKEND_UNAVAILABLE",e);return{async render(e,c={}){if(i)throw d("The ZenUML renderer has been disposed.");if("string"!=typeof e||!e.trim())throw new o("INVALID_SOURCE","Expected a nonempty ZenUML document.");if(s>=32)throw d("The ZenUML renderer already has 32 pending requests.");s++;let u,m,p,h=new Promise((e,t)=>{m=e,p=t}),f,U=new Promise((e,t)=>{f=t});U.catch(()=>{});let y=!1,w,L=()=>{y=!0,clearTimeout(w),s--,r.delete(M);let e=n.indexOf(b);e>=0&&n.splice(e,1)},M=e=>{y||(f(e),L(),p(e))},b=async()=>{if(!y){w=setTimeout(()=>M(d("ZenUML rendering did not complete before its deadline.")),u.timeout);try{let t=async()=>{let[{default:t},{renderLoadedFamilySvg:n}]=await Promise.all([import("./zenuml/chunks/zenuml-N3LZMB2G.js"),import("./zenuml/chunks/render-core-ECIWU5ZS.js")]);if(y)throw d("The ZenUML request is no longer active.");return n(e,u.options,t)},n=await Promise.race([t(),U]);y||(L(),m(n))}catch(e){M(e)}}};r.add(M),n.push(b);try{u=l(c,t.options,t.timeout)}catch(e){M(e)}return a||(a=!0,queueMicrotask(async()=>{try{for(;n.length;)await n.shift()()}finally{a=!1}})),h},dispose(){i=!0;let e=d("The ZenUML renderer has been disposed.");for(let t of r)t(e)}}}async function m(e,t={}){let n=u(t);try{return await n.render(e)}finally{n.dispose()}}export{i as UPSTREAM_ZENUML_CAPABILITIES,c as ZENUML_CAPABILITIES,o as ZenUMLBackendError,a as createUpstreamZenUMLRenderer,u as createZenUMLRenderer,d as renderUpstreamZenUMLSVG,m as renderZenUMLSVG};
|
|
@@ -49,20 +49,89 @@ from `verify.ok` alone.
|
|
|
49
49
|
|
|
50
50
|
## Directory record
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
Evidence reviewed **2026-10-29** for the eight destinations in the
|
|
53
|
+
[original checklist](https://x.com/soraiadev/status/2082500548134056063).
|
|
54
|
+
“Listed” requires a public entry; submission and account ownership are separate
|
|
55
|
+
states. Search-index evidence is labelled below because it cannot establish
|
|
56
|
+
live endpoint health. Review dates do not replace the source's own test or
|
|
57
|
+
publication date. A failed lookup does not establish that a listing is absent.
|
|
55
58
|
|
|
56
|
-
| Directory |
|
|
59
|
+
| Directory / evidence | Status and date | Next action |
|
|
57
60
|
|---|---|---|
|
|
58
|
-
| Official MCP Registry
|
|
59
|
-
| OpenAI Plugins |
|
|
60
|
-
| Claude
|
|
61
|
-
| Cursor Directory |
|
|
62
|
-
| MCPServers.org |
|
|
63
|
-
| PulseMCP |
|
|
64
|
-
| Smithery
|
|
65
|
-
| Glama |
|
|
61
|
+
| [Official MCP Registry: immutable `0.4.1` record](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.adewale%2Fagentic-mermaid/versions/0.4.1) | **Historical publication confirmed; current latest unverified.** The 2026-10-16 audit reported `0.4.1` as latest. The API could not be retrieved on 2026-10-29. Published 2026-07-31 by [release run](https://github.com/adewale/agentic-mermaid/actions/runs/30626742621). | Recheck the live latest record against npm and root [`server.json`](../server.json); keep that manifest as the only publication authority. |
|
|
62
|
+
| [OpenAI Plugins](https://platform.openai.com/plugins) | **Desired; no submission receipt recorded.** Current [submission instructions](https://developers.openai.com/plugins/deploy/submission) checked 2026-10-29. | Prepare the required package and review materials below, then complete the verified developer/account flow. |
|
|
63
|
+
| [Claude directory](https://claude.com/resources/articles/build-plugins-for-claude) | **Desired; no submission receipt recorded.** New portal announced 2026-09-25; accepts a single remote connector or a plugin bundle from developers on paid Claude plans. The old Team/Enterprise-only note is obsolete. | Submit the hosted URL through the portal linked from the announcement; optionally bundle the existing diagram-workflow skill. |
|
|
64
|
+
| [Cursor Directory](https://cursor.directory/) | **Desired; current listing unconfirmed.** The public catalog is a plugin directory, checked 2026-10-29. Neither the catalog view nor search results established an Agentic Mermaid entry. | Search the current catalog while signed in and use its current plugin submission flow; record its receipt. |
|
|
65
|
+
| [MCPServers.org listing](https://mcpservers.org/servers/adewale/agentic-mermaid) | **Public search-index evidence**, rechecked 2026-10-29 via the [localized listing](https://mcpservers.org/zh-CN/servers/adewale/agentic-mermaid). The canonical page could not be retrieved. The index supports listing discovery, not current page or endpoint health; the July submission has no retained receipt. | Inspect the listing in a browser and request an update only if the endpoint/copy is wrong. |
|
|
66
|
+
| [PulseMCP](https://www.pulsemcp.com/servers) | **Historical listing, current entry unconfirmed.** July's record said “Listed as Agentic Mermaid,” but retained no entry URL. On 2026-10-29 the directory still announces that new submissions and listing changes are paused. | Recover the existing entry URL when lookup is available; do not assume Registry ingestion guarantees a current listing or submit a duplicate. |
|
|
67
|
+
| [Smithery service transition](https://smithery.ai/future) | **No verified entry or receipt recorded.** The notice checked 2026-10-29 ends proxy services, accounts, API keys, CLI and SDKs on **2026-10-31**. A curated public directory with direct server URLs remains. | Do not start the retiring account/proxy publishing flow described in older [publishing docs](https://smithery.ai/docs/build/publish). Confirm the continuing directory's intake process; use the canonical hosted URL for any future entry. |
|
|
68
|
+
| [Glama connector](https://glama.ai/mcp/connectors/io.github.adewale/agentic-mermaid) | **Public listing found; ownership unconfirmed.** The page retrieved on 2026-10-29 reports “Healthy,” with **Last Tested 2026-10-16**. This is the directory's dated result, not a fresh independent endpoint probe. | Use the listing's ownership flow to verify the domain or GitHub account. Do not equate automatic indexing with an ownership claim. |
|
|
69
|
+
|
|
70
|
+
### Version and evidence maintenance
|
|
71
|
+
|
|
72
|
+
On 2026-10-29, `npm view agentic-mermaid version --json` returned `0.5.3`.
|
|
73
|
+
This Markdown file ships in the npm package, so changing it requires a new
|
|
74
|
+
source version rather than different contents under published `0.5.3`.
|
|
75
|
+
Root `server.json`, its npm package entry, `package.json`, and `src/version.ts`
|
|
76
|
+
now prepare **source version `0.5.4`**. npm returned E404 for `0.5.4` during
|
|
77
|
+
this review. These source changes do not establish npm or Registry publication,
|
|
78
|
+
or the hosted deployment version.
|
|
79
|
+
The 2026-10-16 audit reported npm and the Registry latest record as `0.4.1`,
|
|
80
|
+
with `0.4.2` in source. Retain those as historical observations.
|
|
81
|
+
|
|
82
|
+
The Registry latest API could not be retrieved during this review, and the
|
|
83
|
+
hosted MCP version was not rechecked. Before publishing or updating a listing,
|
|
84
|
+
query the [Registry latest search](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.adewale%2Fagentic-mermaid&version=latest)
|
|
85
|
+
and initialize the hosted MCP endpoint independently. Do not infer either
|
|
86
|
+
version from a source manifest, npm release, or third-party health badge.
|
|
87
|
+
|
|
88
|
+
The July MCPServers.org submission has no retained receipt ID. Its public
|
|
89
|
+
listing above is the available evidence. For every future submission, add the
|
|
90
|
+
timestamp, resulting listing or receipt URL/ID, submitted version, review status,
|
|
91
|
+
ownership status, and exact remaining action here. Keep credentials and private
|
|
92
|
+
reviewer data out of public records.
|
|
93
|
+
|
|
94
|
+
### Remaining OpenAI submission materials
|
|
95
|
+
|
|
96
|
+
The [official submission guide](https://developers.openai.com/plugins/deploy/submission),
|
|
97
|
+
reviewed on 2026-10-29, separates the package from portal setup. Upload a ZIP
|
|
98
|
+
that declares the remote MCP server; complete developer identity verification,
|
|
99
|
+
the portal's domain challenge, connection setup and automated scans separately.
|
|
100
|
+
Initial MCP review needs five positive and three negative cases plus an
|
|
101
|
+
accessible video walkthrough. These review materials can be supplied through
|
|
102
|
+
the package or portal; private reviewer credentials stay outside the ZIP.
|
|
103
|
+
|
|
104
|
+
Review also requires HTTPS website, support-page, privacy-policy and
|
|
105
|
+
terms-of-service URLs. The email above is a contact, not a support-page URL.
|
|
106
|
+
The three example prompts are not a completed review package. Approved hosted
|
|
107
|
+
terms, a support-page URL, a walkthrough, the package, completed review cases
|
|
108
|
+
and the portal's exact challenge token are not recorded here. The MIT source
|
|
109
|
+
license does not establish hosted-service terms.
|
|
110
|
+
|
|
111
|
+
## Additional opportunities reviewed on 2026-10-29
|
|
112
|
+
|
|
113
|
+
These are researched candidates, not submitted entries or claims that the
|
|
114
|
+
services first launched after July.
|
|
115
|
+
|
|
116
|
+
| Opportunity / primary source | Fit and remaining work |
|
|
117
|
+
|---|---|
|
|
118
|
+
| [MCP.Directory](https://mcp.directory/submit) | Accepts a public GitHub URL and optional npm package. Search for an existing entry before submitting `adewale/agentic-mermaid` with npm package `agentic-mermaid`; use the directory's update process if one exists. No receipt recorded. |
|
|
119
|
+
| [Cline MCP Marketplace](https://github.com/cline/mcp-marketplace) | The current submission instructions require a repository URL, 400×400 PNG logo, reason for inclusion, and observed successful installation by Cline from the README or `llms-install.md`. Check for an existing entry before preparing a submission. No submission made. |
|
|
120
|
+
| [Docker MCP Registry](https://github.com/docker/mcp-registry) | A potential route for the local stdio distribution. Requires a working Docker deployment and a reviewed catalog contribution; it is not automatic ingestion from our hosted Registry entry. Container packaging/validation remains separate work. |
|
|
121
|
+
| [Microsoft MCP Server Registry](https://github.com/microsoft/mcp-server-registry) | **Not currently eligible:** its current README restricts V1 onboarding to Microsoft first-party servers. Watch for community eligibility; do not open an ineligible manifest PR. |
|
|
122
|
+
|
|
123
|
+
Glama ownership and the Claude portal are follow-ups to existing evidence and
|
|
124
|
+
prepared copy. OpenAI can distribute the existing skill with the MCP connection
|
|
125
|
+
once the review materials are ready. Smithery needs a new intake check after
|
|
126
|
+
its service transition; the old proxy publishing route is not a durable next step.
|
|
127
|
+
|
|
128
|
+
### Outreach
|
|
129
|
+
|
|
130
|
+
The [reply to the original checklist](https://x.com/e_stradella/status/2082502989625872764)
|
|
131
|
+
suggests `r/mcp` with the Showcase tag. Record it as **desired outreach, not
|
|
132
|
+
registered or posted**. Prepare a small public diagram example and check the
|
|
133
|
+
community's current rules before posting; no Reddit post or outreach message
|
|
134
|
+
has been sent as part of this refresh.
|
|
66
135
|
|
|
67
136
|
## Publication checks
|
|
68
137
|
|