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.
Files changed (135) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/agent-core.d.ts +7 -7
  3. package/dist/agent-core.js +1 -1
  4. package/dist/agent.d.ts +7 -7
  5. package/dist/agent.js +1 -1
  6. package/dist/agentic-mermaid-mcp.js +1 -1
  7. package/dist/am.js +1 -1
  8. package/dist/browser-lazy/chunks/{agentic-producer-core-CC6OOLDW.js → agentic-producer-core-ECZ3CMZM.js} +1 -1
  9. package/dist/browser-lazy/chunks/{architecture-QUFVKYJR.js → architecture-H5LTMKQW.js} +6 -6
  10. package/dist/browser-lazy/chunks/{block-6J3Q63BO.js → block-566X6FNV.js} +5 -5
  11. package/dist/browser-lazy/chunks/{builtin-backends-7SOZZHPF.js → builtin-backends-VAFEZXKY.js} +6 -6
  12. package/dist/browser-lazy/chunks/{c4-SQVBZAKJ.js → c4-ZXFDLBFK.js} +5 -5
  13. package/dist/browser-lazy/chunks/{chunk-5X6MJX3H.js → chunk-2JQXRKBC.js} +1 -1
  14. package/dist/browser-lazy/chunks/{chunk-E2WMJZNM.js → chunk-37FZNMPR.js} +1 -1
  15. package/dist/browser-lazy/chunks/{chunk-TYZOZXUJ.js → chunk-3JTYTXA6.js} +6 -6
  16. package/dist/browser-lazy/chunks/{chunk-PQGPS2YV.js → chunk-4NILRBC7.js} +1 -1
  17. package/dist/browser-lazy/chunks/{chunk-AMJLVPUB.js → chunk-5LKPDHPC.js} +2 -2
  18. package/dist/browser-lazy/chunks/{chunk-BY2CPG6B.js → chunk-62MR3LWJ.js} +1 -1
  19. package/dist/browser-lazy/chunks/{chunk-J7FFAFQF.js → chunk-64JFHCJC.js} +1 -1
  20. package/dist/browser-lazy/chunks/chunk-6GPDLZFQ.js +1 -0
  21. package/dist/browser-lazy/chunks/{chunk-VWVZGQE2.js → chunk-6UOOATQR.js} +1 -1
  22. package/dist/browser-lazy/chunks/chunk-7TTFBJYA.js +1 -0
  23. package/dist/browser-lazy/chunks/chunk-7UFOFWBA.js +20 -0
  24. package/dist/browser-lazy/chunks/{chunk-5B2Z7575.js → chunk-A7V5VDKN.js} +1 -1
  25. package/dist/browser-lazy/chunks/chunk-CPO5P4L2.js +1 -0
  26. package/dist/browser-lazy/chunks/chunk-EIYLJ4FI.js +20 -0
  27. package/dist/browser-lazy/chunks/{chunk-X2UYKWKM.js → chunk-G4JBA7HU.js} +3 -3
  28. package/dist/browser-lazy/chunks/{chunk-2UIA2IME.js → chunk-IUI4DYC3.js} +1 -1
  29. package/dist/browser-lazy/chunks/{chunk-QA6GJQ4X.js → chunk-J57YRC2M.js} +1 -1
  30. package/dist/browser-lazy/chunks/{chunk-BU5LHXNJ.js → chunk-LBXXKLIR.js} +3 -3
  31. package/dist/browser-lazy/chunks/chunk-NKW2ZNCD.js +1 -0
  32. package/dist/browser-lazy/chunks/{chunk-ICC7HBJX.js → chunk-O34YYEQV.js} +1 -1
  33. package/dist/browser-lazy/chunks/{chunk-UL6NDWLL.js → chunk-OBI5U5XU.js} +1 -1
  34. package/dist/browser-lazy/chunks/{chunk-YCEICNM6.js → chunk-OFOS57WQ.js} +1 -1
  35. package/dist/browser-lazy/chunks/{chunk-OZ443IVJ.js → chunk-PSZEE64O.js} +7 -7
  36. package/dist/browser-lazy/chunks/{chunk-SZELX2EJ.js → chunk-PXTLV57R.js} +1 -1
  37. package/dist/browser-lazy/chunks/{chunk-HLWUNUCM.js → chunk-QVSZOF5M.js} +1 -1
  38. package/dist/browser-lazy/chunks/{chunk-2GPK4VFF.js → chunk-TT5GR5EJ.js} +1 -1
  39. package/dist/browser-lazy/chunks/{chunk-DF6765YX.js → chunk-V6I2VGNQ.js} +5 -5
  40. package/dist/browser-lazy/chunks/{chunk-CN7WTBWB.js → chunk-VRZKI33U.js} +1 -1
  41. package/dist/browser-lazy/chunks/{chunk-2SH76OTH.js → chunk-XHU3A432.js} +1 -1
  42. package/dist/browser-lazy/chunks/{chunk-NO7ZIVRU.js → chunk-YVNJDVQO.js} +1 -1
  43. package/dist/browser-lazy/chunks/chunk-Z7UHFVKN.js +6 -0
  44. package/dist/browser-lazy/chunks/{class-5QA4SCTS.js → class-XIFNVBFE.js} +8 -8
  45. package/dist/{zenuml/chunks/decode-BWERFDGK.js → browser-lazy/chunks/decode-5MFOG3AZ.js} +1 -1
  46. package/dist/browser-lazy/chunks/{elk.bundled-L4CADV5W.js → elk.bundled-RYWHIS5N.js} +8 -8
  47. package/dist/browser-lazy/chunks/er-VEUYJBGG.js +11 -0
  48. package/dist/browser-lazy/chunks/{eventmodeling-2BPLHWRN.js → eventmodeling-G7DITZX7.js} +10 -10
  49. package/dist/browser-lazy/chunks/{flowchart-NEIMZTB5.js → flowchart-SSFIU4EU.js} +1 -1
  50. package/dist/browser-lazy/chunks/{forest-implementation-AEP24AIP.js → forest-implementation-RWFF7XDV.js} +1 -1
  51. package/dist/browser-lazy/chunks/{gantt-RDPIFYAF.js → gantt-HQNVDX2B.js} +6 -6
  52. package/dist/browser-lazy/chunks/{gitgraph-N4Y5RYB7.js → gitgraph-Z5MN6M6L.js} +4 -4
  53. package/dist/browser-lazy/chunks/{ishikawa-LD3YBDJN.js → ishikawa-UEERNFQV.js} +2 -2
  54. package/dist/browser-lazy/chunks/{journey-6YQR5DJX.js → journey-3BEWWGB5.js} +6 -6
  55. package/dist/browser-lazy/chunks/{kanban-PLMJ7NBW.js → kanban-2WFNCWLB.js} +10 -10
  56. package/dist/browser-lazy/chunks/{mermaid-yaml-runtime-QVYX4EWK.js → mermaid-yaml-runtime-IK4ET4BT.js} +8 -8
  57. package/dist/browser-lazy/chunks/{mindmap-K2UBFO3Y.js → mindmap-R2C6SNYR.js} +4 -4
  58. package/dist/browser-lazy/chunks/{packet-CUW4QY6Y.js → packet-GMVCI5YZ.js} +3 -3
  59. package/dist/browser-lazy/chunks/{pie-7F7UUCG3.js → pie-WER45DKC.js} +7 -7
  60. package/dist/browser-lazy/chunks/{quadrant-TOONO2WC.js → quadrant-NCUPSFKN.js} +4 -4
  61. package/dist/browser-lazy/chunks/{radar-J6JVWVAX.js → radar-WLYS4YC5.js} +8 -8
  62. package/dist/browser-lazy/chunks/render-core-42UVWIPF.js +3 -0
  63. package/dist/browser-lazy/chunks/{requirement-CMAKDJPO.js → requirement-AK3NWMJ6.js} +7 -7
  64. package/dist/browser-lazy/chunks/{sankey-AWXQEP3F.js → sankey-C2DY6WVU.js} +4 -4
  65. package/dist/browser-lazy/chunks/{sequence-Q2RJRB4L.js → sequence-D4WJB44W.js} +1 -1
  66. package/dist/browser-lazy/chunks/{state-WRBFQEDX.js → state-YUQVESE7.js} +2 -2
  67. package/dist/browser-lazy/chunks/{timeline-D2KILFXM.js → timeline-BMBJJXWR.js} +4 -4
  68. package/dist/browser-lazy/chunks/{treemap-N3VYX5D4.js → treemap-B66XBZZ6.js} +3 -3
  69. package/dist/browser-lazy/chunks/{xychart-G73OGK66.js → xychart-HAVFROGT.js} +6 -6
  70. package/dist/browser-lazy/chunks/{zenuml-H4BXNYXR.js → zenuml-62RLYFWP.js} +7 -7
  71. package/dist/browser-lazy/index.js +1 -1
  72. package/dist/browser.global.js +507 -507
  73. package/dist/{chunk-DQDKA5ND.js → chunk-2DNGDTJD.js} +2 -2
  74. package/dist/{chunk-GVCHLSHH.js → chunk-4F2UGYTM.js} +2 -2
  75. package/dist/{chunk-H3NCS2XZ.js → chunk-7XYB2LNC.js} +2 -2
  76. package/dist/chunk-DOFB572I.js +58 -0
  77. package/dist/chunk-EHJI3QYE.js +52 -0
  78. package/dist/{chunk-UA234O4M.js → chunk-HINRNKPO.js} +2 -2
  79. package/dist/{chunk-JZOJ4YGS.js → chunk-KXMANAST.js} +33 -33
  80. package/dist/{chunk-7CRDX2QR.js → chunk-U4MT3RRE.js} +2 -2
  81. package/dist/{chunk-NKNFOREZ.js → chunk-WYIB6BUR.js} +2 -2
  82. package/dist/{cli-YGGTJZH7.js → cli-ZYIDBYNS.js} +2 -2
  83. package/dist/{index-EeXqJXr5.d.ts → index-Bvhprdxz.d.ts} +3 -3
  84. package/dist/index.d.ts +4 -4
  85. package/dist/index.js +1 -1
  86. package/dist/{mcp-cli-63DYXTVD.js → mcp-cli-YVDCORWA.js} +2 -2
  87. package/dist/{paint-certification-6rwQjIv_.d.ts → paint-certification-BoLyr006.d.ts} +2 -2
  88. package/dist/{server-5NEOHOFS.js → server-4JGAVXR3.js} +2 -2
  89. package/dist/{svg-styles-BdnoM7AT.d.ts → svg-styles-BnCoXyYe.d.ts} +1 -1
  90. package/dist/svg-styles.d.ts +1 -1
  91. package/dist/svg-styles.js +1 -1
  92. package/dist/svg.d.ts +4 -4
  93. package/dist/svg.js +1 -1
  94. package/dist/{types-BcS52Mjt.d.ts → types-CLVJCaH2.d.ts} +1 -1
  95. package/dist/zenuml/chunks/{appearance-UOQ5KA6O.js → appearance-5RM5MVM2.js} +1 -1
  96. package/dist/zenuml/chunks/{builtin-backends-KDKE7YHO.js → builtin-backends-UTNWL4N3.js} +11 -11
  97. package/dist/zenuml/chunks/{chunk-QWX77U7G.js → chunk-3A6S6GNB.js} +2 -2
  98. package/dist/zenuml/chunks/{chunk-OXQWRSBM.js → chunk-55WS466K.js} +11 -11
  99. package/dist/zenuml/chunks/chunk-6J4BGPB2.js +29 -0
  100. package/dist/zenuml/chunks/chunk-CNLL4BGF.js +1 -0
  101. package/dist/zenuml/chunks/{chunk-RZ6XK5CD.js → chunk-IARQ24W3.js} +13 -13
  102. package/dist/zenuml/chunks/{chunk-42DXZ5C6.js → chunk-ZNZRIISS.js} +2 -2
  103. package/dist/{browser-lazy/chunks/decode-63UIZGD2.js → zenuml/chunks/decode-LDNNXEAO.js} +1 -1
  104. package/dist/zenuml/chunks/{mermaid-yaml-runtime-KZVU74WU.js → mermaid-yaml-runtime-A5CNJ3IE.js} +8 -8
  105. package/dist/zenuml/chunks/render-core-ECIWU5ZS.js +3 -0
  106. package/dist/zenuml/chunks/{zenuml-EA2ZFRUX.js → zenuml-N3LZMB2G.js} +8 -8
  107. package/dist/zenuml.d.ts +2 -2
  108. package/dist/zenuml.js +1 -1
  109. package/docs/MCP-DIRECTORY-LISTINGS.md +81 -12
  110. package/docs/api.md +1 -1
  111. package/package.json +1 -1
  112. package/server.json +2 -2
  113. package/dist/browser-lazy/chunks/chunk-4LHYF3BS.js +0 -1
  114. package/dist/browser-lazy/chunks/chunk-FAIMVOX5.js +0 -6
  115. package/dist/browser-lazy/chunks/chunk-GVOEAY52.js +0 -1
  116. package/dist/browser-lazy/chunks/chunk-J35HAQQF.js +0 -20
  117. package/dist/browser-lazy/chunks/chunk-RIVTHZAQ.js +0 -1
  118. package/dist/browser-lazy/chunks/chunk-Z3FDIVLN.js +0 -20
  119. package/dist/browser-lazy/chunks/er-7ZSKGN7Y.js +0 -11
  120. package/dist/browser-lazy/chunks/render-core-BZOM3K7D.js +0 -3
  121. package/dist/chunk-EHCMJUMD.js +0 -52
  122. package/dist/chunk-OMY6NRQD.js +0 -58
  123. package/dist/zenuml/chunks/chunk-7TVYPTDW.js +0 -1
  124. package/dist/zenuml/chunks/chunk-RLJEI7YN.js +0 -29
  125. package/dist/zenuml/chunks/render-core-V5RQ737O.js +0 -3
  126. /package/dist/browser-lazy/chunks/{chunk-5FQ534HP.js → chunk-BMZ24VPS.js} +0 -0
  127. /package/dist/browser-lazy/chunks/{chunk-2I4UPL7Q.js → chunk-D6MQ7QSU.js} +0 -0
  128. /package/dist/browser-lazy/chunks/{chunk-CQE4HQEW.js → chunk-HJVO5VC3.js} +0 -0
  129. /package/dist/browser-lazy/chunks/{chunk-LH7HUDKW.js → chunk-L4UC3KGS.js} +0 -0
  130. /package/dist/browser-lazy/chunks/{chunk-NMQQMRIR.js → chunk-MFTQWHUB.js} +0 -0
  131. /package/dist/browser-lazy/chunks/{chunk-N5ELX7LR.js → chunk-PJJSDGLB.js} +0 -0
  132. /package/dist/browser-lazy/chunks/{chunk-CSFUKSU6.js → chunk-QCU5G5PZ.js} +0 -0
  133. /package/dist/browser-lazy/chunks/{chunk-VQYYGAXP.js → chunk-TLFX3U6S.js} +0 -0
  134. /package/dist/browser-lazy/chunks/{chunk-5UVGUSD6.js → chunk-YHMTSXIR.js} +0 -0
  135. /package/dist/zenuml/chunks/{chunk-EVPSMEKN.js → chunk-GC7IPQ5P.js} +0 -0
@@ -0,0 +1,6 @@
1
+ import{b as e,c as t}from"./chunk-TT5GR5EJ.js";import{b as n,d as i}from"./chunk-J57YRC2M.js";import{q as o,r as a,w as r}from"./chunk-V6I2VGNQ.js";import{b as l,c as s,f as d,g as c}from"./chunk-VRZKI33U.js";import{D as h,e as p,g as g,i as u}from"./chunk-QVSZOF5M.js";import{c as f,h as x,i as b,k as m,ma as y,oa as k,r as w,s as v,y as M}from"./chunk-G4JBA7HU.js";import{b as I,i as S,j as $,k as L,m as C,q as W,u as P}from"./chunk-3JTYTXA6.js";import{a as q,b as F,c as H,d as E,g as Y,h as z,l as T,m as B,n as _,o as N}from"./chunk-YVNJDVQO.js";import{Aa as O,Ba as j,C as A,Ca as X,E as D,F as R,G as J,H as U,M as V,N as Z,O as G,Qb as Q,T as K,Vb as ee,_ as et,ka as en,ma as ei,na as eo,o as ea,wa as er,x as el,y as es}from"./chunk-EIYLJ4FI.js";import{e as ed}from"./chunk-PJJSDGLB.js";import{a as ec}from"./chunk-YHMTSXIR.js";var eh=/&amp;(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z\d]{0,31});|&(#\d+|#[xX][0-9a-fA-F]+|[a-zA-Z][a-zA-Z\d]{0,31});/g;function ep(e,t){let i=e.originalText;if(!i.includes("&"))return e;let o=i.includes("&")?i.replace(eh,(e,t,i)=>{if(void 0!==t)return t.startsWith("#")||b.has(t)||n(t)?`#38;${t.replace("#","#35;")}#59;`:`&${t};`;if(!i.startsWith("#")&&!b.has(i))return n(i)?`#${i};`:e;let o=ec(e);return"#"===o?"#35;":";"===o?"#59;":o}):i;return o===("decoded"===t?ec(i):i)?e:r(o)}var eg={subject:"Sequence text entity",example:"A->>B: #35;"},eu=RegExp(`#\\w+;|${x.source}`,"g");function ef(e){let t=e.trim(),n=/^:?(wrap|nowrap):/.exec(t);return n?{text:t.slice(n[0].length).trim(),wrap:"wrap"===n[1]}:{text:t}}function ex(e){let t=function(e){let t=i(e,eg);if(t===e)return{value:t};let n=D(J(U(e)),eu,e=>i(e,eg));return{value:t,content:Object.freeze({value:t,authored:e,prepared:n})}}(e),n=i(U(e),eg);return{label:n,...t.content?{labelContent:Object.freeze({...t.content,value:n})}:{}}}var eb=/^(loop|alt|opt|par_over|par|critical|break|rect|box)\b\s*([\s\S]*)$/i,em=/^(else|and|option)\b\s*([\s\S]*)$/i;function ey(e){let t=e.toLowerCase();return"transparent"===t||t in en||!!/^(?:#|(?:rgb|rgba|hsl|hsla)\()/i.test(e)&&null!==O(e)}function ek(e){let t=en[e.toLowerCase()];if(t)return t;let n=ei(e);if(n)return eo(n[0],n[1],n[2]);let i=e.match(/^rgba?\(\s*(\d{1,3})\s*[, ]\s*(\d{1,3})\s*[, ]\s*(\d{1,3})/i);return i?eo(Math.min(255,Number.parseInt(i[1],10)),Math.min(255,Number.parseInt(i[2],10)),Math.min(255,Number.parseInt(i[3],10))):null}var ew=class{constructor(e={}){this.options=e}options;records=new Map;order=[];boxes=[];currentBox;apply(e){if("links"===e.kind){let t=this.records.get(e.id);t&&(t.links={...t.links,...e.links});return}this.addActor(e.id,"declare"===e.kind?e:void 0)}applyAll(e){for(let t of e)this.apply(t)}openBox(e){this.boxes.push(e),this.currentBox=this.boxes.length-1}closeBox(){this.currentBox=void 0}has(e){return this.records.has(e)}indexOf(e){return this.order.indexOf(e)}list(){return this.order.map(e=>this.records.get(e))}addActor(e,t){let n=this.records.get(e),i=this.currentBox;if(n&&(void 0!==i&&void 0!==n.box&&i!==n.box&&this.options.onBoxConflict?.(e),void 0!==(i=n.box??i)&&(n.box=i),t?.label===void 0||t.create))return;let o={id:e,label:t?.label??e,...t?.wrap===void 0?{}:{wrap:t.wrap},type:t?.type??"participant",...t?{keyword:t.keyword}:{},...n?.links&&!this.options.upstreamLinks?{links:n.links}:{},...void 0!==i?{box:i}:{}};this.records.set(e,o),n||this.order.push(e),void 0!==this.currentBox&&i===this.currentBox&&this.boxes[this.currentBox].actorIds.push(e)}},ev=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"]]]),eM=new Set(["--|","-|","--/","-/","--\\","-\\","|--","|-","/--","/-","\\--","\\-"]),eI=new Map([...eM].map(e=>{let[t,n]=ev.get(e),i=[...ev].find(([i,o])=>!eM.has(i)&&o[0]===t&&o[1]===n&&i.includes("--")===e.includes("--"))[0];return[e,i]})),eS=[...ev.keys()].sort((e,t)=>t.length-e.length),e$=eS.map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("|"),eL=new RegExp(String.raw`^(\S+?)(\(\))?\s*(${e$})`),eC=new RegExp(String.raw`^(\S+?)\s+(\(\))\s*(${e$})`),eW=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"]),eP=new Set([...eW,"acctitle","accdescr"]),eq=/(?:#\w+;|[^\/\\\+\()\+<\->\->:\n,;])+((?!(\-x|\-\-x|\-\)|\-\-\)|\-\|\\|\-\\|\-\/|\-\/\/|\-\|\/|\/\|\-|\\\|\-|\/\/\-|\\\\\-|\/\|\-|\-\-\|\\|\-\-|\(\)))[\-]*(?:#\w+;|[^\+<\->\->:\n,;])+)*/iy;function eF(e,t){return eq.lastIndex=t,eq.exec(e)?.[0].trim()??""}function eH(e,t){if(!e||e.trim()!==e||/[\r\n]/.test(e))return!1;let n=m(e);if(n.startsWith("#"))return!1;if("declaration"===t)return eO(e)&&!/:/.test(n)&&!n.includes("%%{");if(n.startsWith("%")||n.includes("%%"))return!1;let i=n.toLowerCase(),o=/^(\w+)\b/.exec(i)?.[1];return!(o&&eW.has(o)&&(!["title","link","links","properties","details"].includes(o)||/\s/.test(i.slice(o.length,o.length+1)))||/^(?:\d+(?:\.\d{1,2})?|\.\d{1,2})(?=\s)/.test(n)||eW.has(i)&&!["title","link","links","properties","details"].includes(i)||"receiver"===t&&["acctitle","accdescr"].includes(i)||/^(?:left|right) of\b/.test(i))&&eF(`${n}${"sender"===t?"->>Z:":":"}`,0)===n}var eE=new WeakMap,eY=new WeakMap;function ez(e,t){eE.set(e,t)}function eT(e,t){eY.set(e,t)}function eB(n,i={}){let r=a(n),l=M(r.map(e=>e.raw)),s=l.familyLines.flatMap((e,t)=>e.trim()?[{text:e.trim(),origin:r[l.familyOrigins[t]].line}]:[]);n=s.map(e=>e.text);let d=e=>{let t=s[e]?.origin??e;return i.authoredLine?.(t)??t+1};p("sequence")&&void 0!==n[0]&&g("sequence","header",n[0],{line:1,unit:"normalized"});let c={actors:[],messages:[],blocks:[],notes:[],activationEvents:[],boxes:[],...void 0!==l.accessibility.title?{accessibilityTitle:U(l.accessibility.title)}:{},...void 0!==l.accessibility.descr?{accessibilityDescription:U(l.accessibility.descr)}:{}},h=new ew,f=new Map,x=new Map,b=function(n){let i=a(n).map(n=>{if(!n.raw.trim()||o(n.raw))return{...n,syntax:null};try{return{...n,syntax:function(n){let i=function(n){let i=n.match(/^(participant|actor)\s+([^\s@]+)\s*@\{/i);if(i){let o=i[1].toLowerCase(),a=i[2];eX(a);let r=e(n,i[0].length-1,"sequence"),l=r.ok?n.slice(r.end+1):"",s=l.match(/^\s+as(?:\s+(.*))?$/i);if(!r.ok||""!==l.trim()&&!s)throw v({what:`Invalid participant metadata in "${n}": ${r.ok?`unexpected "${l.trim()}" after it`:r.message}`,expectedForm:'a YAML mapping in @{…} with no "}" inside, then optionally `as <label>`',example:'participant DB@{ "type": "database", "alias": "Orders" }'});let d=s?ef(s[1]??""):void 0,c=d?d.text||null:void 0;if(null===c)return null;let{entries:h}=r,p=h.get("type"),g="string"==typeof p?p.toLowerCase():o;if(!eN.has(g))throw Error(`Unknown sequence actor type '${g}'`);let u=t(h.get("alias")),f=void 0!==u&&(void 0===c||c===a)?u:c,x=[...h.keys()].filter(e=>"type"!==e&&"alias"!==e);return{id:a,label:f??a,type:g,keyword:o,aliased:void 0!==f,...d?.wrap===void 0?{}:{wrap:d.wrap},...x.length?{unmodeledMetadata:x}:{}}}if(n.includes("@{"))return null;let o=n.match(/^(participant|actor)\s+/i);if(!o)return null;let a=n.slice(o[0].length),r=a.match(/^(\S+?)\s+as(\s*)(.+)$/i);if(!r&&(!a||/\s/.test(a)&&/[<>:\n,;@]/.test(m(a))))return null;let l=r?r[1]:a.trim();eX(l);let s=o[1].toLowerCase(),d=r?.[3]===void 0?void 0:ef(r[3]);return{id:l,label:d?.text??l,type:s,keyword:s,aliased:!!r,...r?.[2]===""?{unspacedAlias:!0}:{},...d?.wrap===void 0?{}:{wrap:d.wrap}}}(n);if(i)return{kind:"declaration",declaration:i};let o=function(e){let t=e.match(/^link\s+(\S+)\s*:\s*(.+?)\s*@\s*(\S+)$/i);if(t)return/^(?:https?:|mailto:)/i.test(t[3])?{actorId:t[1],links:{[t[2].trim()]:t[3]}}:null;let n=e.match(/^links\s+(\S+)\s*:\s*(\{.*\})$/i);if(!n)return null;try{let e=JSON.parse(n[2]),t={};for(let[n,i]of Object.entries(e))"string"==typeof i&&/^(?:https?:|mailto:)/i.test(i)&&(t[n]=i);return Object.keys(t).length>0?{actorId:n[1],links:t}:null}catch{return null}}(n);if(o)return{kind:"links",...o};let a=n.match(/^(?:properties|details)\s+(\S+)\s*:/i);if(a)return{kind:"actor-data",actorId:a[1]};let r=n.match(/^title(?:\s*:\s*|\s+)(.+)$/i);if(r)return{kind:"title",text:r[1].trim()};let l=n.match(/^autonumber(?:\s+(.*))?$/i);if(l){let e=l[1]?.trim()??"";if(/^off$/i.test(e))return{kind:"autonumber",numbering:null};let t=e.match(/^((?:\d+(?:\.\d{1,2})?|\.\d{1,2}))(?:\s+((?:\d+(?:\.\d{1,2})?|\.\d{1,2})))?$/);return(!e||t)&&(!t||Number.isFinite(Number(t[1]))&&(void 0===t[2]||Number.isFinite(Number(t[2]))))?{kind:"autonumber",numbering:t?{next:Number.parseFloat(t[1]),...void 0===t[2]?{}:{step:Number.parseFloat(t[2])}}:{}}:null}let s=n.match(/^box(?:\s+(.*))?$/i);if(s)return{kind:"box",text:s[1]?.trim()??""};let d=function(e){let t=e.match(/^create\s+(participant|actor)\s+(\S+?)(?:\s+as\s+(.+))?$/i);if(!t)return null;let n=t[2];eX(n);let i=void 0===t[3]?void 0:ef(t[3]);return{id:n,label:i?.text??n,type:t[1].toLowerCase(),...i?.wrap===void 0?{}:{wrap:i.wrap}}}(n);if(d)return{kind:"create",declaration:d};let c=n.match(/^destroy\s+(\S+)$/i);if(c)return{kind:"destroy",actorId:c[1]};let h=function(e){let t=e.match(/^Note\s+(left of|right of|over)\s+([^:]+):\s*(.*)$/i);if(!t)return null;let n=t[1].toLowerCase();return{actorIds:t[2].trim().split(",").map(e=>e.trim()),...ef(t[3]),position:"left of"===n?"left":"right of"===n?"right":"over"}}(n);if(h)return{kind:"note",note:h};let p=function(e){let t=eb.exec(e);if(!t)return null;let n=t[1].toLowerCase(),i=t[2]?.trim()??"";if("box"===n)return{type:n,label:i};let o=ef(i);return{type:n,label:o.text,...void 0===o.wrap?{}:{wrap:o.wrap}}}(n);if(p&&"box"!==p.type)return{kind:"block",opener:{type:p.type,label:p.label,...void 0===p.wrap?{}:{wrap:p.wrap}}};let g=function(e){let t=em.exec(e);if(!t)return null;let n=ef(t[2]??"");return{type:t[1].toLowerCase(),label:n.text,...void 0===n.wrap?{}:{wrap:n.wrap}}}(n);if(g)return{kind:"continuation",continuation:g};if("end"===n)return{kind:"end"};let u=function(e){var t;let n=function(e){eq.lastIndex=0;let t=eq.exec(e);if(!t)return;let n=t[0].length,i=e.startsWith("()",n),o=i&&/\s$/.test(t[0]);for(i&&(n+=2);n<e.length&&/\s/.test(e[n]);)n++;let a=eS.find(t=>e.startsWith(t,n));if(a)return n+=a.length,{from:t[0].trim(),arrow:a,end:n,centralStart:i,spacedCentral:o}}(e);if(!n){let t=e.match(eL),i=t??e.match(eC);i&&(n={from:i[1],centralStart:!!i[2],arrow:i[3],end:i[0].length,spacedCentral:!t})}if(!n||(t=n.arrow,!ev.has(t)))return null;let{from:i,arrow:o,centralStart:a,spacedCentral:r}=n;if(r&&(/^(?:[0-9]+(?:\.[0-9]{1,2})?|\.[0-9]{1,2})$/.test(i)||eW.has(i.toLowerCase())))return null;let l=e.slice(n.end).trimStart(),s=l.startsWith("()");s&&(l=l.slice(2).trimStart());let d="+"===l[0]||"-"===l[0]?l[0]:void 0;if(r&&d)return null;d&&(l=l.slice(1).trimStart());let c=l.indexOf(":");if(c<1)return null;let h=l.slice(0,c).trimEnd(),{text:p,wrap:g}=ef(l.slice(c+1));if(!h||r&&(/[+<>]/.test(h)||h.includes("()")||eP.has(h.toLowerCase())))return null;let u=m(e),f=m(i),x=m(h),b=m(e.slice(0,e.length-l.length)).length,y=eF(u,0);return y.length<=f.length&&(y!==f||eF(u,b)!==x)?null:{from:i,arrow:eI.get(o)??o,activationMark:d,to:h,label:p,centralStart:a,centralEnd:s,...void 0===g?{}:{wrap:g},...eM.has(o)?{localArrow:o}:{}}}(n);if(u)return{kind:"message",message:u};let f=n.match(/^(activate|deactivate)\s+(\S+)$/i);return f?{kind:"activation",actorId:f[2],activate:"activate"===f[1].toLowerCase()}:null}(n.raw.trim())}}catch(e){if(e instanceof Q)throw e;return{...n,syntax:null,error:e}}}),r=[],l=[],s=(e,t,n)=>{l.push({line:e.line,syntax:t,message:n})};for(let[e,t]of i.entries()){let{syntax:n}=t;if(r.length&&(t.parent=r.at(-1)),!n){t.error instanceof eA?s(t,"sequence_participant_id",t.error.message):t.raw.trim()&&!o(t.raw)&&s(t,"sequence_statement",`Sequence statement is preserved in source but not drawn: ${t.raw.trim()}`);continue}if("block"===n.kind||"box"===n.kind)r.push(e);else if("end"===n.kind){let n=r.pop();void 0===n?s(t,"sequence_block_boundary","Sequence end has no open block or box"):(t.closes=n,i[n].endIndex=e)}else if("continuation"===n.kind){var d,c;let e=void 0!==t.parent?i[t.parent].syntax:null;e?.kind==="block"&&(d=n.continuation.type,c=e.opener.type,"else"===d&&"alt"===c||"and"===d&&("par"===c||"par_over"===c)||"option"===d&&"critical"===c)||s(t,"sequence_block_boundary",`Sequence ${n.continuation.type} does not belong to the enclosing block`)}else if("declaration"===n.kind&&n.declaration.unmodeledMetadata?.length)s(t,"sequence_participant_metadata",`Participant metadata fields ${n.declaration.unmodeledMetadata.join(", ")} are not modeled; the declaration is preserved as source`);else if("message"===n.kind&&n.message.localArrow){let{localArrow:e,arrow:i}=n.message;s(t,"sequence_local_arrow",`The arrow ${e} is a local spelling pinned Mermaid does not read, so it rejects this line. Ours draws it as Mermaid's ${i} and writes ${i}`)}else"declaration"===n.kind&&n.declaration.unspacedAlias&&s(t,"sequence_unspaced_alias","Participant text immediately following as is read as its alias. Pinned Mermaid can reject this or read it as part of the ID; write as <label> with a separating space");if("declaration"===n.kind||"create"===n.kind){let e=ej(n.declaration.id);e&&s(t,"sequence_participant_id_extension",e)}if("message"===n.kind)for(let[e,i]of[["sender",n.message.from],["receiver",n.message.to]])eH(i,e)||s(t,"sequence_message_id_extension",`Participant "${i}" is read as the ${e}, but pinned Mermaid reads another token there; rename it before typed editing`)}for(let e of r)s(i[e],"sequence_block_boundary","Sequence block or box is never closed by end");return{statements:i,issues:l}}(n.slice(1)),y=b.issues.find(e=>"sequence_block_boundary"===e.syntax);if(y)throw Error(`SEQUENCE_BLOCK_BOUNDARY: line ${d(y.line+1)}: ${y.message}`);let k=new Map,w=[],S=new Map,$={visible:!0===i.showSequenceNumbers,next:1,step:1},L=[],C=[],W=e=>{let{from:t,to:n}=e,o=function(e){let t=e.includes("--")?"dashed":"solid",[n,i]=ev.get(e)??["none","none"];return{lineStyle:t,startHead:n,endHead:i}}(e.arrow),a={from:t,to:n,...ex(e.label.trim()),...(e.wrap??i.wrap)===void 0?{}:{wrap:e.wrap??i.wrap},lineStyle:o.lineStyle,startHead:o.startHead,endHead:o.endHead,centralStart:e.centralStart,centralEnd:e.centralEnd};"+"===e.activationMark&&(a.activate=!0),"-"===e.activationMark&&(a.deactivate=!0),$.visible&&(a.number=$.next),$.next=Math.round(($.next+$.step)*100)/100,eD(L,e=>e===n,e=>{f.set(e,c.messages.length),p("sequence")&&u("sequence","bind-create",{id:e,messageIndex:c.messages.length})}),eD(C,e=>e===t||e===n,e=>{x.set(e,c.messages.length),p("sequence")&&u("sequence","bind-destroy",{id:e,messageIndex:c.messages.length})}),c.messages.push(a),p("sequence")&&u("sequence","add-message",a)};for(let[e,t]of b.statements.entries()){let n=t.raw.trim();if(p("sequence")&&g("sequence",t.syntax?.kind??"unrecognized",t.raw,{line:t.line+2,column:t.column+1,unit:"normalized"}),t.error)throw t.error;let a=t.syntax;if(!a){if(void 0!==l.unclosedIndex&&n===l.familyLines[l.unclosedIndex]?.trim())continue;if(n&&!o(n))throw Error(`SEQUENCE_UNSUPPORTED_STATEMENT: line ${d(t.line+1)}: ${n}`);continue}for(let e of function(e){switch(e?.kind){case"declaration":{let{id:t,label:n,type:i,keyword:o,aliased:a,wrap:r}=e.declaration;return[{kind:"declare",id:t,keyword:o,type:i,...a?{label:n}:{},...void 0===r?{}:{wrap:r}}]}case"create":{let{id:t,label:n,type:i,wrap:o}=e.declaration;return[{kind:"declare",id:t,keyword:"actor"===i?"actor":"participant",type:i,label:n,...void 0===o?{}:{wrap:o},create:!0}]}case"links":return[{kind:"mention",id:e.actorId},{kind:"links",id:e.actorId,links:e.links}];case"actor-data":return[{kind:"mention",id:e.actorId}];case"note":return e.note.actorIds.map(e=>({kind:"mention",id:e}));case"message":return[{kind:"mention",id:e.message.from},{kind:"mention",id:e.message.to}];default:return[]}}(a))h.apply(e),p("sequence")&&u("sequence","participant.apply",e);switch(a.kind){case"declaration":case"create":"create"===a.kind&&L.push(a.declaration.id);break;case"links":case"actor-data":break;case"title":{let e=ex(a.text);c.title=e.label,c.titleContent=e.labelContent,p("sequence")&&u("sequence","set-title",c.title);break}case"autonumber":$.visible=null!==a.numbering,a.numbering?.next!==void 0&&($.next=a.numbering.next,$.step=a.numbering.step??1),p("sequence")&&u("sequence","set-autonumber",$);break;case"box":{let e=a.text,t={actorIds:[]},n=e.match(/^((?:rgb|rgba|hsl|hsla)\([^)]*\))\s*(.*)$/i),o=e;if(n&&ey(n[1]))t.color=n[1],o=n[2]?.trim()??"";else{let n=e.split(/\s+/,1)[0]??"";n&&ey(n)&&(t.color=n,o=e.slice(n.length).trim())}if(o){let e=ef(o);Object.assign(t,ex(e.text)),(e.wrap??i.wrap)!==void 0&&(t.wrap=e.wrap??i.wrap)}c.boxes.push(t),h.openBox(t),p("sequence")&&u("sequence","open-box",{index:c.boxes.length-1,box:t});break}case"destroy":C.push(a.actorId),p("sequence")&&u("sequence","pending-destroy",a.actorId);break;case"note":{let{note:e}=a,n=ex(e.text),o=c.notes.length;c.notes.push({actorIds:e.actorIds,text:n.label,...(e.wrap??i.wrap)===void 0?{}:{wrap:e.wrap??i.wrap},...n.labelContent?{textContent:n.labelContent}:{},position:e.position,afterIndex:c.messages.length-1}),p("sequence")&&u("sequence","add-note",{note:c.notes.at(-1),parent:t.parent});for(let e=t.parent;void 0!==e;e=k.get(e)?.parent)k.get(e)?.noteIndices.push(o);break}case"block":{let{opener:n}=a,o=n.type,r=ex("rect"===n.type?"":n.label),l="rect"===n.type&&n.label.startsWith("#")?"":n.label,s="rect"===n.type?function(e){let t=I(e);if(!t)return;let n=t.toLowerCase();if("transparent"===n||Object.hasOwn(en,n))return t;let i=/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/i.exec(t);if(i&&i.slice(1).every(e=>255>=Number(e)))return t;let o=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0(?:\.\d+)?|\.\d+|1(?:\.0+)?)\s*\)$/i.exec(t);if(o&&o.slice(1,4).every(e=>255>=Number(e)))return t}(l):void 0;if("rect"===n.type&&l&&!s)throw Error("SEQUENCE_RECT_COLOR_UNSUPPORTED: rect requires a safe concrete CSS color");k.set(e,{type:o,...r,...(n.wrap??i.wrap)===void 0?{}:{wrap:n.wrap??i.wrap},...s?{color:s}:{},startIndex:c.messages.length,dividers:[],dividerNoteIndices:[],parent:t.parent,parentSection:void 0===t.parent?0:k.get(t.parent)?.dividers.length??0,noteIndices:[],childBlockIndices:[],childSectionIndices:[]}),w.push({kind:"open",blockId:e,messageIndex:c.messages.length,noteIndex:c.notes.length}),p("sequence")&&u("sequence","open-block",{id:e,block:k.get(e)});break}case"continuation":{let e=void 0!==t.parent?k.get(t.parent):void 0;e&&(w.push({kind:"divider",blockId:t.parent,messageIndex:c.messages.length,noteIndex:c.notes.length,dividerIndex:e.dividers.length}),e.dividerNoteIndices.push(c.notes.length),e.dividers.push({index:c.messages.length,...ex(a.continuation.label),...(a.continuation.wrap??i.wrap)===void 0?{}:{wrap:a.continuation.wrap??i.wrap}}),p("sequence")&&u("sequence","divide-block",{parent:t.parent,divider:e.dividers.at(-1),type:a.continuation.type}));break}case"end":{let e=k.get(t.closes);if(e){let n=c.blocks.length;S.set(t.closes,n),w.push({kind:"close",blockId:t.closes,messageIndex:c.messages.length,noteIndex:c.notes.length});let i={type:e.type,label:e.label,...void 0===e.wrap?{}:{wrap:e.wrap},...e.labelContent?{labelContent:e.labelContent}:{},...e.color?{color:e.color}:{},startIndex:e.startIndex,endIndex:Math.max(c.messages.length-1,e.startIndex),dividers:e.dividers};eE.set(i,{endMessageExclusive:c.messages.length,endNoteExclusive:c.notes.length,dividerNoteIndices:e.dividerNoteIndices,noteIndices:e.noteIndices,childBlockIndices:e.childBlockIndices,childSectionIndices:e.childSectionIndices}),void 0!==e.parent&&(k.get(e.parent)?.childBlockIndices.push(n),k.get(e.parent)?.childSectionIndices.push(e.parentSection)),c.blocks.push(i),p("sequence")&&u("sequence","close-block",{id:t.closes,parent:e.parent,parentSection:e.parentSection,block:i,notes:e.noteIndices,children:e.childBlockIndices})}else h.closeBox(),p("sequence")&&u("sequence","close-box",null);break}case"message":W(a.message);break;case"activation":c.activationEvents.push({actorId:a.actorId,kind:a.activate?"activate":"deactivate",messageIndex:c.messages.length}),p("sequence")&&u("sequence","activation",c.activationEvents.at(-1))}}return c.actors=h.list().map(({id:e,label:t,type:n,links:o,box:a,wrap:r})=>({id:e,...ex(t),type:n,...(r??i.wrap)===void 0?{}:{wrap:r??i.wrap},...o?{links:o}:{},...void 0!==a?{box:a}:{},...f.has(e)?{createMessageIndex:f.get(e)}:{},...x.has(e)?{destroyMessageIndex:x.get(e)}:{}})),eY.set(c,w.map(({blockId:e,...t})=>({...t,blockIndex:S.get(e)}))),c}function e_(e){let t;return n=>{if(!t){let n=e.originalText.split(/\r?\n/),i=e.wrapperSource?e.wrapperSource.split(/\r?\n/).length-1:0,o=n.slice(i).flatMap((e,t)=>(0===t?ed(e).split(`
2
+ `):[e]).map(e=>({text:e.trim(),line:i+t+1}))),a=0;t=e.familyLines.map(e=>{let t=e.trim();for(let e=a;e<o.length;e++){let n=o[e].text;if(n===t||n.slice(n.indexOf("}")+1).trim()===t)return a=e+1,o[e].line}})}return t[n]}}var eN=new Set(["participant","actor","boundary","control","entity","database","collections","queue"]);function eO(e){return"string"==typeof e&&""!==e&&e.trim()===e&&!/[<>,;@#\r\n]/.test(m(e))}function ej(e){let t=eO(e);return t&&eH(e,"declaration")?null:`Sequence participant ID ${JSON.stringify(e)} ${t?"is read as authored, but pinned Mermaid rejects colons in declaration IDs":"has ambiguous declaration delimiters or whitespace"}. Typed editing and serialization require a portable ID; rename this ID and its references, and put display punctuation in an alias`}var eA=class extends w{};function eX(e){if(!eO(e))throw new eA(ej(e))}function eD(e,t,n){for(let i=e.length-1;i>=0;i--){let o=e[i];t(o)&&(n(o),e.splice(i,1))}}function eR(e,t,n,i,o,a,r=0,l=et(e,{fontSize:o,fontWeight:a,letterSpacing:r})){let s="middle"===i?t-l.width/2:"start"===i?t:t-l.width;return{text:l.text,block:l,x:t,y:n,anchor:i,fontSize:o,fontWeight:a,letterSpacing:r,bounds:{x:s,y:n-l.height/2,width:l.width,height:l.height},metrics:l}}function eJ(e,t){let n=Math.min(e.x,t.x),i=Math.min(e.y,t.y);return{x:n,y:i,width:Math.max(e.x+e.width,t.x+t.width)-n,height:Math.max(e.y+e.height,t.y+t.height)-i}}function eU(e,t,n){return{x:e.x+t,y:e.y+n,width:e.width,height:e.height}}function eV(e,t,n){return{...e,x:e.x+t,y:e.y+n,bounds:eU(e.bounds,t,n)}}function eZ(e,t,n,i){if("participant"===e.type){let o=eR(t.displayLabel,n,i+t.height/2,"middle",t.fontSize,t.fontWeight,t.letterSpacing,t.block),a={x:n-t.width/2,y:i,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:n,y:i,width:t.width,height:t.height,bounds:a,labelPosition:o}}let o="actor"===e.type?i+t.height:Math.max(i+t.height,i+26),a=o+Math.max(14,t.labelMetrics.lineHeight/2+5.5)+(t.labelMetrics.lines.length-1)/2*t.labelMetrics.lineHeight,r=eR(t.displayLabel,n,a,"middle",t.fontSize,t.fontWeight,t.letterSpacing,t.block),l=eJ({x:n-t.width/2,y:i,width:t.width,height:o-i},r.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:n,y:i,width:t.width,height:t.height,bounds:s,labelPosition:r}}function eG(e,t,n,i){let o=t.dividerNoteIndices[i]??-1,a=t.dividerNoteIndices[i+1]??t.endNoteExclusive;return o>=0&&o<a&&n.notes[o].afterIndex<e.dividers[i].index?o:void 0}function eQ(e,t,n,i,o,a,r,l,s,d,c,h,p){let g,u,f=e.startIndex<n.endMessageExclusive?r[e.startIndex]:void 0,x=e.startIndex<n.endMessageExclusive?r[n.endMessageExclusive-1]:void 0,b=new Set;for(let t=e.startIndex;t<n.endMessageExclusive;t++){let e=i.messages[t];e&&(b.add(o.get(e.from)??0),b.add(o.get(e.to)??0))}for(let e of n.noteIndices){let t=i.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<i.actors.length;e++)b.add(e);let m=1/0,y=-1/0;for(let e of b){let t=a[e];if(!t)continue;let n=t.bounds;m=Math.min(m,n.x-d.groupPaddingX),y=Math.max(y,n.x+n.width+d.groupPaddingX)}for(let t=e.startIndex;t<n.endMessageExclusive;t++){let e=r[t];e&&(m=Math.min(m,e.bounds.x-d.groupPaddingX),y=Math.max(y,e.bounds.x+e.bounds.width+d.groupPaddingX))}for(let e of n.noteIndices){let t=l[e];t&&(m=Math.min(m,t.x-d.groupPaddingX),y=Math.max(y,t.x+t.width+d.groupPaddingX))}for(let e of n.childBlockIndices){let t=s[e];t&&(m=Math.min(m,t.x-d.groupPaddingX),y=Math.max(y,t.x+t.width+d.groupPaddingX))}for(let n of("rect"!==e.type&&(y=Math.max(y,m+t.tabWidth+d.groupPaddingX)),t.dividers))n.label&&(y=Math.max(y,m+8+n.metrics.width+d.groupPaddingX));let k=f&&!f.isSelf&&f.labelPosition.text.includes(`
3
+ `)?Math.ceil(Math.max(0,f.labelPosition.y-f.labelPosition.bounds.y-d.edgeLabelFontSize*el/2-1e-6)):0,w=n.noteIndices.length>0?t.contentTopPadding:t.blockPadTop,v=p?.top??(f?f.y-(t.blockPadTop+k):h-w),M=(x?.y??h)+d.groupPaddingY+12;for(let i=e.startIndex;i<n.endMessageExclusive;i++){let e=r[i];if(!e)continue;v=Math.min(v,e.bounds.y-Math.max(t.tabHeight,d.groupPaddingY));let n=e.isSelf?d.groupPaddingY+4:d.groupPaddingY;M=Math.max(M,e.bounds.y+e.bounds.height+n)}for(let o of b){let l=i.actors[o],s=a[o];if(!(!s||l?.createMessageIndex===void 0||!r[l.createMessageIndex])&&l.createMessageIndex>=e.startIndex&&l.createMessageIndex<n.endMessageExclusive){let e=t.contentTopPadding;v=Math.min(v,s.bounds.y-e),M=Math.max(M,s.bounds.y+s.bounds.height+d.groupPaddingY)}}for(let e of n.noteIndices){let n=l[e];if(!n)continue;let i=t.contentTopPadding;v=Math.min(v,n.y-i),M=Math.max(M,n.y+n.height+d.groupPaddingY)}for(let e of n.childBlockIndices){let n=s[e];n&&(v=Math.min(v,n.y-t.enclosingHeaderStep),M=Math.max(M,n.y+n.height+d.groupPaddingY))}let I=t.dividers.map((o,a)=>{let g=eG(e,n,i,a),u=void 0===g?void 0:l[g],f=o.index<n.endMessageExclusive?r[o.index]:void 0;if("par_over"===e.type){if(!o.label)return{y:v+t.tabHeight,label:""};let e=u??f?.bounds;for(let[t,r]of n.childBlockIndices.entries()){let l=s[r];l&&n.childSectionIndices[t]===a+1&&i.blocks[r].startIndex===o.index&&(!e||l.y<e.y)&&(e=l)}let r=e?.x??m+8,l=e?e.y-o.metrics.height-8:v+t.tabHeight+8+a*(o.metrics.height+8),c=eR(o.displayLabel,r,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),M=Math.max(M,c.bounds.y+c.bounds.height+d.groupPaddingY),{y:l,label:o.label,labelPosition:c}}let x=f?.y??h,b=28+o.extraLinesHeight+o.extraFontOffset;if(o.label&&f?.label){let e=m+8,t=e+o.metrics.width,n=f.labelPosition.bounds,i=n.x,a=n.x+n.width;if(t+8>i&&e-8<a){let e=Math.max(0,Math.ceil(x-10-(n.y+n.height/2)));b=Math.max(36+o.extraLinesHeight+o.extraFontOffset+e,Math.ceil(24+c+o.extraLinesHeight+o.extraFontOffset+e))}}let k=p?.dividerY[a],w=k??(u?u.y-o.noteContentOffset:x-b);for(let[e,t]of n.childBlockIndices.entries()){let r=s[t],l=i.blocks[t];if(void 0===k&&r&&l?.startIndex===o.index&&n.childSectionIndices[e]===a+1){let e=o.noteContentOffset;w=Math.min(w,r.y-e)}}if(!o.label)return{y:w,label:o.label};let I=w+o.firstLineOffset+(o.metrics.lines.length-1)/2*o.metrics.lineHeight,S=eR(o.displayLabel,m+8,I,"start",d.edgeLabelFontSize,d.edgeLabelFontWeight,d.edgeLetterSpacing,o.block);return M=Math.max(M,S.bounds.y+S.bounds.height+d.groupPaddingY),{y:w,label:o.label,labelPosition:{...S,text:o.displayLabel}}}),S="rect"===e.type?void 0:(g=v+t.tabHeight/2,u=eR(t.headerText,m+d.groupLabelPaddingX,g,"start",d.groupHeaderFontSize,d.groupHeaderFontWeight,d.groupLetterSpacing,t.block),{x:m,y:v,width:t.tabWidth,height:t.tabHeight,label:{...u,text:t.headerText}}),$={x:m,y:v,width:y-m,height:M-v};return{type:e.type,label:e.label,...e.color?{color:e.color}:{},x:$.x,y:$.y,width:$.width,height:$.height,dividers:I,...S?{header:S}:{},bounds:$}}function eK(e,t,n){for(let i of e.actors)i.x+=t,i.y+=n,i.bounds=eU(i.bounds,t,n),i.labelPosition=eV(i.labelPosition,t,n);for(let i of e.messages)!function(e,t,n){e.x1+=t,e.x2+=t,e.y+=n,e.points=e.points.map(e=>({x:e.x+t,y:e.y+n})),e.labelPosition=eV(e.labelPosition,t,n),e.bounds=eU(e.bounds,t,n)}(i,t,n);for(let i of e.blocks)for(let e of(i.x+=t,i.y+=n,i.bounds=eU(i.bounds,t,n),i.header&&(i.header={...i.header,x:i.header.x+t,y:i.header.y+n,label:eV(i.header.label,t,n)}),i.dividers))e.y+=n,e.labelPosition&&(e.labelPosition=eV(e.labelPosition,t,n));for(let i of e.notes)i.x+=t,i.y+=n;for(let i of e.boxes)i.x+=t,i.y+=n,void 0!==i.labelY&&(i.labelY+=n);for(let i of e.activations)i.x+=t,i.topY+=n,i.bottomY+=n;for(let i of e.lifelines)i.x+=t,i.topY+=n,i.bottomY+=n;for(let i of e.destructions)i.x+=t,i.y+=n}var e0={nodeLabelFontSize:q.nodeLabel,edgeLabelFontSize:q.edgeLabel,groupHeaderFontSize:q.edgeLabel,nodeLabelFontWeight:F.nodeLabel,edgeLabelFontWeight:F.edgeLabel,groupHeaderFontWeight:F.groupHeader,nodePaddingX:16,nodePaddingY:6,nodeCornerRadius:4,nodeLineWidth:H.outerBox,edgeLineWidth:H.connector,groupCornerRadius:0,groupPaddingX:10,groupPaddingY:8,groupLabelPaddingX:6,groupLineWidth:H.outerBox};function e1(e,t={},n={},i){let o=z(t,e0,i),a=n.diagramMarginX??30,r=n.diagramMarginY??30,l=n.width??80,s=n.noteMargin??10,d=n.activationWidth??10,c=e.actors.map(e=>ea(i,"actor",{category:e.id},{includeFallback:!1})),h=Math.max(n.height??40,...c.map(e=>es("Mg",e?.fontSize??o.nodeLabelFontSize,e?.fontWeight??o.nodeLabelFontWeight).height+(e?.paddingY??o.nodePaddingY)*2)),p=es("Mg",e0.edgeLabelFontSize,e0.edgeLabelFontWeight).height,g=es("Mg",o.edgeLabelFontSize,o.edgeLabelFontWeight).height,u=n.messageMargin??40,f=Math.max(u,u+g-p),x=Math.max(30,f-10),b=Math.max(40,40+(o.groupHeaderFontSize-e0.groupHeaderFontSize)+(o.groupPaddingY-e0.groupPaddingY)*2),m=Math.max(28,b+o.groupPaddingY+20-f);if(0===e.actors.length)return e2({width:0,height:0,accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:[],lifelines:[],messages:[],activations:[],blocks:[],notes:[],boxes:[],destructions:[]},void 0===e.title?void 0:A(e.title,e.titleContent),o,a,r);let y=e.actors.map((e,t)=>{var i,a;let r,s,d,p,g,u,f,x,b,m;return i=void 0===e.wrap&&void 0!==n.wrap?{...e,wrap:n.wrap}:e,a=c[t],r=a?.textTransform??o.nodeTextTransform,s=a?.fontSize??o.nodeLabelFontSize,d=a?.fontWeight??o.nodeLabelFontWeight,p=a?.letterSpacing??o.nodeLetterSpacing,g=a?.paddingX??o.nodePaddingX,u=a?.paddingY??o.nodePaddingY,x=(f=et(A(i.label,i.labelContent),{transform:r,fontSize:s,fontWeight:d,letterSpacing:p,...i.wrap?{maxWidth:240}:{}})).text,b=Math.max(f.width+2*g,l),m="participant"===i.type?Math.max(h,Math.ceil(f.height+2*u)):h,{fontSize:s,fontWeight:d,letterSpacing:p,paddingX:g,paddingY:u,displayLabel:x,block:f,...i.links?{menuBlock:et("⋯",{display:"literal",fontSize:10,fontWeight:400})}:{},labelMetrics:f,width:b,height:m}}),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 v=e.messages.map(e=>{var t;let i,a,r,l,s,c,h,p,g,u,f,x,b,m,y;return s=(l=et((r=Object.freeze({value:a=void 0!==(t=void 0===e.wrap&&void 0!==n.wrap?{...e,wrap:n.wrap}:e).number?`${t.number}. ${t.label}`:t.label,prepared:J((i=A(t.label,t.labelContent),void 0!==t.number?R([`${t.number}. `,"string"==typeof i?J(i):i]):i))})).prepared,{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...t.wrap?{maxWidth:240}:{}})).text,c=o.edgeLabelFontSize*el,h=a?l:{width:0,height:0,lines:[],lineHeight:c},p=Math.max("none"!==t.startHead?E.width:0,5*!!t.centralStart),g=Math.max("none"!==t.endHead?E.width:0,5*!!t.centralEnd),u=Math.max(o.lineWidth/2,"none"!==t.startHead||"none"!==t.endHead?E.height/2:0,t.centralStart||t.centralEnd?4.75:0),f=Math.max(16,p+g+8),x=h.width+f,m=(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:a,labelContent:r,displayLabel:s,block:l,labelMetrics:h,startPad:p,endPad:g,markerHalfHeight:u,requiredSpanWidth:x,selfRightExtent:b,requiredSelfNeighborGap:m,extraAboveHeight:y}}),M=Array.from({length:Math.max(0,e.actors.length-1)},()=>0);for(let t=0;t<e.messages.length;t++){let n=e.messages[t],i=v[t],o=w.get(n.from),a=w.get(n.to);if(void 0===o||void 0===a)continue;if(o===a){o<e.actors.length-1&&(M[o]=Math.max(M[o],i.requiredSelfNeighborGap));continue}let r=Math.min(o,a),l=Math.max(o,a),s=l-r,d=e.actors[a].createMessageIndex===t&&"participant"===e.actors[a].type?k[a]/2:0,c=(i.requiredSpanWidth+d)/s;for(let e=r;e<l;e++)M[e]=Math.max(M[e],c)}let I=[],S=a+k[0]/2;for(let t=0;t<e.actors.length;t++){if(t>0){let e=(k[t-1]+k[t])/2;S+=Math.max(void 0!==n.actorMargin?e+n.actorMargin:Math.max(140,e+40),M[t-1]??0)}I.push(S)}let $=(e.boxes??[]).flatMap((t,i)=>{let a=e.actors.flatMap((e,t)=>e.box===i?[t]:[]),r=t.label?et(A(t.label,t.labelContent),{transform:o.groupTextTransform,fontSize:o.groupHeaderFontSize,fontWeight:o.groupHeaderFontWeight,letterSpacing:o.groupLetterSpacing,fontFamily:o.groupFont,...t.wrap??n.wrap?{maxWidth:240}:{}}):void 0;return a.length>0?[{box:t,memberIdxs:a,block:r}]:[]}),L=Math.max(22,...$.map(e=>(e.block?.height??0)+8)),C=r+($.length>0?L+6:0),W=e.actors.map((e,t)=>eZ(e,y[t],I[t],C)),P=e.actors.flatMap((t,n)=>{if(void 0!==t.createMessageIndex&&t.createMessageIndex<e.messages.length)return[];let i=W[n].bounds;return[i.y+i.height]}),q=P.length>0?Math.max(...P):C+h,F=q+26,H=[],Y=e.blocks.map((t,n)=>{let i=eE.get(t);if(i)return i;let o=[];for(let n=0;n<e.notes.length;n++){let i=e.notes[n];i.afterIndex>=t.startIndex&&i.afterIndex<=t.endIndex&&o.push(n)}let a=[];for(let i=0;i<n;i++){let o=e.blocks[i];o.startIndex>=t.startIndex&&o.endIndex<=t.endIndex&&(e.blocks.some((e,a)=>a>i&&a<n&&o.startIndex>=e.startIndex&&o.endIndex<=e.endIndex&&e.startIndex>=t.startIndex&&e.endIndex<=t.endIndex)||a.push(i))}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:a,childSectionIndices:a.map(n=>t.dividers.filter(t=>e.blocks[n].startIndex>=t.index).length)}}),T=e.blocks.map(e=>{var t;let i,a,r,l,s,d,c,h,p,u,f;return a=(i=et("rect"===(t={...e,wrap:e.wrap??n.wrap,dividers:e.dividers.map(e=>({...e,wrap:e.wrap??n.wrap}))}).type?"":t.label?R([`${t.type} [`,J(A(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,r=o.groupHeaderFontSize*el,s=Math.ceil(Math.max(0,((l=a?i:{width:0,height:0,lines:[],lineHeight:r}).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,u="rect"===t.type?o.groupPaddingY:h+o.groupPaddingY,f=t.dividers.map(e=>{let t=et(e.label?R(["[",J(A(e.label,e.labelContent)),"]"]):"",{transform:o.edgeTextTransform,fontSize:o.edgeLabelFontSize,fontWeight:o.edgeLabelFontWeight,letterSpacing:o.edgeLetterSpacing,...e.wrap?{maxWidth:240}:{}}),n=t.text,i=e.label?t:{width:0,height:0,lines:[],lineHeight:g},a=Math.max(14,Math.ceil(i.lineHeight/2+6)),r=Math.max(0,a-14),l=Math.ceil(Math.max(0,(i.lines.length-1)*i.lineHeight));return{index:e.index,label:e.label,displayLabel:n,block:t,metrics:i,firstLineOffset:a,extraFontOffset:r,extraLinesHeight:l,requiredExtraBefore:24+l+r,noteContentOffset:Math.ceil(Math.max(28+l+r,a+(i.lines.length-1)/2*i.lineHeight+i.height/2+o.groupPaddingY))}}),{headerText:a,block:i,headerMetrics:l,tabWidth:c,tabHeight:h,extraHeaderLinesHeight:s,blockPadTop:p,blockHeaderExtra:m+s,enclosingHeaderStep:u,contentTopPadding:"rect"===t.type?o.groupPaddingY:Math.max(p,h+o.groupPaddingY),dividers:f}}),B=eY.get(e),_=new Map,N=new Map,O=new Map,j=new Map,X=new Map;for(let t=0;t<e.blocks.length;t++){let n=e.blocks[t],i=N.get(n.startIndex)??[];i.push(t),N.set(n.startIndex,i);let o=Y[t],a=o.noteIndices[0];if(void 0!==a){let e=O.get(a)??[];e.push(t),O.set(a,e)}for(let e of o.childBlockIndices)j.set(e,t)}let D=new Set,U=new Set;if(B){let t=new Map(B.filter(e=>"open"===e.kind).map(e=>[e.blockIndex,e.noteIndex]));for(let n=0;n<e.blocks.length;n++){let i=e.blocks[n],o=Y[n],a=new Set(o.childSectionIndices),r=i.startIndex,l=t.get(n);for(let e=0;e<=i.dividers.length;e++){let t=i.dividers[e]?.index??o.endMessageExclusive,s=o.dividerNoteIndices[e]??o.endNoteExclusive;r!==t||l!==s||a.has(e)||U.add(n),r=t,l=s}o.childBlockIndices.some(t=>e.blocks[t].startIndex===Y[t].endMessageExclusive&&0===Y[t].noteIndices.length)&&U.add(n)}for(let t=0;t<e.blocks.length;t++){let e=j.get(t);U.has(t)&&void 0!==e&&U.add(e)}}let V=e=>(N.get(e)??[]).filter(t=>!D.has(t)&&Y[t].endMessageExclusive>e),Z=e=>0===e.length?0:T[e[0]].blockHeaderExtra+e.slice(1).reduce((e,t)=>e+T[t].enclosingHeaderStep,0);for(let t=0;t<e.blocks.length;t++){if(U.has(t)||"par_over"===e.blocks[t].type)continue;let n=T[t],i=Y[t];for(let[o,a]of n.dividers.entries()){let n=eG(e.blocks[t],i,e,o);if(void 0!==n){X.set(n,Math.max(X.get(n)??0,a.noteContentOffset));continue}if(a.index>=i.endMessageExclusive)continue;let r=a.requiredExtraBefore;for(let t of i.childBlockIndices)e.blocks[t]?.startIndex===a.index&&(r+=T[t].blockHeaderExtra);let l=_.get(a.index)??0;_.set(a.index,Math.max(l,r))}}let G=new Map,Q=new Map,K=new Map;for(let t=0;t<e.actors.length;t++){let n=e.actors[t];if(void 0!==n.createMessageIndex&&n.createMessageIndex<e.messages.length){let e=G.get(n.createMessageIndex)??[];e.push(t),G.set(n.createMessageIndex,e)}if(void 0!==n.destroyMessageIndex&&n.destroyMessageIndex<e.messages.length){let e=Q.get(n.destroyMessageIndex)??[];e.push(n.id),Q.set(n.destroyMessageIndex,e)}}let ee=new Map;for(let t=0;t<e.notes.length;t++){let n=e.notes[t],i=ee.get(n.afterIndex)??[];i.push({note:n,index:t}),ee.set(n.afterIndex,i)}let en=Array(e.notes.length),ei=new Map,eo=[],er=new Map;for(let t of e.activationEvents??[]){let e=er.get(t.messageIndex)??[];e.push(t),er.set(t.messageIndex,e)}let ed=(e,t)=>{let n=ei.get(e)??[];n.push({startY:t,depth:n.length}),ei.set(e,n)},ec=(e,t)=>{let n=ei.get(e);if(!n||0===n.length)return;let{startY:i,depth:o}=n.pop(),a=w.get(e);void 0===a||t<=i||eo.push({actorId:e,x:I[a]-d/2+4*o,topY:i,bottomY:t,width:d})},eh=(e,t)=>{for(let n of er.get(e)??[])"activate"===n.kind?ed(n.actorId,t):ec(n.actorId,t)},ep=(e,t)=>{let i=et(A(e.text,e.textContent),{transform:o.nodeTextTransform,fontSize:o.nodeLabelFontSize,fontWeight:o.nodeLabelFontWeight,letterSpacing:o.nodeLetterSpacing,...e.wrap??n.wrap?{maxWidth:240}:{}}),a=Math.max(60,i.width+2*o.nodePaddingX),r=i.height+2*o.nodePaddingY,l=w.get(e.actorIds[0]??"")??0,d;if("left"===e.position)d=I[l]-k[l]/2-a-s;else if("right"===e.position)d=I[l]+k[l]/2+s;else if(e.actorIds.length>1){let t=w.get(e.actorIds[e.actorIds.length-1]??"")??l;d=(I[l]+I[t])/2-a/2}else d=I[l]-a/2;return{text:e.text,block:i,x:d,y:t,width:a,height:r,position:e.position,actors:e.actorIds}},eg=Array(e.blocks.length),eu=[],ef=-1/0,ex=q,eb=-1/0,em=0,ey=0,ek=0,ew=0,ev=new Map,eM=(t,n,i)=>{let o=0,a=[];for(let[o,r]of ev){let l=e.blocks[o];for(let e=l.startIndex;e<r.messageEnd;e++)H[e]&&a.push(H[e].bounds);for(let e of Y[o].noteIndices)e<r.noteEnd&&en[e]&&a.push(en[e]);for(let e of r.priorChildren)eg[e]&&a.push(eg[e]);for(let[s,d]of l.dividers.entries()){let c=T[o].dividers[s];if(!d.label)continue;let h=eG(l,Y[o],e,s),p=void 0!==h&&h<r.noteEnd?en[h]:void 0===h&&d.index<r.messageEnd?H[d.index]?.bounds:void 0;if(p&&a.push({x:p.x,y:p.y-c.metrics.height-8,width:c.metrics.width,height:c.metrics.height}),void 0===h&&n===d.index||void 0!==h&&i===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<=a.length;e++){let e=a.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},eI=e=>{let t=[];for(let n=e;void 0!==n&&!D.has(n);n=j.get(n))t.push(n);for(let e=t.length-1;e>=0;e--){let n=t[e],i=Math.max(ex,ef,eb)+8;eu[n]={top:i,dividerY:[]},D.add(n),ex=eb=i+T[n].enclosingHeaderStep}},eS=t=>{let n=e.blocks[t],i=Y[t],a=eu[t]?.top,r=void 0!==a&&n.startIndex===i.endMessageExclusive&&0===i.noteIndices.length?a+T[t].blockPadTop:en[i.noteIndices[0]??-1]?.y??F;D.add(t);let l=eQ(n,T[t],i,e,w,W,H,en,eg,o,g,r,eu[t]);eg[t]=l,ef=Math.max(ef,l.y+l.height);let s=ev.get(t);s&&(ex=Math.max(ex,s.bottom,ef),F=Math.max(F,ex+f/2),ev.delete(t))},e$=()=>{if(B){for(;ek<B.length;){let t=B[ek];if(t.messageIndex>H.length||t.noteIndex>em)break;let n=t.blockIndex;if("open"===t.kind&&U.has(n)&&eI(n),"open"===t.kind&&"par_over"===e.blocks[n].type){eI(n);let i=Math.max(0,...T[n].dividers.map(e=>e.noteContentOffset));eb+=i,ex=eb,F=Math.max(F,eb+f/2),ev.set(n,{messageY:F,contentBottom:ex,completedBottom:ef,reservedBottom:eb,bottom:ex,messageEnd:e.blocks[n].startIndex,noteEnd:t.noteIndex,priorChildren:[]}),ew++}if("divider"===t.kind){let e=ev.get(n);if(e){e.bottom=Math.max(e.bottom,ex,ef,eb),e.messageEnd=t.messageIndex,e.noteEnd=t.noteIndex,e.priorChildren=Y[n].childBlockIndices.filter(e=>eg[e]),({messageY:F,contentBottom:ex,completedBottom:ef,reservedBottom:eb}=e),ew++,ek++;continue}let i=T[n].dividers[t.dividerIndex],o=Math.max(ex,ef,eb)+8;U.has(n)?(eu[n].dividerY[t.dividerIndex]=o,ex=eb=o+i.noteContentOffset):eb=o+i.noteContentOffset}"close"===t.kind&&eS(n),ek++}return}for(;ey<e.blocks.length;){let e=ey,t=Y[e];if(t.endMessageExclusive>H.length||t.endNoteExclusive>em)break;eS(e),ey++}},eL=(e,t)=>{let n=t;for(let{note:t,index:i}of ee.get(e)??[]){let e=ew;for(let t of(e$(),e!==ew&&(n=F),n=Math.max(n,ef+8,eb),O.get(i)??[])){let e=eu[t]?.top;void 0!==e&&(n=Math.max(n,e+T[t].contentTopPadding))}let o=(O.get(i)??[]).filter(e=>!D.has(e)),a=X.get(i)??0;if(o.length>0||a>0){let e=a+(o.length>0?T[o[0]].contentTopPadding+o.slice(1).reduce((e,t)=>e+T[t].enclosingHeaderStep,0):0);for(let t of(n=Math.max(n,Math.max(ex,ef)+8+e),o))D.add(t)}let r=ep(t,n),l=eM(r,void 0,i);l>0&&(n+=l,r=ep(t,n)),en[i]=r,ex=Math.max(ex,r.y+r.height),em=i+1,n=r.y+r.height+4}ee.has(e)&&(F=Math.max(F,n+f/2))};eL(-1,F);for(let t=0;t<e.messages.length;t++){let n=e.messages[t],i=v[t],a=w.get(n.from)??0,r=w.get(n.to)??0,l=n.from===n.to;e$();let s=V(t),d=Math.max(_.get(t)??0,Z(s));for(let e of G.get(t)??[]){let t=W[e].height/2;d=d>0?d+Math.max(0,t-12):t+8}F+=d+i.extraAboveHeight;let c=I[a],h=I[r],p=e.actors[r].createMessageIndex!==t||"participant"!==e.actors[r].type||l?h:h-Math.sign(h-c)*k[r]/2,u=()=>{let a=function(e,t,n,i,o,a){let r=e.from===e.to;if(r){let l=a+Math.max(20,t.labelMetrics.height)/2,s=eR(t.displayLabel,i+30+8,l,"start",n.edgeLabelFontSize,n.edgeLabelFontWeight,n.edgeLetterSpacing,t.block),d={x:i-t.startPad,y:a-t.markerHalfHeight,width:30+t.startPad+n.lineWidth/2,height:20+2*t.markerHalfHeight},c=t.label?eJ(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:i,x2:o,y:a,isSelf:r,points:[{x:i,y:a},{x:i+30,y:a},{x:i+30,y:a+20},{x:o,y:a+20}],labelPosition:s,bounds:c}}let l=Math.max(2.85,n.lineWidth/2+2),s=Math.max(10,t.labelMetrics.height/2+l),d=eR(t.displayLabel,(i+o)/2,a-s,"middle",n.edgeLabelFontSize,n.edgeLabelFontWeight,n.edgeLetterSpacing,t.block),c=i<=o?t.startPad:t.endPad,h=i<=o?t.endPad:t.startPad,p=Math.min(i,o)-c,g=Math.max(i,o)+h,u={x:p,y:a-t.markerHalfHeight,width:g-p,height:2*t.markerHalfHeight},f=t.label?eJ(u,d.bounds):u;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:i,x2:o,y:a,isSelf:r,points:[{x:i,y:a},{x:o,y:a}],labelPosition:d,bounds:f}}(n,i,o,c,p,F);for(let n of(H[t]=a,G.get(t)??[]))W[n]=eZ(e.actors[n],y[n],I[n],F-W[n].height/2);return a},b=u(),m=b.bounds.y,M=0,S=new Set(s),$=(N.get(t)??[]).filter(e=>S.has(e)||eu[e]?.top!==void 0&&!eg[e]);if($.length>0){let t=[];for(let n of $){for(let e of Y[n].childBlockIndices)eg[e]&&(t[e]=eg[e]);t[n]=eQ(e.blocks[n],T[n],Y[n],e,w,W,H,en,t,o,g,F,eu[n]);let i=eu[n]?.top;void 0!==i?M=Math.max(M,i-t[n].y):m=Math.min(m,t[n].y)}}let L=Math.max(0,M,(s.length>0?Math.max(ex,ef,eb):Math.max(ef,eb))+8*(s.length>0)-m);L>0&&(F+=L,b=u());let C=eM(b.bounds,t);for(let e of(C>0&&(F+=C,b=u()),s))D.add(e);ex=Math.max(ex,b.bounds.y+b.bounds.height,...(G.get(t)??[]).map(e=>W[e].bounds.y+W[e].bounds.height)),eh(t,F);let P=Q.get(t);if(P)for(let e of P)K.set(e,F);n.activate&&ed(n.to,F),n.deactivate&&ec(n.from,F);let q=l?Math.max(x,Math.ceil(i.labelMetrics.height)+10):0;F+=l?q+f:f;let E=G.get(t);if(E){let e=Math.max(...E.map(e=>{let t=W[e];return t.bounds.height-t.height/2}));F+=e}let z=E?ex+8:b.y+q+14;eL(t,z)}e$();let eC=Math.max(H[H.length-1]?.y??F,F-f/2);for(let[t,n]of(eh(e.messages.length,eC),ei))for(;n.length>0;)ec(t,eC);for(let t of W)e.actors[w.get(t.id)]?.external&&(t.external=!0);for(let[t,n]of H.entries()){let i=e.messages[t];void 0!==i.id&&(n.id=i.id),void 0!==i.parentId&&(n.parentId=i.parentId)}for(let[t,n]of eg.entries()){let i=e.blocks[t];void 0!==i.id&&(n.id=i.id),void 0!==i.parentId&&(n.parentId=i.parentId)}for(let[t,n]of en.entries()){let i=e.notes[t];n&&i?.id!==void 0&&(n.id=i.id),n&&i?.parentId!==void 0&&(n.parentId=i.parentId)}let eW=en.filter(e=>void 0!==e),eP=eg.reduce((e,t)=>Math.max(e,t.y+t.height),0);eP>0&&(F=Math.max(F,eP+8));let eq=F,eF=$.map(({box:e,memberIdxs:t,block:n})=>{let i=Math.min(...t.map(e=>W[e].bounds.x))-8,o=Math.max(...t.map(e=>W[e].bounds.x+W[e].bounds.width))+8;return e.label&&(o=Math.max(o,i+n.width+16)),{label:e.label,block:n,labelY:r+L/2,color:e.color,x:i,y:r,width:o-i,height:eq+8-r}}),eH=F+r,ez=a,eT=0;for(let e of W){let t=e.bounds;ez=Math.min(ez,t.x),eT=Math.max(eT,t.x+t.width)}for(let e of eg)ez=Math.min(ez,e.x),eT=Math.max(eT,e.x+e.width);for(let e of eW)ez=Math.min(ez,e.x),eT=Math.max(eT,e.x+e.width);for(let e of eF)ez=Math.min(ez,e.x),eT=Math.max(eT,e.x+e.width);for(let e of eo)ez=Math.min(ez,e.x),eT=Math.max(eT,e.x+e.width);for(let e of H){ez=Math.min(ez,e.bounds.x);let t=e.isSelf&&e.label?8:0;eT=Math.max(eT,e.bounds.x+e.bounds.width+t)}let eB=ez<a?a-ez:0;if(eB>0){eK({actors:W,messages:H,blocks:eg,notes:eW,boxes:eF,activations:eo,lifelines:[],destructions:[]},eB,0);for(let e=0;e<I.length;e++)I[e]+=eB}let e_=e.actors.map((e,t)=>{let n=W[t],i=n.bounds.y+n.bounds.height;return{actorId:e.id,x:I[t],topY:i,bottomY:K.get(e.id)??eH-r}}),eN=e.actors.filter(e=>K.has(e.id)).map(e=>({actorId:e.id,x:I[w.get(e.id)],y:K.get(e.id)}));return e2({width:Math.max(eT+eB+a,200),height:Math.max(eH,100),accessibilityTitle:e.accessibilityTitle,accessibilityDescription:e.accessibilityDescription,actors:W,lifelines:e_,messages:H,activations:eo,blocks:eg,notes:eW,boxes:eF,destructions:eN},void 0===e.title?void 0:A(e.title,e.titleContent),o,a,r)}function e2(e,t,n,i,o){let a=T(t,n);if(!a)return e;if(0===e.width&&0===e.height)return{...e,...B(a,i,o)};let r=a.height;eK(e,0,r);let l=Math.max(e.width,a.width+2*i);return{...e,width:l,height:e.height+r,title:_(a,l,o)}}function e3(e,t){let n,i,o,a,r,{positioned:l,colors:s,resolved:d}=t,c=d.renderOptions,h=s.font??"Inter",p=c.transparent??!1,g=[],u=z(c,e0,d.styleFace),f=`seq-${ee(l.width,l.height,l.actors.length,l.messages.length)}`,x=`${f}-title`,b=`${f}-desc`,m=W(l.accessibilityTitle,l.accessibilityDescription,x,b);g.push(e.documentOpen({id:"prelude",width:l.width,height:l.height,colors:s,transparent:p,font:h,hasMonoFont:!1},L(l.width,l.height,s,p,m)+`
4
+ `+$(h,!1,s.shadow,s.embedFontImport)));let w=[];w.push("<defs>");let v=(n=E.width,i=E.height,o=u.edgeStrokeColor??"var(--_arrow)",a={size:{width:n,height:i},orient:"auto-start-reverse"},r=[{x:0,y:0},{x:n,y:i/2},{x:0,y:i}],[{...a,id:"seq-arrow",shape:"arrow",ref:{x:n,y:i/2},geometry:{kind:"polygon",points:r},paint:{fill:o}},{...a,id:"seq-arrow-open",shape:"open-arrow",ref:{x:n,y:i/2},geometry:{kind:"polyline",points:r},paint:{fill:"none",stroke:o,strokeWidth:"1"}},{...a,id:"seq-arrow-cross",shape:"cross",ref:{x:n/2,y:i/2},orient:"auto",geometry:{kind:"path",d:`M1 1 L${n-1} ${i-1} M1 ${i-1} L${n-1} 1`},paint:{fill:"none",stroke:o,strokeWidth:"1.5"}},{...a,id:"seq-arrow-half-top",shape:"arrow",ref:{x:n,y:i/2},geometry:{kind:"polygon",points:[{x:0,y:0},{x:n,y:i/2},{x:0,y:i/2}]},paint:{fill:o}},{...a,id:"seq-arrow-half-bottom",shape:"arrow",ref:{x:n,y:i/2},geometry:{kind:"polygon",points:[{x:0,y:i/2},{x:n,y:i/2},{x:0,y:i}]},paint:{fill:o}},{...a,id:"seq-arrow-stick-top",shape:"open-arrow",ref:{x:n,y:i/2},geometry:{kind:"path",d:`M0 0 L${n} ${i/2}`},paint:{fill:"none",stroke:o,strokeWidth:"1.5"}},{...a,id:"seq-arrow-stick-bottom",shape:"open-arrow",ref:{x:n,y:i/2},geometry:{kind:"path",d:`M0 ${i} L${n} ${i/2}`},paint:{fill:"none",stroke:o,strokeWidth:"1.5"}}]);w.push(P(v));let M=S(s);M&&w.push(M),w.push("</defs>"),g.push(e.definitions({id:"defs",markerResources:v},w.join(`
5
+ `))),l.accessibilityTitle&&g.push(e.documentContent({id:"a11y-title",role:"chrome",nonPaint:"accessibility"},`<title id="${x}">${V(l.accessibilityTitle)}</title>`)),l.accessibilityDescription&&g.push(e.documentContent({id:"a11y-desc",role:"chrome",nonPaint:"accessibility"},`<desc id="${b}">${V(l.accessibilityDescription)}</desc>`));let I=l.blocks.some(e=>"rect"===e.type),q=I?[...l.blocks].reverse().sort((e,t)=>t.width*t.height-e.width*e.height):l.blocks,F=function(e,t,n,i){let o=(e,t,n)=>t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height,a=e.flatMap(e=>{let t=e.color&&"transparent"!==e.color.toLowerCase()?ek(e.color):void 0;return t?[{x:e.x,y:e.y,width:e.width,height:e.height,hex:t,authored:!0}]:[]}),r=C("var(--bg)",i)??"#ffffff";for(let e of t){let t=e6(e,n),l=void 0===t?void 0:C(t,i)??t,s=void 0===l?null:O(l);if(!s||0===s[3])continue;let d=e.x+e.width/2,c=e.y+e.height/2,h=j(l,a.findLast(e=>o(e,d,c))?.hex??r);h&&a.push({x:e.x,y:e.y,width:e.width,height:e.height,hex:eo(...h),authored:"rect"===e.type})}return(e,t)=>{let n=a.findLastIndex(t=>o(t,e.x,e.y)),r=a[n],l=void 0!==r&&!(o(r,e.x-e.width/2,e.y-e.height/2)&&o(r,e.x+e.width/2,e.y+e.height/2))||a.some((t,i)=>i>n&&t.hex!==r?.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(!r)return l?{ink:t,halo:"var(--bg)"}:{ink:t};let s=C(t,i),d=s?er(s,r.hex):y(r.hex)??t;return r.authored||l?{ink:d,halo:r.hex}:{ink:d}}}(l.boxes,q,u,s);l.title&&g.push(e.text(N(l.title,u)));let T=new Map;for(let t of l.boxes){let n=t.label??"",i=T.get(n)??0;T.set(n,i+1),g.push(function(e,t,n,i){let o=[],a=`<g class="box"${t.label?` data-label="${G(t.label)}"`:""}>`,r=t.color?.toLowerCase()==="transparent"?"none":t.color,l=r??"color-mix(in srgb, var(--fg) 5%, var(--bg))";if(o.push({indent:2,node:e.shape({id:`${i}:rect`,role:"group",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:n.groupCornerRadius,ry:n.groupCornerRadius},paint:{fill:l,stroke:"none"}})}),t.label){let a=t.block?.text??Y(t.label,n.groupTextTransform),l=function(e,t){let n=t.groupTextColor??"var(--_text-sec)";if(!e||"none"===e)return n;let i=ek(e);if(!i)return n;let o=t.groupTextColor;if(o){let e=X(o,i);if(null!==e&&e>=4.5)return o}return y(i)??n}(r,n),s=t.x+t.width/2,d=t.labelY??t.y+13;o.push({indent:2,node:e.text({id:`${i}:title`,role:"label",text:a,block:t.block,x:s,y:d,fontSize:n.groupHeaderFontSize,fontWeight:n.groupHeaderFontWeight,letterSpacing:n.groupLetterSpacing,anchor:"middle",paint:{fill:l}})})}return e.group({id:i,role:"group",open:a,close:"</g>",children:o})}(e,t,u,`box:${n}#${i}`))}let B=new Map,_=new Map;for(let e of l.blocks){let t=B.get(e.type)??0;B.set(e.type,t+1),_.set(e,e.id??`block:${e.type}#${t}`)}for(let t of q)g.push(e9(e,t,u,_.get(t),I?"background":"all"));if(I){for(let t of q)"rect"!==t.type&&g.push(e9(e,t,u,_.get(t),"frame"));for(let t of l.blocks)t.dividers.length>0&&g.push(e9(e,t,u,_.get(t),"dividers"))}let A=function(e){let t=new Map,n=[];for(let i of e){let e=`${i.from}->${i.to}`,o=t.get(e)??0;if(t.set(e,o+1),!i.labelPosition.text.trim())continue;let a=i.labelPosition.bounds;n.push({key:`${e}#${o}`,x:a.x-2,y:a.y-2,width:a.width+4,height:a.height+4})}let i=e=>{let t="x"===e?"width":"height",i=[...n].sort((t,n)=>t[e]-n[e]),o=(n,a)=>{if(n>=a)return;let r=n+a>>>1,l=i[r],s=o(n,r),d=o(r+1,a);return{area:l,left:s,right:d,end:Math.max(l[e]+l[t],s?.end??-1/0,d?.end??-1/0)}},a=o(0,i.length);return n=>{let i=[],o=a=>{if(!a||a.end<n[e])return;o(a.left);let r=a.area;r[e]>n[e]+n[t]||(r.x<=n.x+n.width&&r.x+r.width>=n.x&&r.y<=n.y+n.height&&r.y+r.height>=n.y&&i.push(r),o(a.right))};return o(a),i}},o=i("x"),a=i("y");return(e,t)=>{let n=("x"===t?o:a)(e).sort((e,t)=>e.y-t.y),i=[],r=e.y+e.height,l=e.y,s;for(let t of n){let n=Math.max(e.y,t.y);n>l&&i.push({top:l,bottom:n,after:s});let o=Math.min(r,t.y+t.height);o>l&&(l=o,s=t.key)}return l<r&&i.push({top:l,bottom:r,after:s}),i}}(l.messages),D=new Set(l.actors.filter(e=>e.external).map(e=>e.id));for(let t of l.lifelines){if(D.has(t.actorId))continue;let n=Math.max(.75,.75*u.lineWidth);g.push(function(e,t,n,i){let o=n.edgeStrokeColor??"var(--_line)",a=Math.max(.75,.75*n.lineWidth),r=`lifeline:${t.actorId}`;return 1!==i.length||i[0].top!==t.topY||i[0].bottom!==t.bottomY?e.group({id:r,role:"lifeline",open:`<g class="lifeline" data-actor="${Z(t.actorId)}">`,close:"</g>",children:i.map(n=>{let i=(n.top-t.topY)%10;return{indent:2,node:e.connector({id:n.after?K(r,"after",n.after):K(r,"start"),role:"lifeline",geometry:{kind:"line",x1:t.x,y1:n.top,x2:t.x,y2:n.bottom},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(a),strokeDasharray:"6 4",strokeDashoffset:String(i)}})}})}):e.connector({id:r,role:"lifeline",geometry:{kind:"line",x1:t.x,y1:t.topY,x2:t.x,y2:t.bottomY},lineStyle:"dashed",paint:{stroke:o,strokeWidth:String(a),strokeDasharray:"6 4"},attributes:{className:"lifeline",data:{actor:t.actorId}}})}(e,t,u,A({x:t.x-n/2,y:t.topY,width:n,height:t.bottomY-t.topY},"x")))}let R=new Map;for(let t of l.activations){let n=R.get(t.actorId)??0;R.set(t.actorId,n+1),g.push(function(e,t,n,i,o){let a=n.nodeFillColor??"var(--_node-fill)",r=n.nodeBorderColor??"var(--_node-stroke)";if(1!==o.length||o[0].top!==t.topY||o[0].bottom!==t.bottomY){let n=[],l=[],s=[];for(let e of o)for(let n 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 ${n.x1} ${n.y1} L ${n.x2} ${n.y2}`);if(l.length){let t=l.join(" "),o=s.join(" ");n.push({indent:2,node:e.shape({id:K(i,"fill"),role:"activation",surfaceFragment:!0,geometry:{kind:"path",d:t},paint:{fill:a,stroke:"none"}})}),n.push({indent:2,node:e.shape({id:K(i,"border"),role:"activation",geometry:{kind:"path",d:o},paint:{fill:"none",stroke:r,strokeWidth:String(H.innerBox)}})})}return e.group({id:i,role:"activation",open:`<g class="activation" data-actor="${Z(t.actorId)}">`,close:"</g>",children:n})}return e.shape({id:i,role:"activation",geometry:{kind:"rect",x:t.x,y:t.topY,width:t.width,height:t.bottomY-t.topY},paint:{fill:a,stroke:r,strokeWidth:String(H.innerBox)},attributes:{className:"activation",data:{actor:t.actorId}}})}(e,t,u,`activation:${t.actorId}#${n}`,A({x:t.x-H.innerBox/2,y:t.topY,width:t.width+H.innerBox,height:t.bottomY-t.topY},"y")))}let J=new Map;for(let t of l.blocks){let n=J.get(t.type)??0;J.set(t.type,n+1),"rect"!==t.type&&t.header&&g.push(function(e,t,n,i){let{x:o,y:a,width:r,height:l,label:s}=t,{text:d,x:c,y:h}=s,p=n.groupHeaderFillColor??"var(--_group-hdr)",g=n.groupBorderColor??"var(--_node-stroke)",u=n.groupTextColor??"var(--_text-sec)";return e.group({id:`${i}: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:`${i}:tab`,role:"block",geometry:{kind:"rect",x:o,y:a,width:r,height:l},paint:{fill:p,stroke:g,strokeWidth:String(n.groupLineWidth)}})},{indent:0,node:e.text({id:`${i}:label`,role:"label",text:d,block:s.block,x:c,y:h,fontSize:n.groupHeaderFontSize,fontWeight:n.groupHeaderFontWeight,letterSpacing:n.groupLetterSpacing,anchor:"start",paint:{fill:u}})}]})}(e,t.header,u,_.get(t)))}let U=new Map;for(let t of l.blocks){let n=U.get(t.type)??0;U.set(t.type,n+1),t.dividers.some(e=>e.label)&&g.push(function(e,t,n,i,o){let a=n.edgeTextColor??"var(--_text-muted)",r=[];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(e8(h),a),g={ink:p.ink,halo:p.halo??n.groupFillColor??"var(--bg)"};r.push({indent:2,node:e.text({id:`${i}:divider#${l}:label`,role:"label",text:s,block:t.labelPosition.block,x:d,y:c,fontSize:n.edgeLabelFontSize,fontWeight:n.edgeLabelFontWeight,letterSpacing:n.edgeLetterSpacing,anchor:"start",paint:{fill:g.ink,...e5(g)}})})}),e.group({id:`${i}:divider-labels`,role:"block",open:'<g class="sequence-block-divider-labels" pointer-events="none">',close:"</g>",children:r})}(e,t,u,_.get(t),F))}let Q=new Map;for(let t of l.messages){let n=`${t.from}->${t.to}`,i=Q.get(n)??0;Q.set(n,i+1),g.push(function(e,t,n,i,o,a){let r=[],l=e4(a,t.startHead),s=e4(a,t.endHead),d=n.edgeStrokeColor??"var(--_line)",c=n.edgeTextColor??"var(--_text-muted)",{text:h,x:p,y:g,bounds:u}=t.labelPosition,f={stroke:d,strokeWidth:String(n.lineWidth),..."dashed"===t.lineStyle?{strokeDasharray:"6 4"}:{}},x={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="${G(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){r.push({indent:2,node:e.connector({id:`${i}:line`,role:"message",geometry:{kind:"polyline",points:t.points},lineStyle:t.lineStyle,paint:f,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...x})});let a=o(e8(u),c);r.push({indent:2,node:e.text({id:`${i}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:n.edgeLabelFontSize,fontWeight:n.edgeLabelFontWeight,letterSpacing:n.edgeLetterSpacing,anchor:"start",paint:{fill:a.ink,...e5(a)}})})}else{let a=t.points[0],d=t.points[t.points.length-1];r.push({indent:2,node:e.connector({id:`${i}:line`,role:"message",geometry:{kind:"line",x1:a.x,y1:a.y,x2:d.x,y2:d.y},lineStyle:t.lineStyle,paint:f,markers:{...l?{start:l}:{},mid:[],...s?{end:s}:{}},...x})});let b=o(e8(u),c);r.push({indent:2,node:e.text({id:`${i}:label`,role:"label",text:h,block:t.labelPosition.block,x:p,y:g,fontSize:n.edgeLabelFontSize,fontWeight:n.edgeLabelFontWeight,letterSpacing:n.edgeLetterSpacing,anchor:"middle",paint:{fill:b.ink,...e5(b)}})})}return t.centralStart&&r.push({indent:2,node:e.shape({id:`${i}: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&&r.push({indent:2,node:e.shape({id:`${i}: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:i,role:"message",open:b,close:"</g>",children:r})}(e,t,u,t.id??`message:${n}#${i}`,F,v))}let et=new Map;for(let t of l.notes){let n=`${(t.actors??[]).join(",")}@${t.position??"over"}`,i=et.get(n)??0;et.set(n,i+1),g.push(function(e,t,n,i,o){let{x:a,y:r,width:l,height:s}=t,d=t.actors&&t.actors.length>0?` data-actors="${t.actors.map(Z).join(",")}"`:"",c=t.position?` data-position="${Z(t.position)}"`:"",h=n.nodeFillColor??"var(--bg)",p=n.nodeBorderColor??"var(--_node-stroke)",g=n.nodeTextColor??k("var(--_text-muted)",h,i),u=n.cornerRadius??0,f=t.block?.text??Y(t.text,n.nodeTextTransform);return e.group({id:o,role:"note",open:`<g class="note"${c}${d}${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:r,width:l,height:s,rx:u,ry:u},paint:{fill:h,stroke:p,strokeWidth:String(H.innerBox)}})},{indent:2,node:e.text({id:`${o}:text`,role:"label",text:f,block:t.block,x:a+l/2,y:r+s/2,fontSize:n.nodeLabelFontSize,fontWeight:n.nodeLabelFontWeight,letterSpacing:n.nodeLetterSpacing,anchor:"middle",paint:{fill:g}})}]})}(e,t,u,s,t.id??`note:${n}#${i}`))}for(let t of l.destructions)g.push(function(e,t,n){let i=n.edgeStrokeColor??"var(--_line)",o=Math.max(1.5,n.lineWidth),a=`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:a},paint:{fill:"none",stroke:i,strokeWidth:String(o)},channels:{category:t.actorId},attributes:{className:"destroy-cross",data:{actor:t.actorId}}})}(e,t,u));for(let t of l.actors)t.external||g.push(function(e,t,n,i,o,a,r){let{id:l,x:s,y:d,width:c,height:h,label:p,type:g}=t,u=[],f=ea(o,"actor",{category:l},{includeFallback:!1}),x=f?.fontSize??n.nodeLabelFontSize,b=f?.fontWeight??n.nodeLabelFontWeight,m=f?.letterSpacing??n.nodeLetterSpacing,y=(f?.textTransform??n.nodeTextTransform,f?.lineWidth??n.nodeLineWidth),w=f?.fillColor??n.nodeFillColor??"var(--_node-fill)",v=f?.borderColor??n.nodeBorderColor??"var(--_node-stroke)",M=f?.textColor??n.nodeTextColor??"var(--_text)",I=f?.textColor??n.nodeTextColor??k("var(--_text)",w,i),S=a&&t.links?` data-links="${Z(JSON.stringify(t.links))}" role="link" tabindex="0"`:"",$=`<g class="actor" data-id="${Z(l)}" data-label="${G(p)}" data-type="${g}"${S}>`,{text:L,x:C,y:W,bounds:P}=t.labelPosition,q=r(e8(P),M);if("actor"===g){let i=h/24*.9,o=s-12*i,a=d+(h-24*i)/2,r=y/i;u.push({indent:2,node:e.pathArtwork({id:`actor:${l}:icon`,owner:{id:l,role:"actor"},channels:{category:l},open:`<g transform="translate(${o},${a}) scale(${i})">`,transform:{kind:"matrix",a:i,b:0,c:0,d:i,e:o,f:a},paint:{fill:"none",stroke:f?.borderColor??n.edgeStrokeColor??"var(--_line)",strokeWidth:String(r)},join:`
6
+ `,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:${l}:label`,role:"label",text:L,block:t.labelPosition.block,x:C,y:W,fontSize:x,fontWeight:b,letterSpacing:m,anchor:"middle",paint:{fill:q.ink,...e5(q)},channels:{category:l}})})}else if("participant"!==g){let i=s-c/2,o=d+2,a=Math.max(24,h-4),r=[],p={id:l,role:"actor"},k={fill:w,stroke:f?.borderColor??n.edgeStrokeColor??"var(--_line)",strokeWidth:String(y)},v=t=>{r.push(e.shape({id:K(`actor:${l}:icon`,"part",r.length),role:"icon",owner:p,geometry:t,paint:k}))},M=e=>v({kind:"path",d:e}),I=(e,t,n)=>v({kind:"circle",cx:e,cy:t,r:n}),S=(e,t,n,i)=>v({kind:"line",x1:e,y1:t,x2:n,y2:i}),$=(e,t,n,i,o)=>v({kind:"rect",x:e,y:t,width:n,height:i,...void 0===o?{}:{rx:o}});"database"===g?(v({kind:"ellipse",cx:s,cy:o+5,rx:c/2,ry:5}),M(`M${i} ${o+5}V${o+a-5}A${c/2} 5 0 0 0 ${i+c} ${o+a-5}V${o+5}`),v({kind:"ellipse",cx:s,cy:o+a-5,rx:c/2,ry:5})):"collections"===g?($(i+6,o,c-6,a-6),$(i,o+6,c-6,a-6)):"queue"===g?($(i,o,c,a,a/2),S(i+8,o+a/2,i+c-8,o+a/2)):"entity"===g?(I(s,o+a/2-3,Math.min(c,a)/2-3),S(i+5,o+a,i+c-5,o+a)):"boundary"===g?(I(s+3,o+a/2,Math.min(c,a)/2-3),S(i+3,o+2,i+3,o+a-2)):"control"===g?(I(s,o+a/2,Math.min(c,a)/2-3),M(`M${s-4} ${o+4}L${s+4} ${o}L${s+2} ${o+8}`)):I(s,o+a/2,Math.min(c,a)/2-3),u.push({indent:2,node:e.group({id:`actor:${l}:icon`,role:"icon",owner:p,channels:{category:l},open:`<g class="sequence-actor-glyph sequence-actor-${g}">`,close:"</g>",join:"",children:r.map(e=>({node:e,indent:0}))})}),u.push({indent:2,node:e.text({id:`actor:${l}:label`,role:"label",text:L,block:t.labelPosition.block,x:C,y:W,fontSize:x,fontWeight:b,letterSpacing:m,anchor:"middle",paint:{fill:q.ink,...e5(q)},channels:{category:l}})})}else{let i=s-c/2,o=f?.cornerRadius??n.cornerRadius??4;u.push({indent:2,node:e.shape({id:`actor:${l}:box`,role:"actor",geometry:{kind:"rect",x:i,y:d,width:c,height:h,rx:o,ry:o},paint:{fill:w,stroke:v,strokeWidth:String(y)},channels:{category:l}})}),u.push({indent:2,node:e.text({id:`actor:${l}:label`,role:"label",text:L,block:t.labelPosition.block,x:C,y:W,fontSize:x,fontWeight:b,letterSpacing:m,anchor:"middle",paint:{fill:I},channels:{category:l}})})}let F="participant"===g?I:M;return t.links&&u.push({indent:2,node:e.text({id:`actor:${l}:menu`,role:"icon",text:"⋯",block:t.menuBlock,x:s+c/2-7,y:d+10,fontSize:10,anchor:"middle",paint:{fill:F},channels:{category:l},baselineShift:0,attributes:{className:"sequence-actor-menu"}})}),e.group({id:`actor:${l}`,role:"actor",open:$,close:"</g>",children:u,channels:{category:l}})}(e,t,u,s,d.styleFace,"strict"!==c.security,F));return g.push(e.documentClose()),{family:"sequence",width:l.width,height:l.height,colors:s,transparent:p,parts:g}}function e5(e){return e.halo?{stroke:e.halo,strokeWidth:"3",strokeLinejoin:"round",paintOrder:"stroke"}:{}}function e8(e){return{x:e.x+e.width/2,y:e.y+e.height/2,width:e.width,height:e.height}}function e4(e,t){if("none"===t)return;let n="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===n)}function e6(e,t){return"rect"===e.type?e.color??t.groupFillColor??"rgba(128, 128, 128, 0.5)":t.groupFillColor}function e9(e,t,n,i,o="all"){let a=[],r=t.label?` data-label="${G(t.label)}"`:"",l="dividers"===o?`<g class="sequence-block-divider-overlay" data-owner="${Z(i)}">`:"frame"===o?`<g class="sequence-block-frame-overlay" data-owner="${Z(i)}">`:`<g class="block" data-type="${Z(t.type)}"${r}${void 0===t.parentId?"":` data-parent-id="${Z(t.parentId)}"`}>`,s=e6(t,n)??"none",d="rect"===t.type?"none":n.groupBorderColor??"var(--_node-stroke)";"dividers"!==o&&a.push({indent:2,node:e.shape({id:"frame"===o?`${i}:frame`:`${i}:rect`,role:"block",geometry:{kind:"rect",x:t.x,y:t.y,width:t.width,height:t.height,rx:n.groupCornerRadius,ry:n.groupCornerRadius},paint:{fill:"frame"===o?"none":s,stroke:"background"===o?"none":d,strokeWidth:String(n.groupLineWidth)}})});let c=n.edgeStrokeColor??"var(--_line)",h=0;for(let r of"background"===o||"frame"===o||"par_over"===t.type?[]:t.dividers){let o=`${i}:divider#${h}`;h++;let l=Math.max(.75,.75*n.lineWidth);a.push({indent:2,node:e.connector({id:o,role:"block",geometry:{kind:"line",x1:t.x,y1:r.y,x2:t.x+t.width,y2:r.y},lineStyle:"dashed",paint:{stroke:c,strokeWidth:String(l),strokeDasharray:"6 4"}})})}return e.group({id:"dividers"===o?`${i}:divider-overlay`:"frame"===o?`${i}:frame-overlay`:i,role:"block",open:l,close:"</g>",children:a})}var e7=f(e3);function te({positioned:e,options:t}){let n=new Map(e.lifelines.map(e=>[e.actorId,e.x])),i=new Map;for(let t of e.messages)for(let e of[t.from,t.to])i.has(e)||i.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:s(e.external?e.x:e.bounds.x),y:s(e.external?i.get(e.id)??e.y:e.bounds.y),w:s(e.external?0:e.bounds.width),h:s(e.external?0:e.bounds.height),shape:e.external?"external-anchor":"rectangle",label:e.label,labelBounds:l(e.labelPosition.bounds),labelContainer:l(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:s(e.x),y:s(e.y),w:s(e.width),h:s(e.height),shape:"note",label:e.text,...h(e.block,e.x+e.width/2,e.y+e.height/2,e),role:"box"}))],edges:e.messages.map((e,i)=>{var o;let a,r,h,p,g,u,f,x;return{id:e.id??`msg#${i}:${e.from}->${e.to}`,...void 0===e.parentId?{}:{parentId:e.parentId},from:e.from,to:e.to,path:e.points.map(e=>[s(e.x),s(e.y)]),label:e.label?{x:s(e.labelPosition.x),y:s(e.labelPosition.y),text:e.label,bounds:l(e.labelPosition.bounds)}:void 0,route:t.debug?(o=e.points,a=n.get(e.from),r=n.get(e.to),h=o[0],p=o[o.length-1],g=void 0!==a&&void 0!==h&&1>=Math.abs(h.x-a),u=void 0!==r&&void 0!==p&&1>=Math.abs(p.x-r),f=!e.isSelf&&o.every(t=>1>=Math.abs(t.y-e.y)),x=d(o),{family:"sequence",edgeIndex:i,routeClass:"family-layout",invariant:g&&u&&x?e.isSelf?"self-message":"lifeline-message":"unverified-family-route",bendCount:c(o),horizontal:f,sourceLifeline:g,targetLifeline:u,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:s(e.bounds.x),y:s(e.bounds.y),w:s(e.bounds.width),h:s(e.bounds.height),members:void 0===e.id?[]:o.get(e.id)??[],label:e.label})),bounds:{w:s(e.width),h:s(e.height)}}}export{ep as a,ez as b,eT as c,eB as d,e_ as e,e1 as f,e3 as g,e7 as h,te as i};