@wo658/redpact 0.3.0 → 0.4.1

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 (95) hide show
  1. package/dist/adapters/environment/testcontainers.js +20 -6
  2. package/dist/adapters/environment/unit-container.js +6 -3
  3. package/dist/adapters/environment/unit-worker.js +14 -1
  4. package/dist/adapters/playwright/Dockerfile +3 -0
  5. package/dist/adapters/playwright/worker.js +23 -1
  6. package/dist/ui/assets/{abnfDiagram-O67JEVCF-D5_0c71T.js → abnfDiagram-O67JEVCF-EXZIR7uE.js} +1 -1
  7. package/dist/ui/assets/{arc-CvMU1nxC.js → arc-DZ7IkhQL.js} +1 -1
  8. package/dist/ui/assets/architecture-7GRP2DOG-DPAY49ac.js +1 -0
  9. package/dist/ui/assets/{architectureDiagram-NJMV4G6O-C5pnJhyL.js → architectureDiagram-NJMV4G6O-oFZ4jPG2.js} +1 -1
  10. package/dist/ui/assets/{blockDiagram-BEXU5L5S-CSY4YaYG.js → blockDiagram-BEXU5L5S-BBUTa13d.js} +1 -1
  11. package/dist/ui/assets/{c4Diagram-YGBWAQC7-BAqi3qgX.js → c4Diagram-YGBWAQC7-CrOB8ApR.js} +1 -1
  12. package/dist/ui/assets/channel-B4U25mhB.js +1 -0
  13. package/dist/ui/assets/{chunk-3FUC2YCW-Brp5pppL.js → chunk-3FUC2YCW-W4k2bur_.js} +1 -1
  14. package/dist/ui/assets/{chunk-5DYCD2WN-DPF_imHM.js → chunk-5DYCD2WN-DsvkZxf0.js} +1 -1
  15. package/dist/ui/assets/{chunk-742MDFTN-B7dqi4lM.js → chunk-742MDFTN-Q9c012fL.js} +1 -1
  16. package/dist/ui/assets/{chunk-7INBJB4K-owIg7950.js → chunk-7INBJB4K-D6-5S_eb.js} +1 -1
  17. package/dist/ui/assets/{chunk-7M6MHVWA-DxdsTD3q.js → chunk-7M6MHVWA-BX-zqrmJ.js} +1 -1
  18. package/dist/ui/assets/{chunk-7PRAP22T-CnZEk7pT.js → chunk-7PRAP22T-D5sSirGe.js} +1 -1
  19. package/dist/ui/assets/{chunk-GTNCS2PH-tIfcSoKX.js → chunk-GTNCS2PH-BrjKdoU7.js} +1 -1
  20. package/dist/ui/assets/{chunk-GWA4HPMP-DvKgnHj7.js → chunk-GWA4HPMP-BzyuOibA.js} +1 -1
  21. package/dist/ui/assets/{chunk-MBY4JIJT-DecLyoJ2.js → chunk-MBY4JIJT-Jg4QirYy.js} +1 -1
  22. package/dist/ui/assets/{chunk-NETBCI7D-IIqAxd8x.js → chunk-NETBCI7D-Bo5sr5ak.js} +1 -1
  23. package/dist/ui/assets/{chunk-O7XYJQB3-BYf0cBjb.js → chunk-O7XYJQB3-ADuOEPCt.js} +1 -1
  24. package/dist/ui/assets/{chunk-UA2S7LBM-Axt5K_7j.js → chunk-UA2S7LBM-BWLbUYDY.js} +1 -1
  25. package/dist/ui/assets/{chunk-WEXAMYUT-DZkcP9P-.js → chunk-WEXAMYUT-BfdLD4oE.js} +1 -1
  26. package/dist/ui/assets/{chunk-XXDRQBXY-DEJDL8DG.js → chunk-XXDRQBXY-CEdjCwp8.js} +1 -1
  27. package/dist/ui/assets/{chunk-Z7XXMR3K-B2eslene.js → chunk-Z7XXMR3K-ooKdHdRU.js} +1 -1
  28. package/dist/ui/assets/{chunk-ZIGJFQKS-Bo83y6q0.js → chunk-ZIGJFQKS-u0lffPbH.js} +1 -1
  29. package/dist/ui/assets/{classDiagram-v2-NBCMYWYE-DKtuWfBH.js → classDiagram-v2-NBCMYWYE-kQl6D-HR.js} +1 -1
  30. package/dist/ui/assets/{cose-bilkent-JH36ORCC-jj68zcpo.js → cose-bilkent-JH36ORCC-DFDknAe8.js} +1 -1
  31. package/dist/ui/assets/{cynefin-OW5HDTMX-DHM-y63G.js → cynefin-OW5HDTMX-D4vNepxD.js} +1 -1
  32. package/dist/ui/assets/{cynefinDiagram-VND7K2PF-CcbJEZHa.js → cynefinDiagram-VND7K2PF-BFJ8dEz7.js} +1 -1
  33. package/dist/ui/assets/{dagre-6A5THRUB-ih8pcWrJ.js → dagre-6A5THRUB-CedM101q.js} +1 -1
  34. package/dist/ui/assets/{diagram-22UHCM2B-gOFjM4vX.js → diagram-22UHCM2B-Drvoaqhq.js} +1 -1
  35. package/dist/ui/assets/{diagram-3UASUU5V-A2EuBZrm.js → diagram-3UASUU5V-BqSEx6TG.js} +1 -1
  36. package/dist/ui/assets/{diagram-ATOU4E4O-NEnWb4jR.js → diagram-ATOU4E4O-SZKgc7Zh.js} +1 -1
  37. package/dist/ui/assets/{diagram-CDSNMT55-BDkkiBbT.js → diagram-CDSNMT55-Dt8thVhY.js} +1 -1
  38. package/dist/ui/assets/{diagram-MLGK6HIB-BuxDP96l.js → diagram-MLGK6HIB-CWFs_OOW.js} +1 -1
  39. package/dist/ui/assets/{diagram-MPIPVDR6-DOvr2wp9.js → diagram-MPIPVDR6-Cwm3bA8U.js} +1 -1
  40. package/dist/ui/assets/{dist-BMqRQFXW.js → dist-B7TllD9l.js} +1 -1
  41. package/dist/ui/assets/{ebnfDiagram-ZINNZB2B-C5aqA0VA.js → ebnfDiagram-ZINNZB2B-D6kGEe9D.js} +1 -1
  42. package/dist/ui/assets/{elk-276RUBZZ-C6X_c2Qp.js → elk-276RUBZZ-wW1KTjEC.js} +1 -1
  43. package/dist/ui/assets/{erDiagram-OPXOYQCR-DzZLfUpD.js → erDiagram-OPXOYQCR-vfhl3sOr.js} +1 -1
  44. package/dist/ui/assets/eventmodeling-NTZA5JFV-CJyNnV02.js +1 -0
  45. package/dist/ui/assets/flowDiagram-KWPJA3E3-C0h7u26C.js +1 -0
  46. package/dist/ui/assets/{ganttDiagram-FUAMR5RP-uqyVG-ha.js → ganttDiagram-FUAMR5RP-BZbSmUfV.js} +1 -1
  47. package/dist/ui/assets/{gitGraph-4MIJSDKK-54WYqHOb.js → gitGraph-4MIJSDKK-D59WREq2.js} +1 -1
  48. package/dist/ui/assets/{gitGraphDiagram-X574FWY7-CoyxlEFA.js → gitGraphDiagram-X574FWY7-CEWcL54p.js} +1 -1
  49. package/dist/ui/assets/{index-BPzC2fNH.js → index-Bv8TXM17.js} +85 -36
  50. package/dist/ui/assets/{info-A6RAGUB7-6Lv6e68U.js → info-A6RAGUB7-CCjOD-hV.js} +1 -1
  51. package/dist/ui/assets/{infoDiagram-VRGFBTTK-BghGYAtB.js → infoDiagram-VRGFBTTK-LS-F_-al.js} +1 -1
  52. package/dist/ui/assets/{ishikawaDiagram-OU5B5YK6-BbkNzdDX.js → ishikawaDiagram-OU5B5YK6-D0NTg-LK.js} +1 -1
  53. package/dist/ui/assets/{journeyDiagram-ZHPQQLJL-CK0HYMSC.js → journeyDiagram-ZHPQQLJL-Dw4e6Wl7.js} +1 -1
  54. package/dist/ui/assets/{kanban-definition-PNTS6WVX-CGSylxjl.js → kanban-definition-PNTS6WVX-k5spTfT7.js} +1 -1
  55. package/dist/ui/assets/{line-CVcWw_Fo.js → line-BFO0LY2j.js} +1 -1
  56. package/dist/ui/assets/{linear-RJCo1zL5.js → linear-Cs_Nmu23.js} +1 -1
  57. package/dist/ui/assets/{mermaid-parser.core-Cin6zZf8.js → mermaid-parser.core-CMSpXjeX.js} +3 -3
  58. package/dist/ui/assets/{mermaid.core-Dmtm0D6c.js → mermaid.core-BBeLf7h3.js} +4 -4
  59. package/dist/ui/assets/{mindmap-definition-NLK3R4M7-8pvUDbSj.js → mindmap-definition-NLK3R4M7-BmsEfsvR.js} +1 -1
  60. package/dist/ui/assets/{packet-AYTQ26CC-CEo_fz3H.js → packet-AYTQ26CC-Cv3YK0Ee.js} +1 -1
  61. package/dist/ui/assets/{pegDiagram-GJSIUBJH-DOOIWOJx.js → pegDiagram-GJSIUBJH-31oI4OLR.js} +1 -1
  62. package/dist/ui/assets/{pie-WAS4IAKB-BrexEBCD.js → pie-WAS4IAKB-bdwe8hf8.js} +1 -1
  63. package/dist/ui/assets/{pieDiagram-5QR66LMP-CBc41tNG.js → pieDiagram-5QR66LMP-TTKdYDzT.js} +1 -1
  64. package/dist/ui/assets/{quadrantDiagram-O4NWA36T-yer4erh3.js → quadrantDiagram-O4NWA36T-DxVQLgKu.js} +1 -1
  65. package/dist/ui/assets/{radar-RG4KPBEZ-JE5pdoOY.js → radar-RG4KPBEZ-giEqBoGT.js} +1 -1
  66. package/dist/ui/assets/{railroad-74A4TZTK-B9nKImjh.js → railroad-74A4TZTK-D-K0dGi8.js} +1 -1
  67. package/dist/ui/assets/railroad-abnf-HS5TGJTU-DcEI15f8.js +1 -0
  68. package/dist/ui/assets/railroad-ebnf-LZEXJU2U-COHEIK3C.js +1 -0
  69. package/dist/ui/assets/railroad-peg-WCYAUIDC-DXgo491l.js +1 -0
  70. package/dist/ui/assets/{railroadDiagram-XR7U4H2S-C2FoKWNS.js → railroadDiagram-XR7U4H2S-DrB5UCmO.js} +1 -1
  71. package/dist/ui/assets/{requirementDiagram-PLB6GJNP-BTN63NDy.js → requirementDiagram-PLB6GJNP-BQyLWXsL.js} +1 -1
  72. package/dist/ui/assets/{sankeyDiagram-IPEJSGJF-BjQ9u5cf.js → sankeyDiagram-IPEJSGJF-De5TIeaU.js} +1 -1
  73. package/dist/ui/assets/{sequenceDiagram-PO4LG4MO-B7FKQ9Xt.js → sequenceDiagram-PO4LG4MO-DUtE2LLg.js} +1 -1
  74. package/dist/ui/assets/{src-Bej7g-L4.js → src-DwTKHdVd.js} +1 -1
  75. package/dist/ui/assets/{stateDiagram-v2-GCMORJYK-DzUKzX-s.js → stateDiagram-v2-GCMORJYK-CVT5Ge16.js} +1 -1
  76. package/dist/ui/assets/{swimlanes-2SLR337P-Bjc68vr3.js → swimlanes-2SLR337P-Cu-5s066.js} +1 -1
  77. package/dist/ui/assets/swimlanesDiagram-TC7HE7FX-636k0i2s.js +8 -0
  78. package/dist/ui/assets/{timeline-definition-EJHVYXUP-VZqo3r3d.js → timeline-definition-EJHVYXUP-CJ8w-7KC.js} +1 -1
  79. package/dist/ui/assets/{treeView-Q6P3EWNA--uDmQgIe.js → treeView-Q6P3EWNA-D1S3DvGP.js} +1 -1
  80. package/dist/ui/assets/{treemap-WGGIJYW6-CW9TiLvB.js → treemap-WGGIJYW6-DblW82Ly.js} +1 -1
  81. package/dist/ui/assets/{usecaseDiagram-POWQR4AR-CmyArIke.js → usecaseDiagram-POWQR4AR-D8BYMSlq.js} +1 -1
  82. package/dist/ui/assets/{vennDiagram-UO4OBE2U-DUhnK8jn.js → vennDiagram-UO4OBE2U-CosmdYh9.js} +1 -1
  83. package/dist/ui/assets/{wardley-WFR3VGLG-DZocd00g.js → wardley-WFR3VGLG-D9U9ulTn.js} +1 -1
  84. package/dist/ui/assets/{wardleyDiagram-VNRHLVJA-DnHCIASf.js → wardleyDiagram-VNRHLVJA-CgtqeFIO.js} +1 -1
  85. package/dist/ui/assets/{xychartDiagram-PMCCYNJV-BzqtLoNZ.js → xychartDiagram-PMCCYNJV-DR25rR7D.js} +1 -1
  86. package/dist/ui/index.html +1 -1
  87. package/package.json +1 -1
  88. package/dist/ui/assets/architecture-7GRP2DOG-C_8wRkfR.js +0 -1
  89. package/dist/ui/assets/channel-IXYN7T6d.js +0 -1
  90. package/dist/ui/assets/eventmodeling-NTZA5JFV-DJMyacNa.js +0 -1
  91. package/dist/ui/assets/flowDiagram-KWPJA3E3-iAaJj6dh.js +0 -1
  92. package/dist/ui/assets/railroad-abnf-HS5TGJTU-CAGz711E.js +0 -1
  93. package/dist/ui/assets/railroad-ebnf-LZEXJU2U-y05iApC_.js +0 -1
  94. package/dist/ui/assets/railroad-peg-WCYAUIDC-C18zuwAF.js +0 -1
  95. package/dist/ui/assets/swimlanesDiagram-TC7HE7FX-1XAlwl_J.js +0 -8
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-Bej7g-L4.js";import{x as n}from"./chunk-O7XYJQB3-BYf0cBjb.js";import"./chunk-ZIGJFQKS-Bo83y6q0.js";import"./chunk-742MDFTN-B7dqi4lM.js";import"./chunk-MBY4JIJT-DecLyoJ2.js";import"./chunk-7PRAP22T-CnZEk7pT.js";import{c as r}from"./chunk-7INBJB4K-owIg7950.js";import{a as i,i as a,n as o}from"./chunk-5DYCD2WN-DPF_imHM.js";import{a as s,i as c,l}from"./chunk-Z7XXMR3K-B2eslene.js";import{$ as u,A as d,B as f,C as p,D as m,E as h,F as g,G as ee,H as _,I as te,J as ne,K as re,L as ie,M as ae,N as oe,O as se,P as v,Q as y,R as ce,S as le,T as ue,U as de,V as fe,W as pe,X as me,Y as he,Z as b,_ as x,a as S,b as ge,c as _e,d as ve,et as ye,f as C,g as be,h as xe,i as w,it as Se,j as Ce,k as we,l as Te,m as Ee,n as T,nt as De,o as E,p as Oe,q as ke,r as D,rt as Ae,s as je,t as O,tt as k,u as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as A}from"./graphlib-DS17s2tU.js";import{r as Le}from"./chunk-UA2S7LBM-Axt5K_7j.js";import{c as Re,i as ze,n as j,o as Be,r as Ve,s as He,t as Ue}from"./chunk-3FUC2YCW-Brp5pppL.js";var We=/\s/;function Ge(e){for(var t=e.length;t--&&We.test(e.charAt(t)););return t}var Ke=/^\s+/;function qe(e){return e&&e.slice(0,Ge(e)+1).replace(Ke,``)}var Je=NaN,Ye=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,Ze=/^0o[0-7]+$/i,Qe=parseInt;function $e(e){if(typeof e==`number`)return e;if(ye(e))return Je;if(b(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=b(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=qe(e);var n=Xe.test(e);return n||Ze.test(e)?Qe(e.slice(2),n?2:8):Ye.test(e)?Je:+e}var et=1/0,tt=17976931348623157e292;function M(e){return e?(e=$e(e),e===et||e===-et?(e<0?-1:1)*tt:e===e?e:0):e===0?e:0}function nt(e){var t=M(e),n=t%1;return t===t?n?t-n:t:0}var rt=Object.create,it=function(){function e(){}return function(t){if(!b(t))return{};if(rt)return rt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function at(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function N(e,t,n){t==`__proto__`&&ke?ke(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var ot=Object.prototype.hasOwnProperty;function P(e,t,n){var r=e[t];(!(ot.call(e,t)&&_(r,n))||n===void 0&&!(t in e))&&N(e,t,n)}function F(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?N(n,s,c):P(n,s,c)}return n}function I(e,t,n){if(!b(n))return!1;var r=typeof t;return(r==`number`?A(n)&&de(t,n.length):r==`string`&&t in n)?_(n[t],e):!1}function st(e){return f(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&I(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function ct(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var lt=Object.prototype.hasOwnProperty;function ut(e){if(!b(e))return ct(e);var t=ce(e),n=[];for(var r in e)r==`constructor`&&(t||!lt.call(e,r))||n.push(r);return n}function L(e){return A(e)?ae(e,!0):ut(e)}function R(e){return e!=null&&e.length?p(e,1):[]}function dt(e){return re(fe(e,void 0,R),e+``)}var ft=Ce(Object.getPrototypeOf,Object),pt=`[object Object]`,mt=Function.prototype,ht=Object.prototype,gt=mt.toString,_t=ht.hasOwnProperty,vt=gt.call(Object);function yt(e){if(!k(e)||De(e)!=pt)return!1;var t=ft(e);if(t===null)return!0;var n=_t.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&gt.call(n)==vt}var bt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function xt(e){return bt.test(e)}function St(e,t){return e&&F(t,we(t),e)}function Ct(e,t){return e&&F(t,L(t),e)}var wt=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Tt=wt&&typeof module==`object`&&module&&!module.nodeType&&module,Et=Tt&&Tt.exports===wt?Se.Buffer:void 0,Dt=Et?Et.allocUnsafe:void 0;function Ot(e,t){if(t)return e.slice();var n=e.length,r=Dt?Dt(n):new e.constructor(n);return e.copy(r),r}function kt(e,t){return F(e,ge(e),t)}var At=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Pe(t,ge(e)),e=ft(e);return t}:Fe;function jt(e,t){return F(e,At(e),t)}function Mt(e){return Ie(e,L,At)}var Nt=Object.prototype.hasOwnProperty;function Pt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Nt.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ft(e){var t=new e.constructor(e.byteLength);return new be(t).set(new be(e)),t}function It(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Lt=/\w*$/;function Rt(e){var t=new e.constructor(e.source,Lt.exec(e));return t.lastIndex=e.lastIndex,t}var zt=Ae?Ae.prototype:void 0,Bt=zt?zt.valueOf:void 0;function Vt(e){return Bt?Object(Bt.call(e)):{}}function Ht(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Ut=`[object Boolean]`,Wt=`[object Date]`,Gt=`[object Map]`,Kt=`[object Number]`,qt=`[object RegExp]`,Jt=`[object Set]`,Yt=`[object String]`,Xt=`[object Symbol]`,Zt=`[object ArrayBuffer]`,Qt=`[object DataView]`,$t=`[object Float32Array]`,en=`[object Float64Array]`,tn=`[object Int8Array]`,nn=`[object Int16Array]`,rn=`[object Int32Array]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`;function ln(e,t,n){var r=e.constructor;switch(t){case Zt:return Ft(e);case Ut:case Wt:return new r(+e);case Qt:return It(e,n);case $t:case en:case tn:case nn:case rn:case an:case on:case sn:case cn:return Ht(e,n);case Gt:return new r;case Kt:case Yt:return new r(e);case qt:return Rt(e);case Jt:return new r;case Xt:return Vt(e)}}function un(e){return typeof e.constructor==`function`&&!ce(e)?it(ft(e)):{}}var dn=`[object Map]`;function fn(e){return k(e)&&x(e)==dn}var pn=v&&v.isMap,mn=pn?g(pn):fn,hn=`[object Set]`;function gn(e){return k(e)&&x(e)==hn}var _n=v&&v.isSet,vn=_n?g(_n):gn,yn=1,bn=2,xn=4,Sn=`[object Arguments]`,Cn=`[object Array]`,wn=`[object Boolean]`,Tn=`[object Date]`,En=`[object Error]`,Dn=`[object Function]`,On=`[object GeneratorFunction]`,kn=`[object Map]`,An=`[object Number]`,jn=`[object Object]`,Mn=`[object RegExp]`,Nn=`[object Set]`,Pn=`[object String]`,Fn=`[object Symbol]`,In=`[object WeakMap]`,Ln=`[object ArrayBuffer]`,Rn=`[object DataView]`,zn=`[object Float32Array]`,Bn=`[object Float64Array]`,Vn=`[object Int8Array]`,Hn=`[object Int16Array]`,Un=`[object Int32Array]`,Wn=`[object Uint8Array]`,Gn=`[object Uint8ClampedArray]`,Kn=`[object Uint16Array]`,qn=`[object Uint32Array]`,z={};z[Sn]=z[Cn]=z[Ln]=z[Rn]=z[wn]=z[Tn]=z[zn]=z[Bn]=z[Vn]=z[Hn]=z[Un]=z[kn]=z[An]=z[jn]=z[Mn]=z[Nn]=z[Pn]=z[Fn]=z[Wn]=z[Gn]=z[Kn]=z[qn]=!0,z[En]=z[Dn]=z[In]=!1;function B(e,t,n,r,i,a){var o,s=t&yn,c=t&bn,l=t&xn;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!b(e))return e;var u=y(e);if(u){if(o=Pt(e),!s)return at(e,o)}else{var d=x(e),f=d==Dn||d==On;if(te(e))return Ot(e,s);if(d==jn||d==Sn||f&&!i){if(o=c||f?{}:un(e),!s)return c?jt(e,Ct(o,e)):kt(e,St(o,e))}else{if(!z[d])return i?e:{};o=ln(e,d,s)}}a||=new le;var p=a.get(e);if(p)return p;a.set(e,o),vn(e)?e.forEach(function(r){o.add(B(r,t,n,r,e,a))}):mn(e)&&e.forEach(function(r,i){o.set(i,B(r,t,n,i,e,a))});var m=u?void 0:(l?c?Mt:Ne:c?L:we)(e);return ee(m||e,function(r,i){m&&(i=r,r=e[i]),P(o,i,B(r,t,n,i,e,a))}),o}var Jn=1,Yn=4;function Xn(e){return B(e,Jn|Yn)}var Zn=function(){return Se.Date.now()},Qn=Object.prototype,$n=Qn.hasOwnProperty,er=f(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&I(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=L(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||_(u,Qn[l])&&!$n.call(e,l))&&(e[l]=a[l])}return e});function tr(e,t,n){(n!==void 0&&!_(e[t],n)||n===void 0&&!(t in e))&&N(e,t,n)}function nr(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function rr(e){return F(e,L(e))}function ir(e,t,n,r,i,a,o){var s=nr(e,n),c=nr(t,n),l=o.get(c);if(l){tr(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=y(c),p=!f&&te(c),m=!f&&!p&&oe(c);u=c,f||p||m?y(s)?u=s:_e(s)?u=at(s):p?(d=!1,u=Ot(c,!0)):m?(d=!1,u=Ht(c,!0)):u=[]:yt(c)||ie(c)?(u=s,ie(s)?u=rr(s):(!b(s)||he(s))&&(u=un(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),tr(e,n,u)}function ar(e,t,n,r,i){e!==t&&ve(t,function(a,o){if(i||=new le,b(a))ir(e,t,o,n,ar,r,i);else{var s=r?r(nr(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),tr(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function or(e){return function(t,n,r){var i=Object(t);if(!A(t)){var a=C(n,3);t=we(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var sr=Math.max;function cr(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:nt(n);return i<0&&(i=sr(r+i,0)),pe(e,C(t,3),i)}var lr=or(cr);function ur(e,t){var n=-1,r=A(e)?Array(e.length):[];return Te(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(y(e)?u:ur)(e,C(t,3))}function dr(e,t){return e==null?e:ve(e,je(t),L)}function fr(e,t){return e&&Me(e,je(t))}function pr(e,t){return e>t}var mr=Object.prototype.hasOwnProperty;function hr(e,t){return e!=null&&mr.call(e,t)}function gr(e,t){return e!=null&&xe(e,t,hr)}var _r=`[object String]`;function vr(e){return typeof e==`string`||!y(e)&&k(e)&&De(e)==_r}function yr(e,t){return e<t}function U(e,t){var n={};return t=C(t,3),Me(e,function(e,r,i){N(n,r,t(e,r,i))}),n}function br(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!ye(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?br(e,me,pr):void 0}var xr=st(function(e,t,n){ar(e,t,n)});function G(e){return e&&e.length?br(e,me,yr):void 0}function Sr(e,t){return e&&e.length?br(e,C(t,2),yr):void 0}function Cr(e,t,n,r){if(!b(e))return e;t=m(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=h(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=b(u)?u:de(t[i+1])?[]:{})}P(s,c,l),s=s[c]}return e}function wr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Cr(a,m(o,e),s)}return a}function Tr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Er(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=ye(e),o=t!==void 0,s=t===null,c=t===t,l=ye(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function Dr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Er(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Or(e,t,n){t=t.length?u(t,function(e){return y(e)?function(t){return ue(t,e.length===1?e[0]:e)}:e}):[me];var r=-1;return t=u(t,g(C)),Tr(ur(e,function(e,n,i){return{criteria:u(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Dr(e,t,n)})}var kr=Oe(`length`),Ar=`\\ud800-\\udfff`,jr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Mr=`\\ufe0e\\ufe0f`,Nr=`[`+Ar+`]`,Pr=`[`+jr+`]`,Fr=`\\ud83c[\\udffb-\\udfff]`,Ir=`(?:`+Pr+`|`+Fr+`)`,Lr=`[^`+Ar+`]`,Rr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,zr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Br=`\\u200d`,Vr=Ir+`?`,Hr=`[`+Mr+`]?`,Ur=`(?:`+Br+`(?:`+[Lr,Rr,zr].join(`|`)+`)`+Hr+Vr+`)*`,Wr=Hr+Vr+Ur,Gr=`(?:`+[Lr+Pr+`?`,Pr,Rr,zr,Nr].join(`|`)+`)`,Kr=RegExp(Fr+`(?=`+Fr+`)|`+Gr+Wr,`g`);function qr(e){for(var t=Kr.lastIndex=0;Kr.test(e);)++t;return t}function Jr(e){return xt(e)?qr(e):kr(e)}function Yr(e,t){return wr(e,t,function(t,n){return Ee(e,n)})}var K=dt(function(e,t){return e==null?{}:Yr(e,t)}),Xr=Math.ceil,Zr=Math.max;function Qr(e,t,n,r){for(var i=-1,a=Zr(Xr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $r(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=M(t),n===void 0?(n=t,t=0):n=M(n),r=r===void 0?t<n?1:-1:M(r),Qr(t,n,r,e)}}var q=$r(),ei=`[object Map]`,ti=`[object Set]`;function ni(e){if(e==null)return 0;if(A(e))return vr(e)?Jr(e):e.length;var t=x(e);return t==ei||t==ti?e.size:d(e).length}var J=f(function(e,t){if(e==null)return[];var n=t.length;return n>1&&I(e,t[0],t[1])?t=[]:n>2&&I(t[0],t[1],t[2])&&(t=[t[0]]),Or(e,p(t,1),[])}),ri=0;function ii(e){var t=++ri;return se(e)+t}function ai(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function oi(e,t){return ai(e||[],t||[],P)}var si=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return ci(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&ci(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,li)),n=n._prev;return`[`+e.join(`, `)+`]`}};function ci(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function li(e,t){if(e!==`_next`&&e!==`_prev`)return t}var ui=ne(1);function di(e,t){if(e.nodeCount()<=1)return[];var n=mi(e,t||ui);return R(H(fi(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function fi(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)pi(e,t,n,o);for(;o=i.dequeue();)pi(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(pi(e,t,n,o,!0));break}}}return r}function pi(e,t,n,r,i){var a=i?[]:void 0;return E(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,hi(t,n,s)}),E(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,hi(t,n,o)}),e.removeNode(r.v),a}function mi(e,t){var n=new O,r=0,i=0;E(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),E(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=q(i+r+3).map(function(){return new si}),o=r+1;return E(n.nodes(),function(e){hi(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function hi(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function gi(e){var t=e.graph().acyclicer===`greedy`?di(e,n(e)):_i(e);E(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,ii(`rev`))});function n(e){return function(t){return e.edge(t).weight}}}function _i(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,E(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return E(e.nodes(),i),t}function vi(e){E(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Y(e,t,n,r){var i;do i=ii(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function yi(e){var t=new O().setGraph(e.graph());return E(e.nodes(),function(n){t.setNode(n,e.node(n))}),E(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function bi(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return E(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),E(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function xi(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function X(e){var t=H(q(Ti(e)+1),function(){return[]});return E(e.nodes(),function(n){var r=e.node(n),i=r.rank;D(i)||(t[i][r.order]=n)}),t}function Si(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));E(e.nodes(),function(n){var r=e.node(n);gr(r,`rank`)&&(r.rank-=t)})}function Ci(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];E(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;E(n,function(t,n){D(t)&&n%i!==0?--r:r&&E(t,function(t){e.node(t).rank+=r})})}function wi(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Y(e,`border`,i,t)}function Ti(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!D(n))return n}))}function Ei(e,t){var n={lhs:[],rhs:[]};return E(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Di(e,t){var n=Zn();try{return t()}finally{console.log(e+` time: `+(Zn()-n)+`ms`)}}function Oi(e,t){return t()}function ki(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&E(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Ai(e,`borderLeft`,`_bl`,n,i,a),Ai(e,`borderRight`,`_br`,n,i,a)}}E(e.children(),t)}function Ai(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Y(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function ji(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Ni(e)}function Mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&Fi(e),(t===`lr`||t===`rl`)&&(Li(e),Ni(e))}function Ni(e){E(e.nodes(),function(t){Pi(e.node(t))}),E(e.edges(),function(t){Pi(e.edge(t))})}function Pi(e){var t=e.width;e.width=e.height,e.height=t}function Fi(e){E(e.nodes(),function(t){Ii(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ii),Object.prototype.hasOwnProperty.call(n,`y`)&&Ii(n)})}function Ii(e){e.y=-e.y}function Li(e){E(e.nodes(),function(t){Ri(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ri),Object.prototype.hasOwnProperty.call(n,`x`)&&Ri(n)})}function Ri(e){var t=e.x;e.x=e.y,e.y=t}function zi(e){e.graph().dummyChains=[],E(e.edges(),function(t){Bi(e,t)})}function Bi(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=Y(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Vi(e){E(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function Hi(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=G(H(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}E(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ui(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Wi(t,e)<r;)i=Gi(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Ki(t,e,a);return t}function Wi(e,t){function n(r){E(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Z(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return E(e.nodes(),n),e.nodeCount()}function Gi(e,t){return Sr(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Ki(e,t,n){E(e.nodes(),function(e){t.node(e).rank+=n})}ne(1),ne(1),qi.CycleException=Q;function qi(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new Q;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,E(e.predecessors(a),i),delete n[a],r.push(a))}if(E(e.sinks(),i),ni(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ji(e,t,n){y(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return E(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Yi(e,t,n===`post`,a,r,i)}),i}function Yi(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),E(i(t),function(t){Yi(e,t,n,r,i,a)}),n&&a.push(t))}function Xi(e,t){return Ji(e,t,`post`)}function Zi(e,t){return Ji(e,t,`pre`)}$.initLowLimValues=ta,$.initCutValues=Qi,$.calcCutValue=ea,$.leaveEdge=ra,$.enterEdge=ia,$.exchangeEdges=aa;function $(e){e=yi(e),Hi(e);var t=Ui(e);ta(t),Qi(t,e);for(var n,r;n=ra(t);)r=ia(t,e,n),aa(t,e,n,r)}function Qi(e,t){var n=Xi(e,e.nodes());n=n.slice(0,n.length-1),E(n,function(n){$i(e,t,n)})}function $i(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=ea(e,t,n)}function ea(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,E(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,sa(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function ta(e,t){arguments.length<2&&(t=e.nodes()[0]),na(e,{},1,t)}function na(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,E(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=na(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function ra(e){return lr(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ia(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),Sr(S(t.edges(),function(t){return c===ca(e,e.node(t.v),s)&&c!==ca(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function aa(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ta(e),Qi(e,t),oa(e,t)}function oa(e,t){var n=Zi(e,lr(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),E(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function sa(e,t,n){return e.hasEdge(t,n)}function ca(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function la(e){switch(e.graph().ranker){case`network-simplex`:fa(e);break;case`tight-tree`:da(e);break;case`longest-path`:ua(e);break;default:fa(e)}}var ua=Hi;function da(e){Hi(e),Ui(e)}function fa(e){$(e)}function pa(e){var t=Y(e,`root`,{},`_root`),n=ha(e),r=W(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,E(e.edges(),function(t){e.edge(t).minlen*=i});var a=ga(e)+1;E(e.children(),function(o){ma(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function ma(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=wi(e,`_bt`),l=wi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,E(s,function(s){ma(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function ha(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&E(a,function(e){n(e,i+1)}),t[r]=i}return E(e.children(),function(e){n(e,1)}),t}function ga(e){return T(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function _a(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,E(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function va(e,t,n){var r={},i;E(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ya(e,t,n){var r=ba(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return E(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),E(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=D(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function ba(e){for(var t;e.hasNode(t=ii(`_root`)););return t}function xa(e,t){for(var n=0,r=1;r<t.length;++r)n+=Sa(e,t[r-1],t[r]);return n}function Sa(e,t,n){for(var r=oi(n,H(n,function(e,t){return t})),i=R(H(t,function(t){return J(H(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=H(Array(o),function(){return 0}),c=0;return E(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function Ca(e){var t={},n=S(e.nodes(),function(t){return!e.children(t).length}),r=H(q(W(H(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){gr(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),E(e.successors(n),i))}var a=J(n,function(t){return e.node(t).rank});return E(a,i),r}function wa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=T(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}function Ta(e,t){var n={};return E(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};D(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),E(t.edges(),function(e){var t=n[e.v],r=n[e.w];!D(t)&&!D(r)&&(r.indegree++,t.out.push(n[e.w]))}),Ea(S(n,function(e){return!e.indegree}))}function Ea(e){var t=[];function n(e){return function(t){t.merged||(D(t.barycenter)||D(e.barycenter)||t.barycenter>=e.barycenter)&&Da(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),E(i.in.reverse(),n(i)),E(i.out,r(i))}return H(S(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function Da(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Oa(e,t){var n=Ei(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=J(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Aa(!!t)),c=ka(a,i,c),E(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=ka(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function ka(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Aa(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function ja(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=S(i,function(e){return e!==o&&e!==s}));var l=wa(e,i);E(l,function(t){if(e.children(t.v).length){var i=ja(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Na(t,i)}});var u=Ta(l,n);Ma(u,c);var d=Oa(u,r);if(o&&(d.vs=R([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function Ma(e,t){E(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Na(e,t){D(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Pa(e){var t=Ti(e),n=Fa(e,q(1,t+1),`inEdges`),r=Fa(e,q(t-1,-1,-1),`outEdges`),i=Ca(e);La(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Ia(s%2?n:r,s%4>=2),i=X(e);var l=xa(e,i);l<a&&(c=0,o=Xn(i),a=l)}La(e,o)}function Fa(e,t,n){return H(t,function(t){return ya(e,t,n)})}function Ia(e,t){var n=new O;E(e,function(e){var r=e.graph().root,i=ja(e,r,n,t);E(i.vs,function(t,n){e.node(t).order=n}),va(e,n,i.vs)})}function La(e,t){E(t,function(t){E(t,function(t,n){e.node(t).order=n})})}function Ra(e){var t=Ba(e);E(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=za(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function za(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Ba(e){var t={},n=0;function r(i){var a=n;E(e.children(i),r),t[i]={low:a,lim:n++}}return E(e.children(),r),t}function Va(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return E(r,function(t,c){var l=Ua(e,t),u=l?e.node(l).order:o;(l||t===s)&&(E(r.slice(a,c+1),function(t){E(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Wa(n,r,t)})}),a=c+1,i=u)}),r}return T(t,r),n}function Ha(e,t){var n={};function r(t,r,i,a,o){var s;E(q(r,i),function(r){s=t[r],e.node(s).dummy&&E(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Wa(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return E(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return T(t,i),n}function Ua(e,t){if(e.node(t).dummy)return lr(e.predecessors(t),function(t){return e.node(t).dummy})}function Wa(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ga(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Ka(e,t,n,r){var i={},a={},o={};return E(t,function(e){E(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),E(t,function(e){var t=-1;E(e,function(e){var s=r(e);if(s.length){s=J(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Ga(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function qa(e,t,n,r,i){var a={},o=Ja(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),E(r,function(e){a[e]=a[n[e]]}),a}function Ja(e,t,n,r){var i=new O,a=e.graph(),o=$a(a.nodesep,a.edgesep,r);return E(t,function(t){var r;E(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function Ya(e,t){return Sr(w(t),function(t){var n=-1/0,r=1/0;return dr(t,function(t,i){var a=eo(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Xa(e,t){var n=w(t),r=G(n),i=W(n);E([`u`,`d`],function(n){E([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=w(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Za(e,t){return U(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=J(H(e,r));return(i[1]+i[2])/2})}function Qa(e){var t=X(e),n=xr(Va(e,t),Ha(e,t)),r={},i;return E([`u`,`d`],function(a){i=a===`u`?t:w(t).reverse(),E([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return w(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Ka(e,i,n,o),c=qa(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Xa(r,Ya(e,r)),Za(r,e.graph().align)}function $a(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),l=0,c}}function eo(e,t){return e.node(t).width}function to(e){e=bi(e),no(e),fr(Qa(e),function(t,n){e.node(n).x=t})}function no(e){var t=X(e),n=e.graph().ranksep,r=0;E(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));E(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function ro(e,t){var n=t&&t.debugTiming?Di:Oi;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>ho(e));n(` runLayout`,()=>io(t,n)),n(` updateInputGraph`,()=>ao(e,t))})}function io(e,t){t(` makeSpaceForEdgeLabels`,()=>go(e)),t(` removeSelfEdges`,()=>To(e)),t(` acyclic`,()=>gi(e)),t(` nestingGraph.run`,()=>pa(e)),t(` rank`,()=>la(bi(e))),t(` injectEdgeLabelProxies`,()=>_o(e)),t(` removeEmptyRanks`,()=>Ci(e)),t(` nestingGraph.cleanup`,()=>_a(e)),t(` normalizeRanks`,()=>Si(e)),t(` assignRankMinMax`,()=>vo(e)),t(` removeEdgeLabelProxies`,()=>yo(e)),t(` normalize.run`,()=>zi(e)),t(` parentDummyChains`,()=>Ra(e)),t(` addBorderSegments`,()=>ki(e)),t(` order`,()=>Pa(e)),t(` insertSelfEdges`,()=>Eo(e)),t(` adjustCoordinateSystem`,()=>ji(e)),t(` position`,()=>to(e)),t(` positionSelfEdges`,()=>Do(e)),t(` removeBorderNodes`,()=>wo(e)),t(` normalize.undo`,()=>Vi(e)),t(` fixupEdgeLabelCoords`,()=>So(e)),t(` undoCoordinateSystem`,()=>Mi(e)),t(` translateGraph`,()=>bo(e)),t(` assignNodeIntersects`,()=>xo(e)),t(` reversePoints`,()=>Co(e)),t(` acyclic.undo`,()=>vi(e))}function ao(e,t){E(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),E(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var oo=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],so={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},co=[`acyclicer`,`ranker`,`rankdir`,`align`],lo=[`width`,`height`],uo={width:0,height:0},fo=[`minlen`,`weight`,`width`,`height`,`labeloffset`],po={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},mo=[`labelpos`];function ho(e){var t=new O({multigraph:!0,compound:!0}),n=ko(e.graph());return t.setGraph(xr({},so,Oo(n,oo),K(n,co))),E(e.nodes(),function(n){var r=ko(e.node(n));t.setNode(n,er(Oo(r,lo),uo)),t.setParent(n,e.parent(n))}),E(e.edges(),function(n){var r=ko(e.edge(n));t.setEdge(n,xr({},po,Oo(r,fo),K(r,mo)))}),t}function go(e){var t=e.graph();t.ranksep/=2,E(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function _o(e){E(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);Y(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function vo(e){var t=0;E(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=W(t,r.maxRank))}),e.graph().maxRank=t}function yo(e){E(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function bo(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}E(e.nodes(),function(t){c(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,E(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),E(e.edges(),function(n){var i=e.edge(n);E(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function xo(e){E(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(xi(r,a)),n.points.push(xi(i,o))})}function So(e){E(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Co(e){E(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function wo(e){E(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(V(n.borderLeft)),o=e.node(V(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),E(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function To(e){E(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Eo(e){var t=X(e);E(t,function(t){var n=0;E(t,function(t,r){var i=e.node(t);i.order=r+n,E(i.selfEdges,function(t){Y(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Do(e){E(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Oo(e,t){return U(K(e,t),Number)}function ko(e){var t={};return E(e,function(e,n){t[n.toLowerCase()]=e}),t}var Ao=e((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),jo=e((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),Mo=e(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),No=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],Po=e((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return jo(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),c=s.x-t.x,l=s.y-t.y;return Math.abs(c)>Math.abs(l)?c>0?`right`:`left`:Math.abs(l)>0?l>0?`bottom`:`top`:jo(i)},`getSelfLoopSide`),Fo=e((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,c=Math.max(36,Math.min(100,e.width*.8)),l=Ao(Math.max(r,e.width*.35),36,c),u=Ao(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-l/2,y:e},{x:i-l/2,y:e+u},{x:i+l/2,y:e+u},{x:i+l/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-l/2},{x:e+u,y:a-l/2},{x:e+u,y:a+l/2},{x:e,y:a+l/2}]}case`left`:{let e=i-o;return[{x:e,y:a-l/2},{x:e-u,y:a-l/2},{x:e-u,y:a+l/2},{x:e,y:a+l/2}]}default:{let e=a-s;return[{x:i-l/2,y:e},{x:i-l/2,y:e-u},{x:i+l/2,y:e-u},{x:i+l/2,y:e}]}}},`getSelfLoopPoints`),Io=e((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,c=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+c/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-c/2-4}}},`getSelfLoopLabelPosition`),Lo=e((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,c=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,l=e.node(c.start);if(!l){n.forEach(e=>i.push(e));return}let u={width:o.edge.width,height:o.edge.height},d=Po(e,l,n,c.start,a),f=Fo(l,d,t,u.width??0),p=Io(l,f,d,t,u),m={...o.edge,...c,id:c.id,points:f,start:c.start,end:c.end,x:p.x,y:p.y,width:u.width,height:u.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete m.selfLoop,delete m.originalEdge,i.push({edge:m,start:m.start,end:m.end})}),i},`getEdgesToRender`),Ro=e(async({element:n,graph:a,diagramType:c,id:l,parentCluster:u,siteConfig:d})=>{let f=a.graph().rankdir;t.trace(`Dir in recursive render - dir:`,f);let{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee}=ze(n,{edgePathsClass:`edgePaths`});a.nodes()?t.info(`Recursive render XXX`,a.nodes()):t.info(`No nodes found for`,a),a.edges().length>0&&t.info(`Recursive edges`,a.edge(a.edges()[0]));let _=Mo(c);await Promise.all(a.nodes().map(async function(e){let n=a.node(e);if(u!==void 0){let n=JSON.parse(JSON.stringify(u.clusterData));t.trace(`Setting data for parent cluster XXX
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-DwTKHdVd.js";import{x as n}from"./chunk-O7XYJQB3-ADuOEPCt.js";import"./chunk-ZIGJFQKS-u0lffPbH.js";import"./chunk-742MDFTN-Q9c012fL.js";import"./chunk-MBY4JIJT-Jg4QirYy.js";import"./chunk-7PRAP22T-D5sSirGe.js";import{c as r}from"./chunk-7INBJB4K-D6-5S_eb.js";import{a as i,i as a,n as o}from"./chunk-5DYCD2WN-DsvkZxf0.js";import{a as s,i as c,l}from"./chunk-Z7XXMR3K-ooKdHdRU.js";import{$ as u,A as d,B as f,C as p,D as m,E as h,F as g,G as ee,H as _,I as te,J as ne,K as re,L as ie,M as ae,N as oe,O as se,P as v,Q as y,R as ce,S as le,T as ue,U as de,V as fe,W as pe,X as me,Y as he,Z as b,_ as x,a as S,b as ge,c as _e,d as ve,et as ye,f as C,g as be,h as xe,i as w,it as Se,j as Ce,k as we,l as Te,m as Ee,n as T,nt as De,o as E,p as Oe,q as ke,r as D,rt as Ae,s as je,t as O,tt as k,u as Me,v as Ne,w as Pe,x as Fe,y as Ie,z as A}from"./graphlib-DS17s2tU.js";import{r as Le}from"./chunk-UA2S7LBM-BWLbUYDY.js";import{c as Re,i as ze,n as j,o as Be,r as Ve,s as He,t as Ue}from"./chunk-3FUC2YCW-W4k2bur_.js";var We=/\s/;function Ge(e){for(var t=e.length;t--&&We.test(e.charAt(t)););return t}var Ke=/^\s+/;function qe(e){return e&&e.slice(0,Ge(e)+1).replace(Ke,``)}var Je=NaN,Ye=/^[-+]0x[0-9a-f]+$/i,Xe=/^0b[01]+$/i,Ze=/^0o[0-7]+$/i,Qe=parseInt;function $e(e){if(typeof e==`number`)return e;if(ye(e))return Je;if(b(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=b(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=qe(e);var n=Xe.test(e);return n||Ze.test(e)?Qe(e.slice(2),n?2:8):Ye.test(e)?Je:+e}var et=1/0,tt=17976931348623157e292;function M(e){return e?(e=$e(e),e===et||e===-et?(e<0?-1:1)*tt:e===e?e:0):e===0?e:0}function nt(e){var t=M(e),n=t%1;return t===t?n?t-n:t:0}var rt=Object.create,it=function(){function e(){}return function(t){if(!b(t))return{};if(rt)return rt(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function at(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}function N(e,t,n){t==`__proto__`&&ke?ke(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var ot=Object.prototype.hasOwnProperty;function P(e,t,n){var r=e[t];(!(ot.call(e,t)&&_(r,n))||n===void 0&&!(t in e))&&N(e,t,n)}function F(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?N(n,s,c):P(n,s,c)}return n}function I(e,t,n){if(!b(n))return!1;var r=typeof t;return(r==`number`?A(n)&&de(t,n.length):r==`string`&&t in n)?_(n[t],e):!1}function st(e){return f(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&I(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}function ct(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var lt=Object.prototype.hasOwnProperty;function ut(e){if(!b(e))return ct(e);var t=ce(e),n=[];for(var r in e)r==`constructor`&&(t||!lt.call(e,r))||n.push(r);return n}function L(e){return A(e)?ae(e,!0):ut(e)}function R(e){return e!=null&&e.length?p(e,1):[]}function dt(e){return re(fe(e,void 0,R),e+``)}var ft=Ce(Object.getPrototypeOf,Object),pt=`[object Object]`,mt=Function.prototype,ht=Object.prototype,gt=mt.toString,_t=ht.hasOwnProperty,vt=gt.call(Object);function yt(e){if(!k(e)||De(e)!=pt)return!1;var t=ft(e);if(t===null)return!0;var n=_t.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&gt.call(n)==vt}var bt=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function xt(e){return bt.test(e)}function St(e,t){return e&&F(t,we(t),e)}function Ct(e,t){return e&&F(t,L(t),e)}var wt=typeof exports==`object`&&exports&&!exports.nodeType&&exports,Tt=wt&&typeof module==`object`&&module&&!module.nodeType&&module,Et=Tt&&Tt.exports===wt?Se.Buffer:void 0,Dt=Et?Et.allocUnsafe:void 0;function Ot(e,t){if(t)return e.slice();var n=e.length,r=Dt?Dt(n):new e.constructor(n);return e.copy(r),r}function kt(e,t){return F(e,ge(e),t)}var At=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)Pe(t,ge(e)),e=ft(e);return t}:Fe;function jt(e,t){return F(e,At(e),t)}function Mt(e){return Ie(e,L,At)}var Nt=Object.prototype.hasOwnProperty;function Pt(e){var t=e.length,n=new e.constructor(t);return t&&typeof e[0]==`string`&&Nt.call(e,`index`)&&(n.index=e.index,n.input=e.input),n}function Ft(e){var t=new e.constructor(e.byteLength);return new be(t).set(new be(e)),t}function It(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}var Lt=/\w*$/;function Rt(e){var t=new e.constructor(e.source,Lt.exec(e));return t.lastIndex=e.lastIndex,t}var zt=Ae?Ae.prototype:void 0,Bt=zt?zt.valueOf:void 0;function Vt(e){return Bt?Object(Bt.call(e)):{}}function Ht(e,t){var n=t?Ft(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Ut=`[object Boolean]`,Wt=`[object Date]`,Gt=`[object Map]`,Kt=`[object Number]`,qt=`[object RegExp]`,Jt=`[object Set]`,Yt=`[object String]`,Xt=`[object Symbol]`,Zt=`[object ArrayBuffer]`,Qt=`[object DataView]`,$t=`[object Float32Array]`,en=`[object Float64Array]`,tn=`[object Int8Array]`,nn=`[object Int16Array]`,rn=`[object Int32Array]`,an=`[object Uint8Array]`,on=`[object Uint8ClampedArray]`,sn=`[object Uint16Array]`,cn=`[object Uint32Array]`;function ln(e,t,n){var r=e.constructor;switch(t){case Zt:return Ft(e);case Ut:case Wt:return new r(+e);case Qt:return It(e,n);case $t:case en:case tn:case nn:case rn:case an:case on:case sn:case cn:return Ht(e,n);case Gt:return new r;case Kt:case Yt:return new r(e);case qt:return Rt(e);case Jt:return new r;case Xt:return Vt(e)}}function un(e){return typeof e.constructor==`function`&&!ce(e)?it(ft(e)):{}}var dn=`[object Map]`;function fn(e){return k(e)&&x(e)==dn}var pn=v&&v.isMap,mn=pn?g(pn):fn,hn=`[object Set]`;function gn(e){return k(e)&&x(e)==hn}var _n=v&&v.isSet,vn=_n?g(_n):gn,yn=1,bn=2,xn=4,Sn=`[object Arguments]`,Cn=`[object Array]`,wn=`[object Boolean]`,Tn=`[object Date]`,En=`[object Error]`,Dn=`[object Function]`,On=`[object GeneratorFunction]`,kn=`[object Map]`,An=`[object Number]`,jn=`[object Object]`,Mn=`[object RegExp]`,Nn=`[object Set]`,Pn=`[object String]`,Fn=`[object Symbol]`,In=`[object WeakMap]`,Ln=`[object ArrayBuffer]`,Rn=`[object DataView]`,zn=`[object Float32Array]`,Bn=`[object Float64Array]`,Vn=`[object Int8Array]`,Hn=`[object Int16Array]`,Un=`[object Int32Array]`,Wn=`[object Uint8Array]`,Gn=`[object Uint8ClampedArray]`,Kn=`[object Uint16Array]`,qn=`[object Uint32Array]`,z={};z[Sn]=z[Cn]=z[Ln]=z[Rn]=z[wn]=z[Tn]=z[zn]=z[Bn]=z[Vn]=z[Hn]=z[Un]=z[kn]=z[An]=z[jn]=z[Mn]=z[Nn]=z[Pn]=z[Fn]=z[Wn]=z[Gn]=z[Kn]=z[qn]=!0,z[En]=z[Dn]=z[In]=!1;function B(e,t,n,r,i,a){var o,s=t&yn,c=t&bn,l=t&xn;if(n&&(o=i?n(e,r,i,a):n(e)),o!==void 0)return o;if(!b(e))return e;var u=y(e);if(u){if(o=Pt(e),!s)return at(e,o)}else{var d=x(e),f=d==Dn||d==On;if(te(e))return Ot(e,s);if(d==jn||d==Sn||f&&!i){if(o=c||f?{}:un(e),!s)return c?jt(e,Ct(o,e)):kt(e,St(o,e))}else{if(!z[d])return i?e:{};o=ln(e,d,s)}}a||=new le;var p=a.get(e);if(p)return p;a.set(e,o),vn(e)?e.forEach(function(r){o.add(B(r,t,n,r,e,a))}):mn(e)&&e.forEach(function(r,i){o.set(i,B(r,t,n,i,e,a))});var m=u?void 0:(l?c?Mt:Ne:c?L:we)(e);return ee(m||e,function(r,i){m&&(i=r,r=e[i]),P(o,i,B(r,t,n,i,e,a))}),o}var Jn=1,Yn=4;function Xn(e){return B(e,Jn|Yn)}var Zn=function(){return Se.Date.now()},Qn=Object.prototype,$n=Qn.hasOwnProperty,er=f(function(e,t){e=Object(e);var n=-1,r=t.length,i=r>2?t[2]:void 0;for(i&&I(t[0],t[1],i)&&(r=1);++n<r;)for(var a=t[n],o=L(a),s=-1,c=o.length;++s<c;){var l=o[s],u=e[l];(u===void 0||_(u,Qn[l])&&!$n.call(e,l))&&(e[l]=a[l])}return e});function tr(e,t,n){(n!==void 0&&!_(e[t],n)||n===void 0&&!(t in e))&&N(e,t,n)}function nr(e,t){if((t!==`constructor`||typeof e[t]!=`function`)&&t!=`__proto__`)return e[t]}function rr(e){return F(e,L(e))}function ir(e,t,n,r,i,a,o){var s=nr(e,n),c=nr(t,n),l=o.get(c);if(l){tr(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=y(c),p=!f&&te(c),m=!f&&!p&&oe(c);u=c,f||p||m?y(s)?u=s:_e(s)?u=at(s):p?(d=!1,u=Ot(c,!0)):m?(d=!1,u=Ht(c,!0)):u=[]:yt(c)||ie(c)?(u=s,ie(s)?u=rr(s):(!b(s)||he(s))&&(u=un(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),tr(e,n,u)}function ar(e,t,n,r,i){e!==t&&ve(t,function(a,o){if(i||=new le,b(a))ir(e,t,o,n,ar,r,i);else{var s=r?r(nr(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),tr(e,o,s)}},L)}function V(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}function or(e){return function(t,n,r){var i=Object(t);if(!A(t)){var a=C(n,3);t=we(t),n=function(e){return a(i[e],e,i)}}var o=e(t,n,r);return o>-1?i[a?t[o]:o]:void 0}}var sr=Math.max;function cr(e,t,n){var r=e==null?0:e.length;if(!r)return-1;var i=n==null?0:nt(n);return i<0&&(i=sr(r+i,0)),pe(e,C(t,3),i)}var lr=or(cr);function ur(e,t){var n=-1,r=A(e)?Array(e.length):[];return Te(e,function(e,i,a){r[++n]=t(e,i,a)}),r}function H(e,t){return(y(e)?u:ur)(e,C(t,3))}function dr(e,t){return e==null?e:ve(e,je(t),L)}function fr(e,t){return e&&Me(e,je(t))}function pr(e,t){return e>t}var mr=Object.prototype.hasOwnProperty;function hr(e,t){return e!=null&&mr.call(e,t)}function gr(e,t){return e!=null&&xe(e,t,hr)}var _r=`[object String]`;function vr(e){return typeof e==`string`||!y(e)&&k(e)&&De(e)==_r}function yr(e,t){return e<t}function U(e,t){var n={};return t=C(t,3),Me(e,function(e,r,i){N(n,r,t(e,r,i))}),n}function br(e,t,n){for(var r=-1,i=e.length;++r<i;){var a=e[r],o=t(a);if(o!=null&&(s===void 0?o===o&&!ye(o):n(o,s)))var s=o,c=a}return c}function W(e){return e&&e.length?br(e,me,pr):void 0}var xr=st(function(e,t,n){ar(e,t,n)});function G(e){return e&&e.length?br(e,me,yr):void 0}function Sr(e,t){return e&&e.length?br(e,C(t,2),yr):void 0}function Cr(e,t,n,r){if(!b(e))return e;t=m(t,e);for(var i=-1,a=t.length,o=a-1,s=e;s!=null&&++i<a;){var c=h(t[i]),l=n;if(c===`__proto__`||c===`constructor`||c===`prototype`)return e;if(i!=o){var u=s[c];l=r?r(u,c,s):void 0,l===void 0&&(l=b(u)?u:de(t[i+1])?[]:{})}P(s,c,l),s=s[c]}return e}function wr(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=ue(e,o);n(s,o)&&Cr(a,m(o,e),s)}return a}function Tr(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Er(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=ye(e),o=t!==void 0,s=t===null,c=t===t,l=ye(t);if(!s&&!l&&!a&&e>t||a&&o&&c&&!s&&!l||r&&o&&c||!n&&c||!i)return 1;if(!r&&!a&&!l&&e<t||l&&n&&i&&!r&&!a||s&&n&&i||!o&&i||!c)return-1}return 0}function Dr(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Er(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Or(e,t,n){t=t.length?u(t,function(e){return y(e)?function(t){return ue(t,e.length===1?e[0]:e)}:e}):[me];var r=-1;return t=u(t,g(C)),Tr(ur(e,function(e,n,i){return{criteria:u(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return Dr(e,t,n)})}var kr=Oe(`length`),Ar=`\\ud800-\\udfff`,jr=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Mr=`\\ufe0e\\ufe0f`,Nr=`[`+Ar+`]`,Pr=`[`+jr+`]`,Fr=`\\ud83c[\\udffb-\\udfff]`,Ir=`(?:`+Pr+`|`+Fr+`)`,Lr=`[^`+Ar+`]`,Rr=`(?:\\ud83c[\\udde6-\\uddff]){2}`,zr=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Br=`\\u200d`,Vr=Ir+`?`,Hr=`[`+Mr+`]?`,Ur=`(?:`+Br+`(?:`+[Lr,Rr,zr].join(`|`)+`)`+Hr+Vr+`)*`,Wr=Hr+Vr+Ur,Gr=`(?:`+[Lr+Pr+`?`,Pr,Rr,zr,Nr].join(`|`)+`)`,Kr=RegExp(Fr+`(?=`+Fr+`)|`+Gr+Wr,`g`);function qr(e){for(var t=Kr.lastIndex=0;Kr.test(e);)++t;return t}function Jr(e){return xt(e)?qr(e):kr(e)}function Yr(e,t){return wr(e,t,function(t,n){return Ee(e,n)})}var K=dt(function(e,t){return e==null?{}:Yr(e,t)}),Xr=Math.ceil,Zr=Math.max;function Qr(e,t,n,r){for(var i=-1,a=Zr(Xr((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $r(e){return function(t,n,r){return r&&typeof r!=`number`&&I(t,n,r)&&(n=r=void 0),t=M(t),n===void 0?(n=t,t=0):n=M(n),r=r===void 0?t<n?1:-1:M(r),Qr(t,n,r,e)}}var q=$r(),ei=`[object Map]`,ti=`[object Set]`;function ni(e){if(e==null)return 0;if(A(e))return vr(e)?Jr(e):e.length;var t=x(e);return t==ei||t==ti?e.size:d(e).length}var J=f(function(e,t){if(e==null)return[];var n=t.length;return n>1&&I(e,t[0],t[1])?t=[]:n>2&&I(t[0],t[1],t[2])&&(t=[t[0]]),Or(e,p(t,1),[])}),ri=0;function ii(e){var t=++ri;return se(e)+t}function ai(e,t,n){for(var r=-1,i=e.length,a=t.length,o={};++r<i;){var s=r<a?t[r]:void 0;n(o,e[r],s)}return o}function oi(e,t){return ai(e||[],t||[],P)}var si=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return ci(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&ci(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){for(var e=[],t=this._sentinel,n=t._prev;n!==t;)e.push(JSON.stringify(n,li)),n=n._prev;return`[`+e.join(`, `)+`]`}};function ci(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function li(e,t){if(e!==`_next`&&e!==`_prev`)return t}var ui=ne(1);function di(e,t){if(e.nodeCount()<=1)return[];var n=mi(e,t||ui);return R(H(fi(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function fi(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)pi(e,t,n,o);for(;o=i.dequeue();)pi(e,t,n,o);if(e.nodeCount()){for(var s=t.length-2;s>0;--s)if(o=t[s].dequeue(),o){r=r.concat(pi(e,t,n,o,!0));break}}}return r}function pi(e,t,n,r,i){var a=i?[]:void 0;return E(e.inEdges(r.v),function(r){var o=e.edge(r),s=e.node(r.v);i&&a.push({v:r.v,w:r.w}),s.out-=o,hi(t,n,s)}),E(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,hi(t,n,o)}),e.removeNode(r.v),a}function mi(e,t){var n=new O,r=0,i=0;E(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),E(e.edges(),function(e){var a=n.edge(e.v,e.w)||0,o=t(e),s=a+o;n.setEdge(e.v,e.w,s),i=Math.max(i,n.node(e.v).out+=o),r=Math.max(r,n.node(e.w).in+=o)});var a=q(i+r+3).map(function(){return new si}),o=r+1;return E(n.nodes(),function(e){hi(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function hi(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}function gi(e){var t=e.graph().acyclicer===`greedy`?di(e,n(e)):_i(e);E(t,function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,ii(`rev`))});function n(e){return function(t){return e.edge(t).weight}}}function _i(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,E(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return E(e.nodes(),i),t}function vi(e){E(e.edges(),function(t){var n=e.edge(t);if(n.reversed){e.removeEdge(t);var r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function Y(e,t,n,r){var i;do i=ii(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function yi(e){var t=new O().setGraph(e.graph());return E(e.nodes(),function(n){t.setNode(n,e.node(n))}),E(e.edges(),function(n){var r=t.edge(n.v,n.w)||{weight:0,minlen:1},i=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+i.weight,minlen:Math.max(r.minlen,i.minlen)})}),t}function bi(e){var t=new O({multigraph:e.isMultigraph()}).setGraph(e.graph());return E(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),E(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function xi(e,t){var n=e.x,r=e.y,i=t.x-n,a=t.y-r,o=e.width/2,s=e.height/2;if(!i&&!a)throw Error(`Not possible to find intersection inside of the rectangle`);var c,l;return Math.abs(a)*o>Math.abs(i)*s?(a<0&&(s=-s),c=s*i/a,l=s):(i<0&&(o=-o),c=o,l=o*a/i),{x:n+c,y:r+l}}function X(e){var t=H(q(Ti(e)+1),function(){return[]});return E(e.nodes(),function(n){var r=e.node(n),i=r.rank;D(i)||(t[i][r.order]=n)}),t}function Si(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank}));E(e.nodes(),function(n){var r=e.node(n);gr(r,`rank`)&&(r.rank-=t)})}function Ci(e){var t=G(H(e.nodes(),function(t){return e.node(t).rank})),n=[];E(e.nodes(),function(r){var i=e.node(r).rank-t;n[i]||(n[i]=[]),n[i].push(r)});var r=0,i=e.graph().nodeRankFactor;E(n,function(t,n){D(t)&&n%i!==0?--r:r&&E(t,function(t){e.node(t).rank+=r})})}function wi(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),Y(e,`border`,i,t)}function Ti(e){return W(H(e.nodes(),function(t){var n=e.node(t).rank;if(!D(n))return n}))}function Ei(e,t){var n={lhs:[],rhs:[]};return E(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function Di(e,t){var n=Zn();try{return t()}finally{console.log(e+` time: `+(Zn()-n)+`ms`)}}function Oi(e,t){return t()}function ki(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&E(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Ai(e,`borderLeft`,`_bl`,n,i,a),Ai(e,`borderRight`,`_br`,n,i,a)}}E(e.children(),t)}function Ai(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=Y(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function ji(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&Ni(e)}function Mi(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&Fi(e),(t===`lr`||t===`rl`)&&(Li(e),Ni(e))}function Ni(e){E(e.nodes(),function(t){Pi(e.node(t))}),E(e.edges(),function(t){Pi(e.edge(t))})}function Pi(e){var t=e.width;e.width=e.height,e.height=t}function Fi(e){E(e.nodes(),function(t){Ii(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ii),Object.prototype.hasOwnProperty.call(n,`y`)&&Ii(n)})}function Ii(e){e.y=-e.y}function Li(e){E(e.nodes(),function(t){Ri(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);E(n.points,Ri),Object.prototype.hasOwnProperty.call(n,`x`)&&Ri(n)})}function Ri(e){var t=e.x;e.x=e.y,e.y=t}function zi(e){e.graph().dummyChains=[],E(e.edges(),function(t){Bi(e,t)})}function Bi(e,t){var n=t.v,r=e.node(n).rank,i=t.w,a=e.node(i).rank,o=t.name,s=e.edge(t),c=s.labelRank;if(a!==r+1){e.removeEdge(t);var l=void 0,u,d;for(d=0,++r;r<a;++d,++r)s.points=[],l={width:0,height:0,edgeLabel:s,edgeObj:t,rank:r},u=Y(e,`edge`,l,`_d`),r===c&&(l.width=s.width,l.height=s.height,l.dummy=`edge-label`,l.labelpos=s.labelpos),e.setEdge(n,u,{weight:s.weight},o),d===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,i,{weight:s.weight},o)}}function Vi(e){E(e.graph().dummyChains,function(t){var n=e.node(t),r=n.edgeLabel,i;for(e.setEdge(n.edgeObj,r);n.dummy;)i=e.successors(t)[0],e.removeNode(t),r.points.push({x:n.x,y:n.y}),n.dummy===`edge-label`&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),t=i,n=e.node(t)})}function Hi(e){var t={};function n(r){var i=e.node(r);if(Object.prototype.hasOwnProperty.call(t,r))return i.rank;t[r]=!0;var a=G(H(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}E(e.sources(),n)}function Z(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function Ui(e){var t=new O({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Wi(t,e)<r;)i=Gi(t,e),a=t.hasNode(i.v)?Z(e,i):-Z(e,i),Ki(t,e,a);return t}function Wi(e,t){function n(r){E(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!Z(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return E(e.nodes(),n),e.nodeCount()}function Gi(e,t){return Sr(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return Z(t,n)})}function Ki(e,t,n){E(e.nodes(),function(e){t.node(e).rank+=n})}ne(1),ne(1),qi.CycleException=Q;function qi(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new Q;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,E(e.predecessors(a),i),delete n[a],r.push(a))}if(E(e.sinks(),i),ni(t)!==e.nodeCount())throw new Q;return r}function Q(){}Q.prototype=Error();function Ji(e,t,n){y(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return E(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Yi(e,t,n===`post`,a,r,i)}),i}function Yi(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),E(i(t),function(t){Yi(e,t,n,r,i,a)}),n&&a.push(t))}function Xi(e,t){return Ji(e,t,`post`)}function Zi(e,t){return Ji(e,t,`pre`)}$.initLowLimValues=ta,$.initCutValues=Qi,$.calcCutValue=ea,$.leaveEdge=ra,$.enterEdge=ia,$.exchangeEdges=aa;function $(e){e=yi(e),Hi(e);var t=Ui(e);ta(t),Qi(t,e);for(var n,r;n=ra(t);)r=ia(t,e,n),aa(t,e,n,r)}function Qi(e,t){var n=Xi(e,e.nodes());n=n.slice(0,n.length-1),E(n,function(n){$i(e,t,n)})}function $i(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=ea(e,t,n)}function ea(e,t,n){var r=e.node(n).parent,i=!0,a=t.edge(n,r),o=0;return a||=(i=!1,t.edge(r,n)),o=a.weight,E(t.nodeEdges(n),function(a){var s=a.v===n,c=s?a.w:a.v;if(c!==r){var l=s===i,u=t.edge(a).weight;if(o+=l?u:-u,sa(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function ta(e,t){arguments.length<2&&(t=e.nodes()[0]),na(e,{},1,t)}function na(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,E(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=na(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function ra(e){return lr(e.edges(),function(t){return e.edge(t).cutvalue<0})}function ia(e,t,n){var r=n.v,i=n.w;t.hasEdge(r,i)||(r=n.w,i=n.v);var a=e.node(r),o=e.node(i),s=a,c=!1;return a.lim>o.lim&&(s=o,c=!0),Sr(S(t.edges(),function(t){return c===ca(e,e.node(t.v),s)&&c!==ca(e,e.node(t.w),s)}),function(e){return Z(t,e)})}function aa(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),ta(e),Qi(e,t),oa(e,t)}function oa(e,t){var n=Zi(e,lr(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),E(n,function(n){var r=e.node(n).parent,i=t.edge(n,r),a=!1;i||(i=t.edge(r,n),a=!0),t.node(n).rank=t.node(r).rank+(a?i.minlen:-i.minlen)})}function sa(e,t,n){return e.hasEdge(t,n)}function ca(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function la(e){switch(e.graph().ranker){case`network-simplex`:fa(e);break;case`tight-tree`:da(e);break;case`longest-path`:ua(e);break;default:fa(e)}}var ua=Hi;function da(e){Hi(e),Ui(e)}function fa(e){$(e)}function pa(e){var t=Y(e,`root`,{},`_root`),n=ha(e),r=W(w(n))-1,i=2*r+1;e.graph().nestingRoot=t,E(e.edges(),function(t){e.edge(t).minlen*=i});var a=ga(e)+1;E(e.children(),function(o){ma(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function ma(e,t,n,r,i,a,o){var s=e.children(o);if(!s.length){o!==t&&e.setEdge(t,o,{weight:0,minlen:n});return}var c=wi(e,`_bt`),l=wi(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,E(s,function(s){ma(e,t,n,r,i,a,s);var u=e.node(s),d=u.borderTop?u.borderTop:s,f=u.borderBottom?u.borderBottom:s,p=u.borderTop?r:2*r,m=d===f?i-a[o]+1:1;e.setEdge(c,d,{weight:p,minlen:m,nestingEdge:!0}),e.setEdge(f,l,{weight:p,minlen:m,nestingEdge:!0})}),e.parent(o)||e.setEdge(t,c,{weight:0,minlen:i+a[o]})}function ha(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&E(a,function(e){n(e,i+1)}),t[r]=i}return E(e.children(),function(e){n(e,1)}),t}function ga(e){return T(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function _a(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,E(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function va(e,t,n){var r={},i;E(n,function(n){for(var a=e.parent(n),o,s;a;){if(o=e.parent(a),o?(s=r[o],r[o]=a):(s=i,i=a),s&&s!==a){t.setEdge(s,a);return}a=o}})}function ya(e,t,n){var r=ba(e),i=new O({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return E(e.nodes(),function(a){var o=e.node(a),s=e.parent(a);(o.rank===t||o.minRank<=t&&t<=o.maxRank)&&(i.setNode(a),i.setParent(a,s||r),E(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=D(r)?0:r.weight;i.setEdge(n,a,{weight:e.edge(t).weight+o})}),Object.prototype.hasOwnProperty.call(o,`minRank`)&&i.setNode(a,{borderLeft:o.borderLeft[t],borderRight:o.borderRight[t]}))}),i}function ba(e){for(var t;e.hasNode(t=ii(`_root`)););return t}function xa(e,t){for(var n=0,r=1;r<t.length;++r)n+=Sa(e,t[r-1],t[r]);return n}function Sa(e,t,n){for(var r=oi(n,H(n,function(e,t){return t})),i=R(H(t,function(t){return J(H(e.outEdges(t),function(t){return{pos:r[t.w],weight:e.edge(t).weight}}),`pos`)})),a=1;a<n.length;)a<<=1;var o=2*a-1;--a;var s=H(Array(o),function(){return 0}),c=0;return E(i.forEach(function(e){var t=e.pos+a;s[t]+=e.weight;for(var n=0;t>0;)t%2&&(n+=s[t+1]),t=t-1>>1,s[t]+=e.weight;c+=e.weight*n})),c}function Ca(e){var t={},n=S(e.nodes(),function(t){return!e.children(t).length}),r=H(q(W(H(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){gr(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),E(e.successors(n),i))}var a=J(n,function(t){return e.node(t).rank});return E(a,i),r}function wa(e,t){return H(t,function(t){var n=e.inEdges(t);if(n.length){var r=T(n,function(t,n){var r=e.edge(n),i=e.node(n.v);return{sum:t.sum+r.weight*i.order,weight:t.weight+r.weight}},{sum:0,weight:0});return{v:t,barycenter:r.sum/r.weight,weight:r.weight}}return{v:t}})}function Ta(e,t){var n={};return E(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};D(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),E(t.edges(),function(e){var t=n[e.v],r=n[e.w];!D(t)&&!D(r)&&(r.indegree++,t.out.push(n[e.w]))}),Ea(S(n,function(e){return!e.indegree}))}function Ea(e){var t=[];function n(e){return function(t){t.merged||(D(t.barycenter)||D(e.barycenter)||t.barycenter>=e.barycenter)&&Da(e,t)}}function r(t){return function(n){n.in.push(t),--n.indegree===0&&e.push(n)}}for(;e.length;){var i=e.pop();t.push(i),E(i.in.reverse(),n(i)),E(i.out,r(i))}return H(S(t,function(e){return!e.merged}),function(e){return K(e,[`vs`,`i`,`barycenter`,`weight`])})}function Da(e,t){var n=0,r=0;e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.vs=t.vs.concat(e.vs),e.barycenter=n/r,e.weight=r,e.i=Math.min(t.i,e.i),t.merged=!0}function Oa(e,t){var n=Ei(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=J(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Aa(!!t)),c=ka(a,i,c),E(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=ka(a,i,c)});var l={vs:R(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function ka(e,t,n){for(var r;t.length&&(r=V(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Aa(e){return function(t,n){return t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}}function ja(e,t,n,r){var i=e.children(t),a=e.node(t),o=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,c={};o&&(i=S(i,function(e){return e!==o&&e!==s}));var l=wa(e,i);E(l,function(t){if(e.children(t.v).length){var i=ja(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Na(t,i)}});var u=Ta(l,n);Ma(u,c);var d=Oa(u,r);if(o&&(d.vs=R([o,d.vs,s]),e.predecessors(o).length)){var f=e.node(e.predecessors(o)[0]),p=e.node(e.predecessors(s)[0]);Object.prototype.hasOwnProperty.call(d,`barycenter`)||(d.barycenter=0,d.weight=0),d.barycenter=(d.barycenter*d.weight+f.order+p.order)/(d.weight+2),d.weight+=2}return d}function Ma(e,t){E(e,function(e){e.vs=R(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Na(e,t){D(e.barycenter)?(e.barycenter=t.barycenter,e.weight=t.weight):(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight)}function Pa(e){var t=Ti(e),n=Fa(e,q(1,t+1),`inEdges`),r=Fa(e,q(t-1,-1,-1),`outEdges`),i=Ca(e);La(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){Ia(s%2?n:r,s%4>=2),i=X(e);var l=xa(e,i);l<a&&(c=0,o=Xn(i),a=l)}La(e,o)}function Fa(e,t,n){return H(t,function(t){return ya(e,t,n)})}function Ia(e,t){var n=new O;E(e,function(e){var r=e.graph().root,i=ja(e,r,n,t);E(i.vs,function(t,n){e.node(t).order=n}),va(e,n,i.vs)})}function La(e,t){E(t,function(t){E(t,function(t,n){e.node(t).order=n})})}function Ra(e){var t=Ba(e);E(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=za(e,t,i.v,i.w),o=a.path,s=a.lca,c=0,l=o[c],u=!0;n!==i.w;){if(r=e.node(n),u){for(;(l=o[c])!==s&&e.node(l).maxRank<r.rank;)c++;l===s&&(u=!1)}if(!u){for(;c<o.length-1&&e.node(l=o[c+1]).minRank<=r.rank;)c++;l=o[c]}e.setParent(n,l),n=e.successors(n)[0]}})}function za(e,t,n,r){var i=[],a=[],o=Math.min(t[n].low,t[r].low),s=Math.max(t[n].lim,t[r].lim),c=n,l;do c=e.parent(c),i.push(c);while(c&&(t[c].low>o||s>t[c].lim));for(l=c,c=r;(c=e.parent(c))!==l;)a.push(c);return{path:i.concat(a.reverse()),lca:l}}function Ba(e){var t={},n=0;function r(i){var a=n;E(e.children(i),r),t[i]={low:a,lim:n++}}return E(e.children(),r),t}function Va(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=V(r);return E(r,function(t,c){var l=Ua(e,t),u=l?e.node(l).order:o;(l||t===s)&&(E(r.slice(a,c+1),function(t){E(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&Wa(n,r,t)})}),a=c+1,i=u)}),r}return T(t,r),n}function Ha(e,t){var n={};function r(t,r,i,a,o){var s;E(q(r,i),function(r){s=t[r],e.node(s).dummy&&E(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&Wa(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return E(n,function(s,c){if(e.node(s).dummy===`border`){var l=e.predecessors(s);l.length&&(a=e.node(l[0]).order,r(n,o,c,i,a),o=c,i=a)}r(n,o,n.length,a,t.length)}),n}return T(t,i),n}function Ua(e,t){if(e.node(t).dummy)return lr(e.predecessors(t),function(t){return e.node(t).dummy})}function Wa(e,t,n){if(t>n){var r=t;t=n,n=r}Object.prototype.hasOwnProperty.call(e,t)||Object.defineProperty(e,t,{enumerable:!0,configurable:!0,value:{},writable:!0});var i=e[t];Object.defineProperty(i,n,{enumerable:!0,configurable:!0,value:!0,writable:!0})}function Ga(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Ka(e,t,n,r){var i={},a={},o={};return E(t,function(e){E(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),E(t,function(e){var t=-1;E(e,function(e){var s=r(e);if(s.length){s=J(s,function(e){return o[e]});for(var c=(s.length-1)/2,l=Math.floor(c),u=Math.ceil(c);l<=u;++l){var d=s[l];a[e]===e&&t<o[d]&&!Ga(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function qa(e,t,n,r,i){var a={},o=Ja(e,t,n,i),s=i?`borderLeft`:`borderRight`;function c(e,t){for(var n=o.nodes(),r=n.pop(),i={};r;)i[r]?e(r):(i[r]=!0,n.push(r),n=n.concat(t(r))),r=n.pop()}function l(e){a[e]=o.inEdges(e).reduce(function(e,t){return Math.max(e,a[t.v]+o.edge(t))},0)}function u(t){var n=o.outEdges(t).reduce(function(e,t){return Math.min(e,a[t.w]-o.edge(t))},1/0),r=e.node(t);n!==1/0&&r.borderType!==s&&(a[t]=Math.max(a[t],n))}return c(l,o.predecessors.bind(o)),c(u,o.successors.bind(o)),E(r,function(e){a[e]=a[n[e]]}),a}function Ja(e,t,n,r){var i=new O,a=e.graph(),o=$a(a.nodesep,a.edgesep,r);return E(t,function(t){var r;E(t,function(t){var a=n[t];if(i.setNode(a),r){var s=n[r],c=i.edge(s,a);i.setEdge(s,a,Math.max(o(e,t,r),c||0))}r=t})}),i}function Ya(e,t){return Sr(w(t),function(t){var n=-1/0,r=1/0;return dr(t,function(t,i){var a=eo(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Xa(e,t){var n=w(t),r=G(n),i=W(n);E([`u`,`d`],function(n){E([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=w(s);c=a===`l`?r-G(l):i-W(l),c&&(e[o]=U(s,function(e){return e+c}))}})})}function Za(e,t){return U(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=J(H(e,r));return(i[1]+i[2])/2})}function Qa(e){var t=X(e),n=xr(Va(e,t),Ha(e,t)),r={},i;return E([`u`,`d`],function(a){i=a===`u`?t:w(t).reverse(),E([`l`,`r`],function(t){t===`r`&&(i=H(i,function(e){return w(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Ka(e,i,n,o),c=qa(e,i,s.root,s.align,t===`r`);t===`r`&&(c=U(c,function(e){return-e})),r[a+t]=c})}),Xa(r,Ya(e,r)),Za(r,e.graph().align)}function $a(e,t,n){return function(r,i,a){var o=r.node(i),s=r.node(a),c=0,l;if(c+=o.width/2,Object.prototype.hasOwnProperty.call(o,`labelpos`))switch(o.labelpos.toLowerCase()){case`l`:l=-o.width/2;break;case`r`:l=o.width/2}if(l&&(c+=n?l:-l),l=0,c+=(o.dummy?t:e)/2,c+=(s.dummy?t:e)/2,c+=s.width/2,Object.prototype.hasOwnProperty.call(s,`labelpos`))switch(s.labelpos.toLowerCase()){case`l`:l=s.width/2;break;case`r`:l=-s.width/2}return l&&(c+=n?l:-l),l=0,c}}function eo(e,t){return e.node(t).width}function to(e){e=bi(e),no(e),fr(Qa(e),function(t,n){e.node(n).x=t})}function no(e){var t=X(e),n=e.graph().ranksep,r=0;E(t,function(t){var i=W(H(t,function(t){return e.node(t).height}));E(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function ro(e,t){var n=t&&t.debugTiming?Di:Oi;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>ho(e));n(` runLayout`,()=>io(t,n)),n(` updateInputGraph`,()=>ao(e,t))})}function io(e,t){t(` makeSpaceForEdgeLabels`,()=>go(e)),t(` removeSelfEdges`,()=>To(e)),t(` acyclic`,()=>gi(e)),t(` nestingGraph.run`,()=>pa(e)),t(` rank`,()=>la(bi(e))),t(` injectEdgeLabelProxies`,()=>_o(e)),t(` removeEmptyRanks`,()=>Ci(e)),t(` nestingGraph.cleanup`,()=>_a(e)),t(` normalizeRanks`,()=>Si(e)),t(` assignRankMinMax`,()=>vo(e)),t(` removeEdgeLabelProxies`,()=>yo(e)),t(` normalize.run`,()=>zi(e)),t(` parentDummyChains`,()=>Ra(e)),t(` addBorderSegments`,()=>ki(e)),t(` order`,()=>Pa(e)),t(` insertSelfEdges`,()=>Eo(e)),t(` adjustCoordinateSystem`,()=>ji(e)),t(` position`,()=>to(e)),t(` positionSelfEdges`,()=>Do(e)),t(` removeBorderNodes`,()=>wo(e)),t(` normalize.undo`,()=>Vi(e)),t(` fixupEdgeLabelCoords`,()=>So(e)),t(` undoCoordinateSystem`,()=>Mi(e)),t(` translateGraph`,()=>bo(e)),t(` assignNodeIntersects`,()=>xo(e)),t(` reversePoints`,()=>Co(e)),t(` acyclic.undo`,()=>vi(e))}function ao(e,t){E(e.nodes(),function(n){var r=e.node(n),i=t.node(n);r&&(r.x=i.x,r.y=i.y,t.children(n).length&&(r.width=i.width,r.height=i.height))}),E(e.edges(),function(n){var r=e.edge(n),i=t.edge(n);r.points=i.points,Object.prototype.hasOwnProperty.call(i,`x`)&&(r.x=i.x,r.y=i.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var oo=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],so={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},co=[`acyclicer`,`ranker`,`rankdir`,`align`],lo=[`width`,`height`],uo={width:0,height:0},fo=[`minlen`,`weight`,`width`,`height`,`labeloffset`],po={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},mo=[`labelpos`];function ho(e){var t=new O({multigraph:!0,compound:!0}),n=ko(e.graph());return t.setGraph(xr({},so,Oo(n,oo),K(n,co))),E(e.nodes(),function(n){var r=ko(e.node(n));t.setNode(n,er(Oo(r,lo),uo)),t.setParent(n,e.parent(n))}),E(e.edges(),function(n){var r=ko(e.edge(n));t.setEdge(n,xr({},po,Oo(r,fo),K(r,mo)))}),t}function go(e){var t=e.graph();t.ranksep/=2,E(e.edges(),function(n){var r=e.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!==`c`&&(t.rankdir===`TB`||t.rankdir===`BT`?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function _o(e){E(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);Y(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function vo(e){var t=0;E(e.nodes(),function(n){var r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=W(t,r.maxRank))}),e.graph().maxRank=t}function yo(e){E(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function bo(e){var t=1/0,n=0,r=1/0,i=0,a=e.graph(),o=a.marginx||0,s=a.marginy||0;function c(e){var a=e.x,o=e.y,s=e.width,c=e.height;t=Math.min(t,a-s/2),n=Math.max(n,a+s/2),r=Math.min(r,o-c/2),i=Math.max(i,o+c/2)}E(e.nodes(),function(t){c(e.node(t))}),E(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,E(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),E(e.edges(),function(n){var i=e.edge(n);E(i.points,function(e){e.x-=t,e.y-=r}),Object.prototype.hasOwnProperty.call(i,`x`)&&(i.x-=t),Object.prototype.hasOwnProperty.call(i,`y`)&&(i.y-=r)}),a.width=n-t+o,a.height=i-r+s}function xo(e){E(e.edges(),function(t){var n=e.edge(t),r=e.node(t.v),i=e.node(t.w),a,o;n.points?(a=n.points[0],o=n.points[n.points.length-1]):(n.points=[],a=i,o=r),n.points.unshift(xi(r,a)),n.points.push(xi(i,o))})}function So(e){E(e.edges(),function(t){var n=e.edge(t);if(Object.prototype.hasOwnProperty.call(n,`x`))switch((n.labelpos===`l`||n.labelpos===`r`)&&(n.width-=n.labeloffset),n.labelpos){case`l`:n.x-=n.width/2+n.labeloffset;break;case`r`:n.x+=n.width/2+n.labeloffset}})}function Co(e){E(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function wo(e){E(e.nodes(),function(t){if(e.children(t).length){var n=e.node(t),r=e.node(n.borderTop),i=e.node(n.borderBottom),a=e.node(V(n.borderLeft)),o=e.node(V(n.borderRight));n.width=Math.abs(o.x-a.x),n.height=Math.abs(i.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),E(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function To(e){E(e.edges(),function(t){if(t.v===t.w){var n=e.node(t.v);n.selfEdges||=[],n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Eo(e){var t=X(e);E(t,function(t){var n=0;E(t,function(t,r){var i=e.node(t);i.order=r+n,E(i.selfEdges,function(t){Y(e,`selfedge`,{width:t.label.width,height:t.label.height,rank:i.rank,order:r+ ++n,e:t.e,label:t.label},`_se`)}),delete i.selfEdges})})}function Do(e){E(e.nodes(),function(t){var n=e.node(t);if(n.dummy===`selfedge`){var r=e.node(n.e.v),i=r.x+r.width/2,a=r.y,o=n.x-i,s=r.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:i+2*o/3,y:a-s},{x:i+5*o/6,y:a-s},{x:i+o,y:a},{x:i+5*o/6,y:a+s},{x:i+2*o/3,y:a+s}],n.label.x=n.x,n.label.y=n.y}})}function Oo(e,t){return U(K(e,t),Number)}function ko(e){var t={};return E(e,function(e,n){t[n.toLowerCase()]=e}),t}var Ao=e((e,t,n)=>Math.max(t,Math.min(n,e)),`clamp`),jo=e((e=`TB`)=>{switch(e){case`BT`:return`bottom`;case`LR`:return`right`;case`RL`:return`left`;default:return`top`}},`getDefaultSelfLoopSide`),Mo=e(e=>e===`flowchart`||e===`flowchart-v2`||e===`stateDiagram`||e===`er`||e===`classDiagram`,`shouldMergeSelfLoopSegments`),No=[`x`,`y`,`width`,`height`,`labelBBox`,`intersect`,`calcIntersect`,`diff`,`clusterNode`],Po=e((e,t,n,r,i)=>{let a=[],o=new Set;if(n.forEach(({start:e,end:t})=>{e!==r&&o.add(e),t!==r&&o.add(t)}),o.forEach(t=>{let n=e.node(t);typeof n?.x==`number`&&typeof n?.y==`number`&&a.push(n)}),a.length===0&&n.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{typeof e?.x==`number`&&typeof e?.y==`number`&&a.push(e)})}),a.length===0)return jo(i);let s=a.reduce((e,t)=>({x:e.x+t.x/a.length,y:e.y+t.y/a.length}),{x:0,y:0}),c=s.x-t.x,l=s.y-t.y;return Math.abs(c)>Math.abs(l)?c>0?`right`:`left`:Math.abs(l)>0?l>0?`bottom`:`top`:jo(i)},`getSelfLoopSide`),Fo=e((e,t=`top`,n=0,r=0)=>{let i=e.x,a=e.y-n,o=e.width/2,s=e.height/2,c=Math.max(36,Math.min(100,e.width*.8)),l=Ao(Math.max(r,e.width*.35),36,c),u=Ao(Math.min(e.width,e.height)*.45,24,48);switch(t){case`bottom`:{let e=a+s;return[{x:i-l/2,y:e},{x:i-l/2,y:e+u},{x:i+l/2,y:e+u},{x:i+l/2,y:e}]}case`right`:{let e=i+o;return[{x:e,y:a-l/2},{x:e+u,y:a-l/2},{x:e+u,y:a+l/2},{x:e,y:a+l/2}]}case`left`:{let e=i-o;return[{x:e,y:a-l/2},{x:e-u,y:a-l/2},{x:e-u,y:a+l/2},{x:e,y:a+l/2}]}default:{let e=a-s;return[{x:i-l/2,y:e},{x:i-l/2,y:e-u},{x:i+l/2,y:e-u},{x:i+l/2,y:e}]}}},`getSelfLoopPoints`),Io=e((e,t,n=`top`,r=0,i={})=>{let a=e.x,o=e.y-r,s=i.width??0,c=i.height??0;switch(n){case`bottom`:return{x:a,y:Math.max(...t.map(e=>e.y))+c/2+4};case`right`:return{x:Math.max(...t.map(e=>e.x))+s/2+4,y:o};case`left`:return{x:Math.min(...t.map(e=>e.x))-s/2-4,y:o};default:return{x:a,y:Math.min(...t.map(e=>e.y))-c/2-4}}},`getSelfLoopLabelPosition`),Lo=e((e,t=0,{mergeSelfLoops:n=!0}={})=>{let r=new Map,i=[],a=e.graph()?.rankdir;return e.edges().forEach(t=>{let a=e.edge(t);if(n&&a.selfLoop){let e=a.selfLoop.id;r.has(e)||r.set(e,[]),r.get(e).push({edge:a,start:t.v,end:t.w})}else i.push({edge:a,start:t.v,end:t.w})}),r.forEach(n=>{if(n.length!==3){n.forEach(e=>i.push(e));return}n.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);let[r,o,s]=n,c=r.edge.originalEdge??o.edge.originalEdge??s.edge.originalEdge??o.edge,l=e.node(c.start);if(!l){n.forEach(e=>i.push(e));return}let u={width:o.edge.width,height:o.edge.height},d=Po(e,l,n,c.start,a),f=Fo(l,d,t,u.width??0),p=Io(l,f,d,t,u),m={...o.edge,...c,id:c.id,points:f,start:c.start,end:c.end,x:p.x,y:p.y,width:u.width,height:u.height,labelStyle:o.edge.labelStyle,fromCluster:r.edge.fromCluster??o.edge.fromCluster??s.edge.fromCluster,toCluster:r.edge.toCluster??o.edge.toCluster??s.edge.toCluster};delete m.selfLoop,delete m.originalEdge,i.push({edge:m,start:m.start,end:m.end})}),i},`getEdgesToRender`),Ro=e(async({element:n,graph:a,diagramType:c,id:l,parentCluster:u,siteConfig:d})=>{let f=a.graph().rankdir;t.trace(`Dir in recursive render - dir:`,f);let{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee}=ze(n,{edgePathsClass:`edgePaths`});a.nodes()?t.info(`Recursive render XXX`,a.nodes()):t.info(`No nodes found for`,a),a.edges().length>0&&t.info(`Recursive edges`,a.edge(a.edges()[0]));let _=Mo(c);await Promise.all(a.nodes().map(async function(e){let n=a.node(e);if(u!==void 0){let n=JSON.parse(JSON.stringify(u.clusterData));t.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,n.height,`
4
4
  Parent cluster`,u.height),a.setNode(u.id,n),a.parent(e)||(t.trace(`Setting parent`,e,u.id),a.setParent(e,u.id,n))}if(t.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(a.node(e))),n?.clusterNode){t.info(`Cluster identified XBX`,e,n.width,a.node(e));let{ranksep:o,nodesep:s}=a.graph();n.graph.setGraph({...n.graph.graph(),ranksep:o+25,nodesep:s});let u=await Go({element:g,graph:n.graph,diagramType:c,id:l,parentCluster:a.node(e),siteConfig:d}),f=u.elem;r(n,f),n.diff=u.diff||0,t.info(`New compound node after recursive render XAX`,e,`width`,n.width,`height`,n.height),i(f,n)}else a.children(e).length>0?(t.trace(`Cluster - the non recursive path XBX`,e,n.id,n,n.width,`Graph:`,a),t.trace(Be(n.id,a)),j.set(n.id,{id:Be(n.id,a),node:n})):(t.trace(`Node - the non recursive path XAX`,e,g,a.node(e),f),await He(g,a.node(e),{config:d,dir:f}))})),await e(async()=>{let e=a.edges().map(async function(e){let n=a.edge(e.v,e.w,e.name);if(t.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),t.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(a.edge(e))),t.info(`Fix`,j,`ids:`,e.v,e.w,`Translating: `,j.get(e.v),j.get(e.w)),_&&n.selfLoop){if(n.selfLoop.order!==1)return;let e={...n.originalEdge,...n,id:n.selfLoop.id,startLabelLeft:n.originalEdge?.startLabelLeft??n.startLabelLeft,startLabelRight:n.originalEdge?.startLabelRight??n.startLabelRight,endLabelLeft:n.originalEdge?.endLabelLeft??n.endLabelLeft,endLabelRight:n.originalEdge?.endLabelRight??n.endLabelRight};await s(h,e),n.width=e.width,n.height=e.height,n.labelStyle=e.labelStyle;return}await s(h,n)});await Promise.all(e)},`processEdges`)();let{subGraphTitleTotalMargin:te}=o(d);return{elem:ee,graph:a,groups:{clusters:p,edgePaths:m,edgeLabels:h,nodes:g,rootGroups:ee},diagramType:c,id:l,mergeSelfLoops:_,subGraphTitleTotalMargin:te}},`measureDagreGraph`),zo=e(e=>{t.info(`############################################# XXX`),t.info(`### Layout ### XXX`),t.info(`############################################# XXX`),ro(e)},`runDagreGraphLayout`),Bo=e((e,t,n)=>{let r=e.node(t);if(!r)return;let i={...r};return r?.clusterNode?i.y=(r.y??0)+n:e.children(t).length>0?i.height=(r.height??0)+n:i.y=(r.y??0)+n/2,i},`normalizeDagreNode`),Vo=e((e,t)=>{No.forEach(n=>{t[n]!==void 0&&(e[n]=t[n])})},`applyDagreNodeLayout`),Ho=e((e,t,n,r)=>({...e,start:e.start??t,end:e.end??n,points:(e.points??[]).map(e=>({...e,y:typeof e.y==`number`?e.y+r:e.y}))}),`normalizeDagreEdge`),Uo=e((e,t)=>{let{graph:n,mergeSelfLoops:r,subGraphTitleTotalMargin:i=0}=t,a=new Map(e.nodes.map(e=>[e.id,e]));Re(n).forEach(e=>{let t=Bo(n,e,i);if(!t)return;Vo(n.node(e),t);let r=a.get(e);r&&Vo(r,t)});let o=i/2;return e.edges=Lo(n,o,{mergeSelfLoops:r}).map(({edge:e,start:t,end:n})=>Ho(e,t,n,o)),e},`applyDagreLayoutResult`),Wo=e(async({elem:e,graph:n,groups:{clusters:r,edgePaths:i},diagramType:o,id:s,mergeSelfLoops:u,subGraphTitleTotalMargin:d})=>{let f=0;await Promise.all(Re(n).map(async function(e){let i=n.node(e);if(t.info(`Position XBX => `+e+`: (`+i.x,`,`+i.y,`) width: `,i.width,` height: `,i.height),i?.clusterNode)i.y+=d,t.info(`A tainted cluster node XBX1`,e,i.id,i.width,i.height,i.x,i.y,n.parent(e)),j.get(i.id).node=i,a(i);else if(n.children(e).length>0){t.info(`A pure cluster node XBX1`,e,i.id,i.x,i.y,i.width,i.height,n.parent(e)),i.height+=d,n.node(i.parentId);let a=i?.padding/2||0,o=i?.labelBBox?.height||0,s=o-a||0;t.debug(`OffsetY`,s,`labelHeight`,o,`halfPadding`,a),await Le(r,i),j.get(i.id).node=i}else{let e=n.node(i.parentId);i.y+=d/2,t.info(`A regular node XBX1 - using the padding`,i.id,`parent`,i.parentId,i.width,i.height,i.x,i.y,`offsetY`,i.offsetY,`parent`,e,e?.offsetY,i),a(i)}}));let p=d/2;return Lo(n,p,{mergeSelfLoops:u}).forEach(function({edge:e,start:r,end:a}){t.info(`Edge `+r+` -> `+a+`: `+JSON.stringify(e),e),e.points.forEach(e=>e.y+=p);let u=n.node(r),d=n.node(a),f=c(i,e,j,o,u,d,s);l(e,f)}),n.nodes().forEach(function(e){let r=n.node(e);t.info(e,r.type,r.diff),r.isGroup&&(f=r.diff)}),t.warn(`Returning from recursive render XAX`,e,f),{elem:e,diff:f}},`paintDagreLayoutCore`),Go=e(async e=>{let t=await Ro(e);return zo(t.graph),await Wo(t)},`renderDagreSubgraph`),Ko=e(e=>{let n=new O({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.nodeSpacing||e.config?.flowchart?.nodeSpacing,ranksep:e.config?.rankSpacing||e.rankSpacing||e.config?.flowchart?.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});return e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),t.debug(`Edges:`,e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+`---`+t+`---1`,i=t+`---`+t+`---2`,a=n.node(t);n.setNode(r,{domId:r,id:r,parentId:a.parentId,labelStyle:``,label:``,padding:0,shape:`labelRect`,style:``,width:10,height:10}),n.setParent(r,a.parentId),n.setNode(i,{domId:i,id:i,parentId:a.parentId,labelStyle:``,padding:0,shape:`labelRect`,label:``,style:``,width:10,height:10}),n.setParent(i,a.parentId);let o=structuredClone(e),s=structuredClone(e),c=structuredClone(e),l=structuredClone(e);s.originalEdge=o,s.selfLoop={id:o.id,order:0},c.originalEdge=o,c.selfLoop={id:o.id,order:1},l.originalEdge=o,l.selfLoop={id:o.id,order:2},s.label=``,s.arrowTypeEnd=`none`,s.endLabelLeft=``,s.endLabelRight=``,s.startLabelLeft=``,s.id=t+`-cyclic-special-1`,c.startLabelRight=``,c.startLabelLeft=``,c.endLabelLeft=``,c.endLabelRight=``,c.arrowTypeStart=`none`,c.arrowTypeEnd=`none`,c.id=t+`-cyclic-special-mid`,l.label=``,l.startLabelRight=``,l.startLabelLeft=``,l.arrowTypeStart=`none`,a.isGroup&&(s.fromCluster=t,l.toCluster=t),l.id=t+`-cyclic-special-2`,l.arrowTypeStart=`none`,n.setEdge(t,r,s,t+`-cyclic-special-0`),n.setEdge(r,i,c,t+`-cyclic-special-1`),n.setEdge(i,t,l,t+`-cyclic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),Ue(n),{graph:n}},`prepareLayoutForDagre`),qo=e(async(e,{element:t,preparedLayout:r})=>{let i=r??Ko(e),a=n(),o=await Ro({element:t,graph:i.graph,diagramType:e.type,id:e.diagramId,parentCluster:void 0,siteConfig:a});return i.measuredLayout=o,o},`measureDagreLayout`),Jo=e((e,t)=>{let n=t.preparedLayout?.measuredLayout;if(!n)throw Error(`runDagreLayoutCore requires measureDagreLayout to run first`);return zo(n.graph),Uo(e,n),n},`runDagreLayoutCore`),Yo=Ve({prepareLayout:Ko,measureLayout:qo,runLayoutCore:Jo,paintOptions:{clusterDb:j,getNodes:e((e,{measure:t})=>Re(t.graph).map(e=>t.graph.node(e)).filter(Boolean),`getDagrePaintNodes`),getEdgeNode:e((e,t,{measure:n})=>e?n.graph.node(e):void 0,`getDagreEdgeNode`),skipNode:e((e,{measure:t})=>!t.graph.hasNode(e.id),`skipNode`),isCluster:e((e,{measure:t})=>t.graph.hasNode(e.id)&&(t.graph.children(e.id)??[]).length>0,`isCluster`)}});export{Uo as applyDagreLayoutResult,Lo as getEdgesToRender,qo as measureDagreLayout,Ko as prepareLayoutForDagre,Yo as render,Jo as runDagreLayoutCore};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-Bej7g-L4.js";import{G as r,H as i,U as a,a as o,at as s,d as c,et as l,q as u,s as d,v as f,w as p,x as m,y as h}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{t as g}from"./channel-IXYN7T6d.js";import{c as _,g as v}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import"./chunk-742MDFTN-B7dqi4lM.js";import"./chunk-MBY4JIJT-DecLyoJ2.js";import{t as y}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-7PRAP22T-CnZEk7pT.js";import{i as b,n as x,o as S,r as C}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{a as w}from"./chunk-7INBJB4K-owIg7950.js";import"./chunk-5DYCD2WN-DPF_imHM.js";import"./chunk-Z7XXMR3K-B2eslene.js";import{t as T}from"./chunk-GWA4HPMP-DvKgnHj7.js";import{t as E}from"./chunk-XXDRQBXY-DEJDL8DG.js";import{t as D}from"./chunk-WEXAMYUT-DZkcP9P-.js";import"./chunk-UA2S7LBM-Axt5K_7j.js";import{i as O,n as k,r as A,t as j}from"./mermaid.core-Dmtm0D6c.js";var M={SHAPE_UNSUPPORTED:`SHAPE_UNSUPPORTED`,SHAPE_REMOVED:`SHAPE_REMOVED`,EDGE_OPERATOR_UNSUPPORTED:`EDGE_OPERATOR_UNSUPPORTED`,REFERENCE_EDGE_LABEL_REJECTED:`REFERENCE_EDGE_LABEL_REJECTED`,CONNECTOR_REF_UNRESOLVED:`CONNECTOR_REF_UNRESOLVED`,CONNECTOR_REF_NOT_A_CONNECTOR:`CONNECTOR_REF_NOT_A_CONNECTOR`,METADATA_KEY_MISAPPLIED:`METADATA_KEY_MISAPPLIED`,DUPLICATE_ID_NODE:`DUPLICATE_ID_NODE`,RESERVED_SYNTHETIC_ID:`RESERVED_SYNTHETIC_ID`,CONTAINMENT_VIOLATION:`CONTAINMENT_VIOLATION`,EDGE_SEMANTIC_CONTRADICTION:`EDGE_SEMANTIC_CONTRADICTION`,FLOW_NO_INPUT:`FLOW_NO_INPUT`},N=new Set([M.SHAPE_UNSUPPORTED,M.SHAPE_REMOVED,M.CONTAINMENT_VIOLATION]);new Set(Object.values(M).filter(e=>!N.has(e)));var P=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),ee=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),te=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),F=`roundedRect`;function I(e){return e&&(P.get(e)??e)}e(I,`resolveShapeAlias`);function ne(e,n){for(let r of e)if(!r.isGroup){if((!r.shape||r.shape===`squareRect`||r.shape===`rect`)&&(r.shape=F),ee.has(r.shape)){let e=`shape "${r.shape}" was removed in v0.8.1, using "${F}"`;n?.emitError?n.emitError(`SHAPE_REMOVED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F;continue}if(!te.has(r.shape)){let e=`shape "${r.shape}" is not supported, using "${F}"`;n?.emitWarning?n.emitWarning(`SHAPE_UNSUPPORTED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}}}e(ne,`normaliseNodeShapes`);var L=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),R=L.size,z=e(e=>`af-kind-${e}`,`kindClass`),B=[...L.keys()],V=e(e=>Math.max(1,e-R),`containerSlotCount`),H=e((e,t)=>{let n=R+e%V(t);return t>0?n%t:n},`containerSlot`);function re(e,t,n){let r=m().themeVariables?.borderColorArray,i=Array.isArray(r)?r.length:0,a=n.size;for(let r of e??[]){if(r.isGroup||r.shape===`collapsedGroup`){r.colorIndex=H(n.get(String(r.id))??a++,i);continue}let e=t(String(r.id));e&&L.has(e)&&(r.cssClasses=`${r.cssClasses??``} ${z(e)}`.replace(/\s+/g,` `).trim())}}e(re,`assignColorSlots`);var ie=`agentflow-`,ae=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),oe=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]),se={flow:`flowGroup`};function ce(e){if(Array.isArray(e))return e.map(e=>ce(e));if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=ce(e[n]));return t}e(ce,`stripPrototypeKeys`);function le(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t,p as n}from"./src-DwTKHdVd.js";import{G as r,H as i,U as a,a as o,at as s,d as c,et as l,q as u,s as d,v as f,w as p,x as m,y as h}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{t as g}from"./channel-B4U25mhB.js";import{c as _,g as v}from"./chunk-ZIGJFQKS-u0lffPbH.js";import"./chunk-742MDFTN-Q9c012fL.js";import"./chunk-MBY4JIJT-Jg4QirYy.js";import{t as y}from"./chunk-5VM5RSS4-ZNzvKenW.js";import"./chunk-7PRAP22T-D5sSirGe.js";import{i as b,n as x,o as S,r as C}from"./chunk-J5ZVWO5B-oDCd-gWO.js";import{a as w}from"./chunk-7INBJB4K-D6-5S_eb.js";import"./chunk-5DYCD2WN-DsvkZxf0.js";import"./chunk-Z7XXMR3K-ooKdHdRU.js";import{t as T}from"./chunk-GWA4HPMP-BzyuOibA.js";import{t as E}from"./chunk-XXDRQBXY-CEdjCwp8.js";import{t as D}from"./chunk-WEXAMYUT-BfdLD4oE.js";import"./chunk-UA2S7LBM-BWLbUYDY.js";import{i as O,n as k,r as A,t as j}from"./mermaid.core-BBeLf7h3.js";var M={SHAPE_UNSUPPORTED:`SHAPE_UNSUPPORTED`,SHAPE_REMOVED:`SHAPE_REMOVED`,EDGE_OPERATOR_UNSUPPORTED:`EDGE_OPERATOR_UNSUPPORTED`,REFERENCE_EDGE_LABEL_REJECTED:`REFERENCE_EDGE_LABEL_REJECTED`,CONNECTOR_REF_UNRESOLVED:`CONNECTOR_REF_UNRESOLVED`,CONNECTOR_REF_NOT_A_CONNECTOR:`CONNECTOR_REF_NOT_A_CONNECTOR`,METADATA_KEY_MISAPPLIED:`METADATA_KEY_MISAPPLIED`,DUPLICATE_ID_NODE:`DUPLICATE_ID_NODE`,RESERVED_SYNTHETIC_ID:`RESERVED_SYNTHETIC_ID`,CONTAINMENT_VIOLATION:`CONTAINMENT_VIOLATION`,EDGE_SEMANTIC_CONTRADICTION:`EDGE_SEMANTIC_CONTRADICTION`,FLOW_NO_INPUT:`FLOW_NO_INPUT`},N=new Set([M.SHAPE_UNSUPPORTED,M.SHAPE_REMOVED,M.CONTAINMENT_VIOLATION]);new Set(Object.values(M).filter(e=>!N.has(e)));var P=new Map([[`task`,`roundedRect`],[`tool`,`subroutine`],[`input`,`lean-right`],[`decision`,`diamond`],[`refdoc`,`lin-doc`],[`action`,`hexagon`],[`round`,`rect`]]),ee=new Set(`doc.stadium.terminal.circle.trapezoid.inv_trapezoid.inv-trapezoid.doublecircle.double-circle.typeDeclaration.procs.lean_left.lean-left.in-out.cylinder.ellipse.odd.tag-rect.tagged-rectangle.delay.half-rounded-rectangle.lin-rect.lined-rectangle.win-pane.window-pane.curv-trap.curved-trapezoid`.split(`.`)),te=new Set([`roundedRect`,`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`lean-right`,`diamond`,`lin-doc`,`lined-document`,`hexagon`,`hex`,`connector`,`collapsedGroup`]),F=`roundedRect`;function I(e){return e&&(P.get(e)??e)}e(I,`resolveShapeAlias`);function ne(e,n){for(let r of e)if(!r.isGroup){if((!r.shape||r.shape===`squareRect`||r.shape===`rect`)&&(r.shape=F),ee.has(r.shape)){let e=`shape "${r.shape}" was removed in v0.8.1, using "${F}"`;n?.emitError?n.emitError(`SHAPE_REMOVED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F;continue}if(!te.has(r.shape)){let e=`shape "${r.shape}" is not supported, using "${F}"`;n?.emitWarning?n.emitWarning(`SHAPE_UNSUPPORTED`,e,{nodeId:r.id}):t.warn(`agentflow: ${e}`),r.shape=F}}}e(ne,`normaliseNodeShapes`);var L=new Map([[`tool`,0],[`task`,1],[`decision`,2],[`input`,3],[`refdoc`,4],[`connector`,5],[`action`,6]]),R=L.size,z=e(e=>`af-kind-${e}`,`kindClass`),B=[...L.keys()],V=e(e=>Math.max(1,e-R),`containerSlotCount`),H=e((e,t)=>{let n=R+e%V(t);return t>0?n%t:n},`containerSlot`);function re(e,t,n){let r=m().themeVariables?.borderColorArray,i=Array.isArray(r)?r.length:0,a=n.size;for(let r of e??[]){if(r.isGroup||r.shape===`collapsedGroup`){r.colorIndex=H(n.get(String(r.id))??a++,i);continue}let e=t(String(r.id));e&&L.has(e)&&(r.cssClasses=`${r.cssClasses??``} ${z(e)}`.replace(/\s+/g,` `).trim())}}e(re,`assignColorSlots`);var ie=`agentflow-`,ae=new Set([`shape`,`view`,`icon`,`img`,`form`,`pos`,`w`,`h`,`class`,`style`,`labelType`]),oe=new Set([`subroutine`,`subprocess`,`subproc`,`framed-rectangle`,`tool`]),se={flow:`flowGroup`};function ce(e){if(Array.isArray(e))return e.map(e=>ce(e));if(typeof e!=`object`||!e)return e;let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=ce(e[n]));return t}e(ce,`stripPrototypeKeys`);function le(e){let t=!1,n=!1,r=0,i,a=[];for(let o of e.split(`
2
2
  `)){if(i!==void 0){let e=o.length-o.trimStart().length;if(o.trim()===``||e>i){a.push(o);continue}i=void 0}let e=-1;for(let i=0;i<o.length;i++){let a=o[i];if(n)a===`\\`?i++:a===`"`&&(n=!1);else if(t)a===`'`&&(t=!1);else if(a===`"`)n=!0;else if(a===`'`)t=!0;else if(a===`#`&&(i===0||o[i-1]===` `||o[i-1]===` `)){e=i;break}else a===`[`||a===`{`?r++:(a===`]`||a===`}`)&&(r=Math.max(0,r-1))}if(t||n||r>0){a.push(o);continue}let s=e>=0?o.slice(0,e):o,c=e>=0?o.slice(e):``;if(/:\s*[>|][\d+-]*\s*$/.test(s)){i=o.length-o.trimStart().length,a.push(o);continue}a.push(s.replace(/,([\t ]*)$/,`$1`)+c)}return a.join(`
3
3
  `)}e(le,`stripLineTrailingCommas`);var ue=class{constructor(){this.vertexCounter=0,this.config=m(),this.vertices=new Map,this.edges=[],this.classes=new Map,this.subGraphs=[],this.subGraphLookup=new Map,this.globalNodes=new Set,this.connectors=new Map,this.tooltips=new Map,this.subCount=0,this.firstGraphFlag=!0,this.secCount=-1,this.posCrossRef=[],this.diagramId=``,this.preserveCommentsWhenParsing=!0,this.frontmatterLineOffset=0,this.elementMappings=[],this.bareVertexMappings=new WeakSet,this.diagnostics=[],this.postParseValidationRun=!1,this.funs=[],this.setAccTitle=a,this.setAccDescription=i,this.setDiagramTitle=u,this.getAccTitle=h,this.getAccDescription=f,this.getDiagramTitle=p,this.funs.push(this.setupToolTips.bind(this)),this.addVertex=this.addVertex.bind(this),this.firstGraph=this.firstGraph.bind(this),this.setDirection=this.setDirection.bind(this),this.addSubGraph=this.addSubGraph.bind(this),this.addGlobal=this.addGlobal.bind(this),this.addConnector=this.addConnector.bind(this),this.addConnectorMapping=this.addConnectorMapping.bind(this),this.addLink=this.addLink.bind(this),this.setLink=this.setLink.bind(this),this.updateLink=this.updateLink.bind(this),this.addClass=this.addClass.bind(this),this.setClass=this.setClass.bind(this),this.destructLink=this.destructLink.bind(this),this.setClickEvent=this.setClickEvent.bind(this),this.setTooltip=this.setTooltip.bind(this),this.updateLinkInterpolate=this.updateLinkInterpolate.bind(this),this.setClickFun=this.setClickFun.bind(this),this.bindFunctions=this.bindFunctions.bind(this),this.setFrontmatterLineOffset=this.setFrontmatterLineOffset.bind(this),this.addVertexMapping=this.addVertexMapping.bind(this),this.extendVertexMapping=this.extendVertexMapping.bind(this),this.addEdgeMapping=this.addEdgeMapping.bind(this),this.addSubgraphMapping=this.addSubgraphMapping.bind(this),this.emitWarning=this.emitWarning.bind(this),this.emitError=this.emitError.bind(this),this.getDiagnostics=this.getDiagnostics.bind(this),this.lex={firstGraph:this.firstGraph.bind(this)},this.clear(),this.setGen(`gen-2`)}static{e(this,`AgentFlowDB`)}sanitizeText(e){return d.sanitizeText(e,this.config)}sanitizeNodeLabelType(e){switch(e){case`markdown`:case`string`:case`text`:return e;default:return`markdown`}}setDiagramId(e){this.diagramId=e}lookUpDomId(e){for(let t of this.vertices.values())if(t.id===e)return this.diagramId?`${this.diagramId}-${t.domId}`:t.domId;return this.diagramId?`${this.diagramId}-${e}`:e}addVertex(e,t,n,r,i,a,o={},s,c){if(!e||e.trim().length===0)return;let l;if(s!==void 0){let e;e=s.includes(`
4
4
  `)?s+`
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-Cin6zZf8.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n,p as r}from"./src-Bej7g-L4.js";import{D as i,H as a,U as o,a as s,b as c,c as l,f as u,q as d,v as f,w as p,y as m}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./defaultLocale-BFoDCU3G.js";import{i as _}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import{t as v}from"./chunk-JWPE2WC7-DVXcaiue.js";import{i as y,n as b}from"./chunk-7PRAP22T-CnZEk7pT.js";import{t as x}from"./chunk-WEXAMYUT-DZkcP9P-.js";import{a as S}from"./mermaid.core-Dmtm0D6c.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function ee(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ne(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var re=(1+Math.sqrt(5))/2;function ie(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?te(c,n,r,i,h?r+=m*g/h:a):ne(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ae=(function e(t){function n(e,n,r,i,a){ie(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(re);function oe(){var e=ae,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(ee),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var J=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=m,this.setDiagramTitle=d,this.getDiagramTitle=p,this.getAccDescription=f,this.setAccDescription=a}static{t(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=u,t=c();return _({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{b(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){s(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Y(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}t(Y,`buildHierarchy`);var se=t((e,n)=>{v(e,n);let r=[];for(let t of e.TreemapRows??[])t.$type===`ClassDefStatement`&&n.addClass(t.className??``,t.styleText??``);for(let t of e.TreemapRows??[]){let e=t.item;if(!e)continue;let i=t.indent?parseInt(t.indent):0,a=ce(e),o=e.classSelector?n.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=Y(r),a=t((e,t)=>{for(let r of e)n.addNode(r,t),r.children&&r.children.length>0&&a(r.children,t+1)},`addNodesRecursively`);a(i,0)},`populate`),ce=t(e=>e.name?String(e.name):``,`getItemName`),X={parser:{yy:void 0},parse:t(async t=>{try{let r=await e(`treemap`,t);n.debug(`Treemap AST:`,r);let i=X.parser?.yy;if(!(i instanceof J))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);se(r,i)}catch(e){throw n.error(`Error parsing treemap:`,e),e}},`parse`)},Z=10,Q=10,$=25,le={draw:t((e,i,a,o)=>{let s=o.db,u=s.getConfig(),d=u.padding??Z,f=s.getDiagramTitle(),p=s.getRoot(),{themeVariables:m}=c();if(!p)return;let _=f?30:0,v=S(i),b=u.nodeWidth?u.nodeWidth*Q:960,C=u.nodeHeight?u.nodeHeight*Q:500,w=b,T=C+_;v.attr(`viewBox`,`0 0 ${w} ${T}`),l(v,T,w,u.useMaxWidth);let E;try{let e=u.valueFormat||`,`;if(e===`$0,0`)E=t(e=>`$`+g(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let n=/\.\d+/.exec(e),r=n?n[0]:``;E=t(e=>`$`+g(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let n=e.substring(1);E=t(e=>`$`+g(n||``)(e),`valueFormat`)}else E=g(e)}catch(e){n.error(`Error creating format function:`,e),E=g(`,`)}let D=h().range([`transparent`,m.cScale0,m.cScale1,m.cScale2,m.cScale3,m.cScale4,m.cScale5,m.cScale6,m.cScale7,m.cScale8,m.cScale9,m.cScale10,m.cScale11]),O=h().range([`transparent`,m.cScalePeer0,m.cScalePeer1,m.cScalePeer2,m.cScalePeer3,m.cScalePeer4,m.cScalePeer5,m.cScalePeer6,m.cScalePeer7,m.cScalePeer8,m.cScalePeer9,m.cScalePeer10,m.cScalePeer11]),k=h().range([m.cScaleLabel0,m.cScaleLabel1,m.cScaleLabel2,m.cScaleLabel3,m.cScaleLabel4,m.cScaleLabel5,m.cScaleLabel6,m.cScaleLabel7,m.cScaleLabel8,m.cScaleLabel9,m.cScaleLabel10,m.cScaleLabel11]);f&&v.append(`text`).attr(`x`,w/2).attr(`y`,_/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(f);let A=v.append(`g`).attr(`transform`,`translate(0, ${_})`).attr(`class`,`treemapContainer`),j=R(p).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=oe().size([b,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=y({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${i}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=u.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),u.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=F.length>20,L=I?16:38,z=I?14:28,B=I?4:8,V=I?4:6,H=I?2:4,U=I?8:10,W=I?1:2,G=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);G.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>y({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),G.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),G.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${L}px;fill:`+k(e.data.name)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-2*H,s=i-2*H;if(o<U||s<U){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>B;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(V,Math.min(z,Math.round(c*l))),d=c+W+u;for(;d>s&&c>B&&(c--,u=Math.max(V,Math.min(z,Math.round(c*l))),!(u<V&&c===B));)t.style(`font-size`,`${c}px`),d=c+W+u;t.style(`font-size`,`${c}px`),I?(c<B||s<B)&&t.style(`display`,`none`):(a.getComputedTextLength()>o||c<B||s<c)&&t.style(`display`,`none`)}),u.showValues!==!1&&G.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${z}px;fill:`+k(e.data.name)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(V,Math.min(z,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+W;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*H;t.node().getComputedTextLength()>u||s+o>l||o<V?t.style(`display`,`none`):t.style(`display`,null)});let K=u.diagramPadding??8;x(v,K,`flowchart`,u?.useMaxWidth||!1)},`draw`),getClasses:t(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:X,get db(){return new J},renderer:le,styles:t(({treemap:e}={})=>{let t=i(),n=c(),r=_(t,n.themeVariables),a=_(ue,e),o=a.titleColor??r.titleColor,s=a.labelColor??r.textColor,l=a.valueColor??r.textColor;return`
1
+ import{n as e}from"./mermaid-parser.core-CMSpXjeX.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n,p as r}from"./src-DwTKHdVd.js";import{D as i,H as a,U as o,a as s,b as c,c as l,f as u,q as d,v as f,w as p,y as m}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./defaultLocale-BFoDCU3G.js";import{i as _}from"./chunk-ZIGJFQKS-u0lffPbH.js";import{t as v}from"./chunk-JWPE2WC7-DVXcaiue.js";import{i as y,n as b}from"./chunk-7PRAP22T-D5sSirGe.js";import{t as x}from"./chunk-WEXAMYUT-BfdLD4oE.js";import{a as S}from"./mermaid.core-BBeLf7h3.js";function C(e){var t=0,n=e.children,r=n&&n.length;if(!r)t=1;else for(;--r>=0;)t+=n[r].value;e.value=t}function w(){return this.eachAfter(C)}function T(e,t){let n=-1;for(let r of this)e.call(t,r,++n,this);return this}function E(e,t){for(var n=this,r=[n],i,a,o=-1;n=r.pop();)if(e.call(t,n,++o,this),i=n.children)for(a=i.length-1;a>=0;--a)r.push(i[a]);return this}function D(e,t){for(var n=this,r=[n],i=[],a,o,s,c=-1;n=r.pop();)if(i.push(n),a=n.children)for(o=0,s=a.length;o<s;++o)r.push(a[o]);for(;n=i.pop();)e.call(t,n,++c,this);return this}function O(e,t){let n=-1;for(let r of this)if(e.call(t,r,++n,this))return r}function k(e){return this.eachAfter(function(t){for(var n=+e(t.data)||0,r=t.children,i=r&&r.length;--i>=0;)n+=r[i].value;t.value=n})}function A(e){return this.eachBefore(function(t){t.children&&t.children.sort(e)})}function j(e){for(var t=this,n=M(t,e),r=[t];t!==n;)t=t.parent,r.push(t);for(var i=r.length;e!==n;)r.splice(i,0,e),e=e.parent;return r}function M(e,t){if(e===t)return e;var n=e.ancestors(),r=t.ancestors(),i=null;for(e=n.pop(),t=r.pop();e===t;)i=e,e=n.pop(),t=r.pop();return i}function N(){for(var e=this,t=[e];e=e.parent;)t.push(e);return t}function P(){return Array.from(this)}function F(){var e=[];return this.eachBefore(function(t){t.children||e.push(t)}),e}function I(){var e=this,t=[];return e.each(function(n){n!==e&&t.push({source:n.parent,target:n})}),t}function*L(){var e=this,t,n=[e],r,i,a;do for(t=n.reverse(),n=[];e=t.pop();)if(yield e,r=e.children)for(i=0,a=r.length;i<a;++i)n.push(r[i]);while(n.length)}function R(e,t){e instanceof Map?(e=[void 0,e],t===void 0&&(t=V)):t===void 0&&(t=B);for(var n=new W(e),r,i=[n],a,o,s,c;r=i.pop();)if((o=t(r.data))&&(c=(o=Array.from(o)).length))for(r.children=o,s=c-1;s>=0;--s)i.push(a=o[s]=new W(o[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(U)}function z(){return R(this).eachBefore(H)}function B(e){return e.children}function V(e){return Array.isArray(e)?e[1]:null}function H(e){e.data.value!==void 0&&(e.value=e.data.value),e.data=e.data.data}function U(e){var t=0;do e.height=t;while((e=e.parent)&&e.height<++t)}function W(e){this.data=e,this.depth=this.height=0,this.parent=null}W.prototype=R.prototype={constructor:W,count:w,each:T,eachAfter:D,eachBefore:E,find:O,sum:k,sort:A,path:j,ancestors:N,descendants:P,leaves:F,links:I,copy:z,[Symbol.iterator]:L};function G(e){if(typeof e!=`function`)throw Error();return e}function K(){return 0}function q(e){return function(){return e}}function ee(e){e.x0=Math.round(e.x0),e.y0=Math.round(e.y0),e.x1=Math.round(e.x1),e.y1=Math.round(e.y1)}function te(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(r-t)/e.value;++s<c;)o=a[s],o.y0=n,o.y1=i,o.x0=t,o.x1=t+=o.value*l}function ne(e,t,n,r,i){for(var a=e.children,o,s=-1,c=a.length,l=e.value&&(i-n)/e.value;++s<c;)o=a[s],o.x0=t,o.x1=r,o.y0=n,o.y1=n+=o.value*l}var re=(1+Math.sqrt(5))/2;function ie(e,t,n,r,i,a){for(var o=[],s=t.children,c,l,u=0,d=0,f=s.length,p,m,h=t.value,g,_,v,y,b,x,S;u<f;){p=i-n,m=a-r;do g=s[d++].value;while(!g&&d<f);for(_=v=g,x=Math.max(m/p,p/m)/(h*e),S=g*g*x,b=Math.max(v/S,S/_);d<f;++d){if(g+=l=s[d].value,l<_&&(_=l),l>v&&(v=l),S=g*g*x,y=Math.max(v/S,S/_),y>b){g-=l;break}b=y}o.push(c={value:g,dice:p<m,children:s.slice(u,d)}),c.dice?te(c,n,r,i,h?r+=m*g/h:a):ne(c,n,r,h?n+=p*g/h:i,a),h-=g,u=d}return o}var ae=(function e(t){function n(e,n,r,i,a){ie(t,e,n,r,i,a)}return n.ratio=function(t){return e((t=+t)>1?t:1)},n})(re);function oe(){var e=ae,t=!1,n=1,r=1,i=[0],a=K,o=K,s=K,c=K,l=K;function u(e){return e.x0=e.y0=0,e.x1=n,e.y1=r,e.eachBefore(d),i=[0],t&&e.eachBefore(ee),e}function d(t){var n=i[t.depth],r=t.x0+n,u=t.y0+n,d=t.x1-n,f=t.y1-n;d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),t.x0=r,t.y0=u,t.x1=d,t.y1=f,t.children&&(n=i[t.depth+1]=a(t)/2,r+=l(t)-n,u+=o(t)-n,d-=s(t)-n,f-=c(t)-n,d<r&&(r=d=(r+d)/2),f<u&&(u=f=(u+f)/2),e(t,r,u,d,f))}return u.round=function(e){return arguments.length?(t=!!e,u):t},u.size=function(e){return arguments.length?(n=+e[0],r=+e[1],u):[n,r]},u.tile=function(t){return arguments.length?(e=G(t),u):e},u.padding=function(e){return arguments.length?u.paddingInner(e).paddingOuter(e):u.paddingInner()},u.paddingInner=function(e){return arguments.length?(a=typeof e==`function`?e:q(+e),u):a},u.paddingOuter=function(e){return arguments.length?u.paddingTop(e).paddingRight(e).paddingBottom(e).paddingLeft(e):u.paddingTop()},u.paddingTop=function(e){return arguments.length?(o=typeof e==`function`?e:q(+e),u):o},u.paddingRight=function(e){return arguments.length?(s=typeof e==`function`?e:q(+e),u):s},u.paddingBottom=function(e){return arguments.length?(c=typeof e==`function`?e:q(+e),u):c},u.paddingLeft=function(e){return arguments.length?(l=typeof e==`function`?e:q(+e),u):l},u}var J=class{constructor(){this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.setAccTitle=o,this.getAccTitle=m,this.setDiagramTitle=d,this.getDiagramTitle=p,this.getAccDescription=f,this.setAccDescription=a}static{t(this,`TreeMapDB`)}getNodes(){return this.nodes}getConfig(){let e=u,t=c();return _({...e.treemap,...t.treemap??{}})}addNode(e,t){this.nodes.push(e),this.levels.set(e,t),t===0&&(this.outerNodes.push(e),this.root??=e)}getRoot(){return{name:``,children:this.outerNodes}}addClass(e,t){let n=this.classes.get(e)??{id:e,styles:[],textStyles:[]},r=t.replace(/\\,/g,`§§§`).replace(/,/g,`;`).replace(/§§§/g,`,`).split(`;`);r&&r.forEach(e=>{b(e)&&(n?.textStyles?n.textStyles.push(e):n.textStyles=[e]),n?.styles?n.styles.push(e):n.styles=[e]}),this.classes.set(e,n)}getClasses(){return this.classes}getStylesForClass(e){return this.classes.get(e)?.styles??[]}clear(){s(),this.nodes=[],this.levels=new Map,this.outerNodes=[],this.classes=new Map,this.root=void 0}};function Y(e){if(!e.length)return[];let t=[],n=[];return e.forEach(e=>{let r={name:e.name,children:e.type===`Leaf`?void 0:[]};for(r.classSelector=e?.classSelector,e?.cssCompiledStyles&&(r.cssCompiledStyles=e.cssCompiledStyles),e.type===`Leaf`&&e.value!==void 0&&(r.value=e.value);n.length>0&&n[n.length-1].level>=e.level;)n.pop();if(n.length===0)t.push(r);else{let e=n[n.length-1].node;e.children?e.children.push(r):e.children=[r]}e.type!==`Leaf`&&n.push({node:r,level:e.level})}),t}t(Y,`buildHierarchy`);var se=t((e,n)=>{v(e,n);let r=[];for(let t of e.TreemapRows??[])t.$type===`ClassDefStatement`&&n.addClass(t.className??``,t.styleText??``);for(let t of e.TreemapRows??[]){let e=t.item;if(!e)continue;let i=t.indent?parseInt(t.indent):0,a=ce(e),o=e.classSelector?n.getStylesForClass(e.classSelector):[],s=o.length>0?o:void 0,c={level:i,name:a,type:e.$type,value:e.value,classSelector:e.classSelector,cssCompiledStyles:s};r.push(c)}let i=Y(r),a=t((e,t)=>{for(let r of e)n.addNode(r,t),r.children&&r.children.length>0&&a(r.children,t+1)},`addNodesRecursively`);a(i,0)},`populate`),ce=t(e=>e.name?String(e.name):``,`getItemName`),X={parser:{yy:void 0},parse:t(async t=>{try{let r=await e(`treemap`,t);n.debug(`Treemap AST:`,r);let i=X.parser?.yy;if(!(i instanceof J))throw Error(`parser.parser?.yy was not a TreemapDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);se(r,i)}catch(e){throw n.error(`Error parsing treemap:`,e),e}},`parse`)},Z=10,Q=10,$=25,le={draw:t((e,i,a,o)=>{let s=o.db,u=s.getConfig(),d=u.padding??Z,f=s.getDiagramTitle(),p=s.getRoot(),{themeVariables:m}=c();if(!p)return;let _=f?30:0,v=S(i),b=u.nodeWidth?u.nodeWidth*Q:960,C=u.nodeHeight?u.nodeHeight*Q:500,w=b,T=C+_;v.attr(`viewBox`,`0 0 ${w} ${T}`),l(v,T,w,u.useMaxWidth);let E;try{let e=u.valueFormat||`,`;if(e===`$0,0`)E=t(e=>`$`+g(`,`)(e),`valueFormat`);else if(e.startsWith(`$`)&&e.includes(`,`)){let n=/\.\d+/.exec(e),r=n?n[0]:``;E=t(e=>`$`+g(`,`+r)(e),`valueFormat`)}else if(e.startsWith(`$`)){let n=e.substring(1);E=t(e=>`$`+g(n||``)(e),`valueFormat`)}else E=g(e)}catch(e){n.error(`Error creating format function:`,e),E=g(`,`)}let D=h().range([`transparent`,m.cScale0,m.cScale1,m.cScale2,m.cScale3,m.cScale4,m.cScale5,m.cScale6,m.cScale7,m.cScale8,m.cScale9,m.cScale10,m.cScale11]),O=h().range([`transparent`,m.cScalePeer0,m.cScalePeer1,m.cScalePeer2,m.cScalePeer3,m.cScalePeer4,m.cScalePeer5,m.cScalePeer6,m.cScalePeer7,m.cScalePeer8,m.cScalePeer9,m.cScalePeer10,m.cScalePeer11]),k=h().range([m.cScaleLabel0,m.cScaleLabel1,m.cScaleLabel2,m.cScaleLabel3,m.cScaleLabel4,m.cScaleLabel5,m.cScaleLabel6,m.cScaleLabel7,m.cScaleLabel8,m.cScaleLabel9,m.cScaleLabel10,m.cScaleLabel11]);f&&v.append(`text`).attr(`x`,w/2).attr(`y`,_/2).attr(`class`,`treemapTitle`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(f);let A=v.append(`g`).attr(`transform`,`translate(0, ${_})`).attr(`class`,`treemapContainer`),j=R(p).sum(e=>e.value??0).sort((e,t)=>(t.value??0)-(e.value??0)),M=oe().size([b,C]).paddingTop(e=>e.children&&e.children.length>0?$+Q:0).paddingInner(d).paddingLeft(e=>e.children&&e.children.length>0?Q:0).paddingRight(e=>e.children&&e.children.length>0?Q:0).paddingBottom(e=>e.children&&e.children.length>0?Q:0).round(!0)(j),N=M.descendants().filter(e=>e.children&&e.children.length>0),P=A.selectAll(`.treemapSection`).data(N).enter().append(`g`).attr(`class`,`treemapSection`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,$).attr(`class`,`treemapSectionHeader`).attr(`fill`,`none`).attr(`fill-opacity`,.6).attr(`stroke-width`,.6).attr(`style`,e=>e.depth===0?`display: none;`:``),P.append(`clipPath`).attr(`id`,(e,t)=>`clip-section-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-12)).attr(`height`,$),P.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,(e,t)=>`treemapSection section${t}`).attr(`fill`,e=>D(e.data.name)).attr(`fill-opacity`,.6).attr(`stroke`,e=>O(e.data.name)).attr(`stroke-width`,2).attr(`stroke-opacity`,.4).attr(`style`,e=>{if(e.depth===0)return`display: none;`;let t=y({cssCompiledStyles:e.data.cssCompiledStyles});return t.nodeStyles+`;`+t.borderStyles.join(`;`)}),P.append(`text`).attr(`class`,`treemapSectionLabel`).attr(`x`,6).attr(`y`,$/2).attr(`dominant-baseline`,`middle`).text(e=>e.depth===0?``:e.data.name).attr(`font-weight`,`bold`).attr(`clip-path`,(e,t)=>`url(#clip-section-${i}-${t})`).attr(`style`,e=>e.depth===0?`display: none;`:`dominant-baseline: middle; font-size: 12px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).each(function(e){if(e.depth===0)return;let t=r(this),n=e.data.name;t.text(n);let i=e.x1-e.x0,a;a=u.showValues!==!1&&e.value?i-10-30-10-6:i-6-6;let o=Math.max(15,a),s=t.node();if(s.getComputedTextLength()>o){let e=n;for(;e.length>0;){if(e=n.substring(0,e.length-1),e.length===0){t.text(`...`),s.getComputedTextLength()>o&&t.text(``);break}if(t.text(e+`...`),s.getComputedTextLength()<=o)break}}}),u.showValues!==!1&&P.append(`text`).attr(`class`,`treemapSectionValue`).attr(`x`,e=>e.x1-e.x0-10).attr(`y`,$/2).attr(`text-anchor`,`end`).attr(`dominant-baseline`,`middle`).text(e=>e.value?E(e.value):``).attr(`font-style`,`italic`).attr(`style`,e=>e.depth===0?`display: none;`:`text-anchor: end; dominant-baseline: middle; font-size: 10px; fill:`+k(e.data.name)+`; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`));let F=M.leaves(),I=F.length>20,L=I?16:38,z=I?14:28,B=I?4:8,V=I?4:6,H=I?2:4,U=I?8:10,W=I?1:2,G=A.selectAll(`.treemapLeafGroup`).data(F).enter().append(`g`).attr(`class`,(e,t)=>`treemapNode treemapLeafGroup leaf${t}${e.data.classSelector?` ${e.data.classSelector}`:``}x`).attr(`transform`,e=>`translate(${e.x0},${e.y0})`);G.append(`rect`).attr(`width`,e=>e.x1-e.x0).attr(`height`,e=>e.y1-e.y0).attr(`class`,`treemapLeaf`).attr(`fill`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`style`,e=>y({cssCompiledStyles:e.data.cssCompiledStyles}).nodeStyles).attr(`fill-opacity`,.3).attr(`stroke`,e=>e.parent?D(e.parent.data.name):D(e.data.name)).attr(`stroke-width`,3),G.append(`clipPath`).attr(`id`,(e,t)=>`clip-${i}-${t}`).append(`rect`).attr(`width`,e=>Math.max(0,e.x1-e.x0-4)).attr(`height`,e=>Math.max(0,e.y1-e.y0-4)),G.append(`text`).attr(`class`,`treemapLabel`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,e=>(e.y1-e.y0)/2).attr(`style`,e=>`text-anchor: middle; dominant-baseline: middle; font-size: ${L}px;fill:`+k(e.data.name)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.data.name).each(function(e){let t=r(this),n=e.x1-e.x0,i=e.y1-e.y0,a=t.node(),o=n-2*H,s=i-2*H;if(o<U||s<U){t.style(`display`,`none`);return}let c=parseInt(t.style(`font-size`),10),l=.6;for(;a.getComputedTextLength()>o&&c>B;)c--,t.style(`font-size`,`${c}px`);let u=Math.max(V,Math.min(z,Math.round(c*l))),d=c+W+u;for(;d>s&&c>B&&(c--,u=Math.max(V,Math.min(z,Math.round(c*l))),!(u<V&&c===B));)t.style(`font-size`,`${c}px`),d=c+W+u;t.style(`font-size`,`${c}px`),I?(c<B||s<B)&&t.style(`display`,`none`):(a.getComputedTextLength()>o||c<B||s<c)&&t.style(`display`,`none`)}),u.showValues!==!1&&G.append(`text`).attr(`class`,`treemapValue`).attr(`x`,e=>(e.x1-e.x0)/2).attr(`y`,function(e){return(e.y1-e.y0)/2}).attr(`style`,e=>`text-anchor: middle; dominant-baseline: hanging; font-size: ${z}px;fill:`+k(e.data.name)+`;`+y({cssCompiledStyles:e.data.cssCompiledStyles}).labelStyles.replace(`color:`,`fill:`)).attr(`clip-path`,(e,t)=>`url(#clip-${i}-${t})`).text(e=>e.value?E(e.value):``).each(function(e){let t=r(this),n=this.parentNode;if(!n){t.style(`display`,`none`);return}let i=r(n).select(`.treemapLabel`);if(i.empty()||i.style(`display`)===`none`){t.style(`display`,`none`);return}let a=parseFloat(i.style(`font-size`)),o=Math.max(V,Math.min(z,Math.round(a*.6)));t.style(`font-size`,`${o}px`);let s=(e.y1-e.y0)/2+a/2+W;t.attr(`y`,s);let c=e.x1-e.x0,l=e.y1-e.y0-4,u=c-2*H;t.node().getComputedTextLength()>u||s+o>l||o<V?t.style(`display`,`none`):t.style(`display`,null)});let K=u.diagramPadding??8;x(v,K,`flowchart`,u?.useMaxWidth||!1)},`draw`),getClasses:t(function(e,t){return t.db.getClasses()},`getClasses`)},ue={sectionStrokeColor:`black`,sectionStrokeWidth:`1`,sectionFillColor:`#efefef`,leafStrokeColor:`black`,leafStrokeWidth:`1`,leafFillColor:`#efefef`,labelFontSize:`12px`,valueFontSize:`10px`,titleFontSize:`14px`},de={parser:X,get db(){return new J},renderer:le,styles:t(({treemap:e}={})=>{let t=i(),n=c(),r=_(t,n.themeVariables),a=_(ue,e),o=a.titleColor??r.titleColor,s=a.labelColor??r.textColor,l=a.valueColor??r.textColor;return`
2
2
  .treemapNode.section {
3
3
  stroke: ${a.sectionStrokeColor};
4
4
  stroke-width: ${a.sectionStrokeWidth};
@@ -1,3 +1,3 @@
1
- import{T as e}from"./chunk-FOHPRMQF-DHwB1DNv.js";import{n as t}from"./mermaid-parser.core-Cin6zZf8.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r,p as i}from"./src-Bej7g-L4.js";import{H as a,U as o,X as s,a as c,b as l,f as u,q as d,v as f,w as p,x as m,y as h,z as g}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{_,i as ee,t as te}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import{t as ne}from"./chunk-JWPE2WC7-DVXcaiue.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=n(function(e){r.debug(`options str`,e)},`setOptions`),ie=n(function(){return{}},`getOptions`),ae=n(function(){S(),c()},`clear`);function S(){C={}}n(S,`reset`);var oe=u.eventmodeling,se=n(()=>ee({...oe,...l().eventmodeling}),`getConfig`),C={};function w(){let e=ce,{ast:t}=C,n=D();if(!t)throw Error(`No data for EventModel`);return t.frames.forEach((i,a)=>{let o=P(i,t.dataEntities,n);e=J(e,{$kind:v,index:a,frame:i,textProps:o});let s;V(i)?(r.debug(`source frame`,i.sourceFrames),s=t.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:a,frame:i,sourceFrame:t})})):e=J(e,{$kind:b,index:a,frame:i})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}n(w,`getState`);function T(e){C.ast=e}n(T,`setAst`);var E={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:`bold`,boxTextPadding:10,swimlaneTextFontWeight:`bold`,labelUiAutomation:`UI/Automation`,labelUiAutomationPrefix:`UI/A: `,labelCommandReadModel:`Command/Read Model`,labelCommandReadModelPrefix:`C/RM: `,labelEvents:`Events`,labelEventsPrefix:`Stream: `};function D(){return E}n(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}n(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}n(k,`extractName`);function A(e,t){if(!(!t||t.length===0))return Object.values(e).find(e=>e.namespace===t)}n(A,`findSwimlaneByNamespace`);function j(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{let r=Number.parseInt(e);return r>t&&r<n}).map(e=>Number.parseInt(e)))+1}n(j,`findNextAvailableIndex`);function M(e,t){let n=O(e.entityIdentifier),r=A(t,n);switch(e.modelEntityType){case`ui`:case`pcr`:case`processor`:return r?{index:r.index,label:r.namespace||E.labelUiAutomation}:n?{index:j(t,0,100),label:E.labelUiAutomationPrefix+n}:{index:0,label:E.labelUiAutomation};case`rmo`:case`readmodel`:case`cmd`:case`command`:return r?{index:r.index,label:r.namespace||E.labelCommandReadModel}:n?{index:j(t,100,200),label:E.labelCommandReadModelPrefix+n}:{index:100,label:E.labelCommandReadModel};default:return r?{index:r.index,label:r.namespace||E.labelEvents}:n?{index:j(t,200,300),label:E.labelEventsPrefix+n}:{index:200,label:E.labelEvents}}}n(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=l();switch(e.modelEntityType){case`ui`:return{fill:t.emUiFill??`white`,stroke:t.emUiStroke??`#dbdada`};case`pcr`:case`processor`:return{fill:t.emProcessorFill??`#edb3f6`,stroke:t.emProcessorStroke??`#b88cbf`};case`rmo`:case`readmodel`:return{fill:t.emReadModelFill??`#d3f1a2`,stroke:t.emReadModelStroke??`#a3b732`};case`cmd`:case`command`:return{fill:t.emCommandFill??`#bcd6fe`,stroke:t.emCommandStroke??`#679ac3`};case`evt`:case`event`:return{fill:t.emEventFill??`#ffb778`,stroke:t.emEventStroke??`#c19a0f`};default:return{fill:`red`,stroke:`black`}}}n(N,`calculateEntityVisualProps`);function P(e,t,n){let i=l(),a=g(k(e.entityIdentifier)??``,i),o,s={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},c=`<b>${_(a,n.textMaxWidth,s)}</b>`;if(e.dataInlineValue&&(o=e.dataInlineValue,o=o.substring(o.indexOf(`{`)+1),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`)),e.dataReference){let r=t.find(t=>t.name===e.dataReference?.$refText);r&&(o=r.dataBlockValue,o=o.substring(o.indexOf(`{
1
+ import{T as e}from"./chunk-FOHPRMQF-DHwB1DNv.js";import{n as t}from"./mermaid-parser.core-CMSpXjeX.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r,p as i}from"./src-DwTKHdVd.js";import{H as a,U as o,X as s,a as c,b as l,f as u,q as d,v as f,w as p,x as m,y as h,z as g}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{_,i as ee,t as te}from"./chunk-ZIGJFQKS-u0lffPbH.js";import{t as ne}from"./chunk-JWPE2WC7-DVXcaiue.js";var v=`position frame`,y=`frame positioned`,b=`position relation`,x=`relation positioned`,re=n(function(e){r.debug(`options str`,e)},`setOptions`),ie=n(function(){return{}},`getOptions`),ae=n(function(){S(),c()},`clear`);function S(){C={}}n(S,`reset`);var oe=u.eventmodeling,se=n(()=>ee({...oe,...l().eventmodeling}),`getConfig`),C={};function w(){let e=ce,{ast:t}=C,n=D();if(!t)throw Error(`No data for EventModel`);return t.frames.forEach((i,a)=>{let o=P(i,t.dataEntities,n);e=J(e,{$kind:v,index:a,frame:i,textProps:o});let s;V(i)?(r.debug(`source frame`,i.sourceFrames),s=t.frames.filter(e=>i.sourceFrames.some(t=>t.$refText===e.name)),s.forEach(t=>{e=J(e,{$kind:b,index:a,frame:i,sourceFrame:t})})):e=J(e,{$kind:b,index:a,frame:i})}),e={...e,sortedSwimlanesArray:R(e.swimlanes)},e}n(w,`getState`);function T(e){C.ast=e}n(T,`setAst`);var E={swimlaneMinHeight:70,swimlanePadding:15,swimlaneGap:10,boxPadding:10,boxOverlap:90,boxDefaultY:0,boxMinWidth:80,boxMaxWidth:450,boxMinHeight:80,boxMaxHeight:750,contentStartX:250,textMaxWidth:430,boxTextFontWeight:`bold`,boxTextPadding:10,swimlaneTextFontWeight:`bold`,labelUiAutomation:`UI/Automation`,labelUiAutomationPrefix:`UI/A: `,labelCommandReadModel:`Command/Read Model`,labelCommandReadModelPrefix:`C/RM: `,labelEvents:`Events`,labelEventsPrefix:`Stream: `};function D(){return E}n(D,`getDiagramProps`);var ce={boxes:[],swimlanes:{},relations:[],maxR:0,sortedSwimlanesArray:[]};function O(e){let t=e.split(`.`);if(t.length===2)return t[0]}n(O,`extractNamespace`);function k(e){let t=e.split(`.`);return t.length===2?t[1]:e}n(k,`extractName`);function A(e,t){if(!(!t||t.length===0))return Object.values(e).find(e=>e.namespace===t)}n(A,`findSwimlaneByNamespace`);function j(e,t,n){return Math.max(t,...Object.keys(e).filter(e=>{let r=Number.parseInt(e);return r>t&&r<n}).map(e=>Number.parseInt(e)))+1}n(j,`findNextAvailableIndex`);function M(e,t){let n=O(e.entityIdentifier),r=A(t,n);switch(e.modelEntityType){case`ui`:case`pcr`:case`processor`:return r?{index:r.index,label:r.namespace||E.labelUiAutomation}:n?{index:j(t,0,100),label:E.labelUiAutomationPrefix+n}:{index:0,label:E.labelUiAutomation};case`rmo`:case`readmodel`:case`cmd`:case`command`:return r?{index:r.index,label:r.namespace||E.labelCommandReadModel}:n?{index:j(t,100,200),label:E.labelCommandReadModelPrefix+n}:{index:100,label:E.labelCommandReadModel};default:return r?{index:r.index,label:r.namespace||E.labelEvents}:n?{index:j(t,200,300),label:E.labelEventsPrefix+n}:{index:200,label:E.labelEvents}}}n(M,`calculateSwimlaneProps`);function N(e){let{themeVariables:t}=l();switch(e.modelEntityType){case`ui`:return{fill:t.emUiFill??`white`,stroke:t.emUiStroke??`#dbdada`};case`pcr`:case`processor`:return{fill:t.emProcessorFill??`#edb3f6`,stroke:t.emProcessorStroke??`#b88cbf`};case`rmo`:case`readmodel`:return{fill:t.emReadModelFill??`#d3f1a2`,stroke:t.emReadModelStroke??`#a3b732`};case`cmd`:case`command`:return{fill:t.emCommandFill??`#bcd6fe`,stroke:t.emCommandStroke??`#679ac3`};case`evt`:case`event`:return{fill:t.emEventFill??`#ffb778`,stroke:t.emEventStroke??`#c19a0f`};default:return{fill:`red`,stroke:`black`}}}n(N,`calculateEntityVisualProps`);function P(e,t,n){let i=l(),a=g(k(e.entityIdentifier)??``,i),o,s={fontSize:16,fontWeight:700,fontFamily:`"trebuchet ms", verdana, arial, sans-serif`,joinWith:`<br/>`},c=`<b>${_(a,n.textMaxWidth,s)}</b>`;if(e.dataInlineValue&&(o=e.dataInlineValue,o=o.substring(o.indexOf(`{`)+1),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`)),e.dataReference){let r=t.find(t=>t.name===e.dataReference?.$refText);r&&(o=r.dataBlockValue,o=o.substring(o.indexOf(`{
2
2
  `)+2),o=o.substring(0,o.lastIndexOf(`}`)-1),o=g(o,i),o=_(o,n.textMaxWidth,s),o=o.replaceAll(` `,`&nbsp;`),o+=`<br/>`)}let u=o!==void 0;u&&(c+=`<br/><br/><code style="text-align: left; display: block;max-width:${n.textMaxWidth}px">${o}</code>`);let d={fontSize:s.fontSize,fontWeight:s.fontWeight,fontFamily:s.fontFamily},f=te(c,d),p=u?f.width/3:f.width,m={content:c,width:p,height:f.height};return r.debug(`[${e.name}] ${e.entityIdentifier} text`,m),m}n(P,`calculateTextProps`);function F(e,t){let n=t,r=N(n.frame),i={width:n.textProps.width+2*E.boxTextPadding,height:n.textProps.height+2*E.boxTextPadding};return[{$kind:y,frame:n.frame,index:n.index,visual:r,dimension:i,textProps:n.textProps}]}n(F,`decidePositionFrame`);function I(e,t,n){return t===void 0?E.contentStartX:t.index===e.index&&e.r?e.r+E.boxPadding:n===void 0?E.contentStartX:n.r-E.boxOverlap+E.boxPadding}n(I,`calculateX`);function L(e,t){let n=[...e.map(e=>e.r),t];return Math.max(...n)}n(L,`calculateMaxRight`);function R(e){return Object.values(e).sort((e,t)=>e.index-t.index)}n(R,`sortedSwimlanesArray`);function z(e,t){let n=t,r=M(n.frame,e.swimlanes),i;i=r.index in e.swimlanes?e.swimlanes[r.index]:{index:r.index,label:r.label,r:0,y:r.index*E.swimlaneMinHeight+E.swimlaneGap,height:E.swimlaneMinHeight,maxHeight:E.swimlaneMinHeight};let a=e.boxes.length>0?e.boxes[e.boxes.length-1]:void 0,o=e.previousSwimlaneNumber===void 0?void 0:e.swimlanes[e.previousSwimlaneNumber],s={width:Math.max(E.boxMinWidth,Math.min(E.boxMaxWidth,n.dimension.width))+2*E.boxPadding,height:Math.max(E.boxMinHeight,Math.min(E.boxMaxHeight,n.dimension.height))+2*E.boxPadding},c=I(i,o,a),l=c+s.width+E.boxPadding,u=L(Object.values(e.swimlanes),l);i.r=c+s.width,i.maxHeight=Math.max(i.maxHeight,s.height),i.height=Math.max(E.swimlaneMinHeight,i.maxHeight)+2*E.swimlanePadding;let d={x:c,y:E.swimlanePadding+i.y,r:l,dimension:s,leftSibling:!1,swimlane:i,visual:n.visual,text:n.textProps.content,frame:n.frame,index:n.index},f={...e,boxes:[...e.boxes,d],swimlanes:{...e.swimlanes,[`${i.index}`]:i},previousSwimlaneNumber:r.index,previousFrame:n.frame,maxR:u},p=R(f.swimlanes);p.length>0&&(p[0].y=0);for(let e=1;e<p.length;e++){let t=p[e],n=p[e-1];t.y=n.y+n.height+E.swimlaneGap}return f}n(z,`evolveFramePositioned`);function B(e,t){return e===0&&t.sourceFrames.length===0}n(B,`isFirstFrame`);function V(e){return e.sourceFrames!==void 0&&e.sourceFrames!==null&&e.sourceFrames.length>0}n(V,`hasSourceFrame`);function H(e,t){if(t!=null)return e.find(e=>e.frame.name===t.name)}n(H,`findBoxByFrame`);function U(e,t,n){if(!(n<0))for(let r=n;r>=0;r--){let n=e[r];if(n.swimlane.index!==t)return n}}n(U,`findBoxByLineIndex`);function W(t,n){let r=n;if(e(r.frame)||B(r.index,r.frame))return[];let i=H(t.boxes,r.frame);if(i===void 0)throw Error(`Target box not found for frame ${r.frame.name}`);let a;return a=r.sourceFrame?H(t.boxes,r.sourceFrame):U(t.boxes,i.swimlane.index,r.index-1),a===void 0?[]:[{$kind:x,frame:r.frame,index:r.index,sourceBox:a,targetBox:i}]}n(W,`decidePositionRelation`);function G(e,t){let n=t,r={visual:{fill:`none`,stroke:`#000`},source:{x:n.sourceBox.x,y:n.sourceBox.y},target:{x:n.targetBox.x,y:n.targetBox.y},sourceBox:n.sourceBox,targetBox:n.targetBox};return{...e,relations:[...e.relations,r]}}n(G,`evolveRelationPositioned`);var le={[v]:F,[b]:W},ue={[y]:z,[x]:G};function K(e,t){let n=le[t.$kind];if(n==null)return[];let i=n(e,t);return r.debug(`decided events`,i),i}n(K,`decide`);function q(e,t){let n=t.reduce((e,t)=>{let n=ue[t.$kind];return n==null?e:n(e,t)},e);return r.debug(`evolve events`,{state:e,newState:n,events:t}),n}n(q,`evolve`);function J(e,t){return q(e,K(e,t))}n(J,`dispatch`);var Y={getConfig:se,setOptions:re,getOptions:ie,clear:ae,setAccTitle:o,getAccTitle:h,getAccDescription:f,setAccDescription:a,setDiagramTitle:d,getDiagramTitle:p,setAst:T,getDiagramProps:D,getState:w},de={parse:n(async e=>{let n=await t(`eventmodeling`,e);r.debug(n),Y.setAst(n),ne(n,Y)},`parse`)},fe=m()?.eventmodeling;function X(e,t){return n=>{let r=n.swimlane.y+t.swimlanePadding,i=e.append(`g`).attr(`class`,`em-box`);i.append(`rect`).attr(`x`,n.x).attr(`y`,r).attr(`rx`,`3`).attr(`width`,n.dimension.width).attr(`height`,n.dimension.height).attr(`stroke`,n.visual.stroke).attr(`fill`,n.visual.fill),i.append(`foreignObject`).attr(`x`,n.x+t.boxPadding).attr(`y`,r+10).attr(`width`,n.dimension.width-2*t.boxPadding).attr(`height`,n.dimension.height-2*t.boxPadding).append(`xhtml:div`).style(`display`,`table`).style(`height`,`100%`).style(`width`,`100%`).append(`span`).style(`display`,`table-cell`).style(`text-align`,`center`).style(`vertical-align`,`middle`).html(n.text)}}n(X,`renderD3Box`);function Z(e,t){return e>t}n(Z,`dirUpwards`);function Q(e,t,n,i){return a=>{let o=a.sourceBox.swimlane.y+t.swimlanePadding,s=a.targetBox.swimlane.y+t.swimlanePadding,c=Z(o,s),l=a.sourceBox.x+a.sourceBox.dimension.width*2/3,u=a.targetBox.x+a.targetBox.dimension.width/3,d,f;r.debug(`rendering relation up=${c} for `,{sourceBox:a.sourceBox,targetBox:a.targetBox}),c?(d=o,f=s+a.targetBox.dimension.height):(d=o+a.sourceBox.dimension.height,f=s);let p=i.emRelationStroke??a.visual.stroke;e.append(`path`).attr(`class`,`em-relation`).attr(`fill`,a.visual.fill).attr(`stroke`,p).attr(`stroke-width`,`1`).attr(`marker-end`,`url(#${n})`).attr(`d`,`M${l} ${d} L${u} ${f}`)}}n(Q,`renderD3Relation`);function $(e,t,n,r){return i=>{let a=e.append(`g`).attr(`class`,`em-swimlane`),o=r.emSwimlaneBackgroundOdd??`rgb(250,250,250)`,s=r.emSwimlaneBackgroundStroke??`rgb(240,240,240)`;a.append(`rect`).attr(`x`,0).attr(`y`,i.y).attr(`rx`,`3`).attr(`width`,t+n.swimlanePadding).attr(`height`,i.height).attr(`fill`,o).attr(`stroke`,s),a.append(`text`).attr(`font-weight`,n.swimlaneTextFontWeight).attr(`x`,30).attr(`y`,i.y+30).text(i.label)}}n($,`renderD3Swimlane`);var pe={parser:de,db:Y,renderer:{draw:n(function(e,t,n,a){if(r.debug(`in eventmodeling renderer`,e+`
3
3
  `,`id:`,t,n),!fe)throw Error(`EventModeling config not found`);let o=a.db,{themeVariables:c,eventmodeling:l}=m(),u=i(`[id="${t}"]`),d=o.getDiagramProps(),f=o.getState(),p=`em-arrowhead-${t}`,h=c.emArrowhead??`#000000`;f.sortedSwimlanesArray.forEach($(u,f.maxR,d,c)),f.boxes.forEach(X(u,d)),f.relations.forEach(Q(u,d,p,c)),u.append(`defs`).append(`marker`).attr(`id`,p).attr(`markerWidth`,`10`).attr(`markerHeight`,`7`).attr(`refX`,`10`).attr(`refY`,`3.5`).attr(`orient`,`auto`).append(`polygon`).attr(`points`,`0 0, 10 3.5, 0 7`).attr(`fill`,h),s(void 0,u,l?.padding??30,l?.useMaxWidth)},`draw`)},styles:n(e=>``,`getStyles`)};export{pe as diagram};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-Cin6zZf8.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-Bej7g-L4.js";import{H as r,U as i,a,b as o,c as s,f as c,q as l,v as u,w as d,y as f,z as p}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{i as m}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{r as g,t as _}from"./chunk-742MDFTN-B7dqi4lM.js";import{t as v}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{a as y}from"./mermaid.core-Dmtm0D6c.js";var b=/[─━│┃└┗├┣]/,x=/[└┗├┣]/,S=/[─━]/,C=/^[\s│┃]+$/,w=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,T=/^\s*%%/,E=` `;function D(e){return e.some(e=>b.test(e))}t(D,`isBoxDrawingFormat`);function O(e){for(let t of e){let e=x.exec(t);if(e?.index&&e.index>0)return e.index}return 4}t(O,`inferSegmentWidth`);function k(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=parseInt(n,10),i=t.get(r);return i?`line ${i}`:e})}t(k,`remapErrorLines`);function A(e){let t=e.split(`
1
+ import{n as e}from"./mermaid-parser.core-CMSpXjeX.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DwTKHdVd.js";import{H as r,U as i,a,b as o,c as s,f as c,q as l,v as u,w as d,y as f,z as p}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{i as m}from"./chunk-ZIGJFQKS-u0lffPbH.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{r as g,t as _}from"./chunk-742MDFTN-Q9c012fL.js";import{t as v}from"./chunk-2Q5K7J3B-C1jixKkw.js";import{a as y}from"./mermaid.core-BBeLf7h3.js";var b=/[─━│┃└┗├┣]/,x=/[└┗├┣]/,S=/[─━]/,C=/^[\s│┃]+$/,w=/^\s*(title[\t ]|accTitle[\t ]*:|accDescr[\t ]*[:{])/,T=/^\s*%%/,E=` `;function D(e){return e.some(e=>b.test(e))}t(D,`isBoxDrawingFormat`);function O(e){for(let t of e){let e=x.exec(t);if(e?.index&&e.index>0)return e.index}return 4}t(O,`inferSegmentWidth`);function k(e,t){return e.replace(/\bline\s+(\d+)\b/gi,(e,n)=>{let r=parseInt(n,10),i=t.get(r);return i?`line ${i}`:e})}t(k,`remapErrorLines`);function A(e){let t=e.split(`
2
2
  `),n=new Map,r=-1;for(let[e,n]of t.entries())if(n.trim()===`treeView-beta`){r=e;break}if(r===-1)return{text:e,lineMap:n};let i=[];for(let e=r+1;e<t.length;e++){let n=t[e];n.trim()===``||T.test(n)||w.test(n)||C.test(n)||i.push(n.replace(/\t/g,` `))}if(!D(i))return{text:e,lineMap:n};let a=O(i),o=[],s=0;for(let e=0;e<=r;e++)o.push(t[e]),s++,n.set(s,e+1);for(let e=r+1;e<t.length;e++){let r=t[e],i=r.trim(),c=e+1;if(i===``){o.push(r),s++,n.set(s,c);continue}if(T.test(r)){o.push(r),s++,n.set(s,c);continue}if(w.test(r)){o.push(r),s++,n.set(s,c);continue}if(C.test(r))continue;let l=r.replace(/\t/g,` `),u=x.exec(l);if(u?.index!==void 0){let e=u.index,t=Math.round(e/a)+1,r=e+1;for(;r<l.length&&S.test(l[r]);)r++;for(;r<l.length&&l[r]===` `;)r++;let i=l.slice(r).trimEnd();if(!i)throw Error(`Line ${c}: Empty node \u2014 expected a filename or directory name after the box-drawing prefix`);let d=E.repeat(t);o.push(d+i),s++,n.set(s,c)}else if(/^[\s─━│┃└┗├┣]+$/.test(l))continue;else if(b.test(l))o.push(r),s++,n.set(s,c);else if(/^\s+/.test(l))throw Error(`Line ${c}: Unexpected indentation without box-drawing characters. In box-drawing format, use \u251C\u2500\u2500 or \u2514\u2500\u2500 prefixes for indented nodes.`);else o.push(r),s++,n.set(s,c)}return{text:o.join(`
3
3
  `),lineMap:n}}t(A,`preprocessBoxDrawing`);var j=new v(()=>({cnt:1,stack:[{id:0,level:-1,name:`/`,nodeType:`directory`,children:[]}]})),M=t(()=>{j.reset(),a()},`clear`),N=t(()=>j.records.stack[0],`getRoot`),P=t(()=>j.records.cnt,`getCount`),F=c.treeView,I={clear:M,addNode:t((e,t,n,r,i,a)=>{for(;e<=j.records.stack[j.records.stack.length-1].level;)j.records.stack.pop();let o={id:j.records.cnt++,level:e,name:t,nodeType:n,icon:i,cssClass:r,description:a,children:[]};j.records.stack[j.records.stack.length-1].children.push(o),j.records.stack.push(o)},`addNode`),getRoot:N,getCount:P,getConfig:t(()=>m(F,o().treeView),`getConfig`),getAccTitle:f,getAccDescription:u,getDiagramTitle:d,setAccDescription:r,setAccTitle:i,setDiagramTitle:l},L=t(e=>{h(e,I);for(let t of e.nodes){let e=typeof t.indent==`number`?t.indent:0,n=t.name,r=n.endsWith(`/`);r&&(n=n.slice(0,-1));let i=r?`directory`:`file`,a=t.classAnnotation||void 0,s=t.iconAnnotation,c=s===void 0?void 0:s||`none`,l=t.descAnnotation||void 0,u=l?p(l,o()):void 0;I.addNode(e,n,i,a,c,u)}},`populate`),R={parse:t(async t=>{let{text:r,lineMap:i}=A(t);try{let t=await e(`treeView`,r);n.debug(t),L(t)}catch(e){throw i.size>0&&e instanceof Error&&(e.message=k(e.message,i)),e}},`parse`)},z={prefix:`mermaid-treeview`,height:24,width:24,icons:{folder:{body:`<path fill="currentColor" d="M10.59 4.59A2 2 0 0 0 9.17 4H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.17z"/>`},file:{body:`<path fill="currentColor" fill-rule="evenodd" d="M6 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8.83a2 2 0 0 0-.59-1.42l-4.82-4.82A2 2 0 0 0 13.17 2H6Zm7.5 1.9l4.6 4.6h-3.6a1 1 0 0 1-1-1V3.9Z" clip-rule="evenodd"/>`}}};function B(e,t){let n=t?.filenameIcons?.[e];if(n)return n;let r=e.lastIndexOf(`.`);if(r>0){let n=e.substring(r).toLowerCase(),i=t?.extensionIcons;return i?.[n]??i?.[n.slice(1)]}}t(B,`detectIcon`);function V(e,t){return e.includes(`:`)?e:e in z.icons||!t?`${z.prefix}:${e}`:`${t}:${e}`}t(V,`qualifyIcon`);function H(e,t){if(e.icon!==`none`){if(e.icon)return V(e.icon,t.defaultIconPack);if(t.showIcons){if(e.nodeType===`file`){let n=B(e.name,t);if(n===`none`)return;if(n)return V(n,t.defaultIconPack)}return`${z.prefix}:${e.nodeType===`directory`?`folder`:`file`}`}}}t(H,`getNodeIcon`),g([{name:z.prefix,icons:z}]);var U=14,W=4,G=16,K=t(async(e,n)=>{let r=[],i=t(e=>{let t=H(e,n);t&&r.push({icon:t,node:e}),e.children.forEach(i)},`collect`);i(e);let a=await Promise.all(r.map(async({icon:e,node:t})=>({id:t.id,svg:await _(e,{height:U,width:U})})));return new Map(a.map(({id:e,svg:t})=>[e,t]))},`resolveNodeIcons`),q=t((e,t,n,r,i,a)=>{let o=r.append(`g`),s=`treeView-node-label`;n.nodeType===`directory`&&(s+=` treeView-node-dir`),n.cssClass&&(s+=` ${n.cssClass}`);let c=U+W,l=H(n,i),u=l!==void 0;l&&o.append(`g`).attr(`class`,`treeView-node-icon`).attr(`transform`,`translate(${e+i.paddingX}, ${t+i.paddingY})`).html(a.get(n.id)??``);let d=o.append(`text`).text(n.name).attr(`dominant-baseline`,`middle`).attr(`class`,s),{height:f,width:p}=d.node().getBBox(),m=f+i.paddingY*2,h=e+i.paddingX+(u?c:0);d.attr(`x`,h),d.attr(`y`,t+m/2);let g=h+p;return n.BBox={x:e,y:t,width:p+i.paddingX*2+(u?c:0),height:m},n.cssClass?.split(/\s+/).includes(`highlight`)&&o.insert(`rect`,`:first-child`).attr(`x`,e).attr(`y`,t+1).attr(`width`,0).attr(`height`,m-2).attr(`rx`,3).attr(`class`,`treeView-highlight-bg`),{node:n,nodeGroup:o,labelRightEdge:g,centerY:t+m/2}},`positionLabel`),J=t((e,t,n,r,i,a)=>e.append(`line`).attr(`x1`,t).attr(`y1`,n).attr(`x2`,r).attr(`y2`,i).attr(`stroke-width`,a).attr(`class`,`treeView-node-line`),`positionLine`),Y=t((e,n,r,i)=>{let a=0,o=0,s=[],c=t((e,t,n,r)=>{let c=r*(n.rowIndent+n.paddingX),l=q(c,a,t,e,n,i);s.push(l);let{height:u,width:d}=t.BBox;J(e,c-n.rowIndent,a+u/2,c,a+u/2,n.lineThickness),o=Math.max(o,c+d),a+=u},`drawNode`),l=t((t,n=0)=>{c(e,t,r,n),t.children.forEach(e=>{l(e,n+1)});let{x:i,y:a,height:o}=t.BBox;if(t.children.length){let{y:n,height:s}=t.children[t.children.length-1].BBox;J(e,i+r.paddingX,a+o,i+r.paddingX,n+s/2+r.lineThickness/2,r.lineThickness)}},`processNode`);l(n);let u=s.filter(e=>e.node.description);if(u.length>0){let e=Math.max(...s.map(e=>e.labelRightEdge))+G;for(let t of u){let n=t.nodeGroup.append(`text`).text(t.node.description).attr(`dominant-baseline`,`middle`).attr(`class`,`treeView-node-description`).attr(`x`,e).attr(`y`,t.centerY).node().getBBox();o=Math.max(o,e+n.width+r.paddingX)}}for(let e of s)if(e.node.cssClass?.split(/\s+/).includes(`highlight`)){let t=e.nodeGroup.select(`.treeView-highlight-bg`);if(!t.empty()){let n=o-e.node.BBox.x+8;t.attr(`width`,n),o=Math.max(o,e.node.BBox.x+n+2)}}return{totalHeight:a,totalWidth:o}},`drawTree`),X={draw:t(async(e,t,r,i)=>{n.debug(`Rendering treeView diagram
4
4
  `+e);let a=i.db,o=a.getRoot(),c=a.getConfig(),l=y(t),u=l.append(`g`);u.attr(`class`,`tree-view`);let{totalHeight:d,totalWidth:f}=Y(u,o,c,await K(o,c));l.attr(`viewBox`,`-${c.lineThickness/2} 0 ${f} ${d}`),s(l,d,f,c.useMaxWidth)},`draw`)},Z={labelFontSize:`16px`,labelColor:`black`,lineColor:`black`,iconColor:`#546e7a`,descriptionColor:`#6a9955`,highlightBg:`rgba(255, 193, 7, 0.15)`,highlightStroke:`#ffc107`},Q={db:I,renderer:X,parser:R,styles:t(({treeView:e})=>{let{labelFontSize:t,labelColor:n,lineColor:r,iconColor:i,descriptionColor:a,highlightBg:o,highlightStroke:s}=m(Z,e);return`
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-Cin6zZf8.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-Bej7g-L4.js";import{H as r,U as i,a,b as o,c as s,f as c,q as l,v as u,w as d,y as f}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{i as p}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import{t as m}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as h}from"./mermaid.core-Dmtm0D6c.js";var g=c.packet,_=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=f,this.setDiagramTitle=l,this.getDiagramTitle=d,this.getAccDescription=u,this.setAccDescription=r}static{t(this,`PacketDB`)}getConfig(){let e=p({...g,...o().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){a(),this.packet=[]}},v=1e4,y=t((e,t)=>{m(e,t);let r=-1,i=[],a=1,{bitsPerRow:o}=t.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,n.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&t.getPacket().length<v;){let[e,n]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(t.pushWord(i),i=[],a++),!n)break;({start:s,end:c,bits:l,label:u}=n)}}t.pushWord(i)},`populate`),b=t((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:t(async t=>{let r=await e(`packet`,t),i=x.parser?.yy;if(!(i instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);n.debug(r),y(r,i)},`parse`)},S=t((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:c,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),p=o+c,m=p*(d.length+1)-(f?0:o),g=l*u+2,_=h(t);_.attr(`viewBox`,`0 0 ${g} ${m}`),s(_,m,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,m-p/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=t((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:t(({packet:e}={})=>{let t=p(T,e);return`
1
+ import{n as e}from"./mermaid-parser.core-CMSpXjeX.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DwTKHdVd.js";import{H as r,U as i,a,b as o,c as s,f as c,q as l,v as u,w as d,y as f}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{i as p}from"./chunk-ZIGJFQKS-u0lffPbH.js";import{t as m}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as h}from"./mermaid.core-BBeLf7h3.js";var g=c.packet,_=class{constructor(){this.packet=[],this.setAccTitle=i,this.getAccTitle=f,this.setDiagramTitle=l,this.getDiagramTitle=d,this.getAccDescription=u,this.setAccDescription=r}static{t(this,`PacketDB`)}getConfig(){let e=p({...g,...o().packet});return e.showBits&&(e.paddingY+=10),e}getPacket(){return this.packet}pushWord(e){e.length>0&&this.packet.push(e)}clear(){a(),this.packet=[]}},v=1e4,y=t((e,t)=>{m(e,t);let r=-1,i=[],a=1,{bitsPerRow:o}=t.getConfig();for(let{start:s,end:c,bits:l,label:u}of e.blocks){if(s!==void 0&&c!==void 0&&c<s)throw Error(`Packet block ${s} - ${c} is invalid. End must be greater than start.`);if(s??=r+1,s!==r+1)throw Error(`Packet block ${s} - ${c??s} is not contiguous. It should start from ${r+1}.`);if(l===0)throw Error(`Packet block ${s} is invalid. Cannot have a zero bit field.`);for(c??=s+(l??1)-1,l??=c-s+1,r=c,n.debug(`Packet block ${s} - ${r} with label ${u}`);i.length<=o+1&&t.getPacket().length<v;){let[e,n]=b({start:s,end:c,bits:l,label:u},a,o);if(i.push(e),e.end+1===a*o&&(t.pushWord(i),i=[],a++),!n)break;({start:s,end:c,bits:l,label:u}=n)}}t.pushWord(i)},`populate`),b=t((e,t,n)=>{if(e.start===void 0)throw Error(`start should have been set during first phase`);if(e.end===void 0)throw Error(`end should have been set during first phase`);if(e.start>e.end)throw Error(`Block start ${e.start} is greater than block end ${e.end}.`);if(e.end+1<=t*n)return[e,void 0];let r=t*n-1,i=t*n;return[{start:e.start,end:r,label:e.label,bits:r-e.start},{start:i,end:e.end,label:e.label,bits:e.end-i}]},`getNextFittingBlock`),x={parser:{yy:void 0},parse:t(async t=>{let r=await e(`packet`,t),i=x.parser?.yy;if(!(i instanceof _))throw Error(`parser.parser?.yy was not a PacketDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);n.debug(r),y(r,i)},`parse`)},S=t((e,t,n,r)=>{let i=r.db,a=i.getConfig(),{rowHeight:o,paddingY:c,bitWidth:l,bitsPerRow:u}=a,d=i.getPacket(),f=i.getDiagramTitle(),p=o+c,m=p*(d.length+1)-(f?0:o),g=l*u+2,_=h(t);_.attr(`viewBox`,`0 0 ${g} ${m}`),s(_,m,g,a.useMaxWidth);for(let[e,t]of d.entries())C(_,t,e,a);_.append(`text`).text(f).attr(`x`,g/2).attr(`y`,m-p/2).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).attr(`class`,`packetTitle`)},`draw`),C=t((e,t,n,{rowHeight:r,paddingX:i,paddingY:a,bitWidth:o,bitsPerRow:s,showBits:c})=>{let l=e.append(`g`),u=n*(r+a)+a;for(let e of t){let t=e.start%s*o+1,n=(e.end-e.start+1)*o-i;if(l.append(`rect`).attr(`x`,t).attr(`y`,u).attr(`width`,n).attr(`height`,r).attr(`class`,`packetBlock`),l.append(`text`).attr(`x`,t+n/2).attr(`y`,u+r/2).attr(`class`,`packetLabel`).attr(`dominant-baseline`,`middle`).attr(`text-anchor`,`middle`).text(e.label),!c)continue;let a=e.end===e.start,d=u-2;l.append(`text`).attr(`x`,t+(a?n/2:0)).attr(`y`,d).attr(`class`,`packetByte start`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,a?`middle`:`start`).text(e.start),a||l.append(`text`).attr(`x`,t+n).attr(`y`,d).attr(`class`,`packetByte end`).attr(`dominant-baseline`,`auto`).attr(`text-anchor`,`end`).text(e.end)}},`drawWord`),w={draw:S},T={byteFontSize:`10px`,startByteColor:`black`,endByteColor:`black`,labelColor:`black`,labelFontSize:`12px`,titleColor:`black`,titleFontSize:`14px`,blockStrokeColor:`black`,blockStrokeWidth:`1`,blockFillColor:`#efefef`},E={parser:x,get db(){return new _},renderer:w,styles:t(({packet:e}={})=>{let t=p(T,e);return`
2
2
  .packetByte {
3
3
  font-size: ${t.byteFontSize};
4
4
  }
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-Cin6zZf8.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-Bej7g-L4.js";import{D as r,H as i,U as a,a as o,b as s,c,f as l,q as u,v as d,w as f,y as p}from"./chunk-O7XYJQB3-BYf0cBjb.js";import{i as m}from"./chunk-ZIGJFQKS-Bo83y6q0.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as g}from"./mermaid.core-Dmtm0D6c.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=l.radar,S=t(()=>m({...x,...s().radar}),`getConfig`),C=t(()=>b.axes,`getAxes`),w=t(()=>b.curves,`getCurves`),T=t(()=>b.options,`getOptions`),E=t(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=t(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=t(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=C();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),k={getAxes:C,getCurves:w,getOptions:T,setAxes:E,setCurves:D,setOptions:t(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});b.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule},b.options.ticks>v&&(n.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:t(()=>{o(),b=structuredClone(y)},`clear`),setAccTitle:a,getAccTitle:p,setDiagramTitle:u,getDiagramTitle:f,getAccDescription:d,setAccDescription:i},A=t(e=>{h(e,k);let{axes:t,curves:n,options:r}=e;k.setAxes(t),k.setCurves(n),k.setOptions(r)},`populate`),j={parse:t(async t=>{let r=await e(`radar`,t);n.debug(r),A(r)},`parse`)},M=t((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=N(g(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;P(u,a,p,s.ticks,s.graticule),F(u,a,p,c),I(u,a,o,f,d,s.graticule,c),z(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),N=t((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return c(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`).attr(`overflow`,`visible`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),P=t((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),F=t((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2,c=Math.cos(s),l=Math.sin(s);e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*c).attr(`y2`,n*r.axisScaleFactor*l).attr(`class`,`radarAxisLine`);let u=c>.01?`start`:c<-.01?`end`:`middle`,d=l>.01?`hanging`:l<-.01?`auto`:`central`;e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*c+4*c).attr(`y`,n*r.axisLabelFactor*l+4*l).attr(`text-anchor`,u).attr(`dominant-baseline`,d).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function I(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=L(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,R(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}t(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}t(L,`relativeRadius`);function R(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}t(R,`closedRoundCurve`);function z(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}t(z,`drawLegend`);var B={draw:M},V=t((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
1
+ import{n as e}from"./mermaid-parser.core-CMSpXjeX.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-DwTKHdVd.js";import{D as r,H as i,U as a,a as o,b as s,c,f as l,q as u,v as d,w as f,y as p}from"./chunk-O7XYJQB3-ADuOEPCt.js";import{i as m}from"./chunk-ZIGJFQKS-u0lffPbH.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{a as g}from"./mermaid.core-BBeLf7h3.js";var _={showLegend:!0,ticks:5,max:null,min:0,graticule:`circle`},v=32,y={axes:[],curves:[],options:_},b=structuredClone(y),x=l.radar,S=t(()=>m({...x,...s().radar}),`getConfig`),C=t(()=>b.axes,`getAxes`),w=t(()=>b.curves,`getCurves`),T=t(()=>b.options,`getOptions`),E=t(e=>{b.axes=e.map(e=>({name:e.name,label:e.label??e.name}))},`setAxes`),D=t(e=>{b.curves=e.map(e=>({name:e.name,label:e.label??e.name,entries:O(e.entries)}))},`setCurves`),O=t(e=>{if(e[0].axis==null)return e.map(e=>e.value);let t=C();if(t.length===0)throw Error(`Axes must be populated before curves for reference entries`);return t.map(t=>{let n=e.find(e=>e.axis?.$refText===t.name);if(n===void 0)throw Error(`Missing entry for axis `+t.label);return n.value})},`computeCurveEntries`),k={getAxes:C,getCurves:w,getOptions:T,setAxes:E,setCurves:D,setOptions:t(e=>{let t=e.reduce((e,t)=>(e[t.name]=t,e),{});b.options={showLegend:t.showLegend?.value??_.showLegend,ticks:t.ticks?.value??_.ticks,max:t.max?.value??_.max,min:t.min?.value??_.min,graticule:t.graticule?.value??_.graticule},b.options.ticks>v&&(n.warn(`Radar diagram ticks (${b.options.ticks}) exceeds maximum allowed (${v}). Using ${v} instead.`),b.options.ticks=v)},`setOptions`),getConfig:S,clear:t(()=>{o(),b=structuredClone(y)},`clear`),setAccTitle:a,getAccTitle:p,setDiagramTitle:u,getDiagramTitle:f,getAccDescription:d,setAccDescription:i},A=t(e=>{h(e,k);let{axes:t,curves:n,options:r}=e;k.setAxes(t),k.setCurves(n),k.setOptions(r)},`populate`),j={parse:t(async t=>{let r=await e(`radar`,t);n.debug(r),A(r)},`parse`)},M=t((e,t,n,r)=>{let i=r.db,a=i.getAxes(),o=i.getCurves(),s=i.getOptions(),c=i.getConfig(),l=i.getDiagramTitle(),u=N(g(t),c),d=s.max??Math.max(...o.map(e=>Math.max(...e.entries))),f=s.min,p=Math.min(c.width,c.height)/2;P(u,a,p,s.ticks,s.graticule),F(u,a,p,c),I(u,a,o,f,d,s.graticule,c),z(u,o,s.showLegend,c),u.append(`text`).attr(`class`,`radarTitle`).text(l).attr(`x`,0).attr(`y`,-c.height/2-c.marginTop)},`draw`),N=t((e,t)=>{let n=t.width+t.marginLeft+t.marginRight,r=t.height+t.marginTop+t.marginBottom,i={x:t.marginLeft+t.width/2,y:t.marginTop+t.height/2};return c(e,r,n,t.useMaxWidth??!0),e.attr(`viewBox`,`0 0 ${n} ${r}`).attr(`overflow`,`visible`),e.append(`g`).attr(`transform`,`translate(${i.x}, ${i.y})`)},`drawFrame`),P=t((e,t,n,r,i)=>{if(i===`circle`)for(let t=0;t<r;t++){let i=n*(t+1)/r;e.append(`circle`).attr(`r`,i).attr(`class`,`radarGraticule`)}else if(i===`polygon`){let i=t.length;for(let a=0;a<r;a++){let o=n*(a+1)/r,s=t.map((e,t)=>{let n=2*t*Math.PI/i-Math.PI/2;return`${o*Math.cos(n)},${o*Math.sin(n)}`}).join(` `);e.append(`polygon`).attr(`points`,s).attr(`class`,`radarGraticule`)}}},`drawGraticule`),F=t((e,t,n,r)=>{let i=t.length;for(let a=0;a<i;a++){let o=t[a].label,s=2*a*Math.PI/i-Math.PI/2,c=Math.cos(s),l=Math.sin(s);e.append(`line`).attr(`x1`,0).attr(`y1`,0).attr(`x2`,n*r.axisScaleFactor*c).attr(`y2`,n*r.axisScaleFactor*l).attr(`class`,`radarAxisLine`);let u=c>.01?`start`:c<-.01?`end`:`middle`,d=l>.01?`hanging`:l<-.01?`auto`:`central`;e.append(`text`).text(o).attr(`x`,n*r.axisLabelFactor*c+4*c).attr(`y`,n*r.axisLabelFactor*l+4*l).attr(`text-anchor`,u).attr(`dominant-baseline`,d).attr(`class`,`radarAxisLabel`)}},`drawAxes`);function I(e,t,n,r,i,a,o){let s=t.length,c=Math.min(o.width,o.height)/2;n.forEach((t,n)=>{if(t.entries.length!==s)return;let l=t.entries.map((e,t)=>{let n=2*Math.PI*t/s-Math.PI/2,a=L(e,r,i,c);return{x:a*Math.cos(n),y:a*Math.sin(n)}});a===`circle`?e.append(`path`).attr(`d`,R(l,o.curveTension)).attr(`class`,`radarCurve-${n}`):a===`polygon`&&e.append(`polygon`).attr(`points`,l.map(e=>`${e.x},${e.y}`).join(` `)).attr(`class`,`radarCurve-${n}`)})}t(I,`drawCurves`);function L(e,t,n,r){return r*(Math.min(Math.max(e,t),n)-t)/(n-t)}t(L,`relativeRadius`);function R(e,t){let n=e.length,r=`M${e[0].x},${e[0].y}`;for(let i=0;i<n;i++){let a=e[(i-1+n)%n],o=e[i],s=e[(i+1)%n],c=e[(i+2)%n],l={x:o.x+(s.x-a.x)*t,y:o.y+(s.y-a.y)*t},u={x:s.x-(c.x-o.x)*t,y:s.y-(c.y-o.y)*t};r+=` C${l.x},${l.y} ${u.x},${u.y} ${s.x},${s.y}`}return`${r} Z`}t(R,`closedRoundCurve`);function z(e,t,n,r){if(!n)return;let i=(r.width/2+r.marginRight)*3/4,a=-(r.height/2+r.marginTop)*3/4;t.forEach((t,n)=>{let r=e.append(`g`).attr(`transform`,`translate(${i}, ${a+n*20})`);r.append(`rect`).attr(`width`,12).attr(`height`,12).attr(`class`,`radarLegendBox-${n}`),r.append(`text`).attr(`x`,16).attr(`y`,0).attr(`class`,`radarLegendText`).text(t.label)})}t(z,`drawLegend`);var B={draw:M},V=t((e,t)=>{let n=``;for(let r=0;r<e.THEME_COLOR_LIMIT;r++){let i=e[`cScale${r}`];n+=`
2
2
  .radarCurve-${r} {
3
3
  color: ${i};
4
4
  fill: ${i};
@@ -1 +1 @@
1
- import{n as e}from"./index-BPzC2fNH.js";var t=Math.abs,n=Math.atan2,r=Math.cos,i=Math.max,a=Math.min,o=Math.sin,s=Math.sqrt,c=1e-12,l=Math.PI,u=l/2,d=2*l;function f(e){return e>1?0:e<-1?l:Math.acos(e)}function p(e){return e>=1?u:e<=-1?-u:Math.asin(e)}var m=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BLANK_URL=e.relativeFirstCharacters=e.whitespaceEscapeCharsRegex=e.urlSchemeRegex=e.ctrlCharactersRegex=e.htmlCtrlEntityRegex=e.htmlEntitiesRegex=e.invalidProtocolRegex=void 0,e.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,e.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,e.htmlCtrlEntityRegex=/&(newline|tab);/gi,e.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,e.urlSchemeRegex=/^.+(:|&colon;)/gim,e.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,e.relativeFirstCharacters=[`.`,`/`],e.BLANK_URL=`about:blank`})),h=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=o;var t=m();function n(e){return t.relativeFirstCharacters.indexOf(e[0])>-1}function r(e){return e.replace(t.ctrlCharactersRegex,``).replace(t.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)})}function i(e){return URL.canParse(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e){if(!e)return t.BLANK_URL;var o,s=a(e.trim());do s=r(s).replace(t.htmlCtrlEntityRegex,``).replace(t.ctrlCharactersRegex,``).replace(t.whitespaceEscapeCharsRegex,``).trim(),s=a(s),o=s.match(t.ctrlCharactersRegex)||s.match(t.htmlEntitiesRegex)||s.match(t.htmlCtrlEntityRegex)||s.match(t.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=s;if(!c)return t.BLANK_URL;if(n(c))return c;var l=c.trimStart(),u=l.match(t.urlSchemeRegex);if(!u)return c;var d=u[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(d))return t.BLANK_URL;var f=l.replace(/\\/g,`/`);if(d===`mailto:`||d.includes(`://`))return f;if(d===`http:`||d===`https:`){if(!i(f))return t.BLANK_URL;var p=new URL(f);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return f}}));export{n as a,u as c,l as d,o as f,p as i,i as l,d as m,t as n,r as o,s as p,f as r,c as s,h as t,a as u};
1
+ import{n as e}from"./index-Bv8TXM17.js";var t=Math.abs,n=Math.atan2,r=Math.cos,i=Math.max,a=Math.min,o=Math.sin,s=Math.sqrt,c=1e-12,l=Math.PI,u=l/2,d=2*l;function f(e){return e>1?0:e<-1?l:Math.acos(e)}function p(e){return e>=1?u:e<=-1?-u:Math.asin(e)}var m=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.BLANK_URL=e.relativeFirstCharacters=e.whitespaceEscapeCharsRegex=e.urlSchemeRegex=e.ctrlCharactersRegex=e.htmlCtrlEntityRegex=e.htmlEntitiesRegex=e.invalidProtocolRegex=void 0,e.invalidProtocolRegex=/^([^\w]*)(javascript|data|vbscript)/im,e.htmlEntitiesRegex=/&#(\w+)(^\w|;)?/g,e.htmlCtrlEntityRegex=/&(newline|tab);/gi,e.ctrlCharactersRegex=/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim,e.urlSchemeRegex=/^.+(:|&colon;)/gim,e.whitespaceEscapeCharsRegex=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g,e.relativeFirstCharacters=[`.`,`/`],e.BLANK_URL=`about:blank`})),h=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.sanitizeUrl=o;var t=m();function n(e){return t.relativeFirstCharacters.indexOf(e[0])>-1}function r(e){return e.replace(t.ctrlCharactersRegex,``).replace(t.htmlEntitiesRegex,function(e,t){return String.fromCharCode(t)})}function i(e){return URL.canParse(e)}function a(e){try{return decodeURIComponent(e)}catch{return e}}function o(e){if(!e)return t.BLANK_URL;var o,s=a(e.trim());do s=r(s).replace(t.htmlCtrlEntityRegex,``).replace(t.ctrlCharactersRegex,``).replace(t.whitespaceEscapeCharsRegex,``).trim(),s=a(s),o=s.match(t.ctrlCharactersRegex)||s.match(t.htmlEntitiesRegex)||s.match(t.htmlCtrlEntityRegex)||s.match(t.whitespaceEscapeCharsRegex);while(o&&o.length>0);var c=s;if(!c)return t.BLANK_URL;if(n(c))return c;var l=c.trimStart(),u=l.match(t.urlSchemeRegex);if(!u)return c;var d=u[0].toLowerCase().trim();if(t.invalidProtocolRegex.test(d))return t.BLANK_URL;var f=l.replace(/\\/g,`/`);if(d===`mailto:`||d.includes(`://`))return f;if(d===`http:`||d===`https:`){if(!i(f))return t.BLANK_URL;var p=new URL(f);return p.protocol=p.protocol.toLowerCase(),p.hostname=p.hostname.toLowerCase(),p.toString()}return f}}));export{n as a,u as c,l as d,o as f,p as i,i as l,d as m,t as n,r as o,s as p,f as r,c as s,h as t,a as u};
@@ -1 +1 @@
1
- import{f as e,t}from"./mermaid-parser.core-Cin6zZf8.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-Bej7g-L4.js";import"./chunk-O7XYJQB3-BYf0cBjb.js";import{n as i,r as a,t as o}from"./chunk-GTNCS2PH-tIfcSoKX.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-Dmtm0D6c.js";var c=e().RailroadEbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformChoice`),u=n(e=>{let t=e.elements.map(p);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformSequence`),d=n(e=>{switch(e.$type){case`EbnfTerminal`:return{type:`terminal`,value:e.value};case`EbnfNonTerminal`:return{type:`nonterminal`,name:e.name};case`EbnfSpecial`:return{type:`special`,text:e.text};case`EbnfGroup`:return l(e.element);case`EbnfOptional`:return{type:`optional`,element:l(e.element)};case`EbnfRepetition`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${e.$type}`)}},`transformPrimary`),f=n((e,t)=>{switch(t.$type){case`EbnfOptionalPostfix`:return{type:`optional`,element:e};case`EbnfZeroOrMorePostfix`:return{type:`repetition`,element:e,min:0,max:1/0};case`EbnfOneOrMorePostfix`:return{type:`repetition`,element:e,min:1,max:1/0};case`EbnfExceptionPostfix`:return{type:`sequence`,elements:[e,{type:`terminal`,value:`-`},d(t.except)]};default:throw Error(`Unsupported EBNF postfix node: ${t.$type}`)}},`transformPostfix`),p=n(e=>e.postfixes.reduce((e,t)=>f(e,t),d(e.base)),`transformTerm`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[EBNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[EBNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[EBNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};
1
+ import{f as e,t}from"./mermaid-parser.core-CMSpXjeX.js";import{n}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as r}from"./src-DwTKHdVd.js";import"./chunk-O7XYJQB3-ADuOEPCt.js";import{n as i,r as a,t as o}from"./chunk-GTNCS2PH-BrjKdoU7.js";import{t as s}from"./chunk-JWPE2WC7-DVXcaiue.js";import"./mermaid.core-BBeLf7h3.js";var c=e().RailroadEbnf.parser.LangiumParser,l=n(e=>{let t=e.alternatives.map(u);return t.length===1?t[0]:{type:`choice`,alternatives:t}},`transformChoice`),u=n(e=>{let t=e.elements.map(p);return t.length===1?t[0]:{type:`sequence`,elements:t}},`transformSequence`),d=n(e=>{switch(e.$type){case`EbnfTerminal`:return{type:`terminal`,value:e.value};case`EbnfNonTerminal`:return{type:`nonterminal`,name:e.name};case`EbnfSpecial`:return{type:`special`,text:e.text};case`EbnfGroup`:return l(e.element);case`EbnfOptional`:return{type:`optional`,element:l(e.element)};case`EbnfRepetition`:return{type:`repetition`,element:l(e.element),min:0,max:1/0};default:throw Error(`Unsupported EBNF primary node: ${e.$type}`)}},`transformPrimary`),f=n((e,t)=>{switch(t.$type){case`EbnfOptionalPostfix`:return{type:`optional`,element:e};case`EbnfZeroOrMorePostfix`:return{type:`repetition`,element:e,min:0,max:1/0};case`EbnfOneOrMorePostfix`:return{type:`repetition`,element:e,min:1,max:1/0};case`EbnfExceptionPostfix`:return{type:`sequence`,elements:[e,{type:`terminal`,value:`-`},d(t.except)]};default:throw Error(`Unsupported EBNF postfix node: ${t.$type}`)}},`transformPostfix`),p=n(e=>e.postfixes.reduce((e,t)=>f(e,t),d(e.base)),`transformTerm`),m=n(e=>({name:e.name,definition:l(e.definition)}),`transformRule`),h=n(e=>{s(e,o),e.title&&o.setTitle(e.title),e.rules.map(e=>o.addRule(m(e)))},`populateDb`),g={parser:{parse:n(e=>{o.clear(),r.debug(`[EBNF Parser] Starting Langium parse`);let n=c.parse(e);if(n.lexerErrors.length>0||n.parserErrors.length>0)throw new t(n);let i=n.value;r.debug(`[EBNF Parser] Parsed rules:`,i.rules.length),h(i),r.debug(`[EBNF Parser] Parse complete`)},`parse`),parser:{yy:o}},db:o,renderer:a,styles:i};export{g as diagram};