@markee/diagrams 0.1.0 → 0.2.0

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 (108) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +39 -0
  3. package/_assets/_head/assets/{_api-BbxJBqLU.js → _api-m6XYvA-0.js} +1 -1
  4. package/_assets/_head/assets/_architecture-PBZL5I3N-xnhut1Pa.js +1 -0
  5. package/_assets/_head/assets/{_architectureDiagram-2XIMDMQ5-B6NKHtRx.js → _architectureDiagram-2XIMDMQ5-CmZPhLbM.js} +1 -1
  6. package/_assets/_head/assets/{_blockDiagram-WCTKOSBZ-Dqnb6UUE.js → _blockDiagram-WCTKOSBZ-C3Asu6Kw.js} +1 -1
  7. package/_assets/_head/assets/{_c4Diagram-IC4MRINW-BZcM5On4.js → _c4Diagram-IC4MRINW-BK3_s_bR.js} +1 -1
  8. package/_assets/_head/assets/_channel-DT33mbtw.js +1 -0
  9. package/_assets/_head/assets/{_chunk-4BX2VUAB-zqTDmcBB.js → _chunk-4BX2VUAB-u7GuGTlH.js} +1 -1
  10. package/_assets/_head/assets/_chunk-55IACEB6-BhegayeB.js +1 -0
  11. package/_assets/_head/assets/{_chunk-7E7YKBS2-BfdwzEwB.js → _chunk-7E7YKBS2-DRw7IFmq.js} +1 -1
  12. package/_assets/_head/assets/{_chunk-7R4GIKGN-CixjX2hF.js → _chunk-7R4GIKGN-CEEB8leR.js} +1 -1
  13. package/_assets/_head/assets/{_chunk-C72U2L5F-Ju1rEIdN.js → _chunk-C72U2L5F-q7txozuq.js} +1 -1
  14. package/_assets/_head/assets/{_chunk-EGIJ26TM-CCUYcH6V.js → _chunk-EGIJ26TM-yYSCEksb.js} +1 -1
  15. package/_assets/_head/assets/{_chunk-FMBD7UC4-D6coRtDw.js → _chunk-FMBD7UC4-Dm6s76j7.js} +1 -1
  16. package/_assets/_head/assets/{_chunk-GEFDOKGD-hedaaI_B.js → _chunk-GEFDOKGD-DinyCumL.js} +1 -1
  17. package/_assets/_head/assets/_chunk-GLR3WWYH-BnCkIl1j.js +2 -0
  18. package/_assets/_head/assets/_chunk-HHEYEP7N-2k_uWfJ-.js +1 -0
  19. package/_assets/_head/assets/{_chunk-JSJVCQXG-CJ2rQuP0.js → _chunk-JSJVCQXG-BwRzsZaf.js} +1 -1
  20. package/_assets/_head/assets/{_chunk-KX2RTZJC-C6_Rew8h.js → _chunk-KX2RTZJC-CU2wfNBA.js} +1 -1
  21. package/_assets/_head/assets/{_chunk-KYZI473N-HFloJmj0.js → _chunk-KYZI473N-DFGZfQqH.js} +1 -1
  22. package/_assets/_head/assets/{_chunk-L3YUKLVL-BZnSrFqZ.js → _chunk-L3YUKLVL-8ZFAhWTa.js} +1 -1
  23. package/_assets/_head/assets/{_chunk-MX3YWQON-DTYOrezi.js → _chunk-MX3YWQON-OBQAAB3N.js} +1 -1
  24. package/_assets/_head/assets/{_chunk-NQ4KR5QH-BUplpEk2.js → _chunk-NQ4KR5QH-DJwRvUSa.js} +1 -1
  25. package/_assets/_head/assets/{_chunk-O4XLMI2P-Dmj7UqP5.js → _chunk-O4XLMI2P-C5stF2lf.js} +1 -1
  26. package/_assets/_head/assets/{_chunk-OZEHJAEY-BSk-0ei6.js → _chunk-OZEHJAEY-C-6Mr0rV.js} +1 -1
  27. package/_assets/_head/assets/{_chunk-PQ6SQG4A-d07SUR0W.js → _chunk-PQ6SQG4A-Ce4yqK2U.js} +1 -1
  28. package/_assets/_head/assets/{_chunk-PU5JKC2W-B7Fh0LIt.js → _chunk-PU5JKC2W-DjhZtVq8.js} +1 -1
  29. package/_assets/_head/assets/_chunk-QZHKN3VN-Bhpn6rDK.js +1 -0
  30. package/_assets/_head/assets/{_chunk-R5LLSJPH-CoKBj2D6.js → _chunk-R5LLSJPH-DzG3FAck.js} +1 -1
  31. package/_assets/_head/assets/{_chunk-WL4C6EOR-bOFxg0ID.js → _chunk-WL4C6EOR-DjvVjER2.js} +1 -1
  32. package/_assets/_head/assets/{_chunk-XIRO2GV7-COC85g2g.js → _chunk-XIRO2GV7-DYEpFn3-.js} +1 -1
  33. package/_assets/_head/assets/{_chunk-XPW4576I-CW6DI-1k.js → _chunk-XPW4576I-CRDcKYn5.js} +1 -1
  34. package/_assets/_head/assets/{_chunk-XZSTWKYB-DNV9pfMo.js → _chunk-XZSTWKYB-Dnmcdxn2.js} +1 -1
  35. package/_assets/_head/assets/{_chunk-YBOYWFTD-nZYHIeRV.js → _chunk-YBOYWFTD-C0sy-tkc.js} +1 -1
  36. package/_assets/_head/assets/_classDiagram-VBA2DB6C-DDvYM7vU.js +1 -0
  37. package/_assets/_head/assets/_classDiagram-v2-RAHNMMFH-BPF9HrXj.js +1 -0
  38. package/_assets/_head/assets/{_cose-bilkent-S5V4N54A-DzNIP-ES.js → _cose-bilkent-S5V4N54A-pwuuIbv2.js} +1 -1
  39. package/_assets/_head/assets/{_d3-graphviz-D-OeP-Hi.js → _d3-graphviz-DcMtfIhp.js} +1 -1
  40. package/_assets/_head/assets/{_dagre-D4f1FF8i.js → _dagre-CA4z7MrA.js} +1 -1
  41. package/_assets/_head/assets/{_dagre-KLK3FWXG-BkNMp9M0.js → _dagre-KLK3FWXG-CoqulaDf.js} +1 -1
  42. package/_assets/_head/assets/{_diagram-E7M64L7V-D6PZVOLB.js → _diagram-E7M64L7V-B-3RYN0e.js} +1 -1
  43. package/_assets/_head/assets/{_diagram-IFDJBPK2-QApacJ5c.js → _diagram-IFDJBPK2-BeCxbGXv.js} +1 -1
  44. package/_assets/_head/assets/{_diagram-P4PSJMXO-CNMUKotv.js → _diagram-P4PSJMXO-CvQRbCi5.js} +1 -1
  45. package/_assets/_head/assets/{_dist-Dk49gvBM.js → _dist-BO11r0fr.js} +1 -1
  46. package/_assets/_head/assets/{_erDiagram-INFDFZHY-Bpnx05jC.js → _erDiagram-INFDFZHY-Zh2XbqbT.js} +1 -1
  47. package/_assets/_head/assets/{_flowDiagram-PKNHOUZH-BdAdScRO.js → _flowDiagram-PKNHOUZH-DrDi74q1.js} +1 -1
  48. package/_assets/_head/assets/{_ganttDiagram-A5KZAMGK-DzEPJRcF.js → _ganttDiagram-A5KZAMGK-DZA6377B.js} +1 -1
  49. package/_assets/_head/assets/_gitGraph-HDMCJU4V-Ec_hDt6_.js +1 -0
  50. package/_assets/_head/assets/{_gitGraphDiagram-K3NZZRJ6-BMvgx1jL.js → _gitGraphDiagram-K3NZZRJ6-Br5Sirqq.js} +1 -1
  51. package/_assets/_head/assets/_info-3K5VOQVL-CENtZRFH.js +1 -0
  52. package/_assets/_head/assets/_infoDiagram-LFFYTUFH-C2swHr78.js +2 -0
  53. package/_assets/_head/assets/{_ishikawaDiagram-PHBUUO56-ye8wu7pU.js → _ishikawaDiagram-PHBUUO56-ETOK-LOw.js} +1 -1
  54. package/_assets/_head/assets/{_journeyDiagram-4ABVD52K-D5OtlO2S.js → _journeyDiagram-4ABVD52K-3Odci6Ma.js} +1 -1
  55. package/_assets/_head/assets/{_kanban-definition-K7BYSVSG-DtUEcx7s.js → _kanban-definition-K7BYSVSG-C-x5I47z.js} +1 -1
  56. package/_assets/_head/assets/{_line-Bn73e1DS.js → _line-BMsgmPE5.js} +1 -1
  57. package/_assets/_head/assets/{_linear-DLy__jWx.js → _linear-D1vf9RD0.js} +1 -1
  58. package/_assets/_head/assets/{_mermaid-parser.core-_H6Clr87.js → _mermaid-parser.core-DZbZ9Nt1.js} +2 -2
  59. package/_assets/_head/assets/{_mermaid.core-CN_dW3wB.js → _mermaid.core-B6JDNx3m.js} +3 -3
  60. package/_assets/_head/assets/{_mindmap-definition-YRQLILUH-Bj6WNjT2.js → _mindmap-definition-YRQLILUH-CY8Mkbyf.js} +1 -1
  61. package/_assets/_head/assets/_packet-RMMSAZCW-HsVTCE5M.js +1 -0
  62. package/_assets/_head/assets/_pie-UPGHQEXC-ClCegNAN.js +1 -0
  63. package/_assets/_head/assets/{_pieDiagram-SKSYHLDU-B7n7B95W.js → _pieDiagram-SKSYHLDU-CYJI9Scd.js} +1 -1
  64. package/_assets/_head/assets/{_quadrantDiagram-337W2JSQ-C_OD8wEG.js → _quadrantDiagram-337W2JSQ-BGW8PhOJ.js} +1 -1
  65. package/_assets/_head/assets/_radar-KQ55EAFF-ugGxOkwG.js +1 -0
  66. package/_assets/_head/assets/{_requirementDiagram-Z7DCOOCP-C8HzXf-7.js → _requirementDiagram-Z7DCOOCP-BbV78NhX.js} +1 -1
  67. package/_assets/_head/assets/{_sankeyDiagram-WA2Y5GQK-Ctpgy26F.js → _sankeyDiagram-WA2Y5GQK-ByyrJf1U.js} +1 -1
  68. package/_assets/_head/assets/{_sequenceDiagram-2WXFIKYE-BrWWYecj.js → _sequenceDiagram-2WXFIKYE-CUwOGuhQ.js} +1 -1
  69. package/_assets/_head/assets/{_src-COkbRRdF.js → _src-Bi8wryCV.js} +1 -1
  70. package/_assets/_head/assets/{_src-EY2faTVt.js → _src-D_0f55rL.js} +1 -1
  71. package/_assets/_head/assets/{_src-DGaYM9rN.js → _src-SNUCTSwP.js} +1 -1
  72. package/_assets/_head/assets/{_stateDiagram-RAJIS63D-DHDYVq4g.js → _stateDiagram-RAJIS63D-Dxv3HBdz.js} +1 -1
  73. package/_assets/_head/assets/_stateDiagram-v2-FVOUBMTO-brNar02G.js +1 -0
  74. package/_assets/_head/assets/{_timeline-definition-YZTLITO2-Baqh8Zr3.js → _timeline-definition-YZTLITO2-COgTpWBR.js} +1 -1
  75. package/_assets/_head/assets/_treemap-KZPCXAKY-CXR7h5hT.js +1 -0
  76. package/_assets/_head/assets/{_value-BHMRaafc.js → _value-NcYKFvkN.js} +1 -1
  77. package/_assets/_head/assets/{_vennDiagram-LZ73GAT5-DT2MLRvW.js → _vennDiagram-LZ73GAT5-CFvtr6ch.js} +1 -1
  78. package/_assets/_head/assets/{_xychartDiagram-JWTSCODW-B4O2dc9N.js → _xychartDiagram-JWTSCODW-DtHVB6Xo.js} +1 -1
  79. package/_assets/_head/assets/{main-GvJmWKsI.js → main-Bgz5KRxr.js} +3 -3
  80. package/_assets/_head/assets/main-DTgc_eyw.css +1 -0
  81. package/package.json +13 -4
  82. package/src/element.test.ts +319 -0
  83. package/src/helpers.test.ts +51 -0
  84. package/src/index.css +4 -4
  85. package/src/main.test.ts +29 -0
  86. package/src/remark.test.ts +196 -0
  87. package/src/remark.ts +4 -5
  88. package/src/runtime.test.ts +78 -0
  89. package/tsconfig.json +3 -10
  90. package/vitest.config.ts +4 -0
  91. package/vitest.setup.ts +6 -0
  92. package/_assets/_head/assets/_architecture-PBZL5I3N-BPxfLoEK.js +0 -1
  93. package/_assets/_head/assets/_channel-CfD3KTsT.js +0 -1
  94. package/_assets/_head/assets/_chunk-55IACEB6-x7bSLf7B.js +0 -1
  95. package/_assets/_head/assets/_chunk-GLR3WWYH-CADHj0Af.js +0 -2
  96. package/_assets/_head/assets/_chunk-HHEYEP7N-yDnzeL6u.js +0 -1
  97. package/_assets/_head/assets/_chunk-QZHKN3VN-OrU_cr5J.js +0 -1
  98. package/_assets/_head/assets/_classDiagram-VBA2DB6C-C9oLPafD.js +0 -1
  99. package/_assets/_head/assets/_classDiagram-v2-RAHNMMFH-Dgh8T6Nh.js +0 -1
  100. package/_assets/_head/assets/_gitGraph-HDMCJU4V-bzhcDRU8.js +0 -1
  101. package/_assets/_head/assets/_info-3K5VOQVL-DO8S_2BK.js +0 -1
  102. package/_assets/_head/assets/_infoDiagram-LFFYTUFH-V27XJ0e-.js +0 -2
  103. package/_assets/_head/assets/_packet-RMMSAZCW-BQu67kO8.js +0 -1
  104. package/_assets/_head/assets/_pie-UPGHQEXC-Bq1eDF5N.js +0 -1
  105. package/_assets/_head/assets/_radar-KQ55EAFF-BVJblTdI.js +0 -1
  106. package/_assets/_head/assets/_stateDiagram-v2-FVOUBMTO-C3RKEofw.js +0 -1
  107. package/_assets/_head/assets/_treemap-KZPCXAKY-DnDBABML.js +0 -1
  108. package/_assets/_head/assets/main-CSvXzq1b.css +0 -1
@@ -1,4 +1,4 @@
1
- import{a as e,i as t,n}from"./_src-COkbRRdF.js";import{a as r,b as i,i as a,n as o,o as s,r as c,t as l,y as u}from"./_src-EY2faTVt.js";import{t as d}from"./_value-BHMRaafc.js";import{t as f}from"./_defaultLocale-CTKA0Sod.js";import{n as p}from"./_path-e1ZUMOO_.js";function m(e){var t={},n=e.node().nodeName;t.tag=n,n==`#text`?t.text=e.text():n==`#comment`&&(t.comment=e.text()),t.attributes={};var r=e.node().attributes;if(r)for(var i=0;i<r.length;i++){var a=r[i],o=a.name,s=a.value;t.attributes[o]=s}var c=e.node().transform;if(c&&c.baseVal.numberOfItems!=0){var l=c.baseVal.consolidate().matrix;t.translation={x:l.e,y:l.f},t.scale=l.a}if(n==`ellipse`&&(t.center={x:t.attributes.cx,y:t.attributes.cy}),n==`polygon`){var u=e.attr(`points`).split(` `),d=u.map(function(e){return e.split(`,`)[0]}),f=u.map(function(e){return e.split(`,`)[1]}),p=Math.min.apply(null,d),m=Math.max.apply(null,d),h=Math.min.apply(null,f),g=Math.max.apply(null,f),_={x:p,y:h,width:m-p,height:g-h};t.bbox=_,t.center={x:(p+m)/2,y:(h+g)/2}}if(n==`path`){var u=e.attr(`d`).split(/[A-Z ]/);u.shift();var d=u.map(function(e){return+e.split(`,`)[0]}),f=u.map(function(e){return+e.split(`,`)[1]}),p=Math.min.apply(null,d),m=Math.max.apply(null,d),h=Math.min.apply(null,f),g=Math.max.apply(null,f),_={x:p,y:h,width:m-p,height:g-h};t.bbox=_,t.center={x:(p+m)/2,y:(h+g)/2},t.totalLength=e.node().getTotalLength()}return n==`text`&&(t.center={x:e.attr(`x`),y:e.attr(`y`)}),n==`#text`?t.text=e.text():n==`#comment`&&(t.comment=e.text()),t}function h(e){var r=m(e);return r.children=[],n(e.node().childNodes).each(function(){var e=h(t(this));e.parent=r,r.children.push(e)}),r}function g(e){return e.tag==`#text`?document.createTextNode(``):e.tag==`#comment`?document.createComment(e.comment):document.createElementNS(`http://www.w3.org/2000/svg`,e.tag)}function _(e){var n=g(e),r=t(n),i=e.attributes;for(var a of Object.keys(i)){var o=i[a];r.attr(a,o)}return n}function v(e,n){var r=t(e.node().parentNode),i=_(n),a=r.insert(function(){return i},function(){return e.node()});return e.remove(),a}function y(e,t){e.datum(t),e.data([t],function(e){return e.key})}function b(e,r){y(e,r),n(e.node().childNodes).each(function(e,n){b(t(this),r.children[n])})}function x(e,t){var n=e.selectAll(function(){return e.node().childNodes});n=n.data(function(e){return e.children},function(e){return e.tag+`-`+t});var r=n.enter().append(function(e){return g(e)}),i=n.exit();i=i.remove(),n=r.merge(n);var a={};n.each(function(e){var t=e.tag;a[t]??(a[t]=0);var n=a[t]++;S.call(this,e,n)})}function S(e,n=0){var r=t(this);e.tag;var i=e.attributes,a=r.node().attributes;if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.name;if(c.split(`:`)[0]!=`xmlns`&&s.namespaceURI){var l=s.namespaceURI.split(`/`);c=l[l.length-1]+`:`+c}c in i||(i[c]=null)}for(var u of Object.keys(i))r.attr(u,i[u]);e.text&&r.text(e.text),x(r,n)}function C(e){return this._options.zoom=e,this._options.zoom&&!this._zoomBehavior?w.call(this):!this._options.zoom&&this._zoomBehavior&&(this._zoomSelection.on(`.zoom`,null),this._zoomBehavior=null),this}function w(){var e=this;function n(n){t(i.node().querySelector(`g`)).attr(`transform`,n.transform),e._dispatch.call(`zoom`,e)}var r=this._selection,i=t(r.node().querySelector(`svg`));if(i.size()==0)return this;this._zoomSelection=i;var a=l().scaleExtent(this._options.zoomScaleExtent).translateExtent(this._options.zoomTranslateExtent).interpolate(d).on(`zoom`,n);this._zoomBehavior=a;var o=t(i.node().querySelector(`g`));return i.call(a),this._active||E.call(this,o),this._originalTransform=c(i.node()),this}function T(e){var t=this._translation,n=this._scale,r=e.datum().translation,i=e.datum().scale,a=c(this._zoomSelection.node());return t&&(a=a.scale(1/n),a=a.translate(-t.x,-t.y)),a=a.translate(r.x,r.y),a=a.scale(i),a}function E(e){this._zoomBehavior.transform(this._zoomSelection,T.call(this,e)),this._translation=e.datum().translation,this._scale=e.datum().scale,this._originalTransform=o.translate(e.datum().translation.x,e.datum().translation.y).scale(e.datum().scale)}function D(e){var t=this._zoomSelection;return e&&(t=t.transition(e)),t.call(this._zoomBehavior.transform,this._originalTransform),this}function O(e){return this._options.zoomScaleExtent=e,this}function k(e){return this._options.zoomTranslateExtent=e,this}function A(){return this._zoomBehavior||null}function j(){return this._zoomSelection||null}function M(e,t){return function(){let n=e.map(function(e){return d([e[0][0],e[0][1]],[e[1][0],e[1][1]])});return function(e){return e<1?`M`+n.map(function(t){return t(e)}).join(`L`):t}}}function ee(e,t,n,r){let i=e,a=i.cloneNode(),o=i.getTotalLength(),s=(a.setAttribute(`d`,t),a).getTotalLength(),c=[0],l=0,u=r?n:n/Math.max(o,s);for(;(l+=u)<1;)c.push(l);return c.push(1),c.map(function(e){let t=i.getPointAtLength(e*o),n=a.getPointAtLength(e*s);return[[t.x,t.y],[n.x,n.y]]})}function te(){return this._data||null}function N(e){return e.attributes.class==`edge`||e.tag==`a`&&e.parent.tag==`g`&&e.parent.parent.attributes.class==`edge`}function P(e){return e.parent&&N(e.parent)}function F(e){return e.parent.attributes.class==`edge`?e.parent:e.parent.parent.parent}function I(e){return F(e).children.find(function(e){return e.tag==`title`})}function ne(e){return this._busy?(this._queue.push(this.render.bind(this,e)),this):(this._dispatch.call(`renderStart`,this),this._transitionFactory?u(function(){this._transition=r(this._transitionFactory()),L.call(this,e)}.bind(this),0):L.call(this,e),this)}function L(e){var n=this._transition,r=this._options.fade&&n!=null,i=this._options.tweenPaths,a=this._options.tweenShapes,o=this._options.convertEqualSidedPolygons,l=this._options.growEnteringEdges&&n!=null,u=this._attributer,d=this;function f(e){var i=e.selectAll(function(){return e.node().childNodes});i=i.data(function(e){return e.children},function(e){return e.key});var a=i.enter().append(function(e){var t=g(e);return e.tag==`#text`&&r&&(t.nodeValue=e.text),t});(r||l&&N(e.datum()))&&a.filter(function(e){return e.tag[0]==`#`?null:this}).each(function(e){var n=t(this);for(var r of Object.keys(e.attributes)){var i=e.attributes[r];n.attr(r,i)}}).filter(function(e){return e.tag==`svg`||e.tag==`g`?null:this}).style(`opacity`,0);var o=i.exit();u&&o.each(u),n&&(o=o.transition(n),r&&o.filter(function(e){return e.tag[0]==`#`?null:this}).style(`opacity`,0)),o=o.remove(),i=a.merge(i).order(),i.each(p)}function p(e){var p=t(this);if(e.tag==`svg`){var h=d._options;if(h.width!=null||h.height!=null){var g=h.width,_=h.height;g==null?g=e.attributes.width.replace(`pt`,``)*4/3:(p.attr(`width`,g),e.attributes.width=g),_==null?_=e.attributes.height.replace(`pt`,``)*4/3:(p.attr(`height`,_),e.attributes.height=_),h.fit||(p.attr(`viewBox`,`0 0 ${g*3/4/h.scale} ${_*3/4/h.scale}`),e.attributes.viewBox=`0 0 ${g*3/4/h.scale} ${_*3/4/h.scale}`)}h.scale!=1&&(h.fit||h.width==null&&h.height==null)&&(g=e.attributes.viewBox.split(` `)[2],_=e.attributes.viewBox.split(` `)[3],p.attr(`viewBox`,`0 0 ${g/h.scale} ${_/h.scale}`),e.attributes.viewBox=`0 0 ${g/h.scale} ${_/h.scale}`)}u&&p.each(u);var y=e.tag,b=e.attributes,x=p.node().attributes;if(x)for(var S=0;S<x.length;S++){var C=x[S],w=C.name;if(w.split(`:`)[0]!=`xmlns`&&C.namespaceURI){var D=C.namespaceURI.split(`/`);w=D[D.length-1]+`:`+w}w in b||(b[w]=null)}var O=!1,k=!1;if(a&&n){if((this.nodeName==`polygon`||this.nodeName==`ellipse`)&&e.alternativeOld&&(k=!0),(y==`polygon`||y==`ellipse`)&&e.alternativeNew&&(O=!0),this.nodeName==`polygon`&&y==`polygon`&&e.alternativeOld){var A=m(p).attributes.points;if(!o){var j=A.split(` `).length,ee=e.attributes.points;ee.split(` `).length==j&&(O=!1,k=!1)}}if(k){var te=e.alternativeOld,N=v(p,te);N.data([e],function(){return e.key}),p=N}if(O){var F=e.alternativeNew;y=`path`,b=F.attributes}}var I=p;if(n&&(I=I.transition(n),r&&I.filter(function(e){return e.tag[0]==`#`?null:this}).style(`opacity`,1),I.filter(function(e){return e.tag[0]==`#`?null:this}).on(`end`,function(e){t(this).attr(`style`,e&&e.attributes&&e.attributes.style||null)})),l&&y==`path`&&e.offset){var ne=e.totalLength;p.attr(`stroke-dasharray`,ne+` `+ne).attr(`stroke-dashoffset`,ne).attr(`transform`,`translate(`+e.offset.x+`,`+e.offset.y+`)`),b[`stroke-dashoffset`]=0,b.transform=`translate(0,0)`,I.attr(`stroke-dashoffset`,b[`stroke-dashoffset`]).attr(`transform`,b.transform).on(`start`,function(){t(this).style(`opacity`,null)}).on(`end`,function(){t(this).attr(`stroke-dashoffset`,null).attr(`stroke-dasharray`,null).attr(`transform`,null)})}if(l&&y==`polygon`&&P(e)&&e.offset&&e.parent.children[3].tag==`path`){var L=t(p.node().parentNode.querySelector(`path`)),R=L.node().getPointAtLength(0),z=L.node().getPointAtLength(e.totalLength),B=L.node().getPointAtLength(e.totalLength-1),V=Math.atan2(z.y-B.y,z.x-B.x)*180/Math.PI,H=R.x-z.x+e.offset.x,U=R.y-z.y+e.offset.y;p.attr(`transform`,`translate(`+H+`,`+U+`)`),I.attrTween(`transform`,function(){return function(t){var n=L.node().getPointAtLength(e.totalLength*t),r=L.node().getPointAtLength(e.totalLength*t+1),i=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI-V;return H=n.x-z.x+e.offset.x*(1-t),U=n.y-z.y+e.offset.y*(1-t),`translate(`+H+`,`+U+`) rotate(`+i+` `+z.x+` `+z.y+`)`}}).on(`start`,function(){t(this).style(`opacity`,null)}).on(`end`,function(){t(this).attr(`transform`,null)})}var re=i&&n&&y==`path`&&p.attr(`d`)!=null;for(var W of Object.keys(b)){var G=b[W];if(re&&W==`d`){var ee=(e.alternativeOld||e).points;ee&&I.attrTween(`d`,M(ee,G))}else{if(W==`transform`&&e.translation)if(n){var ie=I.on(`end`);I.on(`start`,function(){d._zoomBehavior&&I.tween(`attr.transform`,function(){var e=this;return function(t){e.setAttribute(`transform`,s(c(d._zoomSelection.node()).toString(),T.call(d,p).toString())(t))}})}).on(`end`,function(){ie.call(this),d._zoomBehavior&&E.call(d,p)})}else d._zoomBehavior&&(E.call(d,p),G=T.call(d,p).toString());I.attr(W,G)}}O&&I.on(`end`,function(e,n,r){N=t(this),v(N,e).data([e],function(){return e.key})}),e.text&&I.text(e.text),f(p)}var h=this._selection;if(n!=null){var _=this._jobs;if(d._active)return _.push(null),this;h.transition(n).transition().duration(0).on(`end`,function(){d._active=!1,_.length!=0&&(_.shift(),d.render())}),this._active=!0}n!=null&&h.transition(n).on(`start`,function(){d._dispatch.call(`transitionStart`,d)}).on(`end`,function(){d._dispatch.call(`transitionEnd`,d)}).transition().duration(0).on(`start`,function(){d._dispatch.call(`restoreEnd`,d),d._dispatch.call(`end`,d),e&&e.call(d)});var y=this._data,b=h.selectAll(`svg`).data([y],function(e){return e.key});return b=b.enter().append(`svg`).merge(b),p.call(b.node(),y),this._options.zoom&&!this._zoomBehavior&&w.call(this),d._dispatch.call(`renderEnd`,d),n??(this._dispatch.call(`end`,this),e&&e.call(this)),this}function R(){return this._graphvizVersion}var z=ArrayBuffer,B=Uint8Array,V=Uint16Array,H=Int16Array,U=Int32Array,re=function(e,t,n){if(B.prototype.slice)return B.prototype.slice.call(e,t,n);(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new B(n-t);return r.set(e.subarray(t,n)),r},W=function(e,t,n,r){if(B.prototype.fill)return B.prototype.fill.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;++n)e[n]=t;return e},G=function(e,t,n,r){if(B.prototype.copyWithin)return B.prototype.copyWithin.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;)e[t++]=e[n++]},ie=[`invalid zstd data`,`window size too large (>2046MB)`,`invalid block type`,`FSE accuracy too high`,`match distance too far back`,`unexpected EOF`],K=function(e,t,n){var r=Error(t||ie[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,K),!n)throw r;return r},ae=function(e,t,n){for(var r=0,i=0;r<n;++r)i|=e[t++]<<(r<<3);return i},q=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},oe=function(e,t){var n=e[0]|e[1]<<8|e[2]<<16;if(n==3126568&&e[3]==253){var r=e[4],i=r>>5&1,a=r>>2&1,o=r&3,s=r>>6;r&8&&K(0);var c=6-i,l=o==3?4:o,u=ae(e,c,l);c+=l;var d=s?1<<s:i,f=ae(e,c,d)+(s==1&&256),p=f;if(!i){var m=1<<10+(e[5]>>3);p=m+(m>>3)*(e[5]&7)}p>2145386496&&K(1);var h=new B((t==1?f||p:t?0:p)+12);return h[0]=1,h[4]=4,h[8]=8,{b:c+d,y:0,l:0,d:u,w:t&&t!=1?t:h.subarray(12),e:p,o:new U(h.buffer,0,3),u:f,c:a,m:Math.min(131072,p)}}else if((n>>4|e[3]<<20)==25481893)return q(e,4)+8;K(0)},se=function(e){for(var t=0;1<<t<=e;++t);return t-1},ce=function(e,t,n){var r=(t<<3)+4,i=(e[t]&15)+5;i>n&&K(3);for(var a=1<<i,o=a,s=-1,c=-1,l=-1,u=a,d=new z(512+(a<<2)),f=new H(d,0,256),p=new V(d,0,256),m=new V(d,512,a),h=512+(a<<1),g=new B(d,h,a),_=new B(d,h+a);s<255&&o>0;){var v=se(o+1),y=r>>3,b=(1<<v+1)-1,x=(e[y]|e[y+1]<<8|e[y+2]<<16)>>(r&7)&b,S=(1<<v)-1,C=b-o-1,w=x&S;if(w<C?(r+=v,x=w):(r+=v+1,x>S&&(x-=C)),f[++s]=--x,x==-1?(o+=x,g[--u]=s):o-=x,!x)do{var T=r>>3;c=(e[T]|e[T+1]<<8)>>(r&7)&3,r+=2,s+=c}while(c==3)}(s>255||o)&&K(0);for(var E=0,D=(a>>1)+(a>>3)+3,O=a-1,k=0;k<=s;++k){var A=f[k];if(A<1){p[k]=-A;continue}for(l=0;l<A;++l){g[E]=k;do E=E+D&O;while(E>=u)}}for(E&&K(0),l=0;l<a;++l){var j=p[g[l]]++;m[l]=(j<<(_[l]=i-se(j)))-a}return[r+7>>3,{b:i,s:g,n:_,t:m}]},J=function(e,t){var n=0,r=-1,i=new B(292),a=e[t],o=i.subarray(0,256),s=i.subarray(256,268),c=new V(i.buffer,268);if(a<128){var l=ce(e,t+1,6),u=l[0],d=l[1];t+=a;var f=u<<3,p=e[t];p||K(0);for(var m=0,h=0,g=d.b,_=g,v=(++t<<3)-8+se(p);v-=g,!(v<f);){var y=v>>3;if(m+=(e[y]|e[y+1]<<8)>>(v&7)&(1<<g)-1,o[++r]=d.s[m],v-=_,v<f)break;y=v>>3,h+=(e[y]|e[y+1]<<8)>>(v&7)&(1<<_)-1,o[++r]=d.s[h],g=d.n[m],m=d.t[m],_=d.n[h],h=d.t[h]}++r>255&&K(0)}else{for(r=a-127;n<r;n+=2){var b=e[++t];o[n]=b>>4,o[n+1]=b&15}++t}var x=0;for(n=0;n<r;++n){var S=o[n];S>11&&K(0),x+=S&&1<<S-1}var C=se(x)+1,w=1<<C,T=w-x;for(T&T-1&&K(0),o[r++]=se(T)+1,n=0;n<r;++n){var S=o[n];++s[o[n]=S&&C+1-S]}var E=new B(w<<1),D=E.subarray(0,w),O=E.subarray(w);for(c[C]=0,n=C;n>0;--n){var k=c[n];W(O,n,k,c[n-1]=k+s[n]*(1<<C-n))}for(c[0]!=w&&K(0),n=0;n<r;++n){var A=o[n];if(A){var j=c[A];W(D,n,j,c[A]=j+(1<<C-A))}}return[t,{n:O,b:C,s:D}]},le=ce(new B([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],ue=ce(new B([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],de=ce(new B([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],fe=function(e,t){for(var n=e.length,r=new U(n),i=0;i<n;++i)r[i]=t,t+=1<<e[i];return r},pe=new B(new U([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),me=fe(pe,0),he=new B(new U([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),ge=fe(he,3),_e=function(e,t,n){var r=e.length,i=t.length,a=e[r-1],o=(1<<n.b)-1,s=-n.b;a||K(0);for(var c=0,l=n.b,u=(r<<3)-8+se(a)-l,d=-1;u>s&&d<i;){var f=u>>3,p=(e[f]|e[f+1]<<8|e[f+2]<<16)>>(u&7);c=(c<<l|p)&o,t[++d]=n.s[c],u-=l=n.n[c]}(u!=s||d+1!=i)&&K(0)},ve=function(e,t,n){var r=6,i=t.length+3>>2,a=i<<1,o=i+a;_e(e.subarray(r,r+=e[0]|e[1]<<8),t.subarray(0,i),n),_e(e.subarray(r,r+=e[2]|e[3]<<8),t.subarray(i,a),n),_e(e.subarray(r,r+=e[4]|e[5]<<8),t.subarray(a,o),n),_e(e.subarray(r),t.subarray(o),n)},ye=function(e,t,n){var r,i=t.b,a=e[i],o=a>>1&3;t.l=a&1;var s=a>>3|e[i+1]<<5|e[i+2]<<13,c=(i+=3)+s;if(o==1)return i>=e.length?void 0:(t.b=i+1,n?(W(n,e[i],t.y,t.y+=s),n):W(new B(s),e[i]));if(!(c>e.length)){if(o==0)return t.b=c,n?(n.set(e.subarray(i,c),t.y),t.y+=s,n):re(e,i,c);if(o==2){var l=e[i],u=l&3,d=l>>2&3,f=l>>4,p=0,m=0;u<2?d&1?f|=e[++i]<<4|(d&2&&e[++i]<<12):f=l>>3:(m=d,d<2?(f|=(e[++i]&63)<<4,p=e[i]>>6|e[++i]<<2):d==2?(f|=e[++i]<<4|(e[++i]&3)<<12,p=e[i]>>2|e[++i]<<6):(f|=e[++i]<<4|(e[++i]&63)<<12,p=e[i]>>6|e[++i]<<2|e[++i]<<10)),++i;var h=n?n.subarray(t.y,t.y+t.m):new B(t.m),g=h.length-f;if(u==0)h.set(e.subarray(i,i+=f),g);else if(u==1)W(h,e[i++],g);else{var _=t.h;if(u==2){var v=J(e,i);p+=i-(i=v[0]),t.h=_=v[1]}else _||K(0);(m?ve:_e)(e.subarray(i,i+=p),h.subarray(g),_)}var y=e[i++];if(y){y==255?y=(e[i++]|e[i++]<<8)+32512:y>127&&(y=y-128<<8|e[i++]);var b=e[i++];b&3&&K(0);for(var x=[ue,de,le],S=2;S>-1;--S){var C=b>>(S<<1)+2&3;if(C==1){var w=new B([0,0,e[i++]]);x[S]={s:w.subarray(2,3),n:w.subarray(0,1),t:new V(w.buffer,0,1),b:0}}else C==2?(r=ce(e,i,9-(S&1)),i=r[0],x[S]=r[1]):C==3&&(t.t||K(0),x[S]=t.t[S])}var T=t.t=x,E=T[0],D=T[1],O=T[2],k=e[c-1];k||K(0);var A=(c<<3)-8+se(k)-O.b,j=A>>3,M=0,ee=(e[j]|e[j+1]<<8)>>(A&7)&(1<<O.b)-1;j=(A-=D.b)>>3;var te=(e[j]|e[j+1]<<8)>>(A&7)&(1<<D.b)-1;j=(A-=E.b)>>3;var N=(e[j]|e[j+1]<<8)>>(A&7)&(1<<E.b)-1;for(++y;--y;){var P=O.s[ee],F=O.n[ee],I=E.s[N],ne=E.n[N],L=D.s[te],R=D.n[te];j=(A-=L)>>3;var z=1<<L,H=z+((e[j]|e[j+1]<<8|e[j+2]<<16|e[j+3]<<24)>>>(A&7)&z-1);j=(A-=he[I])>>3;var U=ge[I]+((e[j]|e[j+1]<<8|e[j+2]<<16)>>(A&7)&(1<<he[I])-1);j=(A-=pe[P])>>3;var G=me[P]+((e[j]|e[j+1]<<8|e[j+2]<<16)>>(A&7)&(1<<pe[P])-1);if(j=(A-=F)>>3,ee=O.t[ee]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<F)-1),j=(A-=ne)>>3,N=E.t[N]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<ne)-1),j=(A-=R)>>3,te=D.t[te]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<R)-1),H>3)t.o[2]=t.o[1],t.o[1]=t.o[0],t.o[0]=H-=3;else{var ie=H-(G!=0);ie?(H=ie==3?t.o[0]-1:t.o[ie],ie>1&&(t.o[2]=t.o[1]),t.o[1]=t.o[0],t.o[0]=H):H=t.o[0]}for(var S=0;S<G;++S)h[M+S]=h[g+S];M+=G,g+=G;var ae=M-H;if(ae<0){var q=-ae,oe=t.e+ae;q>U&&(q=U);for(var S=0;S<q;++S)h[M+S]=t.w[oe+S];M+=q,U-=q,ae=0}for(var S=0;S<U;++S)h[M+S]=h[ae+S];M+=U}if(M!=g)for(;g<h.length;)h[M++]=h[g++];else M=h.length;n?t.y+=M:h=re(h,0,M)}else if(n){if(t.y+=f,g)for(var S=0;S<f;++S)h[S]=h[g+S]}else g&&(h=re(h,g));return t.b=c,h}K(2)}},be=function(e,t){if(e.length==1)return e[0];for(var n=new B(t),r=0,i=0;r<e.length;++r){var a=e[r];n.set(a,i),i+=a.length}return n};function xe(e,t){for(var n=[],r=+!t,i=0,a=0;e.length;){var o=oe(e,r||t);if(typeof o==`object`){for(r?(t=null,o.w.length==o.u&&(n.push(t=o.w),a+=o.u)):(n.push(t),o.e=0);!o.l;){var s=ye(e,o,t);s||K(5),t?o.e=o.y:(n.push(s),a+=s.length,G(o.w,0,s.length),o.w.set(s,o.w.length-s.length))}i=o.b+o.c*4}else i=o;e=e.subarray(i)}return be(n,a)}async function Y(e={}){var t,n=e,r=!1,i=`./this.program`,a=(e,t)=>{throw t},o,s,c=console.log.bind(console),l=console.error.bind(console),u,d=!1,f,p=e=>e.startsWith(`file://`),m,h,g,_,v,y,b,x,S,C,w=!1;function T(){var e=wr.buffer;g=new Int8Array(e),v=new Int16Array(e),n.HEAPU8=_=new Uint8Array(e),y=new Uint16Array(e),b=new Int32Array(e),x=new Uint32Array(e),S=new Float32Array(e),C=new Float64Array(e)}function E(){w=!0,!n.noFSInit&&!Y.initialized&&Y.init(),q.init(),kr.S(),Y.ignorePermissions=!1}function D(e){e=`Aborted(`+e+`)`,l(e),d=!0,e+=`. Build with -sASSERTIONS for more info.`,w&&hr();var t=new WebAssembly.RuntimeError(e);throw h?.(t),t}var O;let k=()=>``;function A(e){if(e==O&&u)return new Uint8Array(u);if(s)return s(e);throw`both async and sync fetching of the wasm failed`}async function j(e){if(!u)try{var t=await o(e);return new Uint8Array(t)}catch{}return A(e)}async function M(e,t){try{var n=await j(e);return await WebAssembly.instantiate(n,t)}catch(e){l(`failed to asynchronously prepare wasm: ${e}`),D(e)}}async function ee(e,t,n){if(!e&&!p(t))try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){l(`wasm streaming compile failed: ${e}`),l(`falling back to ArrayBuffer instantiation`)}return M(t,n)}function te(){return{a:Dr}}async function N(){function e(e,t){return kr=e.exports,Er(kr),T(),kr}function t(t){return e(t.instance)}var n=te();return O??=k(),t(await ee(u,O,n))}var P,F;class I{name=`ExitStatus`;constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var ne=globalThis.TextDecoder&&new TextDecoder,L=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},R=(e,t=0,n,r)=>{var i=L(e,t,n,r);if(i-t>16&&e.buffer&&ne)return ne.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},z=(e,t,n)=>e?R(_,e,t,n):``,B=(e,t,n,r)=>D(`Assertion failed: ${z(e)}, at: `+[t?z(t):`unknown filename`,n,r?z(r):`unknown function`]),V={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=V.isAbs(e),n=e.slice(-1)===`/`;return e=V.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=V.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,-1),n+r)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>V.normalize(e.join(`/`)),join2:(e,t)=>V.normalize(e+`/`+t)},H=()=>e=>crypto.getRandomValues(e),U=e=>{(U=H())(e)},re={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:Y.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=V.isAbs(i)}return t=V.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=re.resolve(e).slice(1),t=re.resolve(t).slice(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},W=[],G=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},ie=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63,o++}}return t[n]=0,n-i},K=(e,t,n)=>{var r=n>0?n:G(e)+1,i=Array(r),a=ie(e,i,0,i.length);return t&&(i.length=a),i},ae=()=>{if(!W.length){var e=null;if(!e)return null;W=K(e,!0)}return W.shift()},q={ttys:[],init(){},shutdown(){},register(e,t){q.ttys[e]={input:[],output:[],ops:t},Y.registerDevice(e,q.stream_ops)},stream_ops:{open(e){var t=q.ttys[e.node.rdev];if(!t)throw new Y.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new Y.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new Y.ErrnoError(29)}if(s===void 0&&a===0)throw new Y.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new Y.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new Y.ErrnoError(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return ae()},put_char(e,t){t===null||t===10?(c(R(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(c(R(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(l(R(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(l(R(e.output)),e.output=[])}}},oe=(e,t)=>_.fill(0,e,e+t),se=(e,t)=>Math.ceil(e/t)*t,ce=e=>{e=se(e,65536);var t=pr(65536,e);return t&&oe(t,e),t},J={ops_table:null,mount(e){return J.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(Y.isBlkdev(n)||Y.isFIFO(n))throw new Y.ErrnoError(63);J.ops_table||={dir:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,lookup:J.node_ops.lookup,mknod:J.node_ops.mknod,rename:J.node_ops.rename,unlink:J.node_ops.unlink,rmdir:J.node_ops.rmdir,readdir:J.node_ops.readdir,symlink:J.node_ops.symlink},stream:{llseek:J.stream_ops.llseek}},file:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:{llseek:J.stream_ops.llseek,read:J.stream_ops.read,write:J.stream_ops.write,mmap:J.stream_ops.mmap,msync:J.stream_ops.msync}},link:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,readlink:J.node_ops.readlink},stream:{}},chrdev:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:Y.chrdev_stream_ops}};var i=Y.createNode(e,t,n,r);return Y.isDir(i.mode)?(i.node_ops=J.ops_table.dir.node,i.stream_ops=J.ops_table.dir.stream,i.contents={}):Y.isFile(i.mode)?(i.node_ops=J.ops_table.file.node,i.stream_ops=J.ops_table.file.stream,i.usedBytes=0,i.contents=null):Y.isLink(i.mode)?(i.node_ops=J.ops_table.link.node,i.stream_ops=J.ops_table.link.stream):Y.isChrdev(i.mode)&&(i.node_ops=J.ops_table.chrdev.node,i.stream_ops=J.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[t]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n!=0&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Y.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Y.isDir(e.mode)?t.size=4096:Y.isFile(e.mode)?t.size=e.usedBytes:Y.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(let n of[`mode`,`atime`,`mtime`,`ctime`])t[n]!=null&&(e[n]=t[n]);t.size!==void 0&&J.resizeFileStorage(e,t.size)},lookup(e,t){throw J.doesNotExistError||(J.doesNotExistError=new Y.ErrnoError(44),J.doesNotExistError.stack=`<generic error, no stack>`),J.doesNotExistError},mknod(e,t,n,r){return J.createNode(e,t,n,r)},rename(e,t,n){var r;try{r=Y.lookupNode(t,n)}catch{}if(r){if(Y.isDir(e.mode))for(var i in r.contents)throw new Y.ErrnoError(55);Y.hashRemoveNode(r)}delete e.parent.contents[e.name],t.contents[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){for(var n in Y.lookupNode(e,t).contents)throw new Y.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir(e){return[`.`,`..`,...Object.keys(e.contents)]},symlink(e,t,n){var r=J.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!Y.isLink(e.mode))throw new Y.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);if(o>8&&a.subarray)t.set(a.subarray(i,i+o),n);else for(var s=0;s<o;s++)t[n+s]=a[i+s];return o},write(e,t,n,r,i,a){if(t.buffer===g.buffer&&(a=!1),!r)return 0;var o=e.node;if(o.mtime=o.ctime=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return o.contents=t.subarray(n,n+r),o.usedBytes=r,r;if(o.usedBytes===0&&i===0)return o.contents=t.slice(n,n+r),o.usedBytes=r,r;if(i+r<=o.usedBytes)return o.contents.set(t.subarray(n,n+r),i),r}if(J.expandFileStorage(o,i+r),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(n,n+r),i);else for(var s=0;s<r;s++)o.contents[i+s]=t[n+s];return o.usedBytes=Math.max(o.usedBytes,i+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&Y.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new Y.ErrnoError(28);return r},mmap(e,t,n,r,i){if(!Y.isFile(e.node.mode))throw new Y.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s&&s.buffer===g.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=ce(t),!a)throw new Y.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),g.set(s,a))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return J.stream_ops.write(e,t,0,r,n,!1),0}}},le=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(typeof t>`u`)throw Error(`Unknown file open mode: ${e}`);return t},ue=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},de=async e=>{var t=await o(e);return new Uint8Array(t)},fe=(...e)=>Y.createDataFile(...e),pe=e=>e,me=0,he=null,ge=e=>{if(me--,me==0&&he){var t=he;he=null,t()}},_e=e=>{me++},ve=[],ye=async(e,t)=>{typeof Browser<`u`&&Browser.init();for(var n of ve)if(n.canHandle(t))return n.handle(e,t);return e},be=async(e,t,n,r,i,a,o,s)=>{var c=t?re.resolve(V.join2(e,t)):e,l=pe(`cp ${c}`);_e(l);try{var u=n;typeof n==`string`&&(u=await de(n)),u=await ye(u,c),s?.(),a||fe(e,t,u,r,i,o)}finally{ge(l)}},xe=(e,t,n,r,i,a,o,s,c,l)=>{be(e,t,n,r,i,s,c,l).then(a).catch(o)},Y={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:`/`,initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name=`ErrnoError`;constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!=1}get isWrite(){return(this.flags&2097155)!=0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.id=Y.nextInode++,this.name=t,this.mode=n,this.rdev=r,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Y.isDir(this.mode)}get isDevice(){return Y.isChrdev(this.mode)}},lookupPath(e,t={}){if(!e)throw new Y.ErrnoError(44);t.follow_mount??=!0,V.isAbs(e)||(e=Y.cwd()+`/`+e);e:for(var n=0;n<40;n++){for(var r=e.split(`/`).filter(e=>!!e),i=Y.root,a=`/`,o=0;o<r.length;o++){var s=o===r.length-1;if(s&&t.parent)break;if(r[o]!==`.`){if(r[o]===`..`){if(a=V.dirname(a),Y.isRoot(i)){e=a+`/`+r.slice(o+1).join(`/`),n--;continue e}else i=i.parent;continue}a=V.join2(a,r[o]);try{i=Y.lookupNode(i,r[o])}catch(e){if(e?.errno===44&&s&&t.noent_okay)return{path:a};throw e}if(Y.isMountpoint(i)&&(!s||t.follow_mount)&&(i=i.mounted.root),Y.isLink(i.mode)&&(!s||t.follow)){if(!i.node_ops.readlink)throw new Y.ErrnoError(52);var c=i.node_ops.readlink(i);V.isAbs(c)||(c=V.dirname(a)+`/`+c),e=c+`/`+r.slice(o+1).join(`/`);continue e}}}return{path:a,node:i}}throw new Y.ErrnoError(32)},getPath(e){for(var t;;){if(Y.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%Y.nameTable.length},hashAddNode(e){var t=Y.hashName(e.parent.id,e.name);e.name_next=Y.nameTable[t],Y.nameTable[t]=e},hashRemoveNode(e){var t=Y.hashName(e.parent.id,e.name);if(Y.nameTable[t]===e)Y.nameTable[t]=e.name_next;else for(var n=Y.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=Y.mayLookup(e);if(n)throw new Y.ErrnoError(n);for(var r=Y.hashName(e.id,t),i=Y.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return Y.lookup(e,t)},createNode(e,t,n,r){var i=new Y.FSNode(e,t,n,r);return Y.hashAddNode(i),i},destroyNode(e){Y.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return Y.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return Y.isDir(e.mode)?Y.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){if(!Y.isDir(e.mode))return 54;try{return Y.lookupNode(e,t),20}catch{}return Y.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=Y.lookupNode(e,t)}catch(e){return e.errno}var i=Y.nodePermissions(e,`wx`);if(i)return i;if(n){if(!Y.isDir(r.mode))return 54;if(Y.isRoot(r)||Y.getPath(r)===Y.cwd())return 10}else if(Y.isDir(r.mode))return 31;return 0},mayOpen(e,t){if(!e)return 44;if(Y.isLink(e.mode))return 32;var n=Y.flagsToPermissionString(t);return Y.isDir(e.mode)&&(n!==`r`||t&576)?31:Y.nodePermissions(e,n)},checkOpExists(e,t){if(!e)throw new Y.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Y.MAX_OPEN_FDS;e++)if(!Y.streams[e])return e;throw new Y.ErrnoError(33)},getStreamChecked(e){var t=Y.getStream(e);if(!t)throw new Y.ErrnoError(8);return t},getStream:e=>Y.streams[e],createStream(e,t=-1){return e=Object.assign(new Y.FSStream,e),t==-1&&(t=Y.nextfd()),e.fd=t,Y.streams[t]=e,e},closeStream(e){Y.streams[e]=null},dupStream(e,t=-1){var n=Y.createStream(e,t);return n.stream_ops?.dup?.(n),n},doSetAttr(e,t,n){var r=e?.stream_ops.setattr,i=r?e:t;r??=t.node_ops.setattr,Y.checkOpExists(r,63),r(i,n)},chrdev_stream_ops:{open(e){e.stream_ops=Y.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Y.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Y.devices[e]={stream_ops:t}},getDevice:e=>Y.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),Y.syncFSRequests++,Y.syncFSRequests>1&&l(`warning: ${Y.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=Y.getMounts(Y.root.mount),r=0;function i(e){return Y.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}for(var o of n)o.type.syncfs?o.type.syncfs(o,e,a):a(null)},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&Y.root)throw new Y.ErrnoError(10);if(!r&&!i){var o=Y.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,Y.isMountpoint(a))throw new Y.ErrnoError(10);if(!Y.isDir(a.mode))throw new Y.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?Y.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=Y.lookupPath(e,{follow_mount:!1});if(!Y.isMountpoint(t.node))throw new Y.ErrnoError(28);var n=t.node,r=n.mounted,i=Y.getMounts(r);for(var[a,o]of Object.entries(Y.nameTable))for(;o;){var s=o.name_next;i.includes(o.mount)&&Y.destroyNode(o),o=s}n.mounted=null;var c=n.mount.mounts.indexOf(r);n.mount.mounts.splice(c,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=Y.lookupPath(e,{parent:!0}).node,i=V.basename(e);if(!i)throw new Y.ErrnoError(28);if(i===`.`||i===`..`)throw new Y.ErrnoError(20);var a=Y.mayCreate(r,i);if(a)throw new Y.ErrnoError(a);if(!r.node_ops.mknod)throw new Y.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},statfs(e){return Y.statfsNode(Y.lookupPath(e,{follow:!0}).node)},statfsStream(e){return Y.statfsNode(e.node)},statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Y.nextInode,ffree:Y.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create(e,t=438){return t&=4095,t|=32768,Y.mknod(e,t,0)},mkdir(e,t=511){return t&=1023,t|=16384,Y.mknod(e,t,0)},mkdirTree(e,t){var n=e.split(`/`),r=``;for(var i of n)if(i){(r||V.isAbs(e))&&(r+=`/`),r+=i;try{Y.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return typeof n>`u`&&(n=t,t=438),t|=8192,Y.mknod(e,t,n)},symlink(e,t){if(!re.resolve(e))throw new Y.ErrnoError(44);var n=Y.lookupPath(t,{parent:!0}).node;if(!n)throw new Y.ErrnoError(44);var r=V.basename(t),i=Y.mayCreate(n,r);if(i)throw new Y.ErrnoError(i);if(!n.node_ops.symlink)throw new Y.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n=V.dirname(e),r=V.dirname(t),i=V.basename(e),a=V.basename(t),o,s,c;if(o=Y.lookupPath(e,{parent:!0}),s=o.node,o=Y.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new Y.ErrnoError(44);if(s.mount!==c.mount)throw new Y.ErrnoError(75);var l=Y.lookupNode(s,i),u=re.relative(e,r);if(u.charAt(0)!==`.`)throw new Y.ErrnoError(28);if(u=re.relative(t,n),u.charAt(0)!==`.`)throw new Y.ErrnoError(55);var d;try{d=Y.lookupNode(c,a)}catch{}if(l!==d){var f=Y.isDir(l.mode),p=Y.mayDelete(s,i,f);if(p||(p=d?Y.mayDelete(c,a,f):Y.mayCreate(c,a),p))throw new Y.ErrnoError(p);if(!s.node_ops.rename)throw new Y.ErrnoError(63);if(Y.isMountpoint(l)||d&&Y.isMountpoint(d))throw new Y.ErrnoError(10);if(c!==s&&(p=Y.nodePermissions(s,`w`),p))throw new Y.ErrnoError(p);Y.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{Y.hashAddNode(l)}}},rmdir(e){var t=Y.lookupPath(e,{parent:!0}).node,n=V.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!0);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.rmdir)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.rmdir(t,n),Y.destroyNode(r)},readdir(e){var t=Y.lookupPath(e,{follow:!0}).node;return Y.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Y.lookupPath(e,{parent:!0}).node;if(!t)throw new Y.ErrnoError(44);var n=V.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!1);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.unlink)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.unlink(t,n),Y.destroyNode(r)},readlink(e){var t=Y.lookupPath(e).node;if(!t)throw new Y.ErrnoError(44);if(!t.node_ops.readlink)throw new Y.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var n=Y.lookupPath(e,{follow:!t}).node;return Y.checkOpExists(n.node_ops.getattr,63)(n)},fstat(e){var t=Y.getStreamChecked(e),n=t.node,r=t.stream_ops.getattr,i=r?t:n;return r??=n.node_ops.getattr,Y.checkOpExists(r,63),r(i)},lstat(e){return Y.stat(e,!0)},doChmod(e,t,n,r){Y.doSetAttr(e,t,{mode:n&4095|t.mode&-4096,ctime:Date.now(),dontFollow:r})},chmod(e,t,n){var r=typeof e==`string`?Y.lookupPath(e,{follow:!n}).node:e;Y.doChmod(null,r,t,n)},lchmod(e,t){Y.chmod(e,t,!0)},fchmod(e,t){var n=Y.getStreamChecked(e);Y.doChmod(n,n.node,t,!1)},doChown(e,t,n){Y.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:n})},chown(e,t,n,r){var i=typeof e==`string`?Y.lookupPath(e,{follow:!r}).node:e;Y.doChown(null,i,r)},lchown(e,t,n){Y.chown(e,t,n,!0)},fchown(e,t,n){var r=Y.getStreamChecked(e);Y.doChown(r,r.node,!1)},doTruncate(e,t,n){if(Y.isDir(t.mode))throw new Y.ErrnoError(31);if(!Y.isFile(t.mode))throw new Y.ErrnoError(28);var r=Y.nodePermissions(t,`w`);if(r)throw new Y.ErrnoError(r);Y.doSetAttr(e,t,{size:n,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Y.ErrnoError(28);var n=typeof e==`string`?Y.lookupPath(e,{follow:!0}).node:e;Y.doTruncate(null,n,t)},ftruncate(e,t){var n=Y.getStreamChecked(e);if(t<0||!(n.flags&2097155))throw new Y.ErrnoError(28);Y.doTruncate(n,n.node,t)},utime(e,t,n){var r=Y.lookupPath(e,{follow:!0}).node;Y.checkOpExists(r.node_ops.setattr,63)(r,{atime:t,mtime:n})},open(e,t,n=438){if(e===``)throw new Y.ErrnoError(44);t=typeof t==`string`?le(t):t,n=t&64?n&4095|32768:0;var r,i;if(typeof e==`object`)r=e;else{i=e.endsWith(`/`);var a=Y.lookupPath(e,{follow:!(t&131072),noent_okay:!0});r=a.node,e=a.path}var o=!1;if(t&64)if(r){if(t&128)throw new Y.ErrnoError(20)}else{if(i)throw new Y.ErrnoError(31);r=Y.mknod(e,n|511,0),o=!0}if(!r)throw new Y.ErrnoError(44);if(Y.isChrdev(r.mode)&&(t&=-513),t&65536&&!Y.isDir(r.mode))throw new Y.ErrnoError(54);if(!o){var s=Y.mayOpen(r,t);if(s)throw new Y.ErrnoError(s)}t&512&&!o&&Y.truncate(r,0),t&=-131713;var c=Y.createStream({node:r,path:Y.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o&&Y.chmod(r,n&511),c},close(e){if(Y.isClosed(e))throw new Y.ErrnoError(8);e.getdents&&=null;try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Y.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(Y.isClosed(e))throw new Y.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Y.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new Y.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||(e.flags&2097155)==1)throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.read)throw new Y.ErrnoError(28);var a=typeof i<`u`;if(!a)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||!(e.flags&2097155))throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.write)throw new Y.ErrnoError(28);e.seekable&&e.flags&1024&&Y.llseek(e,0,2);var o=typeof i<`u`;if(!o)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new Y.ErrnoError(2);if(!e.stream_ops.mmap)throw new Y.ErrnoError(43);if(!t)throw new Y.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new Y.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`&&D(`Invalid encoding type "${t.encoding}"`);var n=Y.open(e,t.flags),r=Y.stat(e).size,i=new Uint8Array(r);return Y.read(n,i,0,r,0),t.encoding===`utf8`&&(i=R(i)),Y.close(n),i},writeFile(e,t,n={}){n.flags=n.flags||577;var r=Y.open(e,n.flags,n.mode);typeof t==`string`&&(t=new Uint8Array(K(t,!0))),ArrayBuffer.isView(t)?Y.write(r,t,0,t.byteLength,void 0,n.canOwn):D(`Unsupported data type`),Y.close(r)},cwd:()=>Y.currentPath,chdir(e){var t=Y.lookupPath(e,{follow:!0});if(t.node===null)throw new Y.ErrnoError(44);if(!Y.isDir(t.node.mode))throw new Y.ErrnoError(54);var n=Y.nodePermissions(t.node,`x`);if(n)throw new Y.ErrnoError(n);Y.currentPath=t.path},createDefaultDirectories(){Y.mkdir(`/tmp`),Y.mkdir(`/home`),Y.mkdir(`/home/web_user`)},createDefaultDevices(){Y.mkdir(`/dev`),Y.registerDevice(Y.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),Y.mkdev(`/dev/null`,Y.makedev(1,3)),q.register(Y.makedev(5,0),q.default_tty_ops),q.register(Y.makedev(6,0),q.default_tty1_ops),Y.mkdev(`/dev/tty`,Y.makedev(5,0)),Y.mkdev(`/dev/tty1`,Y.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(U(e),t=e.byteLength),e[--t]);Y.createDevice(`/dev`,`random`,n),Y.createDevice(`/dev`,`urandom`,n),Y.mkdir(`/dev/shm`),Y.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){Y.mkdir(`/proc`);var e=Y.mkdir(`/proc/self`);Y.mkdir(`/proc/self/fd`),Y.mount({mount(){var t=Y.createNode(e,`fd`,16895,73);return t.stream_ops={llseek:J.stream_ops.llseek},t.node_ops={lookup(e,t){var n=+t,r=Y.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path},id:n+1};return i.parent=i,i},readdir(){return Array.from(Y.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?Y.createDevice(`/dev`,`stdin`,e):Y.symlink(`/dev/tty`,`/dev/stdin`),t?Y.createDevice(`/dev`,`stdout`,null,t):Y.symlink(`/dev/tty`,`/dev/stdout`),n?Y.createDevice(`/dev`,`stderr`,null,n):Y.symlink(`/dev/tty1`,`/dev/stderr`),Y.open(`/dev/stdin`,0),Y.open(`/dev/stdout`,1),Y.open(`/dev/stderr`,1)},staticInit(){Y.nameTable=Array(4096),Y.mount(J,{},`/`),Y.createDefaultDirectories(),Y.createDefaultDevices(),Y.createSpecialDirectories(),Y.filesystems={MEMFS:J}},init(e,t,n){Y.initialized=!0,Y.createStandardStreams(e,t,n)},quit(){Y.initialized=!1;for(var e of Y.streams)e&&Y.close(e)},findObject(e,t){var n=Y.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=Y.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Y.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=V.basename(e),n=Y.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:Y.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=V.join2(e,a);try{Y.mkdir(o)}catch(e){if(e.errno!=20)throw e}e=o}}return o},createFile(e,t,n,r,i){var a=V.join2(typeof e==`string`?e:Y.getPath(e),t),o=ue(r,i);return Y.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:Y.getPath(e),o=t?V.join2(e,t):e);var s=ue(r,i),c=Y.create(o,s);if(n){if(typeof n==`string`){for(var l=Array(n.length),u=0,d=n.length;u<d;++u)l[u]=n.charCodeAt(u);n=l}Y.chmod(c,s|146);var f=Y.open(c,577);Y.write(f,n,0,n.length,0,a),Y.close(f),Y.chmod(c,s)}},createDevice(e,t,n,r){var i=V.join2(typeof e==`string`?e:Y.getPath(e),t),a=ue(!!n,!!r);Y.createDevice.major??=64;var o=Y.makedev(Y.createDevice.major++,0);return Y.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new Y.ErrnoError(29)}if(c===void 0&&o===0)throw new Y.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.atime=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new Y.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),Y.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)D(`Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.`);else try{e.contents=s(e.url)}catch{throw new Y.ErrnoError(29)}},createLazyFile(e,t,n,i,a){class o{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open(`HEAD`,n,!1),e.send(null),e.status>=200&&e.status<300||e.status===304||D(`Couldn't load `+n+`. Status: `+e.status);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1024*1024;i||(o=t);var s=(e,r)=>{e>r&&D(`invalid range (`+e+`, `+r+`) or no bytes requested!`),r>t-1&&D(`only `+t+` bytes available! programmer error!`);var i=new XMLHttpRequest;return i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+r),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),i.status>=200&&i.status<300||i.status===304||D(`Couldn't load `+n+`. Status: `+i.status),i.response===void 0?K(i.responseText||``,!0):new Uint8Array(i.response||[])},l=this;l.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;return r=Math.min(r,t-1),typeof l.chunks[e]>`u`&&(l.chunks[e]=s(n,r)),typeof l.chunks[e]>`u`&&D(`doXHR failed!`),l.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,c(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){r||D(`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`);var s={isDevice:!1,contents:new o}}else var s={isDevice:!1,url:n};var l=Y.createFile(e,t,s,i,a);s.contents?l.contents=s.contents:s.url&&(l.contents=null,l.url=s.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var u={};for(let[e,t]of Object.entries(l.stream_ops))u[e]=(...e)=>(Y.forceLoadFile(l),t(...e));function d(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return u.read=(e,t,n,r,i)=>(Y.forceLoadFile(l),d(e,t,n,r,i)),u.mmap=(e,t,n,r,i)=>{Y.forceLoadFile(l);var a=ce(t);if(!a)throw new Y.ErrnoError(48);return d(e,g,a,t,n),{ptr:a,allocated:!0}},l.stream_ops=u,l}},X={calculateAt(e,t,n){if(V.isAbs(t))return t;var r=e===-100?Y.cwd():X.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new Y.ErrnoError(44);return r}return r+`/`+t},writeStat(e,t){x[e>>2]=t.dev,x[e+4>>2]=t.mode,x[e+8>>2]=t.nlink,x[e+12>>2]=t.uid,x[e+16>>2]=t.gid,x[e+20>>2]=t.rdev,F=[t.size>>>0,(P=t.size,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+24>>2]=F[0],b[e+28>>2]=F[1],b[e+32>>2]=4096,b[e+36>>2]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return F=[Math.floor(n/1e3)>>>0,(P=Math.floor(n/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+40>>2]=F[0],b[e+44>>2]=F[1],x[e+48>>2]=n%1e3*1e3*1e3,F=[Math.floor(r/1e3)>>>0,(P=Math.floor(r/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+56>>2]=F[0],b[e+60>>2]=F[1],x[e+64>>2]=r%1e3*1e3*1e3,F=[Math.floor(i/1e3)>>>0,(P=Math.floor(i/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+72>>2]=F[0],b[e+76>>2]=F[1],x[e+80>>2]=i%1e3*1e3*1e3,F=[t.ino>>>0,(P=t.ino,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+88>>2]=F[0],b[e+92>>2]=F[1],0},writeStatFs(e,t){x[e+4>>2]=t.bsize,x[e+60>>2]=t.bsize,F=[t.blocks>>>0,(P=t.blocks,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+8>>2]=F[0],b[e+12>>2]=F[1],F=[t.bfree>>>0,(P=t.bfree,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+16>>2]=F[0],b[e+20>>2]=F[1],F=[t.bavail>>>0,(P=t.bavail,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+24>>2]=F[0],b[e+28>>2]=F[1],F=[t.files>>>0,(P=t.files,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+32>>2]=F[0],b[e+36>>2]=F[1],F=[t.ffree>>>0,(P=t.ffree,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+40>>2]=F[0],b[e+44>>2]=F[1],x[e+48>>2]=t.fsid,x[e+64>>2]=t.flags,x[e+56>>2]=t.namelen},doMsync(e,t,n,r,i){if(!Y.isFile(t.node.mode))throw new Y.ErrnoError(43);if(r&2)return 0;var a=_.slice(e,e+n);Y.msync(t,a,i,n,r)},getStreamFromFD(e){return Y.getStreamChecked(e)},varargs:void 0,getStr(e){return z(e)}};function Se(e,t,n,r){try{if(t=X.getStr(t),t=X.calculateAt(e,t),n&-8)return-28;var i=Y.lookupPath(t,{follow:!0}).node;if(!i)return-44;var a=``;return n&4&&(a+=`r`),n&2&&(a+=`w`),n&1&&(a+=`x`),a&&Y.nodePermissions(i,a)?-2:0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var Ce=()=>{var e=b[X.varargs>>2];return X.varargs+=4,e},we=Ce;function Te(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 0:var i=Ce();if(i<0)return-28;for(;Y.streams[i];)i++;var a;return a=Y.dupStream(r,i),a.fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=Ce();return r.flags|=i,0;case 12:var i=we(),o=0;return v[i+o>>1]=2,0;case 13:case 14:return 0}return-28}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ee(e,t){try{return X.writeStat(t,Y.fstat(e))}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function De(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=we();b[a>>2]=i.c_iflag||0,b[a+4>>2]=i.c_oflag||0,b[a+8>>2]=i.c_cflag||0,b[a+12>>2]=i.c_lflag||0;for(var o=0;o<32;o++)g[a+o+17]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=we(),s=b[a>>2],c=b[a+4>>2],l=b[a+8>>2],u=b[a+12>>2],d=[],o=0;o<32;o++)d.push(g[a+o+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:if(!r.tty)return-59;var a=we();return b[a>>2]=0,0;case 21520:return r.tty?-28:-59;case 21537:case 21531:var a=we();return Y.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty),a=we();v[a>>1]=f[0],v[a+2>>1]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Oe(e,t,n,r){X.varargs=r;try{t=X.getStr(t),t=X.calculateAt(e,t);var i=r?Ce():0;return Y.open(t,n,i).fd}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var ke=(e,t,n)=>ie(e,_,t,n);function Ae(e,t,n,r){try{if(t=X.getStr(t),t=X.calculateAt(e,t),r<=0)return-28;var i=Y.readlink(t),a=Math.min(r,G(i)),o=g[n+a];return ke(i,n,r+1),g[n+a]=o,a}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function je(e){try{return e=X.getStr(e),Y.rmdir(e),0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Me(e,t,n){try{if(t=X.getStr(t),t=X.calculateAt(e,t),!n)Y.unlink(t);else if(n===512)Y.rmdir(t);else return-28;return 0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var Ne=()=>Cr,Z=e=>{var t=e.getArg(Ne(),0);return xr(t)},Pe=()=>vr(),Fe=e=>gr(e),Ie=e=>_r(e),Le=e=>{var t=Pe(),n=Ie(4),r=Ie(4);Sr(e,n,r);var i=x[n>>2],a=x[r>>2],o=z(i);fr(i);var s;return a&&(s=z(a),fr(a)),Fe(t),[o,s]},Re=e=>Le(Z(e)),ze=e=>{var t=new WebAssembly.Exception(Ne(),[e],{traceStack:!0});throw t.message=Re(t),t},Be=()=>D(``),Ve=(e,t,n,r,i)=>{},Q=e=>{for(var t=``;;){var n=_[e++];if(!n)return t;t+=String.fromCharCode(n)}},He={},Ue={},We={},Ge=class extends Error{constructor(e){super(e),this.name=`BindingError`}},$=e=>{throw new Ge(e)};function Ke(e,t,n={}){var r=t.name;if(e||$(`type "${r}" must have a positive integer typeid pointer`),Ue.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;$(`Cannot register type '${r}' twice`)}if(Ue[e]=t,delete We[e],He.hasOwnProperty(e)){var i=He[e];delete He[e],i.forEach(e=>e())}}function qe(e,t,n={}){return Ke(e,t,n)}var Je=(e,t,n,r)=>{t=Q(t),qe(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},readValueFromPointer:function(e){return this.fromWireType(_[e])},destructorFunction:null})},Ye=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Xe=e=>{function t(e){return e.$$.ptrType.registeredClass.name}$(t(e)+` instance already deleted`)},Ze=!1,Qe=e=>{},$e=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},et=e=>{--e.count.value,e.count.value===0&&$e(e)},tt=e=>globalThis.FinalizationRegistry?(Ze=new FinalizationRegistry(e=>{et(e.$$)}),tt=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};Ze.register(e,n,e)}return e},Qe=e=>Ze.unregister(e),tt(e)):(tt=e=>e,e),nt=[],rt=()=>{for(;nt.length;){var e=nt.pop();e.$$.deleteScheduled=!1,e.delete()}},it,at=()=>{let e=ot.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof ot)||!(e instanceof ot))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var r=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)i=r.upcast(i),r=r.baseClass;return t===r&&n===i},clone(){if(this.$$.ptr||Xe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=tt(Object.create(Object.getPrototypeOf(this),{$$:{value:Ye(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$(`Object already scheduled for deletion`),Qe(this),et(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$(`Object already scheduled for deletion`),nt.push(this),nt.length===1&&it&&it(rt),this.$$.deleteScheduled=!0,this}});let t=Symbol.dispose;t&&(e[t]=e.delete)};function ot(){}var st=(e,t)=>Object.defineProperty(t,`name`,{value:e}),ct={},lt=(e,t,n)=>{if(e[t].overloadTable===void 0){var r=e[t];e[t]=function(...r){return e[t].overloadTable.hasOwnProperty(r.length)||$(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[r.length].apply(this,r)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}},ut=(e,t,r)=>{n.hasOwnProperty(e)?((r===void 0||n[e].overloadTable!==void 0&&n[e].overloadTable[r]!==void 0)&&$(`Cannot register public name '${e}' twice`),lt(n,e,e),n[e].overloadTable.hasOwnProperty(r)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,n[e].argCount=r)},dt=48,ft=57,pt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,`$`);var t=e.charCodeAt(0);return t>=dt&&t<=ft?`_${e}`:e};function mt(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var ht=(e,t,n)=>{for(;t!==n;)t.upcast||$(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},gt=e=>{if(e===null)return`null`;var t=typeof e;return t===`object`||t===`array`||t===`function`?e.toString():``+e};function _t(e,t){if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;t.$$||$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,n,this.registeredClass)}function vt(e,t){var n;if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&$(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;if(n=ht(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&$(`Passing raw pointer to smart pointer is illegal`),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:$(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var i=t.clone();n=this.rawShare(n,rn.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:$(`Unsupported sharing policy`)}return n}function yt(e,t){if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;t.$$||$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&$(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,n,this.registeredClass)}function bt(e){return this.fromWireType(x[e>>2])}var xt=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var r=xt(e,t,n.baseClass);return r===null?null:n.downcast(r)},St={},Ct=(e,t)=>{for(t===void 0&&$(`ptr should not be undefined`);e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},wt=(e,t)=>(t=Ct(e,t),St[t]),Tt=class extends Error{constructor(e){super(e),this.name=`InternalError`}},Et=e=>{throw new Tt(e)},Dt=(e,t)=>((!t.ptrType||!t.ptr)&&Et(`makeClassHandle requires ptr and ptrType`),!!t.smartPtrType!=!!t.smartPtr&&Et(`Both smartPtrType and smartPtr must be specified`),t.count={value:1},tt(Object.create(e,{$$:{value:t,writable:!0}})));function Ot(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=wt(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function i(){return this.isSmartPointer?Dt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Dt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=ct[this.registeredClass.getActualType(t)];if(!a)return i.call(this);var o=this.isConst?a.constPointerType:a.pointerType,s=xt(t,this.registeredClass,o.registeredClass);return s===null?i.call(this):this.isSmartPointer?Dt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s,smartPtrType:this,smartPtr:e}):Dt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s})}var kt=()=>{Object.assign(At.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:bt,fromWireType:Ot})};function At(e,t,n,r,i,a,o,s,c,l,u){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=l,this.rawDestructor=u,!i&&t.baseClass===void 0?r?(this.toWireType=_t,this.destructorFunction=null):(this.toWireType=yt,this.destructorFunction=null):this.toWireType=vt}var jt=(e,t,r)=>{n.hasOwnProperty(e)||Et(`Replacing nonexistent public symbol`),n[e].overloadTable!==void 0&&r!==void 0?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt={},Nt=(e,t,n)=>{e=e.replace(/p/g,`i`);var r=Mt[e];return r(t,...n)},Pt=e=>Tr.get(e),Ft=(e,t,n=[],r=!1)=>e.includes(`j`)?Nt(e,t,n):Pt(t)(...n),It=(e,t,n=!1)=>(...r)=>Ft(e,t,r,n),Lt=(e,t,n=!1)=>{e=Q(e);function r(){return e.includes(`j`)?It(e,t):Pt(t)}var i=r();return typeof i!=`function`&&$(`unknown function pointer with signature ${e}: ${t}`),i};class Rt extends Error{}var zt=e=>{var t=ur(e),n=Q(t);return fr(t),n},Bt=(e,t)=>{var n=[],r={};function i(e){if(!r[e]&&!Ue[e]){if(We[e]){We[e].forEach(i);return}n.push(e),r[e]=!0}}throw t.forEach(i),new Rt(`${e}: `+n.map(zt).join([`, `]))},Vt=(e,t,n)=>{e.forEach(e=>We[e]=t);function r(t){var r=n(t);r.length!==e.length&&Et(`Mismatched type converter count`);for(var i=0;i<e.length;++i)qe(e[i],r[i])}var i=Array(t.length),a=[],o=0;for(let[e,n]of t.entries())Ue.hasOwnProperty(n)?i[e]=Ue[n]:(a.push(n),He.hasOwnProperty(n)||(He[n]=[]),He[n].push(()=>{i[e]=Ue[n],++o,o===a.length&&r(i)}));a.length===0&&r(i)},Ht=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{u=Q(u),a=Lt(i,a),s&&=Lt(o,s),l&&=Lt(c,l),f=Lt(d,f);var p=pt(u);ut(p,function(){Bt(`Cannot construct ${u} due to unbound types`,[r])}),Vt([e,t,n],r?[r]:[],t=>{t=t[0];var n,i;r?(n=t.registeredClass,i=n.instancePrototype):i=ot.prototype;var o=st(u,function(...e){if(Object.getPrototypeOf(this)!==c)throw new Ge(`Use 'new' to construct ${u}`);if(d.constructor_body===void 0)throw new Ge(`${u} has no accessible constructor`);var t=d.constructor_body[e.length];if(t===void 0)throw new Ge(`Tried to invoke ctor of ${u} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(i,{constructor:{value:o}});o.prototype=c;var d=new mt(u,o,c,f,n,a,s,l);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var m=new At(u,d,!0,!1,!1),h=new At(u+`*`,d,!1,!1,!1),g=new At(u+` const*`,d,!1,!0,!1);return ct[e]={pointerType:h,constPointerType:g},jt(p,o),[m,h,g]})},Ut=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Wt(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Gt(e,t,n,r){var i=Wt(e),a=e.length-2,o=[],s=[`fn`];t&&s.push(`thisWired`);for(var c=0;c<a;++c)o.push(`arg${c}`),s.push(`arg${c}Wired`);o=o.join(`,`),s=s.join(`,`);var l=`return function (${o}) {
1
+ import{a as e,i as t,n}from"./_src-Bi8wryCV.js";import{a as r,b as i,i as a,n as o,o as s,r as c,t as l,y as u}from"./_src-D_0f55rL.js";import{t as d}from"./_value-NcYKFvkN.js";import{t as f}from"./_defaultLocale-CTKA0Sod.js";import{n as p}from"./_path-e1ZUMOO_.js";function m(e){var t={},n=e.node().nodeName;t.tag=n,n==`#text`?t.text=e.text():n==`#comment`&&(t.comment=e.text()),t.attributes={};var r=e.node().attributes;if(r)for(var i=0;i<r.length;i++){var a=r[i],o=a.name,s=a.value;t.attributes[o]=s}var c=e.node().transform;if(c&&c.baseVal.numberOfItems!=0){var l=c.baseVal.consolidate().matrix;t.translation={x:l.e,y:l.f},t.scale=l.a}if(n==`ellipse`&&(t.center={x:t.attributes.cx,y:t.attributes.cy}),n==`polygon`){var u=e.attr(`points`).split(` `),d=u.map(function(e){return e.split(`,`)[0]}),f=u.map(function(e){return e.split(`,`)[1]}),p=Math.min.apply(null,d),m=Math.max.apply(null,d),h=Math.min.apply(null,f),g=Math.max.apply(null,f),_={x:p,y:h,width:m-p,height:g-h};t.bbox=_,t.center={x:(p+m)/2,y:(h+g)/2}}if(n==`path`){var u=e.attr(`d`).split(/[A-Z ]/);u.shift();var d=u.map(function(e){return+e.split(`,`)[0]}),f=u.map(function(e){return+e.split(`,`)[1]}),p=Math.min.apply(null,d),m=Math.max.apply(null,d),h=Math.min.apply(null,f),g=Math.max.apply(null,f),_={x:p,y:h,width:m-p,height:g-h};t.bbox=_,t.center={x:(p+m)/2,y:(h+g)/2},t.totalLength=e.node().getTotalLength()}return n==`text`&&(t.center={x:e.attr(`x`),y:e.attr(`y`)}),n==`#text`?t.text=e.text():n==`#comment`&&(t.comment=e.text()),t}function h(e){var r=m(e);return r.children=[],n(e.node().childNodes).each(function(){var e=h(t(this));e.parent=r,r.children.push(e)}),r}function g(e){return e.tag==`#text`?document.createTextNode(``):e.tag==`#comment`?document.createComment(e.comment):document.createElementNS(`http://www.w3.org/2000/svg`,e.tag)}function _(e){var n=g(e),r=t(n),i=e.attributes;for(var a of Object.keys(i)){var o=i[a];r.attr(a,o)}return n}function v(e,n){var r=t(e.node().parentNode),i=_(n),a=r.insert(function(){return i},function(){return e.node()});return e.remove(),a}function y(e,t){e.datum(t),e.data([t],function(e){return e.key})}function b(e,r){y(e,r),n(e.node().childNodes).each(function(e,n){b(t(this),r.children[n])})}function x(e,t){var n=e.selectAll(function(){return e.node().childNodes});n=n.data(function(e){return e.children},function(e){return e.tag+`-`+t});var r=n.enter().append(function(e){return g(e)}),i=n.exit();i=i.remove(),n=r.merge(n);var a={};n.each(function(e){var t=e.tag;a[t]??(a[t]=0);var n=a[t]++;S.call(this,e,n)})}function S(e,n=0){var r=t(this);e.tag;var i=e.attributes,a=r.node().attributes;if(a)for(var o=0;o<a.length;o++){var s=a[o],c=s.name;if(c.split(`:`)[0]!=`xmlns`&&s.namespaceURI){var l=s.namespaceURI.split(`/`);c=l[l.length-1]+`:`+c}c in i||(i[c]=null)}for(var u of Object.keys(i))r.attr(u,i[u]);e.text&&r.text(e.text),x(r,n)}function C(e){return this._options.zoom=e,this._options.zoom&&!this._zoomBehavior?w.call(this):!this._options.zoom&&this._zoomBehavior&&(this._zoomSelection.on(`.zoom`,null),this._zoomBehavior=null),this}function w(){var e=this;function n(n){t(i.node().querySelector(`g`)).attr(`transform`,n.transform),e._dispatch.call(`zoom`,e)}var r=this._selection,i=t(r.node().querySelector(`svg`));if(i.size()==0)return this;this._zoomSelection=i;var a=l().scaleExtent(this._options.zoomScaleExtent).translateExtent(this._options.zoomTranslateExtent).interpolate(d).on(`zoom`,n);this._zoomBehavior=a;var o=t(i.node().querySelector(`g`));return i.call(a),this._active||E.call(this,o),this._originalTransform=c(i.node()),this}function T(e){var t=this._translation,n=this._scale,r=e.datum().translation,i=e.datum().scale,a=c(this._zoomSelection.node());return t&&(a=a.scale(1/n),a=a.translate(-t.x,-t.y)),a=a.translate(r.x,r.y),a=a.scale(i),a}function E(e){this._zoomBehavior.transform(this._zoomSelection,T.call(this,e)),this._translation=e.datum().translation,this._scale=e.datum().scale,this._originalTransform=o.translate(e.datum().translation.x,e.datum().translation.y).scale(e.datum().scale)}function D(e){var t=this._zoomSelection;return e&&(t=t.transition(e)),t.call(this._zoomBehavior.transform,this._originalTransform),this}function O(e){return this._options.zoomScaleExtent=e,this}function k(e){return this._options.zoomTranslateExtent=e,this}function A(){return this._zoomBehavior||null}function j(){return this._zoomSelection||null}function M(e,t){return function(){let n=e.map(function(e){return d([e[0][0],e[0][1]],[e[1][0],e[1][1]])});return function(e){return e<1?`M`+n.map(function(t){return t(e)}).join(`L`):t}}}function ee(e,t,n,r){let i=e,a=i.cloneNode(),o=i.getTotalLength(),s=(a.setAttribute(`d`,t),a).getTotalLength(),c=[0],l=0,u=r?n:n/Math.max(o,s);for(;(l+=u)<1;)c.push(l);return c.push(1),c.map(function(e){let t=i.getPointAtLength(e*o),n=a.getPointAtLength(e*s);return[[t.x,t.y],[n.x,n.y]]})}function te(){return this._data||null}function N(e){return e.attributes.class==`edge`||e.tag==`a`&&e.parent.tag==`g`&&e.parent.parent.attributes.class==`edge`}function P(e){return e.parent&&N(e.parent)}function F(e){return e.parent.attributes.class==`edge`?e.parent:e.parent.parent.parent}function I(e){return F(e).children.find(function(e){return e.tag==`title`})}function ne(e){return this._busy?(this._queue.push(this.render.bind(this,e)),this):(this._dispatch.call(`renderStart`,this),this._transitionFactory?u(function(){this._transition=r(this._transitionFactory()),L.call(this,e)}.bind(this),0):L.call(this,e),this)}function L(e){var n=this._transition,r=this._options.fade&&n!=null,i=this._options.tweenPaths,a=this._options.tweenShapes,o=this._options.convertEqualSidedPolygons,l=this._options.growEnteringEdges&&n!=null,u=this._attributer,d=this;function f(e){var i=e.selectAll(function(){return e.node().childNodes});i=i.data(function(e){return e.children},function(e){return e.key});var a=i.enter().append(function(e){var t=g(e);return e.tag==`#text`&&r&&(t.nodeValue=e.text),t});(r||l&&N(e.datum()))&&a.filter(function(e){return e.tag[0]==`#`?null:this}).each(function(e){var n=t(this);for(var r of Object.keys(e.attributes)){var i=e.attributes[r];n.attr(r,i)}}).filter(function(e){return e.tag==`svg`||e.tag==`g`?null:this}).style(`opacity`,0);var o=i.exit();u&&o.each(u),n&&(o=o.transition(n),r&&o.filter(function(e){return e.tag[0]==`#`?null:this}).style(`opacity`,0)),o=o.remove(),i=a.merge(i).order(),i.each(p)}function p(e){var p=t(this);if(e.tag==`svg`){var h=d._options;if(h.width!=null||h.height!=null){var g=h.width,_=h.height;g==null?g=e.attributes.width.replace(`pt`,``)*4/3:(p.attr(`width`,g),e.attributes.width=g),_==null?_=e.attributes.height.replace(`pt`,``)*4/3:(p.attr(`height`,_),e.attributes.height=_),h.fit||(p.attr(`viewBox`,`0 0 ${g*3/4/h.scale} ${_*3/4/h.scale}`),e.attributes.viewBox=`0 0 ${g*3/4/h.scale} ${_*3/4/h.scale}`)}h.scale!=1&&(h.fit||h.width==null&&h.height==null)&&(g=e.attributes.viewBox.split(` `)[2],_=e.attributes.viewBox.split(` `)[3],p.attr(`viewBox`,`0 0 ${g/h.scale} ${_/h.scale}`),e.attributes.viewBox=`0 0 ${g/h.scale} ${_/h.scale}`)}u&&p.each(u);var y=e.tag,b=e.attributes,x=p.node().attributes;if(x)for(var S=0;S<x.length;S++){var C=x[S],w=C.name;if(w.split(`:`)[0]!=`xmlns`&&C.namespaceURI){var D=C.namespaceURI.split(`/`);w=D[D.length-1]+`:`+w}w in b||(b[w]=null)}var O=!1,k=!1;if(a&&n){if((this.nodeName==`polygon`||this.nodeName==`ellipse`)&&e.alternativeOld&&(k=!0),(y==`polygon`||y==`ellipse`)&&e.alternativeNew&&(O=!0),this.nodeName==`polygon`&&y==`polygon`&&e.alternativeOld){var A=m(p).attributes.points;if(!o){var j=A.split(` `).length,ee=e.attributes.points;ee.split(` `).length==j&&(O=!1,k=!1)}}if(k){var te=e.alternativeOld,N=v(p,te);N.data([e],function(){return e.key}),p=N}if(O){var F=e.alternativeNew;y=`path`,b=F.attributes}}var I=p;if(n&&(I=I.transition(n),r&&I.filter(function(e){return e.tag[0]==`#`?null:this}).style(`opacity`,1),I.filter(function(e){return e.tag[0]==`#`?null:this}).on(`end`,function(e){t(this).attr(`style`,e&&e.attributes&&e.attributes.style||null)})),l&&y==`path`&&e.offset){var ne=e.totalLength;p.attr(`stroke-dasharray`,ne+` `+ne).attr(`stroke-dashoffset`,ne).attr(`transform`,`translate(`+e.offset.x+`,`+e.offset.y+`)`),b[`stroke-dashoffset`]=0,b.transform=`translate(0,0)`,I.attr(`stroke-dashoffset`,b[`stroke-dashoffset`]).attr(`transform`,b.transform).on(`start`,function(){t(this).style(`opacity`,null)}).on(`end`,function(){t(this).attr(`stroke-dashoffset`,null).attr(`stroke-dasharray`,null).attr(`transform`,null)})}if(l&&y==`polygon`&&P(e)&&e.offset&&e.parent.children[3].tag==`path`){var L=t(p.node().parentNode.querySelector(`path`)),R=L.node().getPointAtLength(0),z=L.node().getPointAtLength(e.totalLength),B=L.node().getPointAtLength(e.totalLength-1),V=Math.atan2(z.y-B.y,z.x-B.x)*180/Math.PI,H=R.x-z.x+e.offset.x,U=R.y-z.y+e.offset.y;p.attr(`transform`,`translate(`+H+`,`+U+`)`),I.attrTween(`transform`,function(){return function(t){var n=L.node().getPointAtLength(e.totalLength*t),r=L.node().getPointAtLength(e.totalLength*t+1),i=Math.atan2(r.y-n.y,r.x-n.x)*180/Math.PI-V;return H=n.x-z.x+e.offset.x*(1-t),U=n.y-z.y+e.offset.y*(1-t),`translate(`+H+`,`+U+`) rotate(`+i+` `+z.x+` `+z.y+`)`}}).on(`start`,function(){t(this).style(`opacity`,null)}).on(`end`,function(){t(this).attr(`transform`,null)})}var re=i&&n&&y==`path`&&p.attr(`d`)!=null;for(var W of Object.keys(b)){var G=b[W];if(re&&W==`d`){var ee=(e.alternativeOld||e).points;ee&&I.attrTween(`d`,M(ee,G))}else{if(W==`transform`&&e.translation)if(n){var ie=I.on(`end`);I.on(`start`,function(){d._zoomBehavior&&I.tween(`attr.transform`,function(){var e=this;return function(t){e.setAttribute(`transform`,s(c(d._zoomSelection.node()).toString(),T.call(d,p).toString())(t))}})}).on(`end`,function(){ie.call(this),d._zoomBehavior&&E.call(d,p)})}else d._zoomBehavior&&(E.call(d,p),G=T.call(d,p).toString());I.attr(W,G)}}O&&I.on(`end`,function(e,n,r){N=t(this),v(N,e).data([e],function(){return e.key})}),e.text&&I.text(e.text),f(p)}var h=this._selection;if(n!=null){var _=this._jobs;if(d._active)return _.push(null),this;h.transition(n).transition().duration(0).on(`end`,function(){d._active=!1,_.length!=0&&(_.shift(),d.render())}),this._active=!0}n!=null&&h.transition(n).on(`start`,function(){d._dispatch.call(`transitionStart`,d)}).on(`end`,function(){d._dispatch.call(`transitionEnd`,d)}).transition().duration(0).on(`start`,function(){d._dispatch.call(`restoreEnd`,d),d._dispatch.call(`end`,d),e&&e.call(d)});var y=this._data,b=h.selectAll(`svg`).data([y],function(e){return e.key});return b=b.enter().append(`svg`).merge(b),p.call(b.node(),y),this._options.zoom&&!this._zoomBehavior&&w.call(this),d._dispatch.call(`renderEnd`,d),n??(this._dispatch.call(`end`,this),e&&e.call(this)),this}function R(){return this._graphvizVersion}var z=ArrayBuffer,B=Uint8Array,V=Uint16Array,H=Int16Array,U=Int32Array,re=function(e,t,n){if(B.prototype.slice)return B.prototype.slice.call(e,t,n);(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length);var r=new B(n-t);return r.set(e.subarray(t,n)),r},W=function(e,t,n,r){if(B.prototype.fill)return B.prototype.fill.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;++n)e[n]=t;return e},G=function(e,t,n,r){if(B.prototype.copyWithin)return B.prototype.copyWithin.call(e,t,n,r);for((n==null||n<0)&&(n=0),(r==null||r>e.length)&&(r=e.length);n<r;)e[t++]=e[n++]},ie=[`invalid zstd data`,`window size too large (>2046MB)`,`invalid block type`,`FSE accuracy too high`,`match distance too far back`,`unexpected EOF`],K=function(e,t,n){var r=Error(t||ie[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,K),!n)throw r;return r},ae=function(e,t,n){for(var r=0,i=0;r<n;++r)i|=e[t++]<<(r<<3);return i},q=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},oe=function(e,t){var n=e[0]|e[1]<<8|e[2]<<16;if(n==3126568&&e[3]==253){var r=e[4],i=r>>5&1,a=r>>2&1,o=r&3,s=r>>6;r&8&&K(0);var c=6-i,l=o==3?4:o,u=ae(e,c,l);c+=l;var d=s?1<<s:i,f=ae(e,c,d)+(s==1&&256),p=f;if(!i){var m=1<<10+(e[5]>>3);p=m+(m>>3)*(e[5]&7)}p>2145386496&&K(1);var h=new B((t==1?f||p:t?0:p)+12);return h[0]=1,h[4]=4,h[8]=8,{b:c+d,y:0,l:0,d:u,w:t&&t!=1?t:h.subarray(12),e:p,o:new U(h.buffer,0,3),u:f,c:a,m:Math.min(131072,p)}}else if((n>>4|e[3]<<20)==25481893)return q(e,4)+8;K(0)},se=function(e){for(var t=0;1<<t<=e;++t);return t-1},ce=function(e,t,n){var r=(t<<3)+4,i=(e[t]&15)+5;i>n&&K(3);for(var a=1<<i,o=a,s=-1,c=-1,l=-1,u=a,d=new z(512+(a<<2)),f=new H(d,0,256),p=new V(d,0,256),m=new V(d,512,a),h=512+(a<<1),g=new B(d,h,a),_=new B(d,h+a);s<255&&o>0;){var v=se(o+1),y=r>>3,b=(1<<v+1)-1,x=(e[y]|e[y+1]<<8|e[y+2]<<16)>>(r&7)&b,S=(1<<v)-1,C=b-o-1,w=x&S;if(w<C?(r+=v,x=w):(r+=v+1,x>S&&(x-=C)),f[++s]=--x,x==-1?(o+=x,g[--u]=s):o-=x,!x)do{var T=r>>3;c=(e[T]|e[T+1]<<8)>>(r&7)&3,r+=2,s+=c}while(c==3)}(s>255||o)&&K(0);for(var E=0,D=(a>>1)+(a>>3)+3,O=a-1,k=0;k<=s;++k){var A=f[k];if(A<1){p[k]=-A;continue}for(l=0;l<A;++l){g[E]=k;do E=E+D&O;while(E>=u)}}for(E&&K(0),l=0;l<a;++l){var j=p[g[l]]++;m[l]=(j<<(_[l]=i-se(j)))-a}return[r+7>>3,{b:i,s:g,n:_,t:m}]},J=function(e,t){var n=0,r=-1,i=new B(292),a=e[t],o=i.subarray(0,256),s=i.subarray(256,268),c=new V(i.buffer,268);if(a<128){var l=ce(e,t+1,6),u=l[0],d=l[1];t+=a;var f=u<<3,p=e[t];p||K(0);for(var m=0,h=0,g=d.b,_=g,v=(++t<<3)-8+se(p);v-=g,!(v<f);){var y=v>>3;if(m+=(e[y]|e[y+1]<<8)>>(v&7)&(1<<g)-1,o[++r]=d.s[m],v-=_,v<f)break;y=v>>3,h+=(e[y]|e[y+1]<<8)>>(v&7)&(1<<_)-1,o[++r]=d.s[h],g=d.n[m],m=d.t[m],_=d.n[h],h=d.t[h]}++r>255&&K(0)}else{for(r=a-127;n<r;n+=2){var b=e[++t];o[n]=b>>4,o[n+1]=b&15}++t}var x=0;for(n=0;n<r;++n){var S=o[n];S>11&&K(0),x+=S&&1<<S-1}var C=se(x)+1,w=1<<C,T=w-x;for(T&T-1&&K(0),o[r++]=se(T)+1,n=0;n<r;++n){var S=o[n];++s[o[n]=S&&C+1-S]}var E=new B(w<<1),D=E.subarray(0,w),O=E.subarray(w);for(c[C]=0,n=C;n>0;--n){var k=c[n];W(O,n,k,c[n-1]=k+s[n]*(1<<C-n))}for(c[0]!=w&&K(0),n=0;n<r;++n){var A=o[n];if(A){var j=c[A];W(D,n,j,c[A]=j+(1<<C-A))}}return[t,{n:O,b:C,s:D}]},le=ce(new B([81,16,99,140,49,198,24,99,12,33,196,24,99,102,102,134,70,146,4]),0,6)[1],ue=ce(new B([33,20,196,24,99,140,33,132,16,66,8,33,132,16,66,8,33,68,68,68,68,68,68,68,68,36,9]),0,6)[1],de=ce(new B([32,132,16,66,102,70,68,68,68,68,36,73,2]),0,5)[1],fe=function(e,t){for(var n=e.length,r=new U(n),i=0;i<n;++i)r[i]=t,t+=1<<e[i];return r},pe=new B(new U([0,0,0,0,16843009,50528770,134678020,202050057,269422093]).buffer,0,36),me=fe(pe,0),he=new B(new U([0,0,0,0,0,0,0,0,16843009,50528770,117769220,185207048,252579084,16]).buffer,0,53),ge=fe(he,3),_e=function(e,t,n){var r=e.length,i=t.length,a=e[r-1],o=(1<<n.b)-1,s=-n.b;a||K(0);for(var c=0,l=n.b,u=(r<<3)-8+se(a)-l,d=-1;u>s&&d<i;){var f=u>>3,p=(e[f]|e[f+1]<<8|e[f+2]<<16)>>(u&7);c=(c<<l|p)&o,t[++d]=n.s[c],u-=l=n.n[c]}(u!=s||d+1!=i)&&K(0)},ve=function(e,t,n){var r=6,i=t.length+3>>2,a=i<<1,o=i+a;_e(e.subarray(r,r+=e[0]|e[1]<<8),t.subarray(0,i),n),_e(e.subarray(r,r+=e[2]|e[3]<<8),t.subarray(i,a),n),_e(e.subarray(r,r+=e[4]|e[5]<<8),t.subarray(a,o),n),_e(e.subarray(r),t.subarray(o),n)},ye=function(e,t,n){var r,i=t.b,a=e[i],o=a>>1&3;t.l=a&1;var s=a>>3|e[i+1]<<5|e[i+2]<<13,c=(i+=3)+s;if(o==1)return i>=e.length?void 0:(t.b=i+1,n?(W(n,e[i],t.y,t.y+=s),n):W(new B(s),e[i]));if(!(c>e.length)){if(o==0)return t.b=c,n?(n.set(e.subarray(i,c),t.y),t.y+=s,n):re(e,i,c);if(o==2){var l=e[i],u=l&3,d=l>>2&3,f=l>>4,p=0,m=0;u<2?d&1?f|=e[++i]<<4|(d&2&&e[++i]<<12):f=l>>3:(m=d,d<2?(f|=(e[++i]&63)<<4,p=e[i]>>6|e[++i]<<2):d==2?(f|=e[++i]<<4|(e[++i]&3)<<12,p=e[i]>>2|e[++i]<<6):(f|=e[++i]<<4|(e[++i]&63)<<12,p=e[i]>>6|e[++i]<<2|e[++i]<<10)),++i;var h=n?n.subarray(t.y,t.y+t.m):new B(t.m),g=h.length-f;if(u==0)h.set(e.subarray(i,i+=f),g);else if(u==1)W(h,e[i++],g);else{var _=t.h;if(u==2){var v=J(e,i);p+=i-(i=v[0]),t.h=_=v[1]}else _||K(0);(m?ve:_e)(e.subarray(i,i+=p),h.subarray(g),_)}var y=e[i++];if(y){y==255?y=(e[i++]|e[i++]<<8)+32512:y>127&&(y=y-128<<8|e[i++]);var b=e[i++];b&3&&K(0);for(var x=[ue,de,le],S=2;S>-1;--S){var C=b>>(S<<1)+2&3;if(C==1){var w=new B([0,0,e[i++]]);x[S]={s:w.subarray(2,3),n:w.subarray(0,1),t:new V(w.buffer,0,1),b:0}}else C==2?(r=ce(e,i,9-(S&1)),i=r[0],x[S]=r[1]):C==3&&(t.t||K(0),x[S]=t.t[S])}var T=t.t=x,E=T[0],D=T[1],O=T[2],k=e[c-1];k||K(0);var A=(c<<3)-8+se(k)-O.b,j=A>>3,M=0,ee=(e[j]|e[j+1]<<8)>>(A&7)&(1<<O.b)-1;j=(A-=D.b)>>3;var te=(e[j]|e[j+1]<<8)>>(A&7)&(1<<D.b)-1;j=(A-=E.b)>>3;var N=(e[j]|e[j+1]<<8)>>(A&7)&(1<<E.b)-1;for(++y;--y;){var P=O.s[ee],F=O.n[ee],I=E.s[N],ne=E.n[N],L=D.s[te],R=D.n[te];j=(A-=L)>>3;var z=1<<L,H=z+((e[j]|e[j+1]<<8|e[j+2]<<16|e[j+3]<<24)>>>(A&7)&z-1);j=(A-=he[I])>>3;var U=ge[I]+((e[j]|e[j+1]<<8|e[j+2]<<16)>>(A&7)&(1<<he[I])-1);j=(A-=pe[P])>>3;var G=me[P]+((e[j]|e[j+1]<<8|e[j+2]<<16)>>(A&7)&(1<<pe[P])-1);if(j=(A-=F)>>3,ee=O.t[ee]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<F)-1),j=(A-=ne)>>3,N=E.t[N]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<ne)-1),j=(A-=R)>>3,te=D.t[te]+((e[j]|e[j+1]<<8)>>(A&7)&(1<<R)-1),H>3)t.o[2]=t.o[1],t.o[1]=t.o[0],t.o[0]=H-=3;else{var ie=H-(G!=0);ie?(H=ie==3?t.o[0]-1:t.o[ie],ie>1&&(t.o[2]=t.o[1]),t.o[1]=t.o[0],t.o[0]=H):H=t.o[0]}for(var S=0;S<G;++S)h[M+S]=h[g+S];M+=G,g+=G;var ae=M-H;if(ae<0){var q=-ae,oe=t.e+ae;q>U&&(q=U);for(var S=0;S<q;++S)h[M+S]=t.w[oe+S];M+=q,U-=q,ae=0}for(var S=0;S<U;++S)h[M+S]=h[ae+S];M+=U}if(M!=g)for(;g<h.length;)h[M++]=h[g++];else M=h.length;n?t.y+=M:h=re(h,0,M)}else if(n){if(t.y+=f,g)for(var S=0;S<f;++S)h[S]=h[g+S]}else g&&(h=re(h,g));return t.b=c,h}K(2)}},be=function(e,t){if(e.length==1)return e[0];for(var n=new B(t),r=0,i=0;r<e.length;++r){var a=e[r];n.set(a,i),i+=a.length}return n};function xe(e,t){for(var n=[],r=+!t,i=0,a=0;e.length;){var o=oe(e,r||t);if(typeof o==`object`){for(r?(t=null,o.w.length==o.u&&(n.push(t=o.w),a+=o.u)):(n.push(t),o.e=0);!o.l;){var s=ye(e,o,t);s||K(5),t?o.e=o.y:(n.push(s),a+=s.length,G(o.w,0,s.length),o.w.set(s,o.w.length-s.length))}i=o.b+o.c*4}else i=o;e=e.subarray(i)}return be(n,a)}async function Y(e={}){var t,n=e,r=!1,i=`./this.program`,a=(e,t)=>{throw t},o,s,c=console.log.bind(console),l=console.error.bind(console),u,d=!1,f,p=e=>e.startsWith(`file://`),m,h,g,_,v,y,b,x,S,C,w=!1;function T(){var e=wr.buffer;g=new Int8Array(e),v=new Int16Array(e),n.HEAPU8=_=new Uint8Array(e),y=new Uint16Array(e),b=new Int32Array(e),x=new Uint32Array(e),S=new Float32Array(e),C=new Float64Array(e)}function E(){w=!0,!n.noFSInit&&!Y.initialized&&Y.init(),q.init(),kr.S(),Y.ignorePermissions=!1}function D(e){e=`Aborted(`+e+`)`,l(e),d=!0,e+=`. Build with -sASSERTIONS for more info.`,w&&hr();var t=new WebAssembly.RuntimeError(e);throw h?.(t),t}var O;let k=()=>``;function A(e){if(e==O&&u)return new Uint8Array(u);if(s)return s(e);throw`both async and sync fetching of the wasm failed`}async function j(e){if(!u)try{var t=await o(e);return new Uint8Array(t)}catch{}return A(e)}async function M(e,t){try{var n=await j(e);return await WebAssembly.instantiate(n,t)}catch(e){l(`failed to asynchronously prepare wasm: ${e}`),D(e)}}async function ee(e,t,n){if(!e&&!p(t))try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){l(`wasm streaming compile failed: ${e}`),l(`falling back to ArrayBuffer instantiation`)}return M(t,n)}function te(){return{a:Dr}}async function N(){function e(e,t){return kr=e.exports,Er(kr),T(),kr}function t(t){return e(t.instance)}var n=te();return O??=k(),t(await ee(u,O,n))}var P,F;class I{name=`ExitStatus`;constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var ne=globalThis.TextDecoder&&new TextDecoder,L=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},R=(e,t=0,n,r)=>{var i=L(e,t,n,r);if(i-t>16&&e.buffer&&ne)return ne.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},z=(e,t,n)=>e?R(_,e,t,n):``,B=(e,t,n,r)=>D(`Assertion failed: ${z(e)}, at: `+[t?z(t):`unknown filename`,n,r?z(r):`unknown function`]),V={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=V.isAbs(e),n=e.slice(-1)===`/`;return e=V.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=V.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,-1),n+r)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>V.normalize(e.join(`/`)),join2:(e,t)=>V.normalize(e+`/`+t)},H=()=>e=>crypto.getRandomValues(e),U=e=>{(U=H())(e)},re={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:Y.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=V.isAbs(i)}return t=V.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=re.resolve(e).slice(1),t=re.resolve(t).slice(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},W=[],G=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},ie=(e,t,n,r)=>{if(!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++]=s}else if(s<=2047){if(n+1>=a)break;t[n++]=192|s>>6,t[n++]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++]=224|s>>12,t[n++]=128|s>>6&63,t[n++]=128|s&63}else{if(n+3>=a)break;t[n++]=240|s>>18,t[n++]=128|s>>12&63,t[n++]=128|s>>6&63,t[n++]=128|s&63,o++}}return t[n]=0,n-i},K=(e,t,n)=>{var r=n>0?n:G(e)+1,i=Array(r),a=ie(e,i,0,i.length);return t&&(i.length=a),i},ae=()=>{if(!W.length){var e=null;if(!e)return null;W=K(e,!0)}return W.shift()},q={ttys:[],init(){},shutdown(){},register(e,t){q.ttys[e]={input:[],output:[],ops:t},Y.registerDevice(e,q.stream_ops)},stream_ops:{open(e){var t=q.ttys[e.node.rdev];if(!t)throw new Y.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new Y.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new Y.ErrnoError(29)}if(s===void 0&&a===0)throw new Y.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new Y.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new Y.ErrnoError(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return ae()},put_char(e,t){t===null||t===10?(c(R(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(c(R(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(l(R(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(l(R(e.output)),e.output=[])}}},oe=(e,t)=>_.fill(0,e,e+t),se=(e,t)=>Math.ceil(e/t)*t,ce=e=>{e=se(e,65536);var t=pr(65536,e);return t&&oe(t,e),t},J={ops_table:null,mount(e){return J.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(Y.isBlkdev(n)||Y.isFIFO(n))throw new Y.ErrnoError(63);J.ops_table||={dir:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,lookup:J.node_ops.lookup,mknod:J.node_ops.mknod,rename:J.node_ops.rename,unlink:J.node_ops.unlink,rmdir:J.node_ops.rmdir,readdir:J.node_ops.readdir,symlink:J.node_ops.symlink},stream:{llseek:J.stream_ops.llseek}},file:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:{llseek:J.stream_ops.llseek,read:J.stream_ops.read,write:J.stream_ops.write,mmap:J.stream_ops.mmap,msync:J.stream_ops.msync}},link:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr,readlink:J.node_ops.readlink},stream:{}},chrdev:{node:{getattr:J.node_ops.getattr,setattr:J.node_ops.setattr},stream:Y.chrdev_stream_ops}};var i=Y.createNode(e,t,n,r);return Y.isDir(i.mode)?(i.node_ops=J.ops_table.dir.node,i.stream_ops=J.ops_table.dir.stream,i.contents={}):Y.isFile(i.mode)?(i.node_ops=J.ops_table.file.node,i.stream_ops=J.ops_table.file.stream,i.usedBytes=0,i.contents=null):Y.isLink(i.mode)?(i.node_ops=J.ops_table.link.node,i.stream_ops=J.ops_table.link.stream):Y.isChrdev(i.mode)&&(i.node_ops=J.ops_table.chrdev.node,i.stream_ops=J.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[t]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n!=0&&(t=Math.max(t,256));var r=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(r.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=Y.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,Y.isDir(e.mode)?t.size=4096:Y.isFile(e.mode)?t.size=e.usedBytes:Y.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(let n of[`mode`,`atime`,`mtime`,`ctime`])t[n]!=null&&(e[n]=t[n]);t.size!==void 0&&J.resizeFileStorage(e,t.size)},lookup(e,t){throw J.doesNotExistError||(J.doesNotExistError=new Y.ErrnoError(44),J.doesNotExistError.stack=`<generic error, no stack>`),J.doesNotExistError},mknod(e,t,n,r){return J.createNode(e,t,n,r)},rename(e,t,n){var r;try{r=Y.lookupNode(t,n)}catch{}if(r){if(Y.isDir(e.mode))for(var i in r.contents)throw new Y.ErrnoError(55);Y.hashRemoveNode(r)}delete e.parent.contents[e.name],t.contents[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){for(var n in Y.lookupNode(e,t).contents)throw new Y.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir(e){return[`.`,`..`,...Object.keys(e.contents)]},symlink(e,t,n){var r=J.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!Y.isLink(e.mode))throw new Y.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);if(o>8&&a.subarray)t.set(a.subarray(i,i+o),n);else for(var s=0;s<o;s++)t[n+s]=a[i+s];return o},write(e,t,n,r,i,a){if(t.buffer===g.buffer&&(a=!1),!r)return 0;var o=e.node;if(o.mtime=o.ctime=Date.now(),t.subarray&&(!o.contents||o.contents.subarray)){if(a)return o.contents=t.subarray(n,n+r),o.usedBytes=r,r;if(o.usedBytes===0&&i===0)return o.contents=t.slice(n,n+r),o.usedBytes=r,r;if(i+r<=o.usedBytes)return o.contents.set(t.subarray(n,n+r),i),r}if(J.expandFileStorage(o,i+r),o.contents.subarray&&t.subarray)o.contents.set(t.subarray(n,n+r),i);else for(var s=0;s<r;s++)o.contents[i+s]=t[n+s];return o.usedBytes=Math.max(o.usedBytes,i+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&Y.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new Y.ErrnoError(28);return r},mmap(e,t,n,r,i){if(!Y.isFile(e.node.mode))throw new Y.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s&&s.buffer===g.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=ce(t),!a)throw new Y.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),g.set(s,a))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return J.stream_ops.write(e,t,0,r,n,!1),0}}},le=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(typeof t>`u`)throw Error(`Unknown file open mode: ${e}`);return t},ue=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},de=async e=>{var t=await o(e);return new Uint8Array(t)},fe=(...e)=>Y.createDataFile(...e),pe=e=>e,me=0,he=null,ge=e=>{if(me--,me==0&&he){var t=he;he=null,t()}},_e=e=>{me++},ve=[],ye=async(e,t)=>{typeof Browser<`u`&&Browser.init();for(var n of ve)if(n.canHandle(t))return n.handle(e,t);return e},be=async(e,t,n,r,i,a,o,s)=>{var c=t?re.resolve(V.join2(e,t)):e,l=pe(`cp ${c}`);_e(l);try{var u=n;typeof n==`string`&&(u=await de(n)),u=await ye(u,c),s?.(),a||fe(e,t,u,r,i,o)}finally{ge(l)}},xe=(e,t,n,r,i,a,o,s,c,l)=>{be(e,t,n,r,i,s,c,l).then(a).catch(o)},Y={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:`/`,initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name=`ErrnoError`;constructor(e){this.errno=e}},FSStream:class{shared={};get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!=1}get isWrite(){return(this.flags&2097155)!=0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.id=Y.nextInode++,this.name=t,this.mode=n,this.rdev=r,this.atime=this.mtime=this.ctime=Date.now()}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return Y.isDir(this.mode)}get isDevice(){return Y.isChrdev(this.mode)}},lookupPath(e,t={}){if(!e)throw new Y.ErrnoError(44);t.follow_mount??=!0,V.isAbs(e)||(e=Y.cwd()+`/`+e);e:for(var n=0;n<40;n++){for(var r=e.split(`/`).filter(e=>!!e),i=Y.root,a=`/`,o=0;o<r.length;o++){var s=o===r.length-1;if(s&&t.parent)break;if(r[o]!==`.`){if(r[o]===`..`){if(a=V.dirname(a),Y.isRoot(i)){e=a+`/`+r.slice(o+1).join(`/`),n--;continue e}else i=i.parent;continue}a=V.join2(a,r[o]);try{i=Y.lookupNode(i,r[o])}catch(e){if(e?.errno===44&&s&&t.noent_okay)return{path:a};throw e}if(Y.isMountpoint(i)&&(!s||t.follow_mount)&&(i=i.mounted.root),Y.isLink(i.mode)&&(!s||t.follow)){if(!i.node_ops.readlink)throw new Y.ErrnoError(52);var c=i.node_ops.readlink(i);V.isAbs(c)||(c=V.dirname(a)+`/`+c),e=c+`/`+r.slice(o+1).join(`/`);continue e}}}return{path:a,node:i}}throw new Y.ErrnoError(32)},getPath(e){for(var t;;){if(Y.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%Y.nameTable.length},hashAddNode(e){var t=Y.hashName(e.parent.id,e.name);e.name_next=Y.nameTable[t],Y.nameTable[t]=e},hashRemoveNode(e){var t=Y.hashName(e.parent.id,e.name);if(Y.nameTable[t]===e)Y.nameTable[t]=e.name_next;else for(var n=Y.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=Y.mayLookup(e);if(n)throw new Y.ErrnoError(n);for(var r=Y.hashName(e.id,t),i=Y.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return Y.lookup(e,t)},createNode(e,t,n,r){var i=new Y.FSNode(e,t,n,r);return Y.hashAddNode(i),i},destroyNode(e){Y.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return Y.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return Y.isDir(e.mode)?Y.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){if(!Y.isDir(e.mode))return 54;try{return Y.lookupNode(e,t),20}catch{}return Y.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=Y.lookupNode(e,t)}catch(e){return e.errno}var i=Y.nodePermissions(e,`wx`);if(i)return i;if(n){if(!Y.isDir(r.mode))return 54;if(Y.isRoot(r)||Y.getPath(r)===Y.cwd())return 10}else if(Y.isDir(r.mode))return 31;return 0},mayOpen(e,t){if(!e)return 44;if(Y.isLink(e.mode))return 32;var n=Y.flagsToPermissionString(t);return Y.isDir(e.mode)&&(n!==`r`||t&576)?31:Y.nodePermissions(e,n)},checkOpExists(e,t){if(!e)throw new Y.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=Y.MAX_OPEN_FDS;e++)if(!Y.streams[e])return e;throw new Y.ErrnoError(33)},getStreamChecked(e){var t=Y.getStream(e);if(!t)throw new Y.ErrnoError(8);return t},getStream:e=>Y.streams[e],createStream(e,t=-1){return e=Object.assign(new Y.FSStream,e),t==-1&&(t=Y.nextfd()),e.fd=t,Y.streams[t]=e,e},closeStream(e){Y.streams[e]=null},dupStream(e,t=-1){var n=Y.createStream(e,t);return n.stream_ops?.dup?.(n),n},doSetAttr(e,t,n){var r=e?.stream_ops.setattr,i=r?e:t;r??=t.node_ops.setattr,Y.checkOpExists(r,63),r(i,n)},chrdev_stream_ops:{open(e){e.stream_ops=Y.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new Y.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){Y.devices[e]={stream_ops:t}},getDevice:e=>Y.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),Y.syncFSRequests++,Y.syncFSRequests>1&&l(`warning: ${Y.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=Y.getMounts(Y.root.mount),r=0;function i(e){return Y.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}for(var o of n)o.type.syncfs?o.type.syncfs(o,e,a):a(null)},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&Y.root)throw new Y.ErrnoError(10);if(!r&&!i){var o=Y.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,Y.isMountpoint(a))throw new Y.ErrnoError(10);if(!Y.isDir(a.mode))throw new Y.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?Y.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=Y.lookupPath(e,{follow_mount:!1});if(!Y.isMountpoint(t.node))throw new Y.ErrnoError(28);var n=t.node,r=n.mounted,i=Y.getMounts(r);for(var[a,o]of Object.entries(Y.nameTable))for(;o;){var s=o.name_next;i.includes(o.mount)&&Y.destroyNode(o),o=s}n.mounted=null;var c=n.mount.mounts.indexOf(r);n.mount.mounts.splice(c,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=Y.lookupPath(e,{parent:!0}).node,i=V.basename(e);if(!i)throw new Y.ErrnoError(28);if(i===`.`||i===`..`)throw new Y.ErrnoError(20);var a=Y.mayCreate(r,i);if(a)throw new Y.ErrnoError(a);if(!r.node_ops.mknod)throw new Y.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},statfs(e){return Y.statfsNode(Y.lookupPath(e,{follow:!0}).node)},statfsStream(e){return Y.statfsNode(e.node)},statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:Y.nextInode,ffree:Y.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create(e,t=438){return t&=4095,t|=32768,Y.mknod(e,t,0)},mkdir(e,t=511){return t&=1023,t|=16384,Y.mknod(e,t,0)},mkdirTree(e,t){var n=e.split(`/`),r=``;for(var i of n)if(i){(r||V.isAbs(e))&&(r+=`/`),r+=i;try{Y.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return typeof n>`u`&&(n=t,t=438),t|=8192,Y.mknod(e,t,n)},symlink(e,t){if(!re.resolve(e))throw new Y.ErrnoError(44);var n=Y.lookupPath(t,{parent:!0}).node;if(!n)throw new Y.ErrnoError(44);var r=V.basename(t),i=Y.mayCreate(n,r);if(i)throw new Y.ErrnoError(i);if(!n.node_ops.symlink)throw new Y.ErrnoError(63);return n.node_ops.symlink(n,r,e)},rename(e,t){var n=V.dirname(e),r=V.dirname(t),i=V.basename(e),a=V.basename(t),o,s,c;if(o=Y.lookupPath(e,{parent:!0}),s=o.node,o=Y.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new Y.ErrnoError(44);if(s.mount!==c.mount)throw new Y.ErrnoError(75);var l=Y.lookupNode(s,i),u=re.relative(e,r);if(u.charAt(0)!==`.`)throw new Y.ErrnoError(28);if(u=re.relative(t,n),u.charAt(0)!==`.`)throw new Y.ErrnoError(55);var d;try{d=Y.lookupNode(c,a)}catch{}if(l!==d){var f=Y.isDir(l.mode),p=Y.mayDelete(s,i,f);if(p||(p=d?Y.mayDelete(c,a,f):Y.mayCreate(c,a),p))throw new Y.ErrnoError(p);if(!s.node_ops.rename)throw new Y.ErrnoError(63);if(Y.isMountpoint(l)||d&&Y.isMountpoint(d))throw new Y.ErrnoError(10);if(c!==s&&(p=Y.nodePermissions(s,`w`),p))throw new Y.ErrnoError(p);Y.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{Y.hashAddNode(l)}}},rmdir(e){var t=Y.lookupPath(e,{parent:!0}).node,n=V.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!0);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.rmdir)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.rmdir(t,n),Y.destroyNode(r)},readdir(e){var t=Y.lookupPath(e,{follow:!0}).node;return Y.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=Y.lookupPath(e,{parent:!0}).node;if(!t)throw new Y.ErrnoError(44);var n=V.basename(e),r=Y.lookupNode(t,n),i=Y.mayDelete(t,n,!1);if(i)throw new Y.ErrnoError(i);if(!t.node_ops.unlink)throw new Y.ErrnoError(63);if(Y.isMountpoint(r))throw new Y.ErrnoError(10);t.node_ops.unlink(t,n),Y.destroyNode(r)},readlink(e){var t=Y.lookupPath(e).node;if(!t)throw new Y.ErrnoError(44);if(!t.node_ops.readlink)throw new Y.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var n=Y.lookupPath(e,{follow:!t}).node;return Y.checkOpExists(n.node_ops.getattr,63)(n)},fstat(e){var t=Y.getStreamChecked(e),n=t.node,r=t.stream_ops.getattr,i=r?t:n;return r??=n.node_ops.getattr,Y.checkOpExists(r,63),r(i)},lstat(e){return Y.stat(e,!0)},doChmod(e,t,n,r){Y.doSetAttr(e,t,{mode:n&4095|t.mode&-4096,ctime:Date.now(),dontFollow:r})},chmod(e,t,n){var r=typeof e==`string`?Y.lookupPath(e,{follow:!n}).node:e;Y.doChmod(null,r,t,n)},lchmod(e,t){Y.chmod(e,t,!0)},fchmod(e,t){var n=Y.getStreamChecked(e);Y.doChmod(n,n.node,t,!1)},doChown(e,t,n){Y.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:n})},chown(e,t,n,r){var i=typeof e==`string`?Y.lookupPath(e,{follow:!r}).node:e;Y.doChown(null,i,r)},lchown(e,t,n){Y.chown(e,t,n,!0)},fchown(e,t,n){var r=Y.getStreamChecked(e);Y.doChown(r,r.node,!1)},doTruncate(e,t,n){if(Y.isDir(t.mode))throw new Y.ErrnoError(31);if(!Y.isFile(t.mode))throw new Y.ErrnoError(28);var r=Y.nodePermissions(t,`w`);if(r)throw new Y.ErrnoError(r);Y.doSetAttr(e,t,{size:n,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new Y.ErrnoError(28);var n=typeof e==`string`?Y.lookupPath(e,{follow:!0}).node:e;Y.doTruncate(null,n,t)},ftruncate(e,t){var n=Y.getStreamChecked(e);if(t<0||!(n.flags&2097155))throw new Y.ErrnoError(28);Y.doTruncate(n,n.node,t)},utime(e,t,n){var r=Y.lookupPath(e,{follow:!0}).node;Y.checkOpExists(r.node_ops.setattr,63)(r,{atime:t,mtime:n})},open(e,t,n=438){if(e===``)throw new Y.ErrnoError(44);t=typeof t==`string`?le(t):t,n=t&64?n&4095|32768:0;var r,i;if(typeof e==`object`)r=e;else{i=e.endsWith(`/`);var a=Y.lookupPath(e,{follow:!(t&131072),noent_okay:!0});r=a.node,e=a.path}var o=!1;if(t&64)if(r){if(t&128)throw new Y.ErrnoError(20)}else{if(i)throw new Y.ErrnoError(31);r=Y.mknod(e,n|511,0),o=!0}if(!r)throw new Y.ErrnoError(44);if(Y.isChrdev(r.mode)&&(t&=-513),t&65536&&!Y.isDir(r.mode))throw new Y.ErrnoError(54);if(!o){var s=Y.mayOpen(r,t);if(s)throw new Y.ErrnoError(s)}t&512&&!o&&Y.truncate(r,0),t&=-131713;var c=Y.createStream({node:r,path:Y.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o&&Y.chmod(r,n&511),c},close(e){if(Y.isClosed(e))throw new Y.ErrnoError(8);e.getdents&&=null;try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{Y.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(Y.isClosed(e))throw new Y.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new Y.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new Y.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||(e.flags&2097155)==1)throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.read)throw new Y.ErrnoError(28);var a=typeof i<`u`;if(!a)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new Y.ErrnoError(28);if(Y.isClosed(e)||!(e.flags&2097155))throw new Y.ErrnoError(8);if(Y.isDir(e.node.mode))throw new Y.ErrnoError(31);if(!e.stream_ops.write)throw new Y.ErrnoError(28);e.seekable&&e.flags&1024&&Y.llseek(e,0,2);var o=typeof i<`u`;if(!o)i=e.position;else if(!e.seekable)throw new Y.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new Y.ErrnoError(2);if(!e.stream_ops.mmap)throw new Y.ErrnoError(43);if(!t)throw new Y.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new Y.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){t.flags=t.flags||0,t.encoding=t.encoding||`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`&&D(`Invalid encoding type "${t.encoding}"`);var n=Y.open(e,t.flags),r=Y.stat(e).size,i=new Uint8Array(r);return Y.read(n,i,0,r,0),t.encoding===`utf8`&&(i=R(i)),Y.close(n),i},writeFile(e,t,n={}){n.flags=n.flags||577;var r=Y.open(e,n.flags,n.mode);typeof t==`string`&&(t=new Uint8Array(K(t,!0))),ArrayBuffer.isView(t)?Y.write(r,t,0,t.byteLength,void 0,n.canOwn):D(`Unsupported data type`),Y.close(r)},cwd:()=>Y.currentPath,chdir(e){var t=Y.lookupPath(e,{follow:!0});if(t.node===null)throw new Y.ErrnoError(44);if(!Y.isDir(t.node.mode))throw new Y.ErrnoError(54);var n=Y.nodePermissions(t.node,`x`);if(n)throw new Y.ErrnoError(n);Y.currentPath=t.path},createDefaultDirectories(){Y.mkdir(`/tmp`),Y.mkdir(`/home`),Y.mkdir(`/home/web_user`)},createDefaultDevices(){Y.mkdir(`/dev`),Y.registerDevice(Y.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),Y.mkdev(`/dev/null`,Y.makedev(1,3)),q.register(Y.makedev(5,0),q.default_tty_ops),q.register(Y.makedev(6,0),q.default_tty1_ops),Y.mkdev(`/dev/tty`,Y.makedev(5,0)),Y.mkdev(`/dev/tty1`,Y.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(U(e),t=e.byteLength),e[--t]);Y.createDevice(`/dev`,`random`,n),Y.createDevice(`/dev`,`urandom`,n),Y.mkdir(`/dev/shm`),Y.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){Y.mkdir(`/proc`);var e=Y.mkdir(`/proc/self`);Y.mkdir(`/proc/self/fd`),Y.mount({mount(){var t=Y.createNode(e,`fd`,16895,73);return t.stream_ops={llseek:J.stream_ops.llseek},t.node_ops={lookup(e,t){var n=+t,r=Y.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path},id:n+1};return i.parent=i,i},readdir(){return Array.from(Y.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?Y.createDevice(`/dev`,`stdin`,e):Y.symlink(`/dev/tty`,`/dev/stdin`),t?Y.createDevice(`/dev`,`stdout`,null,t):Y.symlink(`/dev/tty`,`/dev/stdout`),n?Y.createDevice(`/dev`,`stderr`,null,n):Y.symlink(`/dev/tty1`,`/dev/stderr`),Y.open(`/dev/stdin`,0),Y.open(`/dev/stdout`,1),Y.open(`/dev/stderr`,1)},staticInit(){Y.nameTable=Array(4096),Y.mount(J,{},`/`),Y.createDefaultDirectories(),Y.createDefaultDevices(),Y.createSpecialDirectories(),Y.filesystems={MEMFS:J}},init(e,t,n){Y.initialized=!0,Y.createStandardStreams(e,t,n)},quit(){Y.initialized=!1;for(var e of Y.streams)e&&Y.close(e)},findObject(e,t){var n=Y.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=Y.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=Y.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=V.basename(e),n=Y.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:Y.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=V.join2(e,a);try{Y.mkdir(o)}catch(e){if(e.errno!=20)throw e}e=o}}return o},createFile(e,t,n,r,i){var a=V.join2(typeof e==`string`?e:Y.getPath(e),t),o=ue(r,i);return Y.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:Y.getPath(e),o=t?V.join2(e,t):e);var s=ue(r,i),c=Y.create(o,s);if(n){if(typeof n==`string`){for(var l=Array(n.length),u=0,d=n.length;u<d;++u)l[u]=n.charCodeAt(u);n=l}Y.chmod(c,s|146);var f=Y.open(c,577);Y.write(f,n,0,n.length,0,a),Y.close(f),Y.chmod(c,s)}},createDevice(e,t,n,r){var i=V.join2(typeof e==`string`?e:Y.getPath(e),t),a=ue(!!n,!!r);Y.createDevice.major??=64;var o=Y.makedev(Y.createDevice.major++,0);return Y.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new Y.ErrnoError(29)}if(c===void 0&&o===0)throw new Y.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.atime=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new Y.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),Y.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)D(`Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.`);else try{e.contents=s(e.url)}catch{throw new Y.ErrnoError(29)}},createLazyFile(e,t,n,i,a){class o{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open(`HEAD`,n,!1),e.send(null),e.status>=200&&e.status<300||e.status===304||D(`Couldn't load `+n+`. Status: `+e.status);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1024*1024;i||(o=t);var s=(e,r)=>{e>r&&D(`invalid range (`+e+`, `+r+`) or no bytes requested!`),r>t-1&&D(`only `+t+` bytes available! programmer error!`);var i=new XMLHttpRequest;return i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=`+e+`-`+r),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),i.status>=200&&i.status<300||i.status===304||D(`Couldn't load `+n+`. Status: `+i.status),i.response===void 0?K(i.responseText||``,!0):new Uint8Array(i.response||[])},l=this;l.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;return r=Math.min(r,t-1),typeof l.chunks[e]>`u`&&(l.chunks[e]=s(n,r)),typeof l.chunks[e]>`u`&&D(`doXHR failed!`),l.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,c(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){r||D(`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`);var s={isDevice:!1,contents:new o}}else var s={isDevice:!1,url:n};var l=Y.createFile(e,t,s,i,a);s.contents?l.contents=s.contents:s.url&&(l.contents=null,l.url=s.url),Object.defineProperties(l,{usedBytes:{get:function(){return this.contents.length}}});var u={};for(let[e,t]of Object.entries(l.stream_ops))u[e]=(...e)=>(Y.forceLoadFile(l),t(...e));function d(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return u.read=(e,t,n,r,i)=>(Y.forceLoadFile(l),d(e,t,n,r,i)),u.mmap=(e,t,n,r,i)=>{Y.forceLoadFile(l);var a=ce(t);if(!a)throw new Y.ErrnoError(48);return d(e,g,a,t,n),{ptr:a,allocated:!0}},l.stream_ops=u,l}},X={calculateAt(e,t,n){if(V.isAbs(t))return t;var r=e===-100?Y.cwd():X.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new Y.ErrnoError(44);return r}return r+`/`+t},writeStat(e,t){x[e>>2]=t.dev,x[e+4>>2]=t.mode,x[e+8>>2]=t.nlink,x[e+12>>2]=t.uid,x[e+16>>2]=t.gid,x[e+20>>2]=t.rdev,F=[t.size>>>0,(P=t.size,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+24>>2]=F[0],b[e+28>>2]=F[1],b[e+32>>2]=4096,b[e+36>>2]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return F=[Math.floor(n/1e3)>>>0,(P=Math.floor(n/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+40>>2]=F[0],b[e+44>>2]=F[1],x[e+48>>2]=n%1e3*1e3*1e3,F=[Math.floor(r/1e3)>>>0,(P=Math.floor(r/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+56>>2]=F[0],b[e+60>>2]=F[1],x[e+64>>2]=r%1e3*1e3*1e3,F=[Math.floor(i/1e3)>>>0,(P=Math.floor(i/1e3),+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+72>>2]=F[0],b[e+76>>2]=F[1],x[e+80>>2]=i%1e3*1e3*1e3,F=[t.ino>>>0,(P=t.ino,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+88>>2]=F[0],b[e+92>>2]=F[1],0},writeStatFs(e,t){x[e+4>>2]=t.bsize,x[e+60>>2]=t.bsize,F=[t.blocks>>>0,(P=t.blocks,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+8>>2]=F[0],b[e+12>>2]=F[1],F=[t.bfree>>>0,(P=t.bfree,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+16>>2]=F[0],b[e+20>>2]=F[1],F=[t.bavail>>>0,(P=t.bavail,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+24>>2]=F[0],b[e+28>>2]=F[1],F=[t.files>>>0,(P=t.files,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+32>>2]=F[0],b[e+36>>2]=F[1],F=[t.ffree>>>0,(P=t.ffree,+Math.abs(P)>=1?P>0?Math.floor(P/4294967296)>>>0:~~+Math.ceil((P-+(~~P>>>0))/4294967296)>>>0:0)],b[e+40>>2]=F[0],b[e+44>>2]=F[1],x[e+48>>2]=t.fsid,x[e+64>>2]=t.flags,x[e+56>>2]=t.namelen},doMsync(e,t,n,r,i){if(!Y.isFile(t.node.mode))throw new Y.ErrnoError(43);if(r&2)return 0;var a=_.slice(e,e+n);Y.msync(t,a,i,n,r)},getStreamFromFD(e){return Y.getStreamChecked(e)},varargs:void 0,getStr(e){return z(e)}};function Se(e,t,n,r){try{if(t=X.getStr(t),t=X.calculateAt(e,t),n&-8)return-28;var i=Y.lookupPath(t,{follow:!0}).node;if(!i)return-44;var a=``;return n&4&&(a+=`r`),n&2&&(a+=`w`),n&1&&(a+=`x`),a&&Y.nodePermissions(i,a)?-2:0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var Ce=()=>{var e=b[X.varargs>>2];return X.varargs+=4,e},we=Ce;function Te(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 0:var i=Ce();if(i<0)return-28;for(;Y.streams[i];)i++;var a;return a=Y.dupStream(r,i),a.fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=Ce();return r.flags|=i,0;case 12:var i=we(),o=0;return v[i+o>>1]=2,0;case 13:case 14:return 0}return-28}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ee(e,t){try{return X.writeStat(t,Y.fstat(e))}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function De(e,t,n){X.varargs=n;try{var r=X.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=we();b[a>>2]=i.c_iflag||0,b[a+4>>2]=i.c_oflag||0,b[a+8>>2]=i.c_cflag||0,b[a+12>>2]=i.c_lflag||0;for(var o=0;o<32;o++)g[a+o+17]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=we(),s=b[a>>2],c=b[a+4>>2],l=b[a+8>>2],u=b[a+12>>2],d=[],o=0;o<32;o++)d.push(g[a+o+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:if(!r.tty)return-59;var a=we();return b[a>>2]=0,0;case 21520:return r.tty?-28:-59;case 21537:case 21531:var a=we();return Y.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty),a=we();v[a>>1]=f[0],v[a+2>>1]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Oe(e,t,n,r){X.varargs=r;try{t=X.getStr(t),t=X.calculateAt(e,t);var i=r?Ce():0;return Y.open(t,n,i).fd}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var ke=(e,t,n)=>ie(e,_,t,n);function Ae(e,t,n,r){try{if(t=X.getStr(t),t=X.calculateAt(e,t),r<=0)return-28;var i=Y.readlink(t),a=Math.min(r,G(i)),o=g[n+a];return ke(i,n,r+1),g[n+a]=o,a}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function je(e){try{return e=X.getStr(e),Y.rmdir(e),0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}function Me(e,t,n){try{if(t=X.getStr(t),t=X.calculateAt(e,t),!n)Y.unlink(t);else if(n===512)Y.rmdir(t);else return-28;return 0}catch(e){if(typeof Y>`u`||e.name!==`ErrnoError`)throw e;return-e.errno}}var Ne=()=>Cr,Z=e=>{var t=e.getArg(Ne(),0);return xr(t)},Pe=()=>vr(),Fe=e=>gr(e),Ie=e=>_r(e),Le=e=>{var t=Pe(),n=Ie(4),r=Ie(4);Sr(e,n,r);var i=x[n>>2],a=x[r>>2],o=z(i);fr(i);var s;return a&&(s=z(a),fr(a)),Fe(t),[o,s]},Re=e=>Le(Z(e)),ze=e=>{var t=new WebAssembly.Exception(Ne(),[e],{traceStack:!0});throw t.message=Re(t),t},Be=()=>D(``),Ve=(e,t,n,r,i)=>{},Q=e=>{for(var t=``;;){var n=_[e++];if(!n)return t;t+=String.fromCharCode(n)}},He={},Ue={},We={},Ge=class extends Error{constructor(e){super(e),this.name=`BindingError`}},$=e=>{throw new Ge(e)};function Ke(e,t,n={}){var r=t.name;if(e||$(`type "${r}" must have a positive integer typeid pointer`),Ue.hasOwnProperty(e)){if(n.ignoreDuplicateRegistrations)return;$(`Cannot register type '${r}' twice`)}if(Ue[e]=t,delete We[e],He.hasOwnProperty(e)){var i=He[e];delete He[e],i.forEach(e=>e())}}function qe(e,t,n={}){return Ke(e,t,n)}var Je=(e,t,n,r)=>{t=Q(t),qe(e,{name:t,fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:r},readValueFromPointer:function(e){return this.fromWireType(_[e])},destructorFunction:null})},Ye=e=>({count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}),Xe=e=>{function t(e){return e.$$.ptrType.registeredClass.name}$(t(e)+` instance already deleted`)},Ze=!1,Qe=e=>{},$e=e=>{e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)},et=e=>{--e.count.value,e.count.value===0&&$e(e)},tt=e=>globalThis.FinalizationRegistry?(Ze=new FinalizationRegistry(e=>{et(e.$$)}),tt=e=>{var t=e.$$;if(t.smartPtr){var n={$$:t};Ze.register(e,n,e)}return e},Qe=e=>Ze.unregister(e),tt(e)):(tt=e=>e,e),nt=[],rt=()=>{for(;nt.length;){var e=nt.pop();e.$$.deleteScheduled=!1,e.delete()}},it,at=()=>{let e=ot.prototype;Object.assign(e,{isAliasOf(e){if(!(this instanceof ot)||!(e instanceof ot))return!1;var t=this.$$.ptrType.registeredClass,n=this.$$.ptr;e.$$=e.$$;for(var r=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)n=t.upcast(n),t=t.baseClass;for(;r.baseClass;)i=r.upcast(i),r=r.baseClass;return t===r&&n===i},clone(){if(this.$$.ptr||Xe(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=tt(Object.create(Object.getPrototypeOf(this),{$$:{value:Ye(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e},delete(){this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$(`Object already scheduled for deletion`),Qe(this),et(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Xe(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&$(`Object already scheduled for deletion`),nt.push(this),nt.length===1&&it&&it(rt),this.$$.deleteScheduled=!0,this}});let t=Symbol.dispose;t&&(e[t]=e.delete)};function ot(){}var st=(e,t)=>Object.defineProperty(t,`name`,{value:e}),ct={},lt=(e,t,n)=>{if(e[t].overloadTable===void 0){var r=e[t];e[t]=function(...r){return e[t].overloadTable.hasOwnProperty(r.length)||$(`Function '${n}' called with an invalid number of arguments (${r.length}) - expects one of (${e[t].overloadTable})!`),e[t].overloadTable[r.length].apply(this,r)},e[t].overloadTable=[],e[t].overloadTable[r.argCount]=r}},ut=(e,t,r)=>{n.hasOwnProperty(e)?((r===void 0||n[e].overloadTable!==void 0&&n[e].overloadTable[r]!==void 0)&&$(`Cannot register public name '${e}' twice`),lt(n,e,e),n[e].overloadTable.hasOwnProperty(r)&&$(`Cannot register multiple overloads of a function with the same number of arguments (${r})!`),n[e].overloadTable[r]=t):(n[e]=t,n[e].argCount=r)},dt=48,ft=57,pt=e=>{e=e.replace(/[^a-zA-Z0-9_]/g,`$`);var t=e.charCodeAt(0);return t>=dt&&t<=ft?`_${e}`:e};function mt(e,t,n,r,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=n,this.rawDestructor=r,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}var ht=(e,t,n)=>{for(;t!==n;)t.upcast||$(`Expected null or instance of ${n.name}, got an instance of ${t.name}`),e=t.upcast(e),t=t.baseClass;return e},gt=e=>{if(e===null)return`null`;var t=typeof e;return t===`object`||t===`array`||t===`function`?e.toString():``+e};function _t(e,t){if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;t.$$||$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`);var n=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,n,this.registeredClass)}function vt(e,t){var n;if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),this.isSmartPointer?(n=this.rawConstructor(),e!==null&&e.push(this.rawDestructor,n),n):0;(!t||!t.$$)&&$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&t.$$.ptrType.isConst&&$(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);var r=t.$$.ptrType.registeredClass;if(n=ht(t.$$.ptr,r,this.registeredClass),this.isSmartPointer)switch(t.$$.smartPtr===void 0&&$(`Passing raw pointer to smart pointer is illegal`),this.sharingPolicy){case 0:t.$$.smartPtrType===this?n=t.$$.smartPtr:$(`Cannot convert argument of type ${t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:n=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)n=t.$$.smartPtr;else{var i=t.clone();n=this.rawShare(n,rn.toHandle(()=>i.delete())),e!==null&&e.push(this.rawDestructor,n)}break;default:$(`Unsupported sharing policy`)}return n}function yt(e,t){if(t===null)return this.isReference&&$(`null is not a valid ${this.name}`),0;t.$$||$(`Cannot pass "${gt(t)}" as a ${this.name}`),t.$$.ptr||$(`Cannot pass deleted object as a pointer of type ${this.name}`),t.$$.ptrType.isConst&&$(`Cannot convert argument of type ${t.$$.ptrType.name} to parameter type ${this.name}`);var n=t.$$.ptrType.registeredClass;return ht(t.$$.ptr,n,this.registeredClass)}function bt(e){return this.fromWireType(x[e>>2])}var xt=(e,t,n)=>{if(t===n)return e;if(n.baseClass===void 0)return null;var r=xt(e,t,n.baseClass);return r===null?null:n.downcast(r)},St={},Ct=(e,t)=>{for(t===void 0&&$(`ptr should not be undefined`);e.baseClass;)t=e.upcast(t),e=e.baseClass;return t},wt=(e,t)=>(t=Ct(e,t),St[t]),Tt=class extends Error{constructor(e){super(e),this.name=`InternalError`}},Et=e=>{throw new Tt(e)},Dt=(e,t)=>((!t.ptrType||!t.ptr)&&Et(`makeClassHandle requires ptr and ptrType`),!!t.smartPtrType!=!!t.smartPtr&&Et(`Both smartPtrType and smartPtr must be specified`),t.count={value:1},tt(Object.create(e,{$$:{value:t,writable:!0}})));function Ot(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var n=wt(this.registeredClass,t);if(n!==void 0){if(n.$$.count.value===0)return n.$$.ptr=t,n.$$.smartPtr=e,n.clone();var r=n.clone();return this.destructor(e),r}function i(){return this.isSmartPointer?Dt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Dt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a=ct[this.registeredClass.getActualType(t)];if(!a)return i.call(this);var o=this.isConst?a.constPointerType:a.pointerType,s=xt(t,this.registeredClass,o.registeredClass);return s===null?i.call(this):this.isSmartPointer?Dt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s,smartPtrType:this,smartPtr:e}):Dt(o.registeredClass.instancePrototype,{ptrType:o,ptr:s})}var kt=()=>{Object.assign(At.prototype,{getPointee(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e},destructor(e){this.rawDestructor?.(e)},readValueFromPointer:bt,fromWireType:Ot})};function At(e,t,n,r,i,a,o,s,c,l,u){this.name=e,this.registeredClass=t,this.isReference=n,this.isConst=r,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=l,this.rawDestructor=u,!i&&t.baseClass===void 0?r?(this.toWireType=_t,this.destructorFunction=null):(this.toWireType=yt,this.destructorFunction=null):this.toWireType=vt}var jt=(e,t,r)=>{n.hasOwnProperty(e)||Et(`Replacing nonexistent public symbol`),n[e].overloadTable!==void 0&&r!==void 0?n[e].overloadTable[r]=t:(n[e]=t,n[e].argCount=r)},Mt={},Nt=(e,t,n)=>{e=e.replace(/p/g,`i`);var r=Mt[e];return r(t,...n)},Pt=e=>Tr.get(e),Ft=(e,t,n=[],r=!1)=>e.includes(`j`)?Nt(e,t,n):Pt(t)(...n),It=(e,t,n=!1)=>(...r)=>Ft(e,t,r,n),Lt=(e,t,n=!1)=>{e=Q(e);function r(){return e.includes(`j`)?It(e,t):Pt(t)}var i=r();return typeof i!=`function`&&$(`unknown function pointer with signature ${e}: ${t}`),i};class Rt extends Error{}var zt=e=>{var t=ur(e),n=Q(t);return fr(t),n},Bt=(e,t)=>{var n=[],r={};function i(e){if(!r[e]&&!Ue[e]){if(We[e]){We[e].forEach(i);return}n.push(e),r[e]=!0}}throw t.forEach(i),new Rt(`${e}: `+n.map(zt).join([`, `]))},Vt=(e,t,n)=>{e.forEach(e=>We[e]=t);function r(t){var r=n(t);r.length!==e.length&&Et(`Mismatched type converter count`);for(var i=0;i<e.length;++i)qe(e[i],r[i])}var i=Array(t.length),a=[],o=0;for(let[e,n]of t.entries())Ue.hasOwnProperty(n)?i[e]=Ue[n]:(a.push(n),He.hasOwnProperty(n)||(He[n]=[]),He[n].push(()=>{i[e]=Ue[n],++o,o===a.length&&r(i)}));a.length===0&&r(i)},Ht=(e,t,n,r,i,a,o,s,c,l,u,d,f)=>{u=Q(u),a=Lt(i,a),s&&=Lt(o,s),l&&=Lt(c,l),f=Lt(d,f);var p=pt(u);ut(p,function(){Bt(`Cannot construct ${u} due to unbound types`,[r])}),Vt([e,t,n],r?[r]:[],t=>{t=t[0];var n,i;r?(n=t.registeredClass,i=n.instancePrototype):i=ot.prototype;var o=st(u,function(...e){if(Object.getPrototypeOf(this)!==c)throw new Ge(`Use 'new' to construct ${u}`);if(d.constructor_body===void 0)throw new Ge(`${u} has no accessible constructor`);var t=d.constructor_body[e.length];if(t===void 0)throw new Ge(`Tried to invoke ctor of ${u} with invalid number of parameters (${e.length}) - expected (${Object.keys(d.constructor_body).toString()}) parameters instead!`);return t.apply(this,e)}),c=Object.create(i,{constructor:{value:o}});o.prototype=c;var d=new mt(u,o,c,f,n,a,s,l);d.baseClass&&(d.baseClass.__derivedClasses??=[],d.baseClass.__derivedClasses.push(d));var m=new At(u,d,!0,!1,!1),h=new At(u+`*`,d,!1,!1,!1),g=new At(u+` const*`,d,!1,!0,!1);return ct[e]={pointerType:h,constPointerType:g},jt(p,o),[m,h,g]})},Ut=e=>{for(;e.length;){var t=e.pop();e.pop()(t)}};function Wt(e){for(var t=1;t<e.length;++t)if(e[t]!==null&&e[t].destructorFunction===void 0)return!0;return!1}function Gt(e,t,n,r){var i=Wt(e),a=e.length-2,o=[],s=[`fn`];t&&s.push(`thisWired`);for(var c=0;c<a;++c)o.push(`arg${c}`),s.push(`arg${c}Wired`);o=o.join(`,`),s=s.join(`,`);var l=`return function (${o}) {
2
2
  `;i&&(l+=`var destructors = [];
3
3
  `);var u=i?`destructors`:`null`,d=[`humanName`,`throwBindingError`,`invoker`,`fn`,`runDestructors`,`fromRetWire`,`toClassParamWire`];t&&(l+=`var thisWired = toClassParamWire(${u}, this);
4
4
  `);for(var c=0;c<a;++c){var f=`toArg${c}Wire`;l+=`var arg${c}Wired = ${f}(${u}, arg${c});
@@ -1 +1 @@
1
- import{C as e,D as t,E as n,G as r,N as i,P as a,V as o,j as s,k as c,n as l,p as u,v as d,w as f,z as p}from"./_isArrayLikeObject-B62EgjVm.js";import{C as m,E as ee,M as h,N as te,S as ne,a as g,c as re,d as ie,f as _,i as v,m as ae,n as y,p as oe,r as b,s as x,y as se}from"./__baseUniq-BbfvCSQ0.js";import{a as ce,c as le,d as ue,f as S,i as de,l as C,m as w,n as T,o as fe,r as pe,s as E,t as me,u as D}from"./__basePickBy-seJymvZv.js";import{i as he,n as ge}from"./_isEmpty-DwnoWLeP.js";import{k as O}from"./_chunk-GEFDOKGD-hedaaI_B.js";import{t as k}from"./_graphlib-CWZwVoL0.js";function _e(e){return i(t(e,void 0,S),e+``)}var ve=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ye(e){return ve.test(e)}var be=1,xe=4;function Se(e){return se(e,be|xe)}var Ce=function(){return r.Date.now()};function we(e,t){return e==null?e:l(e,re(t),u)}function Te(e,t){return e&&ie(e,re(t))}function Ee(e,t){return e>t}function A(e,t){var n={};return t=_(t,3),ie(e,function(e,r,i){s(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,p,Ee):void 0}function M(e,t){return e&&e.length?pe(e,_(t,2),de):void 0}function De(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Oe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=te(e),o=t!==void 0,s=t===null,c=t===t,l=te(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 ke(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Oe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Ae(e,t,n){t=t.length?h(t,function(e){return o(e)?function(t){return m(t,e.length===1?e[0]:e)}:e}):[p];var r=-1;return t=h(t,d(_)),De(le(e,function(e,n,i){return{criteria:h(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return ke(e,t,n)})}var je=oe(`length`),Me=`\\ud800-\\udfff`,Ne=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Pe=`\\ufe0e\\ufe0f`,Fe=`[`+Me+`]`,N=`[`+Ne+`]`,P=`\\ud83c[\\udffb-\\udfff]`,Ie=`(?:`+N+`|`+P+`)`,Le=`[^`+Me+`]`,Re=`(?:\\ud83c[\\udde6-\\uddff]){2}`,ze=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Be=`\\u200d`,Ve=Ie+`?`,He=`[`+Pe+`]?`,Ue=`(?:`+Be+`(?:`+[Le,Re,ze].join(`|`)+`)`+He+Ve+`)*`,We=He+Ve+Ue,Ge=`(?:`+[Le+N+`?`,N,Re,ze,Fe].join(`|`)+`)`,Ke=RegExp(P+`(?=`+P+`)|`+Ge+We,`g`);function qe(e){for(var t=Ke.lastIndex=0;Ke.test(e);)++t;return t}function Je(e){return ye(e)?qe(e):je(e)}function Ye(e,t){return me(e,t,function(t,n){return ae(e,n)})}var F=_e(function(e,t){return e==null?{}:Ye(e,t)}),Xe=Math.ceil,Ze=Math.max;function Qe(e,t,n,r){for(var i=-1,a=Ze(Xe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $e(t){return function(n,r,i){return i&&typeof i!=`number`&&e(n,r,i)&&(r=i=void 0),n=w(n),r===void 0?(r=n,n=0):r=w(r),i=i===void 0?n<r?1:-1:w(i),Qe(n,r,i,t)}}var I=$e(),et=`[object Map]`,tt=`[object Set]`;function nt(e){if(e==null)return 0;if(f(e))return ce(e)?Je(e):e.length;var t=ge(e);return t==et||t==tt?e.size:he(e).length}var L=n(function(t,n){if(t==null)return[];var r=n.length;return r>1&&e(t,n[0],n[1])?n=[]:r>2&&e(n[0],n[1],n[2])&&(n=[n[0]]),Ae(t,ne(n,1),[])}),rt=0;function R(e){var t=++rt;return ee(e)+t}function it(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 at(e,t){return it(e||[],t||[],c)}var ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return st(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&st(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,ct)),n=n._prev;return`[`+e.join(`, `)+`]`}};function st(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ct(e,t){if(e!==`_next`&&e!==`_prev`)return t}var lt=a(1);function ut(e,t){if(e.nodeCount()<=1)return[];var n=ft(e,t||lt);return S(E(dt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function dt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(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(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return x(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,B(t,n,s)}),x(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function ft(e,t){var n=new k,r=0,i=0;x(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),x(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=I(i+r+3).map(function(){return new ot}),o=r+1;return x(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(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 pt(e){x(e.graph().acyclicer===`greedy`?ut(e,t(e)):mt(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function mt(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,x(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return x(e.nodes(),i),t}function ht(e){x(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 V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function gt(e){var t=new k().setGraph(e.graph());return x(e.nodes(),function(n){t.setNode(n,e.node(n))}),x(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 _t(e){var t=new k({multigraph:e.isMultigraph()}).setGraph(e.graph());return x(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),x(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function vt(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 H(e){var t=E(I(St(e)+1),function(){return[]});return x(e.nodes(),function(n){var r=e.node(n),i=r.rank;b(i)||(t[i][r.order]=n)}),t}function yt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank}));x(e.nodes(),function(n){var r=e.node(n);fe(r,`rank`)&&(r.rank-=t)})}function bt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank})),n=[];x(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;x(n,function(t,n){b(t)&&n%i!==0?--r:r&&x(t,function(t){e.node(t).rank+=r})})}function xt(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function St(e){return j(E(e.nodes(),function(t){var n=e.node(t).rank;if(!b(n))return n}))}function Ct(e,t){var n={lhs:[],rhs:[]};return x(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function wt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function Tt(e,t){return t()}function Et(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&x(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Dt(e,`borderLeft`,`_bl`,n,i,a),Dt(e,`borderRight`,`_br`,n,i,a)}}x(e.children(),t)}function Dt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Ot(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&At(e)}function kt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&jt(e),(t===`lr`||t===`rl`)&&(Mt(e),At(e))}function At(e){x(e.nodes(),function(t){U(e.node(t))}),x(e.edges(),function(t){U(e.edge(t))})}function U(e){var t=e.width;e.width=e.height,e.height=t}function jt(e){x(e.nodes(),function(t){W(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,W),Object.prototype.hasOwnProperty.call(n,`y`)&&W(n)})}function W(e){e.y=-e.y}function Mt(e){x(e.nodes(),function(t){G(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,G),Object.prototype.hasOwnProperty.call(n,`x`)&&G(n)})}function G(e){var t=e.x;e.x=e.y,e.y=t}function Nt(e){e.graph().dummyChains=[],x(e.edges(),function(t){Pt(e,t)})}function Pt(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=V(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 Ft(e){x(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 K(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=T(E(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}x(e.sources(),n)}function q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function It(e){var t=new k({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Lt(t,e)<r;)i=Rt(t,e),a=t.hasNode(i.v)?q(e,i):-q(e,i),zt(t,e,a);return t}function Lt(e,t){function n(r){x(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return x(e.nodes(),n),e.nodeCount()}function Rt(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return q(t,n)})}function zt(e,t,n){x(e.nodes(),function(e){t.node(e).rank+=n})}a(1),a(1),Bt.CycleException=J;function Bt(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new J;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,x(e.predecessors(a),i),delete n[a],r.push(a))}if(x(e.sinks(),i),nt(t)!==e.nodeCount())throw new J;return r}function J(){}J.prototype=Error();function Vt(e,t,n){o(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return x(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Ht(e,t,n===`post`,a,r,i)}),i}function Ht(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),x(i(t),function(t){Ht(e,t,n,r,i,a)}),n&&a.push(t))}function Ut(e,t){return Vt(e,t,`post`)}function Wt(e,t){return Vt(e,t,`pre`)}Y.initLowLimValues=Z,Y.initCutValues=X,Y.calcCutValue=Kt,Y.leaveEdge=Jt,Y.enterEdge=Yt,Y.exchangeEdges=Xt;function Y(e){e=gt(e),K(e);var t=It(e);Z(t),X(t,e);for(var n,r;n=Jt(t);)r=Yt(t,e,n),Xt(t,e,n,r)}function X(e,t){var n=Ut(e,e.nodes());n=n.slice(0,n.length-1),x(n,function(n){Gt(e,t,n)})}function Gt(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Kt(e,t,n)}function Kt(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,x(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,Qt(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Z(e,t){arguments.length<2&&(t=e.nodes()[0]),qt(e,{},1,t)}function qt(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,x(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=qt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Jt(e){return C(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Yt(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),M(g(t.edges(),function(t){return c===$t(e,e.node(t.v),s)&&c!==$t(e,e.node(t.w),s)}),function(e){return q(t,e)})}function Xt(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Z(e),X(e,t),Zt(e,t)}function Zt(e,t){var n=Wt(e,C(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),x(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 Qt(e,t,n){return e.hasEdge(t,n)}function $t(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function en(e){switch(e.graph().ranker){case`network-simplex`:rn(e);break;case`tight-tree`:nn(e);break;case`longest-path`:tn(e);break;default:rn(e)}}var tn=K;function nn(e){K(e),It(e)}function rn(e){Y(e)}function an(e){var t=V(e,`root`,{},`_root`),n=sn(e),r=j(v(n))-1,i=2*r+1;e.graph().nestingRoot=t,x(e.edges(),function(t){e.edge(t).minlen*=i});var a=cn(e)+1;x(e.children(),function(o){on(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function on(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=xt(e,`_bt`),l=xt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,x(s,function(s){on(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 sn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&x(a,function(e){n(e,i+1)}),t[r]=i}return x(e.children(),function(e){n(e,1)}),t}function cn(e){return y(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function ln(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,x(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function un(e,t,n){var r={},i;x(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 dn(e,t,n){var r=fn(e),i=new k({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return x(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),x(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=b(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 fn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function pn(e,t){for(var n=0,r=1;r<t.length;++r)n+=mn(e,t[r-1],t[r]);return n}function mn(e,t,n){for(var r=at(n,E(n,function(e,t){return t})),i=S(E(t,function(t){return L(E(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=E(Array(o),function(){return 0}),c=0;return x(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 hn(e){var t={},n=g(e.nodes(),function(t){return!e.children(t).length}),r=E(I(j(E(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){fe(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),x(e.successors(n),i))}return x(L(n,function(t){return e.node(t).rank}),i),r}function gn(e,t){return E(t,function(t){var n=e.inEdges(t);if(n.length){var r=y(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}}else return{v:t}})}function _n(e,t){var n={};return x(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};b(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),x(t.edges(),function(e){var t=n[e.v],r=n[e.w];!b(t)&&!b(r)&&(r.indegree++,t.out.push(n[e.w]))}),vn(g(n,function(e){return!e.indegree}))}function vn(e){var t=[];function n(e){return function(t){t.merged||(b(t.barycenter)||b(e.barycenter)||t.barycenter>=e.barycenter)&&yn(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),x(i.in.reverse(),n(i)),x(i.out,r(i))}return E(g(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function yn(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 bn(e,t){var n=Ct(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Sn(!!t)),c=xn(a,i,c),x(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=xn(a,i,c)});var l={vs:S(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function xn(e,t,n){for(var r;t.length&&(r=D(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Sn(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 Cn(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=g(i,function(e){return e!==o&&e!==s}));var l=gn(e,i);x(l,function(t){if(e.children(t.v).length){var i=Cn(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Tn(t,i)}});var u=_n(l,n);wn(u,c);var d=bn(u,r);if(o&&(d.vs=S([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 wn(e,t){x(e,function(e){e.vs=S(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Tn(e,t){b(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 En(e){var t=St(e),n=Dn(e,I(1,t+1),`inEdges`),r=Dn(e,I(t-1,-1,-1),`outEdges`),i=hn(e);kn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){On(s%2?n:r,s%4>=2),i=H(e);var l=pn(e,i);l<a&&(c=0,o=Se(i),a=l)}kn(e,o)}function Dn(e,t,n){return E(t,function(t){return dn(e,t,n)})}function On(e,t){var n=new k;x(e,function(e){var r=e.graph().root,i=Cn(e,r,n,t);x(i.vs,function(t,n){e.node(t).order=n}),un(e,n,i.vs)})}function kn(e,t){x(t,function(t){x(t,function(t,n){e.node(t).order=n})})}function An(e){var t=Mn(e);x(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=jn(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 jn(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 Mn(e){var t={},n=0;function r(i){var a=n;x(e.children(i),r),t[i]={low:a,lim:n++}}return x(e.children(),r),t}function Nn(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=D(r);return x(r,function(t,c){var l=Fn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(x(r.slice(a,c+1),function(t){x(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&In(n,r,t)})}),a=c+1,i=u)}),r}return y(t,r),n}function Pn(e,t){var n={};function r(t,r,i,a,o){var s;x(I(r,i),function(r){s=t[r],e.node(s).dummy&&x(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&In(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return x(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 y(t,i),n}function Fn(e,t){if(e.node(t).dummy)return C(e.predecessors(t),function(t){return e.node(t).dummy})}function In(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 Ln(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Rn(e,t,n,r){var i={},a={},o={};return x(t,function(e){x(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),x(t,function(e){var t=-1;x(e,function(e){var s=r(e);if(s.length){s=L(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]&&!Ln(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function zn(e,t,n,r,i){var a={},o=Bn(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)),x(r,function(e){a[e]=a[n[e]]}),a}function Bn(e,t,n,r){var i=new k,a=e.graph(),o=Gn(a.nodesep,a.edgesep,r);return x(t,function(t){var r;x(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 Vn(e,t){return M(v(t),function(t){var n=-1/0,r=1/0;return we(t,function(t,i){var a=Kn(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Hn(e,t){var n=v(t),r=T(n),i=j(n);x([`u`,`d`],function(n){x([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=v(s);c=a===`l`?r-T(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function Un(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(E(e,r));return(i[1]+i[2])/2})}function Wn(e){var t=H(e),n=O(Nn(e,t),Pn(e,t)),r={},i;return x([`u`,`d`],function(a){i=a===`u`?t:v(t).reverse(),x([`l`,`r`],function(t){t===`r`&&(i=E(i,function(e){return v(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Rn(e,i,n,o),c=zn(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),Hn(r,Vn(e,r)),Un(r,e.graph().align)}function Gn(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;break}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;break}return l&&(c+=n?l:-l),l=0,c}}function Kn(e,t){return e.node(t).width}function qn(e){e=_t(e),Jn(e),Te(Wn(e),function(t,n){e.node(n).x=t})}function Jn(e){var t=H(e),n=e.graph().ranksep,r=0;x(t,function(t){var i=j(E(t,function(t){return e.node(t).height}));x(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function Yn(e,t){var n=t&&t.debugTiming?wt:Tt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>or(e));n(` runLayout`,()=>Xn(t,n)),n(` updateInputGraph`,()=>Zn(e,t))})}function Xn(e,t){t(` makeSpaceForEdgeLabels`,()=>sr(e)),t(` removeSelfEdges`,()=>gr(e)),t(` acyclic`,()=>pt(e)),t(` nestingGraph.run`,()=>an(e)),t(` rank`,()=>en(_t(e))),t(` injectEdgeLabelProxies`,()=>cr(e)),t(` removeEmptyRanks`,()=>bt(e)),t(` nestingGraph.cleanup`,()=>ln(e)),t(` normalizeRanks`,()=>yt(e)),t(` assignRankMinMax`,()=>lr(e)),t(` removeEdgeLabelProxies`,()=>ur(e)),t(` normalize.run`,()=>Nt(e)),t(` parentDummyChains`,()=>An(e)),t(` addBorderSegments`,()=>Et(e)),t(` order`,()=>En(e)),t(` insertSelfEdges`,()=>_r(e)),t(` adjustCoordinateSystem`,()=>Ot(e)),t(` position`,()=>qn(e)),t(` positionSelfEdges`,()=>vr(e)),t(` removeBorderNodes`,()=>hr(e)),t(` normalize.undo`,()=>Ft(e)),t(` fixupEdgeLabelCoords`,()=>pr(e)),t(` undoCoordinateSystem`,()=>kt(e)),t(` translateGraph`,()=>dr(e)),t(` assignNodeIntersects`,()=>fr(e)),t(` reversePoints`,()=>mr(e)),t(` acyclic.undo`,()=>ht(e))}function Zn(e,t){x(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))}),x(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 Qn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],$n={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},er=[`acyclicer`,`ranker`,`rankdir`,`align`],tr=[`width`,`height`],nr={width:0,height:0},rr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],ir={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},ar=[`labelpos`];function or(e){var t=new k({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(O({},$n,Q(n,Qn),F(n,er))),x(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,ue(Q(r,tr),nr)),t.setParent(n,e.parent(n))}),x(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,O({},ir,Q(r,rr),F(r,ar)))}),t}function sr(e){var t=e.graph();t.ranksep/=2,x(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 cr(e){x(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function lr(e){var t=0;x(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=j(t,r.maxRank))}),e.graph().maxRank=t}function ur(e){x(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function dr(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)}x(e.nodes(),function(t){c(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,x(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),x(e.edges(),function(n){var i=e.edge(n);x(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 fr(e){x(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(vt(r,a)),n.points.push(vt(i,o))})}function pr(e){x(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;break}})}function mr(e){x(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function hr(e){x(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(D(n.borderLeft)),o=e.node(D(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}}),x(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function gr(e){x(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 _r(e){x(H(e),function(t){var n=0;x(t,function(t,r){var i=e.node(t);i.order=r+n,x(i.selfEdges,function(t){V(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 vr(e){x(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 Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return x(e,function(e,n){t[n.toLowerCase()]=e}),t}export{Yn as t};
1
+ import{C as e,D as t,E as n,G as r,N as i,P as a,V as o,j as s,k as c,n as l,p as u,v as d,w as f,z as p}from"./_isArrayLikeObject-B62EgjVm.js";import{C as m,E as ee,M as h,N as te,S as ne,a as g,c as re,d as ie,f as _,i as v,m as ae,n as y,p as oe,r as b,s as x,y as se}from"./__baseUniq-BbfvCSQ0.js";import{a as ce,c as le,d as ue,f as S,i as de,l as C,m as w,n as T,o as fe,r as pe,s as E,t as me,u as D}from"./__basePickBy-seJymvZv.js";import{i as he,n as ge}from"./_isEmpty-DwnoWLeP.js";import{k as O}from"./_chunk-GEFDOKGD-DinyCumL.js";import{t as k}from"./_graphlib-CWZwVoL0.js";function _e(e){return i(t(e,void 0,S),e+``)}var ve=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function ye(e){return ve.test(e)}var be=1,xe=4;function Se(e){return se(e,be|xe)}var Ce=function(){return r.Date.now()};function we(e,t){return e==null?e:l(e,re(t),u)}function Te(e,t){return e&&ie(e,re(t))}function Ee(e,t){return e>t}function A(e,t){var n={};return t=_(t,3),ie(e,function(e,r,i){s(n,r,t(e,r,i))}),n}function j(e){return e&&e.length?pe(e,p,Ee):void 0}function M(e,t){return e&&e.length?pe(e,_(t,2),de):void 0}function De(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}function Oe(e,t){if(e!==t){var n=e!==void 0,r=e===null,i=e===e,a=te(e),o=t!==void 0,s=t===null,c=t===t,l=te(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 ke(e,t,n){for(var r=-1,i=e.criteria,a=t.criteria,o=i.length,s=n.length;++r<o;){var c=Oe(i[r],a[r]);if(c)return r>=s?c:c*(n[r]==`desc`?-1:1)}return e.index-t.index}function Ae(e,t,n){t=t.length?h(t,function(e){return o(e)?function(t){return m(t,e.length===1?e[0]:e)}:e}):[p];var r=-1;return t=h(t,d(_)),De(le(e,function(e,n,i){return{criteria:h(t,function(t){return t(e)}),index:++r,value:e}}),function(e,t){return ke(e,t,n)})}var je=oe(`length`),Me=`\\ud800-\\udfff`,Ne=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,Pe=`\\ufe0e\\ufe0f`,Fe=`[`+Me+`]`,N=`[`+Ne+`]`,P=`\\ud83c[\\udffb-\\udfff]`,Ie=`(?:`+N+`|`+P+`)`,Le=`[^`+Me+`]`,Re=`(?:\\ud83c[\\udde6-\\uddff]){2}`,ze=`[\\ud800-\\udbff][\\udc00-\\udfff]`,Be=`\\u200d`,Ve=Ie+`?`,He=`[`+Pe+`]?`,Ue=`(?:`+Be+`(?:`+[Le,Re,ze].join(`|`)+`)`+He+Ve+`)*`,We=He+Ve+Ue,Ge=`(?:`+[Le+N+`?`,N,Re,ze,Fe].join(`|`)+`)`,Ke=RegExp(P+`(?=`+P+`)|`+Ge+We,`g`);function qe(e){for(var t=Ke.lastIndex=0;Ke.test(e);)++t;return t}function Je(e){return ye(e)?qe(e):je(e)}function Ye(e,t){return me(e,t,function(t,n){return ae(e,n)})}var F=_e(function(e,t){return e==null?{}:Ye(e,t)}),Xe=Math.ceil,Ze=Math.max;function Qe(e,t,n,r){for(var i=-1,a=Ze(Xe((t-e)/(n||1)),0),o=Array(a);a--;)o[r?a:++i]=e,e+=n;return o}function $e(t){return function(n,r,i){return i&&typeof i!=`number`&&e(n,r,i)&&(r=i=void 0),n=w(n),r===void 0?(r=n,n=0):r=w(r),i=i===void 0?n<r?1:-1:w(i),Qe(n,r,i,t)}}var I=$e(),et=`[object Map]`,tt=`[object Set]`;function nt(e){if(e==null)return 0;if(f(e))return ce(e)?Je(e):e.length;var t=ge(e);return t==et||t==tt?e.size:he(e).length}var L=n(function(t,n){if(t==null)return[];var r=n.length;return r>1&&e(t,n[0],n[1])?n=[]:r>2&&e(n[0],n[1],n[2])&&(n=[n[0]]),Ae(t,ne(n,1),[])}),rt=0;function R(e){var t=++rt;return ee(e)+t}function it(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 at(e,t){return it(e||[],t||[],c)}var ot=class{constructor(){var e={};e._next=e._prev=e,this._sentinel=e}dequeue(){var e=this._sentinel,t=e._prev;if(t!==e)return st(t),t}enqueue(e){var t=this._sentinel;e._prev&&e._next&&st(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,ct)),n=n._prev;return`[`+e.join(`, `)+`]`}};function st(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function ct(e,t){if(e!==`_next`&&e!==`_prev`)return t}var lt=a(1);function ut(e,t){if(e.nodeCount()<=1)return[];var n=ft(e,t||lt);return S(E(dt(n.graph,n.buckets,n.zeroIdx),function(t){return e.outEdges(t.v,t.w)}))}function dt(e,t,n){for(var r=[],i=t[t.length-1],a=t[0],o;e.nodeCount();){for(;o=a.dequeue();)z(e,t,n,o);for(;o=i.dequeue();)z(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(z(e,t,n,o,!0));break}}}return r}function z(e,t,n,r,i){var a=i?[]:void 0;return x(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,B(t,n,s)}),x(e.outEdges(r.v),function(r){var i=e.edge(r),a=r.w,o=e.node(a);o.in-=i,B(t,n,o)}),e.removeNode(r.v),a}function ft(e,t){var n=new k,r=0,i=0;x(e.nodes(),function(e){n.setNode(e,{v:e,in:0,out:0})}),x(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=I(i+r+3).map(function(){return new ot}),o=r+1;return x(n.nodes(),function(e){B(a,o,n.node(e))}),{graph:n,buckets:a,zeroIdx:o}}function B(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 pt(e){x(e.graph().acyclicer===`greedy`?ut(e,t(e)):mt(e),function(t){var n=e.edge(t);e.removeEdge(t),n.forwardName=t.name,n.reversed=!0,e.setEdge(t.w,t.v,n,R(`rev`))});function t(e){return function(t){return e.edge(t).weight}}}function mt(e){var t=[],n={},r={};function i(a){Object.prototype.hasOwnProperty.call(r,a)||(r[a]=!0,n[a]=!0,x(e.outEdges(a),function(e){Object.prototype.hasOwnProperty.call(n,e.w)?t.push(e):i(e.w)}),delete n[a])}return x(e.nodes(),i),t}function ht(e){x(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 V(e,t,n,r){var i;do i=R(r);while(e.hasNode(i));return n.dummy=t,e.setNode(i,n),i}function gt(e){var t=new k().setGraph(e.graph());return x(e.nodes(),function(n){t.setNode(n,e.node(n))}),x(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 _t(e){var t=new k({multigraph:e.isMultigraph()}).setGraph(e.graph());return x(e.nodes(),function(n){e.children(n).length||t.setNode(n,e.node(n))}),x(e.edges(),function(n){t.setEdge(n,e.edge(n))}),t}function vt(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 H(e){var t=E(I(St(e)+1),function(){return[]});return x(e.nodes(),function(n){var r=e.node(n),i=r.rank;b(i)||(t[i][r.order]=n)}),t}function yt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank}));x(e.nodes(),function(n){var r=e.node(n);fe(r,`rank`)&&(r.rank-=t)})}function bt(e){var t=T(E(e.nodes(),function(t){return e.node(t).rank})),n=[];x(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;x(n,function(t,n){b(t)&&n%i!==0?--r:r&&x(t,function(t){e.node(t).rank+=r})})}function xt(e,t,n,r){var i={width:0,height:0};return arguments.length>=4&&(i.rank=n,i.order=r),V(e,`border`,i,t)}function St(e){return j(E(e.nodes(),function(t){var n=e.node(t).rank;if(!b(n))return n}))}function Ct(e,t){var n={lhs:[],rhs:[]};return x(e,function(e){t(e)?n.lhs.push(e):n.rhs.push(e)}),n}function wt(e,t){var n=Ce();try{return t()}finally{console.log(e+` time: `+(Ce()-n)+`ms`)}}function Tt(e,t){return t()}function Et(e){function t(n){var r=e.children(n),i=e.node(n);if(r.length&&x(r,t),Object.prototype.hasOwnProperty.call(i,`minRank`)){i.borderLeft=[],i.borderRight=[];for(var a=i.minRank,o=i.maxRank+1;a<o;++a)Dt(e,`borderLeft`,`_bl`,n,i,a),Dt(e,`borderRight`,`_br`,n,i,a)}}x(e.children(),t)}function Dt(e,t,n,r,i,a){var o={width:0,height:0,rank:a,borderType:t},s=i[t][a-1],c=V(e,`border`,o,n);i[t][a]=c,e.setParent(c,r),s&&e.setEdge(s,c,{weight:1})}function Ot(e){var t=e.graph().rankdir.toLowerCase();(t===`lr`||t===`rl`)&&At(e)}function kt(e){var t=e.graph().rankdir.toLowerCase();(t===`bt`||t===`rl`)&&jt(e),(t===`lr`||t===`rl`)&&(Mt(e),At(e))}function At(e){x(e.nodes(),function(t){U(e.node(t))}),x(e.edges(),function(t){U(e.edge(t))})}function U(e){var t=e.width;e.width=e.height,e.height=t}function jt(e){x(e.nodes(),function(t){W(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,W),Object.prototype.hasOwnProperty.call(n,`y`)&&W(n)})}function W(e){e.y=-e.y}function Mt(e){x(e.nodes(),function(t){G(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);x(n.points,G),Object.prototype.hasOwnProperty.call(n,`x`)&&G(n)})}function G(e){var t=e.x;e.x=e.y,e.y=t}function Nt(e){e.graph().dummyChains=[],x(e.edges(),function(t){Pt(e,t)})}function Pt(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=V(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 Ft(e){x(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 K(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=T(E(e.outEdges(r),function(t){return n(t.w)-e.edge(t).minlen}));return(a===1/0||a==null)&&(a=0),i.rank=a}x(e.sources(),n)}function q(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}function It(e){var t=new k({directed:!1}),n=e.nodes()[0],r=e.nodeCount();t.setNode(n,{});for(var i,a;Lt(t,e)<r;)i=Rt(t,e),a=t.hasNode(i.v)?q(e,i):-q(e,i),zt(t,e,a);return t}function Lt(e,t){function n(r){x(t.nodeEdges(r),function(i){var a=i.v,o=r===a?i.w:a;!e.hasNode(o)&&!q(t,i)&&(e.setNode(o,{}),e.setEdge(r,o,{}),n(o))})}return x(e.nodes(),n),e.nodeCount()}function Rt(e,t){return M(t.edges(),function(n){if(e.hasNode(n.v)!==e.hasNode(n.w))return q(t,n)})}function zt(e,t,n){x(e.nodes(),function(e){t.node(e).rank+=n})}a(1),a(1),Bt.CycleException=J;function Bt(e){var t={},n={},r=[];function i(a){if(Object.prototype.hasOwnProperty.call(n,a))throw new J;Object.prototype.hasOwnProperty.call(t,a)||(n[a]=!0,t[a]=!0,x(e.predecessors(a),i),delete n[a],r.push(a))}if(x(e.sinks(),i),nt(t)!==e.nodeCount())throw new J;return r}function J(){}J.prototype=Error();function Vt(e,t,n){o(t)||(t=[t]);var r=(e.isDirected()?e.successors:e.neighbors).bind(e),i=[],a={};return x(t,function(t){if(!e.hasNode(t))throw Error(`Graph does not have node: `+t);Ht(e,t,n===`post`,a,r,i)}),i}function Ht(e,t,n,r,i,a){Object.prototype.hasOwnProperty.call(r,t)||(r[t]=!0,n||a.push(t),x(i(t),function(t){Ht(e,t,n,r,i,a)}),n&&a.push(t))}function Ut(e,t){return Vt(e,t,`post`)}function Wt(e,t){return Vt(e,t,`pre`)}Y.initLowLimValues=Z,Y.initCutValues=X,Y.calcCutValue=Kt,Y.leaveEdge=Jt,Y.enterEdge=Yt,Y.exchangeEdges=Xt;function Y(e){e=gt(e),K(e);var t=It(e);Z(t),X(t,e);for(var n,r;n=Jt(t);)r=Yt(t,e,n),Xt(t,e,n,r)}function X(e,t){var n=Ut(e,e.nodes());n=n.slice(0,n.length-1),x(n,function(n){Gt(e,t,n)})}function Gt(e,t,n){var r=e.node(n).parent;e.edge(n,r).cutvalue=Kt(e,t,n)}function Kt(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,x(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,Qt(e,n,c)){var d=e.edge(n,c).cutvalue;o+=l?-d:d}}}),o}function Z(e,t){arguments.length<2&&(t=e.nodes()[0]),qt(e,{},1,t)}function qt(e,t,n,r,i){var a=n,o=e.node(r);return t[r]=!0,x(e.neighbors(r),function(i){Object.prototype.hasOwnProperty.call(t,i)||(n=qt(e,t,n,i,r))}),o.low=a,o.lim=n++,i?o.parent=i:delete o.parent,n}function Jt(e){return C(e.edges(),function(t){return e.edge(t).cutvalue<0})}function Yt(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),M(g(t.edges(),function(t){return c===$t(e,e.node(t.v),s)&&c!==$t(e,e.node(t.w),s)}),function(e){return q(t,e)})}function Xt(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),Z(e),X(e,t),Zt(e,t)}function Zt(e,t){var n=Wt(e,C(e.nodes(),function(e){return!t.node(e).parent}));n=n.slice(1),x(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 Qt(e,t,n){return e.hasEdge(t,n)}function $t(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}function en(e){switch(e.graph().ranker){case`network-simplex`:rn(e);break;case`tight-tree`:nn(e);break;case`longest-path`:tn(e);break;default:rn(e)}}var tn=K;function nn(e){K(e),It(e)}function rn(e){Y(e)}function an(e){var t=V(e,`root`,{},`_root`),n=sn(e),r=j(v(n))-1,i=2*r+1;e.graph().nestingRoot=t,x(e.edges(),function(t){e.edge(t).minlen*=i});var a=cn(e)+1;x(e.children(),function(o){on(e,t,i,a,r,n,o)}),e.graph().nodeRankFactor=i}function on(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=xt(e,`_bt`),l=xt(e,`_bb`),u=e.node(o);e.setParent(c,o),u.borderTop=c,e.setParent(l,o),u.borderBottom=l,x(s,function(s){on(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 sn(e){var t={};function n(r,i){var a=e.children(r);a&&a.length&&x(a,function(e){n(e,i+1)}),t[r]=i}return x(e.children(),function(e){n(e,1)}),t}function cn(e){return y(e.edges(),function(t,n){return t+e.edge(n).weight},0)}function ln(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,x(e.edges(),function(t){e.edge(t).nestingEdge&&e.removeEdge(t)})}function un(e,t,n){var r={},i;x(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 dn(e,t,n){var r=fn(e),i=new k({compound:!0}).setGraph({root:r}).setDefaultNodeLabel(function(t){return e.node(t)});return x(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),x(e[n](a),function(t){var n=t.v===a?t.w:t.v,r=i.edge(n,a),o=b(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 fn(e){for(var t;e.hasNode(t=R(`_root`)););return t}function pn(e,t){for(var n=0,r=1;r<t.length;++r)n+=mn(e,t[r-1],t[r]);return n}function mn(e,t,n){for(var r=at(n,E(n,function(e,t){return t})),i=S(E(t,function(t){return L(E(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=E(Array(o),function(){return 0}),c=0;return x(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 hn(e){var t={},n=g(e.nodes(),function(t){return!e.children(t).length}),r=E(I(j(E(n,function(t){return e.node(t).rank}))+1),function(){return[]});function i(n){fe(t,n)||(t[n]=!0,r[e.node(n).rank].push(n),x(e.successors(n),i))}return x(L(n,function(t){return e.node(t).rank}),i),r}function gn(e,t){return E(t,function(t){var n=e.inEdges(t);if(n.length){var r=y(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}}else return{v:t}})}function _n(e,t){var n={};return x(e,function(e,t){var r=n[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};b(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)}),x(t.edges(),function(e){var t=n[e.v],r=n[e.w];!b(t)&&!b(r)&&(r.indegree++,t.out.push(n[e.w]))}),vn(g(n,function(e){return!e.indegree}))}function vn(e){var t=[];function n(e){return function(t){t.merged||(b(t.barycenter)||b(e.barycenter)||t.barycenter>=e.barycenter)&&yn(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),x(i.in.reverse(),n(i)),x(i.out,r(i))}return E(g(t,function(e){return!e.merged}),function(e){return F(e,[`vs`,`i`,`barycenter`,`weight`])})}function yn(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 bn(e,t){var n=Ct(e,function(e){return Object.prototype.hasOwnProperty.call(e,`barycenter`)}),r=n.lhs,i=L(n.rhs,function(e){return-e.i}),a=[],o=0,s=0,c=0;r.sort(Sn(!!t)),c=xn(a,i,c),x(r,function(e){c+=e.vs.length,a.push(e.vs),o+=e.barycenter*e.weight,s+=e.weight,c=xn(a,i,c)});var l={vs:S(a)};return s&&(l.barycenter=o/s,l.weight=s),l}function xn(e,t,n){for(var r;t.length&&(r=D(t)).i<=n;)t.pop(),e.push(r.vs),n++;return n}function Sn(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 Cn(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=g(i,function(e){return e!==o&&e!==s}));var l=gn(e,i);x(l,function(t){if(e.children(t.v).length){var i=Cn(e,t.v,n,r);c[t.v]=i,Object.prototype.hasOwnProperty.call(i,`barycenter`)&&Tn(t,i)}});var u=_n(l,n);wn(u,c);var d=bn(u,r);if(o&&(d.vs=S([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 wn(e,t){x(e,function(e){e.vs=S(e.vs.map(function(e){return t[e]?t[e].vs:e}))})}function Tn(e,t){b(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 En(e){var t=St(e),n=Dn(e,I(1,t+1),`inEdges`),r=Dn(e,I(t-1,-1,-1),`outEdges`),i=hn(e);kn(e,i);for(var a=1/0,o,s=0,c=0;c<4;++s,++c){On(s%2?n:r,s%4>=2),i=H(e);var l=pn(e,i);l<a&&(c=0,o=Se(i),a=l)}kn(e,o)}function Dn(e,t,n){return E(t,function(t){return dn(e,t,n)})}function On(e,t){var n=new k;x(e,function(e){var r=e.graph().root,i=Cn(e,r,n,t);x(i.vs,function(t,n){e.node(t).order=n}),un(e,n,i.vs)})}function kn(e,t){x(t,function(t){x(t,function(t,n){e.node(t).order=n})})}function An(e){var t=Mn(e);x(e.graph().dummyChains,function(n){for(var r=e.node(n),i=r.edgeObj,a=jn(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 jn(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 Mn(e){var t={},n=0;function r(i){var a=n;x(e.children(i),r),t[i]={low:a,lim:n++}}return x(e.children(),r),t}function Nn(e,t){var n={};function r(t,r){var i=0,a=0,o=t.length,s=D(r);return x(r,function(t,c){var l=Fn(e,t),u=l?e.node(l).order:o;(l||t===s)&&(x(r.slice(a,c+1),function(t){x(e.predecessors(t),function(r){var a=e.node(r),o=a.order;(o<i||u<o)&&!(a.dummy&&e.node(t).dummy)&&In(n,r,t)})}),a=c+1,i=u)}),r}return y(t,r),n}function Pn(e,t){var n={};function r(t,r,i,a,o){var s;x(I(r,i),function(r){s=t[r],e.node(s).dummy&&x(e.predecessors(s),function(t){var r=e.node(t);r.dummy&&(r.order<a||r.order>o)&&In(n,t,s)})})}function i(t,n){var i=-1,a,o=0;return x(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 y(t,i),n}function Fn(e,t){if(e.node(t).dummy)return C(e.predecessors(t),function(t){return e.node(t).dummy})}function In(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 Ln(e,t,n){if(t>n){var r=t;t=n,n=r}return!!e[t]&&Object.prototype.hasOwnProperty.call(e[t],n)}function Rn(e,t,n,r){var i={},a={},o={};return x(t,function(e){x(e,function(e,t){i[e]=e,a[e]=e,o[e]=t})}),x(t,function(e){var t=-1;x(e,function(e){var s=r(e);if(s.length){s=L(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]&&!Ln(n,e,d)&&(a[d]=e,a[e]=i[e]=i[d],t=o[d])}}})}),{root:i,align:a}}function zn(e,t,n,r,i){var a={},o=Bn(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)),x(r,function(e){a[e]=a[n[e]]}),a}function Bn(e,t,n,r){var i=new k,a=e.graph(),o=Gn(a.nodesep,a.edgesep,r);return x(t,function(t){var r;x(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 Vn(e,t){return M(v(t),function(t){var n=-1/0,r=1/0;return we(t,function(t,i){var a=Kn(e,i)/2;n=Math.max(t+a,n),r=Math.min(t-a,r)}),n-r})}function Hn(e,t){var n=v(t),r=T(n),i=j(n);x([`u`,`d`],function(n){x([`l`,`r`],function(a){var o=n+a,s=e[o],c;if(s!==t){var l=v(s);c=a===`l`?r-T(l):i-j(l),c&&(e[o]=A(s,function(e){return e+c}))}})})}function Un(e,t){return A(e.ul,function(n,r){if(t)return e[t.toLowerCase()][r];var i=L(E(e,r));return(i[1]+i[2])/2})}function Wn(e){var t=H(e),n=O(Nn(e,t),Pn(e,t)),r={},i;return x([`u`,`d`],function(a){i=a===`u`?t:v(t).reverse(),x([`l`,`r`],function(t){t===`r`&&(i=E(i,function(e){return v(e).reverse()}));var o=(a===`u`?e.predecessors:e.successors).bind(e),s=Rn(e,i,n,o),c=zn(e,i,s.root,s.align,t===`r`);t===`r`&&(c=A(c,function(e){return-e})),r[a+t]=c})}),Hn(r,Vn(e,r)),Un(r,e.graph().align)}function Gn(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;break}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;break}return l&&(c+=n?l:-l),l=0,c}}function Kn(e,t){return e.node(t).width}function qn(e){e=_t(e),Jn(e),Te(Wn(e),function(t,n){e.node(n).x=t})}function Jn(e){var t=H(e),n=e.graph().ranksep,r=0;x(t,function(t){var i=j(E(t,function(t){return e.node(t).height}));x(t,function(t){e.node(t).y=r+i/2}),r+=i+n})}function Yn(e,t){var n=t&&t.debugTiming?wt:Tt;n(`layout`,()=>{var t=n(` buildLayoutGraph`,()=>or(e));n(` runLayout`,()=>Xn(t,n)),n(` updateInputGraph`,()=>Zn(e,t))})}function Xn(e,t){t(` makeSpaceForEdgeLabels`,()=>sr(e)),t(` removeSelfEdges`,()=>gr(e)),t(` acyclic`,()=>pt(e)),t(` nestingGraph.run`,()=>an(e)),t(` rank`,()=>en(_t(e))),t(` injectEdgeLabelProxies`,()=>cr(e)),t(` removeEmptyRanks`,()=>bt(e)),t(` nestingGraph.cleanup`,()=>ln(e)),t(` normalizeRanks`,()=>yt(e)),t(` assignRankMinMax`,()=>lr(e)),t(` removeEdgeLabelProxies`,()=>ur(e)),t(` normalize.run`,()=>Nt(e)),t(` parentDummyChains`,()=>An(e)),t(` addBorderSegments`,()=>Et(e)),t(` order`,()=>En(e)),t(` insertSelfEdges`,()=>_r(e)),t(` adjustCoordinateSystem`,()=>Ot(e)),t(` position`,()=>qn(e)),t(` positionSelfEdges`,()=>vr(e)),t(` removeBorderNodes`,()=>hr(e)),t(` normalize.undo`,()=>Ft(e)),t(` fixupEdgeLabelCoords`,()=>pr(e)),t(` undoCoordinateSystem`,()=>kt(e)),t(` translateGraph`,()=>dr(e)),t(` assignNodeIntersects`,()=>fr(e)),t(` reversePoints`,()=>mr(e)),t(` acyclic.undo`,()=>ht(e))}function Zn(e,t){x(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))}),x(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 Qn=[`nodesep`,`edgesep`,`ranksep`,`marginx`,`marginy`],$n={ranksep:50,edgesep:20,nodesep:50,rankdir:`tb`},er=[`acyclicer`,`ranker`,`rankdir`,`align`],tr=[`width`,`height`],nr={width:0,height:0},rr=[`minlen`,`weight`,`width`,`height`,`labeloffset`],ir={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:`r`},ar=[`labelpos`];function or(e){var t=new k({multigraph:!0,compound:!0}),n=$(e.graph());return t.setGraph(O({},$n,Q(n,Qn),F(n,er))),x(e.nodes(),function(n){var r=$(e.node(n));t.setNode(n,ue(Q(r,tr),nr)),t.setParent(n,e.parent(n))}),x(e.edges(),function(n){var r=$(e.edge(n));t.setEdge(n,O({},ir,Q(r,rr),F(r,ar)))}),t}function sr(e){var t=e.graph();t.ranksep/=2,x(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 cr(e){x(e.edges(),function(t){var n=e.edge(t);if(n.width&&n.height){var r=e.node(t.v);V(e,`edge-proxy`,{rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t},`_ep`)}})}function lr(e){var t=0;x(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=j(t,r.maxRank))}),e.graph().maxRank=t}function ur(e){x(e.nodes(),function(t){var n=e.node(t);n.dummy===`edge-proxy`&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}function dr(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)}x(e.nodes(),function(t){c(e.node(t))}),x(e.edges(),function(t){var n=e.edge(t);Object.prototype.hasOwnProperty.call(n,`x`)&&c(n)}),t-=o,r-=s,x(e.nodes(),function(n){var i=e.node(n);i.x-=t,i.y-=r}),x(e.edges(),function(n){var i=e.edge(n);x(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 fr(e){x(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(vt(r,a)),n.points.push(vt(i,o))})}function pr(e){x(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;break}})}function mr(e){x(e.edges(),function(t){var n=e.edge(t);n.reversed&&n.points.reverse()})}function hr(e){x(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(D(n.borderLeft)),o=e.node(D(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}}),x(e.nodes(),function(t){e.node(t).dummy===`border`&&e.removeNode(t)})}function gr(e){x(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 _r(e){x(H(e),function(t){var n=0;x(t,function(t,r){var i=e.node(t);i.order=r+n,x(i.selfEdges,function(t){V(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 vr(e){x(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 Q(e,t){return A(F(e,t),Number)}function $(e){var t={};return x(e,function(e,n){t[n.toLowerCase()]=e}),t}export{Yn as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./__baseUniq-BbfvCSQ0.js";import{s as t}from"./__basePickBy-seJymvZv.js";import{t as n}from"./_dagre-D4f1FF8i.js";import"./_chunk-GEFDOKGD-hedaaI_B.js";import{t as r}from"./_clone-C4VI7IwW.js";import{t as i}from"./_graphlib-CWZwVoL0.js";import"./_src-EY2faTVt.js";import{n as a,r as o}from"./_src-DGaYM9rN.js";import{b as s}from"./_chunk-7R4GIKGN-CixjX2hF.js";import"./_dist-Dk49gvBM.js";import"./_chunk-PU5JKC2W-B7Fh0LIt.js";import"./_chunk-MX3YWQON-DTYOrezi.js";import{n as c}from"./_chunk-YBOYWFTD-nZYHIeRV.js";import"./_chunk-PQ6SQG4A-d07SUR0W.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./_chunk-KYZI473N-HFloJmj0.js";import{a as g,i as _,n as v,r as y,t as b}from"./_chunk-O4XLMI2P-Dmj7UqP5.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=a(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=a((e,t)=>{let n=T.get(t)||[];return o.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=a((e,t)=>{let n=T.get(t)||[];return o.info(`Descendants of `,t,` is `,n),o.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(o.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=a((e,t,n,r)=>{o.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),o.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let a=t.node(i);o.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,a),r!==t.parent(i)&&(o.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(o.debug(`Setting parent`,i,e),n.setParent(i,e)):(o.info(`In copy `,e,`root`,r,`data`,t.node(e),r),o.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);o.debug(`Copying Edges`,s),s.forEach(i=>{o.info(`Edge`,i);let a=t.edge(i.v,i.w,i.name);o.info(`Edge data`,a,r);try{k(i,r)?(o.info(`Copying as `,i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),o.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):o.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){o.error(e)}})}o.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=a((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=a((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=a((e,t,n)=>{let r=t.children(e);if(o.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=a(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=a((e,t)=>{if(!e||t>10){o.debug(`Opting out, no graph `);return}else o.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(o.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(o.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(o.warn(`Edge: `,e,` leaves cluster `,t),o.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):o.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);o.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),o.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(o.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(o.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}o.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),o.warn(`Adjusted Graph`,x(e)),I(e,0),o.trace(w)},`adjustClustersAndEdges`),I=a((e,t)=>{if(o.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){o.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){o.debug(`Done, no node has children`,e.nodes());return}o.debug(`Nodes = `,n,t);for(let r of n)if(o.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))o.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){o.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,o.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let a=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});o.warn(`Old graph before copy`,x(e)),A(r,e,a,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:a}),o.warn(`New graph after copy node: (`,r,`)`,x(a)),o.debug(`Old graph after copy`,x(e))}else o.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),o.debug(w);n=e.nodes(),o.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);o.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=a((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=a(e=>L(e,e.children()),`sortNodesByHierarchy`),z=a(async(e,t,r,i,s,p)=>{o.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;o.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?o.info(`Recursive render XXX`,t.nodes()):o.info(`No nodes found for`,t),t.edges().length>0&&o.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));o.trace(`Setting data for parent cluster XXX
1
+ import{r as e}from"./__baseUniq-BbfvCSQ0.js";import{s as t}from"./__basePickBy-seJymvZv.js";import{t as n}from"./_dagre-CA4z7MrA.js";import"./_chunk-GEFDOKGD-DinyCumL.js";import{t as r}from"./_clone-C4VI7IwW.js";import{t as i}from"./_graphlib-CWZwVoL0.js";import"./_src-D_0f55rL.js";import{n as a,r as o}from"./_src-SNUCTSwP.js";import{b as s}from"./_chunk-7R4GIKGN-CEEB8leR.js";import"./_dist-BO11r0fr.js";import"./_chunk-PU5JKC2W-DjhZtVq8.js";import"./_chunk-MX3YWQON-OBQAAB3N.js";import{n as c}from"./_chunk-YBOYWFTD-C0sy-tkc.js";import"./_chunk-PQ6SQG4A-Ce4yqK2U.js";import{a as l,c as u,i as d,l as f,n as p,t as m,u as h}from"./_chunk-KYZI473N-DFGZfQqH.js";import{a as g,i as _,n as v,r as y,t as b}from"./_chunk-O4XLMI2P-C5stF2lf.js";function x(t){var n={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:S(t),edges:C(t)};return e(t.graph())||(n.value=r(t.graph())),n}function S(n){return t(n.nodes(),function(t){var r=n.node(t),i=n.parent(t),a={v:t};return e(r)||(a.value=r),e(i)||(a.parent=i),a})}function C(n){return t(n.edges(),function(t){var r=n.edge(t),i={v:t.v,w:t.w};return e(t.name)||(i.name=t.name),e(r)||(i.value=r),i})}var w=new Map,T=new Map,E=new Map,D=a(()=>{T.clear(),E.clear(),w.clear()},`clear`),O=a((e,t)=>{let n=T.get(t)||[];return o.trace(`In isDescendant`,t,` `,e,` = `,n.includes(e)),n.includes(e)},`isDescendant`),k=a((e,t)=>{let n=T.get(t)||[];return o.info(`Descendants of `,t,` is `,n),o.info(`Edge is `,e),e.v===t||e.w===t?!1:n?n.includes(e.v)||O(e.v,t)||O(e.w,t)||n.includes(e.w):(o.debug(`Tilt, `,t,`,not in descendants`),!1)},`edgeInCluster`),A=a((e,t,n,r)=>{o.warn(`Copying children of `,e,`root`,r,`data`,t.node(e),r);let i=t.children(e)||[];e!==r&&i.push(e),o.warn(`Copying (nodes) clusterId`,e,`nodes`,i),i.forEach(i=>{if(t.children(i).length>0)A(i,t,n,r);else{let a=t.node(i);o.info(`cp `,i,` to `,r,` with parent `,e),n.setNode(i,a),r!==t.parent(i)&&(o.warn(`Setting parent`,i,t.parent(i)),n.setParent(i,t.parent(i))),e!==r&&i!==e?(o.debug(`Setting parent`,i,e),n.setParent(i,e)):(o.info(`In copy `,e,`root`,r,`data`,t.node(e),r),o.debug(`Not Setting parent for node=`,i,`cluster!==rootId`,e!==r,`node!==clusterId`,i!==e));let s=t.edges(i);o.debug(`Copying Edges`,s),s.forEach(i=>{o.info(`Edge`,i);let a=t.edge(i.v,i.w,i.name);o.info(`Edge data`,a,r);try{k(i,r)?(o.info(`Copying as `,i.v,i.w,a,i.name),n.setEdge(i.v,i.w,a,i.name),o.info(`newGraph edges `,n.edges(),n.edge(n.edges()[0]))):o.info(`Skipping copy of edge `,i.v,`-->`,i.w,` rootId: `,r,` clusterId:`,e)}catch(e){o.error(e)}})}o.debug(`Removing node`,i),t.removeNode(i)})},`copy`),j=a((e,t)=>{let n=t.children(e),r=[...n];for(let i of n)E.set(i,e),r=[...r,...j(i,t)];return r},`extractDescendants`),M=a((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),i=e.edges().filter(e=>e.v===n||e.w===n),a=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),o=i.map(e=>({v:e.v,w:e.w}));return a.filter(e=>o.some(t=>e.v===t.v&&e.w===t.w))},`findCommonEdges`),N=a((e,t,n)=>{let r=t.children(e);if(o.trace(`Searching children of id `,e,r),r.length<1)return e;let i;for(let e of r){let r=N(e,t,n),a=M(t,n,r);if(r)if(a.length>0)i=r;else return r}return i},`findNonClusterChild`),P=a(e=>!w.has(e)||!w.get(e).externalConnections?e:w.has(e)?w.get(e).id:e,`getAnchorId`),F=a((e,t)=>{if(!e||t>10){o.debug(`Opting out, no graph `);return}else o.debug(`Opting in, graph `);e.nodes().forEach(function(t){e.children(t).length>0&&(o.warn(`Cluster identified`,t,` Replacement id in edges: `,N(t,e,t)),T.set(t,j(t,e)),w.set(t,{id:N(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(o.debug(`Cluster identified`,t,T),r.forEach(e=>{O(e.v,t)^O(e.w,t)&&(o.warn(`Edge: `,e,` leaves cluster `,t),o.warn(`Descendants of XXX `,t,`: `,T.get(t)),w.get(t).externalConnections=!0)})):o.debug(`Not a cluster `,t,T)});for(let t of w.keys()){let n=w.get(t).id,r=e.parent(n);r!==t&&w.has(r)&&!w.get(r).externalConnections&&(w.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);o.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(t)),o.warn(`Edge `+t.v+` -> `+t.w+`: `+JSON.stringify(e.edge(t)));let r=t.v,i=t.w;if(o.warn(`Fix XXX`,w,`ids:`,t.v,t.w,`Translating: `,w.get(t.v),` --- `,w.get(t.w)),w.get(t.v)||w.get(t.w)){if(o.warn(`Fixing and trying - removing XXX`,t.v,t.w,t.name),r=P(t.v),i=P(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let i=e.parent(r);w.get(i).externalConnections=!0,n.fromCluster=t.v}if(i!==t.w){let r=e.parent(i);w.get(r).externalConnections=!0,n.toCluster=t.w}o.warn(`Fix Replacing with XXX`,r,i,t.name),e.setEdge(r,i,n,t.name)}}),o.warn(`Adjusted Graph`,x(e)),I(e,0),o.trace(w)},`adjustClustersAndEdges`),I=a((e,t)=>{if(o.warn(`extractor - `,t,x(e),e.children(`D`)),t>10){o.error(`Bailing out`);return}let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r||=n.length>0}if(!r){o.debug(`Done, no node has children`,e.nodes());return}o.debug(`Nodes = `,n,t);for(let r of n)if(o.debug(`Extracting node`,r,w,w.has(r)&&!w.get(r).externalConnections,!e.parent(r),e.node(r),e.children(`D`),` Depth `,t),!w.has(r))o.debug(`Not a cluster`,r,t);else if(!w.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){o.warn(`Cluster without external connections, without a parent and with children`,r,t);let n=e.graph().rankdir===`TB`?`LR`:`TB`;w.get(r)?.clusterData?.dir&&(n=w.get(r).clusterData.dir,o.warn(`Fixing dir`,w.get(r).clusterData.dir,n));let a=new i({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});o.warn(`Old graph before copy`,x(e)),A(r,e,a,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:w.get(r).clusterData,label:w.get(r).label,graph:a}),o.warn(`New graph after copy node: (`,r,`)`,x(a)),o.debug(`Old graph after copy`,x(e))}else o.warn(`Cluster ** `,r,` **not meeting the criteria !externalConnections:`,!w.get(r).externalConnections,` no parent: `,!e.parent(r),` children `,e.children(r)&&e.children(r).length>0,e.children(`D`),t),o.debug(w);n=e.nodes(),o.warn(`New list of nodes`,n);for(let r of n){let n=e.node(r);o.warn(` Now next level`,r,n),n?.clusterNode&&I(n.graph,t+1)}},`extractor`),L=a((e,t)=>{if(t.length===0)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=L(e,e.children(t));n=[...n,...r]}),n},`sorter`),R=a(e=>L(e,e.children()),`sortNodesByHierarchy`),z=a(async(e,t,r,i,s,p)=>{o.warn(`Graph in recursive render:XAX`,x(t),s);let m=t.graph().rankdir;o.trace(`Dir in recursive render - dir:`,m);let _=e.insert(`g`).attr(`class`,`root`);t.nodes()?o.info(`Recursive render XXX`,t.nodes()):o.info(`No nodes found for`,t),t.edges().length>0&&o.info(`Recursive edges`,t.edge(t.edges()[0]));let b=_.insert(`g`).attr(`class`,`clusters`),S=_.insert(`g`).attr(`class`,`edgePaths`),C=_.insert(`g`).attr(`class`,`edgeLabels`),T=_.insert(`g`).attr(`class`,`nodes`);await Promise.all(t.nodes().map(async function(e){let n=t.node(e);if(s!==void 0){let n=JSON.parse(JSON.stringify(s.clusterData));o.trace(`Setting data for parent cluster XXX
2
2
  Node.id = `,e,`
3
3
  data=`,n.height,`
4
4
  Parent cluster`,s.height),t.setNode(s.id,n),t.parent(e)||(o.trace(`Setting parent`,e,s.id),t.setParent(e,s.id,n))}if(o.info(`(Insert) Node XXX`+e+`: `+JSON.stringify(t.node(e))),n?.clusterNode){o.info(`Cluster identified XBX`,e,n.width,t.node(e));let{ranksep:a,nodesep:s}=t.graph();n.graph.setGraph({...n.graph.graph(),ranksep:a+25,nodesep:s});let c=await z(T,n.graph,r,i,t.node(e),p),l=c.elem;h(n,l),n.diff=c.diff||0,o.info(`New compound node after recursive render XAX`,e,`width`,n.width,`height`,n.height),f(l,n)}else t.children(e).length>0?(o.trace(`Cluster - the non recursive path XBX`,e,n.id,n,n.width,`Graph:`,t),o.trace(N(n.id,t)),w.set(n.id,{id:N(n.id,t),node:n})):(o.trace(`Node - the non recursive path XAX`,e,T,t.node(e),m),await l(T,t.node(e),{config:p,dir:m}))})),await a(async()=>{let e=t.edges().map(async function(e){let n=t.edge(e.v,e.w,e.name);o.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(e)),o.info(`Edge `+e.v+` -> `+e.w+`: `,e,` `,JSON.stringify(t.edge(e))),o.info(`Fix`,w,`ids:`,e.v,e.w,`Translating: `,w.get(e.v),w.get(e.w)),await y(C,n)});await Promise.all(e)},`processEdges`)(),o.info(`Graph before layout:`,JSON.stringify(x(t))),o.info(`############################################# XXX`),o.info(`### Layout ### XXX`),o.info(`############################################# XXX`),n(t),o.info(`Graph after layout:`,JSON.stringify(x(t)));let E=0,{subGraphTitleTotalMargin:D}=c(p);return await Promise.all(R(t).map(async function(e){let n=t.node(e);if(o.info(`Position XBX => `+e+`: (`+n.x,`,`+n.y,`) width: `,n.width,` height: `,n.height),n?.clusterNode)n.y+=D,o.info(`A tainted cluster node XBX1`,e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),w.get(n.id).node=n,u(n);else if(t.children(e).length>0){o.info(`A pure cluster node XBX1`,e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=D,t.node(n.parentId);let r=n?.padding/2||0,i=n?.labelBBox?.height||0,a=i-r||0;o.debug(`OffsetY`,a,`labelHeight`,i,`halfPadding`,r),await d(b,n),w.get(n.id).node=n}else{let e=t.node(n.parentId);n.y+=D/2,o.info(`A regular node XBX1 - using the padding`,n.id,`parent`,n.parentId,n.width,n.height,n.x,n.y,`offsetY`,n.offsetY,`parent`,e,e?.offsetY,n),u(n)}})),t.edges().forEach(function(e){let n=t.edge(e);o.info(`Edge `+e.v+` -> `+e.w+`: `+JSON.stringify(n),n),n.points.forEach(e=>e.y+=D/2),g(n,v(S,n,w,r,t.node(e.v),t.node(e.w),i))}),t.nodes().forEach(function(e){let n=t.node(e);o.info(e,n.type,n.diff),n.isGroup&&(E=n.diff)}),o.warn(`Returning from recursive render XAX`,_,E),{elem:_,diff:E}},`recursiveRender`),B=a(async(e,t)=>{let n=new i({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),r=t.select(`g`);_(r,e.markers,e.type,e.diagramId),p(),b(),m(),D(),e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),o.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);o.label=``,o.arrowTypeEnd=`none`,o.id=t+`-cyclic-special-1`,s.arrowTypeStart=`none`,s.arrowTypeEnd=`none`,s.id=t+`-cyclic-special-mid`,c.label=``,a.isGroup&&(o.fromCluster=t,c.toCluster=t),c.id=t+`-cyclic-special-2`,c.arrowTypeStart=`none`,n.setEdge(t,r,o,t+`-cyclic-special-0`),n.setEdge(r,i,s,t+`-cyclic-special-1`),n.setEdge(i,t,c,t+`-cyc<lic-special-2`)}else n.setEdge(e.start,e.end,{...e},e.id)}),o.warn(`Graph at first:`,JSON.stringify(x(n))),F(n),o.warn(`Graph after XAX:`,JSON.stringify(x(n)));let a=s();await z(r,n,e.type,e.diagramId,void 0,a)},`render`);export{B as render};