pgexplain 0.2.0 → 0.3.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.
- package/CHANGELOG.md +27 -0
- package/README.md +102 -6
- package/dist/cli.js +355 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +98 -3
- package/dist/index.js.map +1 -1
- package/dist/server.js +208 -38
- package/dist/server.js.map +1 -1
- package/dist/web/assets/{PlanGraph-0P3xGm2e.js → PlanGraph-CD8gYPCY.js} +1 -1
- package/dist/web/assets/index-D3fMyvfo.js +237 -0
- package/dist/web/assets/index-p4QC4qQe.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +4 -2
- package/dist/web/assets/index-BqB6p5Pn.js +0 -227
- package/dist/web/assets/index-ByEFSLsN.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as ci,g as Sc,R as Mc,a as D,j as M,B as kc,n as Cc}from"./index-BqB6p5Pn.js";var ui=Object.defineProperty,Ic=(e,t,n)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t)ui(e,n,{get:t[n],enumerable:!0})},$c=(e,t,n)=>Ic(e,t+"",n),li={};Ac(li,{Graph:()=>de,alg:()=>ar,json:()=>fi,version:()=>Lc});var Pc=Object.defineProperty,di=(e,t)=>{for(var n in t)Pc(e,n,{get:t[n],enumerable:!0})},de=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,s,a,c=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,s=e.name,arguments.length===2&&(a=t,c=!0)):(o=e,i=t,s=r,arguments.length>2&&(a=n,c=!0)),o=""+o,i=""+i,s!==void 0&&(s=""+s);let u=ft(this._isDirected,o,i,s);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=a),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=c?a:this._defaultEdgeLabelFn(o,i,s);let d=Tc(this._isDirected,o,i,s);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,zr(this._preds[i],o),zr(this._sucs[o],i),this._in[i][u]=d,this._out[o][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,s=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],jr(this._preds[s],i),jr(this._sucs[i],s),delete this._in[s][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function zr(e,t){e[t]?e[t]++:e[t]=1}function jr(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function ft(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let s=o;o=i,i=s}return o+""+i+""+(r===void 0?"\0":r)}function Tc(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let a=o;o=i,i=a}let s={v:o,w:i};return r&&(s.name=r),s}function Mn(e,t){return ft(e,t.v,t.w,t.name)}var Lc="4.0.1",fi={};di(fi,{read:()=>zc,write:()=>Dc});function Dc(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Oc(e),edges:Rc(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Oc(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function Rc(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function zc(e){let t=new de(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ar={};di(ar,{CycleException:()=>Kt,bellmanFord:()=>hi,components:()=>Vc,dijkstra:()=>Ut,dijkstraAll:()=>Yc,findCycles:()=>Xc,floydWarshall:()=>Gc,isAcyclic:()=>Uc,postorder:()=>Zc,preorder:()=>Qc,prim:()=>Jc,shortestPaths:()=>eu,tarjan:()=>pi,topsort:()=>mi});var jc=()=>1;function hi(e,t,n,r){return Hc(e,String(t),n||jc,r||function(o){return e.outEdges(o)})}function Hc(e,t,n,r){let o={},i,s=0,a=e.nodes(),c=function(l){let f=n(l);o[l.v].distance+f<o[l.w].distance&&(o[l.w]={distance:o[l.v].distance+f,predecessor:l.v},i=!0)},u=function(){a.forEach(function(l){r(l).forEach(function(f){let h=f.v===l?f.v:f.w,g=h===f.v?f.w:f.v;c({v:h,w:g})})})};a.forEach(function(l){let f=l===t?0:Number.POSITIVE_INFINITY;o[l]={distance:f,predecessor:""}});let d=a.length;for(let l=1;l<d&&(i=!1,s++,u(),!!i);l++);if(s===d-1&&(i=!1,u(),i))throw new Error("The graph contains a negative weight cycle");return o}function Vc(e){let t={},n=[],r;function o(i){i in t||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var gi=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Bc=()=>1;function Ut(e,t,n,r){let o=function(i){return e.outEdges(i)};return Fc(e,String(t),n||Bc,r||o)}function Fc(e,t,n,r){let o={},i=new gi,s,a,c=function(u){let d=u.v!==s?u.v:u.w,l=o[d],f=n(u),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h<l.distance&&(l.distance=h,l.predecessor=s,i.decrease(d,h))};for(e.nodes().forEach(function(u){let d=u===t?0:Number.POSITIVE_INFINITY;o[u]={distance:d,predecessor:""},i.add(u,d)});i.size()>0&&(s=i.removeMin(),a=o[s],a.distance!==Number.POSITIVE_INFINITY);)r(s).forEach(c);return o}function Yc(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Ut(e,o,t,n),r},{})}function pi(e){let t=0,n=[],r={},o=[];function i(s){let a=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(c){c in r?r[c].onStack&&(a.lowlink=Math.min(a.lowlink,r[c].index)):(i(c),a.lowlink=Math.min(a.lowlink,r[c].lowlink))}),a.lowlink===a.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(s!==u);o.push(c)}}return e.nodes().forEach(function(s){s in r||i(s)}),o}function Xc(e){return pi(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Wc=()=>1;function Gc(e,t,n){return qc(e,t||Wc,n||function(r){return e.outEdges(r)})}function qc(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},o.forEach(function(s){i!==s&&(r[i][s]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(s){let a=s.v===i?s.w:s.v,c=t(s);r[i][a]={distance:c,predecessor:i}})}),o.forEach(function(i){let s=r[i];o.forEach(function(a){let c=r[a];o.forEach(function(u){let d=c[i],l=s[u],f=c[u],h=d.distance+l.distance;h<f.distance&&(f.distance=h,f.predecessor=l.predecessor)})})}),r}var Kt=class extends Error{constructor(...e){super(...e)}};function mi(e){let t={},n={},r=[];function o(i){if(i in n)throw new Kt;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new Kt;return r}function Uc(e){try{mi(e)}catch(t){if(t instanceof Kt)return!1;throw t}return!0}function Kc(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(a=>{var c;return(c=e.isDirected()?e.successors(a):e.neighbors(a))!=null?c:[]}),s={};return t.forEach(function(a){if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);o=yi(e,a,n==="post",s,i,r,o)}),o}function yi(e,t,n,r,o,i,s){return t in r||(r[t]=!0,n||(s=i(s,t)),o(t).forEach(function(a){s=yi(e,a,n,r,o,i,s)}),n&&(s=i(s,t))),s}function xi(e,t,n){return Kc(e,t,n,function(r,o){return r.push(o),r},[])}function Zc(e,t){return xi(e,t,"post")}function Qc(e,t){return xi(e,t,"pre")}function Jc(e,t){let n=new de,r={},o=new gi,i;function s(c){let u=c.v===i?c.w:c.v,d=o.priority(u);if(d!==void 0){let l=t(c);l<d&&(r[u]=i,o.decrease(u,l))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(c){o.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),o.decrease(e.nodes()[0],0);let a=!1;for(;o.size()>0;){if(i=o.removeMin(),i in r)n.setEdge(i,r[i]);else{if(a)throw new Error("Input graph is not connected: "+e);a=!0}e.nodeEdges(i).forEach(s)}return n}function eu(e,t,n,r){return tu(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function tu(e,t,n,r){if(n===void 0)return Ut(e,t,n,r);let o=!1,i=e.nodes();for(let s=0;s<i.length;s++){let a=r(i[s]);for(let c=0;c<a.length;c++){let u=a[c],d=u.v===i[s]?u.v:u.w,l=d===u.v?u.w:u.v;n({v:d,w:l})<0&&(o=!0)}if(o)return hi(e,t,n,r)}return Ut(e,t,n,r)}function ct(e,t,n,r){let o=r;for(;e.hasNode(o);)o=cr(r);return n.dummy=t,e.setNode(o,n),o}function nu(e){let t=new de().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function wi(e){let t=new de({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Hr(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,a=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*s>Math.abs(o)*a?(i<0&&(a=-a),c=a*o/i,u=a):(o<0&&(s=-s),c=s,u=s*i/o),{x:n+c,y:r+u}}function kt(e){let t=yt(bi(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function ru(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=_e(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function ou(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=_e(Math.min,t),r=[];e.nodes().forEach(s=>{let a=e.node(s).rank-n;r[a]||(r[a]=[]),r[a].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,a)=>{s===void 0&&a%i!==0?--o:s!==void 0&&o&&s.forEach(c=>e.node(c).rank+=o)})}function Vr(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),ct(e,"border",o,t)}function iu(e,t=vi){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var vi=65535;function _e(e,t){if(t.length>vi){let n=iu(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function bi(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return _e(Math.max,t)}function su(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function _i(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Ei(e,t){return t()}var au=0;function cr(e){let t=++au;return e+(""+t)}function yt(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function Zt(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function ln(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function cu(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var dn="\0",uu="3.0.0",lu=class{constructor(){$c(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Br(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Br(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,du)),n=n._prev;return"["+e.join(", ")+"]"}};function Br(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function du(e,t){if(e!=="_next"&&e!=="_prev")return t}var fu=lu,hu=()=>1;function gu(e,t){if(e.nodeCount()<=1)return[];let n=mu(e,t||hu);return pu(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function pu(e,t,n){var r;let o=[],i=t[t.length-1],s=t[0],a;for(;e.nodeCount();){for(;a=s.dequeue();)kn(e,t,n,a);for(;a=i.dequeue();)kn(e,t,n,a);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(a=(r=t[c])==null?void 0:r.dequeue(),a){o=o.concat(kn(e,t,n,a,!0)||[]);break}}}return o}function kn(e,t,n,r,o){let i=[],s=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),u=e.node(a.v);o&&i.push({v:a.v,w:a.w}),u.out-=c,Xn(t,n,u)}),(e.outEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),u=a.w,d=e.node(u);d.in-=c,Xn(t,n,d)}),e.removeNode(r.v),s}function mu(e,t){let n=new de,r=0,o=0;e.nodes().forEach(a=>{n.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let c=n.edge(a.v,a.w)||0,u=t(a),d=c+u;n.setEdge(a.v,a.w,d);let l=n.node(a.v),f=n.node(a.w);o=Math.max(o,l.out+=u),r=Math.max(r,f.in+=u)});let i=yu(o+r+3).map(()=>new fu),s=r+1;return n.nodes().forEach(a=>{Xn(i,s,n.node(a))}),{graph:n,buckets:i,zeroIdx:s}}function Xn(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function yu(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function xu(e){(e.graph().acyclicer==="greedy"?gu(e,t(e)):wu(e)).forEach(n=>{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,cr("rev"))});function t(n){return r=>n.edge(r).weight}}function wu(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(s=>{Object.hasOwn(n,s.w)?t.push(s):o(s.w)}),delete n[i])}return e.nodes().forEach(o),t}function vu(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function bu(e){e.graph().dummyChains=[],e.edges().forEach(t=>_u(e,t))}function _u(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,a=e.edge(t),c=a.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,l;for(l=0,++r;r<i;++l,++r)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:t,rank:r},u=ct(e,"edge",d,"_d"),r===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),e.setEdge(n,u,{weight:a.weight},s),l===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,o,{weight:a.weight},s)}function Eu(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=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=o,n=e.node(t)})}function ur(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),s=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],a=_e(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),o.rank=a}e.sources().forEach(n)}function et(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ni=Nu;function Nu(e){let t=new de({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,s;for(;Su(t,e)<o&&(i=Mu(t,e),!!i);)s=t.hasNode(i.v)?et(e,i):-et(e,i),ku(t,e,s);return t}function Su(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let s=i.v,a=r===s?i.w:s;!e.hasNode(a)&&!et(t,i)&&(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}return e.nodes().forEach(n),e.nodeCount()}function Mu(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=et(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function ku(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:Cu,postorder:Iu}=ar,Au=qe;qe.initLowLimValues=dr;qe.initCutValues=lr;qe.calcCutValue=Si;qe.leaveEdge=ki;qe.enterEdge=Ci;qe.exchangeEdges=Ii;function qe(e){e=nu(e),ur(e);let t=Ni(e);dr(t),lr(t,e);let n,r;for(;n=ki(t);)r=Ci(t,e,n),Ii(t,e,n,r)}function lr(e,t){let n=Iu(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>$u(e,t,r))}function $u(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=Si(e,t,n)}function Si(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),s=0;i||(o=!1,i=t.edge(r,n)),s=i.weight;let a=t.nodeEdges(n);return a&&a.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let l=u===o,f=t.edge(c).weight;if(s+=l?f:-f,Tu(e,n,d)){let h=e.edge(n,d).cutvalue;s+=l?-h:h}}}),s}function dr(e,t){arguments.length<2&&(t=e.nodes()[0]),Mi(e,{},1,t)}function Mi(e,t,n,r,o){let i=n,s=e.node(r);t[r]=!0;let a=e.neighbors(r);return a&&a.forEach(c=>{Object.hasOwn(t,c)||(n=Mi(e,t,n,c,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function ki(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Ci(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),s=e.node(o),a=i,c=!1;return i.lim>s.lim&&(a=s,c=!0),t.edges().filter(u=>c===Fr(e,e.node(u.v),a)&&c!==Fr(e,e.node(u.w),a)).reduce((u,d)=>et(t,d)<et(t,u)?d:u)}function Ii(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),dr(e),lr(e,t),Pu(e,t)}function Pu(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=Cu(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,s=t.edge(o,i),a=!1;s||(s=t.edge(i,o),a=!0),t.node(o).rank=t.node(i).rank+(a?s.minlen:-s.minlen)})}function Tu(e,t,n){return e.hasEdge(t,n)}function Fr(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Lu=Du;function Du(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":Yr(e);break;case"tight-tree":Ru(e);break;case"longest-path":Ou(e);break;case"none":break;default:Yr(e)}}var Ou=ur;function Ru(e){ur(e),Ni(e)}function Yr(e){Au(e)}var zu=ju;function ju(e){let t=Vu(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=Hu(e,t,o.v,o.w),s=i.path,a=i.lca,c=0,u=s[c],d=!0;for(;n!==o.w;){if(r=e.node(n),d){for(;(u=s[c])!==a&&e.node(u).maxRank<r.rank;)c++;u===a&&(d=!1)}if(!d){for(;c<s.length-1&&e.node(s[c+1]).minRank<=r.rank;)c++;u=s[c]}u!==void 0&&e.setParent(n,u),n=e.successors(n)[0]}})}function Hu(e,t,n,r){let o=[],i=[],s=Math.min(t[n].low,t[r].low),a=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),o.push(c);while(c&&(t[c].low>s||a>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:o.concat(i.reverse()),lca:u}}function Vu(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(dn).forEach(r),t}function Bu(e){let t=ct(e,"root",{},"_root"),n=Fu(e),r=Object.values(n),o=_e(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=i);let s=Yu(e)+1;e.children(dn).forEach(a=>Ai(e,t,i,s,o,n,a)),e.graph().nodeRankFactor=i}function Ai(e,t,n,r,o,i,s){var a;let c=e.children(s);if(!c.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=Vr(e,"_bt"),d=Vr(e,"_bb"),l=e.node(s);e.setParent(u,s),l.borderTop=u,e.setParent(d,s),l.borderBottom=d,c.forEach(f=>{var h;Ai(e,t,n,r,o,i,f);let g=e.node(f),x=g.borderTop?g.borderTop:f,y=g.borderBottom?g.borderBottom:f,p=g.borderTop?r:2*r,b=x!==y?1:o-((h=i[s])!=null?h:0)+1;e.setEdge(u,x,{weight:p,minlen:b,nestingEdge:!0}),e.setEdge(y,d,{weight:p,minlen:b,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:o+((a=i[s])!=null?a:0)})}function Fu(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children(dn).forEach(r=>n(r,1)),t}function Yu(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Xu(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Wu=Gu;function Gu(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)Xr(e,"borderLeft","_bl",n,o,i),Xr(e,"borderRight","_br",n,o,i)}}e.children(dn).forEach(t)}function Xr(e,t,n,r,o,i){let s={width:0,height:0,rank:i,borderType:t},a=o[t][i-1],c=ct(e,"border",s,n);o[t][i]=c,e.setParent(c,r),a&&e.setEdge(a,c,{weight:1})}function qu(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&$i(e)}function Uu(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Ku(e),(n==="lr"||n==="rl")&&(Zu(e),$i(e))}function $i(e){e.nodes().forEach(t=>Wr(e.node(t))),e.edges().forEach(t=>Wr(e.edge(t)))}function Wr(e){let t=e.width;e.width=e.height,e.height=t}function Ku(e){e.nodes().forEach(t=>Cn(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Cn),Object.hasOwn(r,"y")&&Cn(r)})}function Cn(e){e.y=-e.y}function Zu(e){e.nodes().forEach(t=>In(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(In),Object.hasOwn(r,"x")&&In(r)})}function In(e){let t=e.x;e.x=e.y,e.y=t}function Qu(e){let t={},n=e.nodes().filter(a=>!e.children(a).length),r=n.map(a=>e.node(a).rank),o=_e(Math.max,r),i=yt(o+1).map(()=>[]);function s(a){if(t[a])return;t[a]=!0;let c=e.node(a);i[c.rank].push(a);let u=e.successors(a);u&&u.forEach(s)}return n.sort((a,c)=>e.node(a).rank-e.node(c).rank).forEach(s),i}function Ju(e,t){let n=0;for(let r=1;r<t.length;++r)n+=el(e,t[r-1],t[r]);return n}function el(e,t,n){let r=cu(n,n.map((u,d)=>d)),o=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(l=>({pos:r[l.w],weight:e.edge(l).weight})).sort((l,f)=>l.pos-f.pos):[]}),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let a=new Array(s).fill(0),c=0;return o.forEach(u=>{let d=u.pos+i;a[d]+=u.weight;let l=0;for(;d>0;)d%2&&(l+=a[d+1]),d=d-1>>1,a[d]+=u.weight;c+=u.weight*l}),c}function tl(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,s)=>{let a=e.edge(s),c=e.node(s.v);return{sum:i.sum+a.weight*c.order,weight:i.weight+a.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function nl(e,t){let n={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),n[o.v]=s}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let r=Object.values(n).filter(o=>!o.indegree);return rl(r)}function rl(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&ol(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>Zt(o,["vs","i","barycenter","weight"]))}function ol(e,t){let 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 il(e,t){let n=su(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,l)=>l.i-d.i),i=[],s=0,a=0,c=0;r.sort(sl(!!t)),c=Gr(i,o,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,a+=d.weight,c=Gr(i,o,c)});let u={vs:i.flat(1)};return a&&(u.barycenter=s/a,u.weight=a),u}function Gr(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function sl(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function Pi(e,t,n,r){let o=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,a=i?i.borderRight:void 0,c={};s&&(o=o.filter(f=>f!==s&&f!==a));let u=tl(e,o);u.forEach(f=>{if(e.children(f.v).length){let h=Pi(e,f.v,n,r);c[f.v]=h,Object.hasOwn(h,"barycenter")&&cl(f,h)}});let d=nl(u,n);al(d,c);let l=il(d,r);if(s&&a){l.vs=[s,l.vs,a].flat(1);let f=e.predecessors(s);if(f&&f.length){let h=e.node(f[0]),g=e.predecessors(a),x=e.node(g[0]);Object.hasOwn(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+x.order)/(l.weight+2),l.weight+=2}}return l}function al(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function cl(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function ul(e,t,n,r){r||(r=e.nodes());let o=ll(e),i=new de({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let a=e.node(s),c=e.parent(s);if(a.rank===t||a.minRank<=t&&t<=a.maxRank){i.setNode(s),i.setParent(s,c||o);let u=e[n](s);u&&u.forEach(d=>{let l=d.v===s?d.w:d.v,f=i.edge(l,s),h=f!==void 0?f.weight:0;i.setEdge(l,s,{weight:e.edge(d).weight+h})}),Object.hasOwn(a,"minRank")&&i.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]})}}),i}function ll(e){let t;for(;e.hasNode(t=cr("_root")););return t}function dl(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),a,c;for(;s;){if(a=e.parent(s),a?(c=r[a],r[a]=s):(c=o,o=s),c&&c!==s){t.setEdge(c,s);return}s=a}})}function Ti(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Ti);return}let n=bi(e),r=qr(e,yt(1,n+1),"inEdges"),o=qr(e,yt(n-1,-1,-1),"outEdges"),i=Qu(e);if(Ur(e,i),t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,a,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){fl(u%2?r:o,u%4>=2,c),i=kt(e);let l=Ju(e,i);l<s?(d=0,a=Object.assign({},i),s=l):l===s&&(a=structuredClone(i))}Ur(e,a)}function qr(e,t,n){let r=new Map,o=(i,s)=>{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&o(a,i)}return t.map(function(i){return ul(e,i,n,r.get(i)||[])})}function fl(e,t,n){let r=new de;e.forEach(function(o){n.forEach(a=>r.setEdge(a.left,a.right));let i=o.graph().root,s=Pi(o,i,r,t);s.vs.forEach((a,c)=>o.node(a).order=c),dl(o,r,s.vs)})}function Ur(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function hl(e,t){let n={};function r(o,i){let s=0,a=0,c=o.length,u=i[i.length-1];return i.forEach((d,l)=>{let f=pl(e,d),h=f?e.node(f).order:c;(f||d===u)&&(i.slice(a,l+1).forEach(g=>{let x=e.predecessors(g);x&&x.forEach(y=>{let p=e.node(y),b=p.order;(b<s||h<b)&&!(p.dummy&&e.node(g).dummy)&&Li(n,y,g)})}),a=l+1,s=h)}),i}return t.length&&t.reduce(r),n}function gl(e,t){let n={};function r(i,s,a,c,u){yt(s,a).forEach(d=>{let l=i[d];if(l!==void 0&&e.node(l).dummy){let f=e.predecessors(l);f&&f.forEach(h=>{if(h===void 0)return;let g=e.node(h);g.dummy&&(g.order<c||g.order>u)&&Li(n,h,l)})}})}function o(i,s){let a=-1,c=-1,u=0;return s.forEach((d,l)=>{if(e.node(d).dummy==="border"){let f=e.predecessors(d);if(f&&f.length){let h=f[0];if(h===void 0)return;c=e.node(h).order,r(s,u,l,a,c),u=l,a=c}}r(s,u,s.length,c,i.length)}),s}return t.length&&t.reduce(o),n}function pl(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function Li(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function ml(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function yl(e,t,n,r){let o={},i={},s={};return t.forEach(a=>{a.forEach((c,u)=>{o[c]=c,i[c]=c,s[c]=u})}),t.forEach(a=>{let c=-1;a.forEach(u=>{let d=r(u);if(d&&d.length){let l=d.sort((h,g)=>{let x=s[h],y=s[g];return(x!==void 0?x:0)-(y!==void 0?y:0)}),f=(l.length-1)/2;for(let h=Math.floor(f),g=Math.ceil(f);h<=g;++h){let x=l[h];if(x===void 0)continue;let y=s[x];if(y!==void 0&&i[u]===u&&c<y&&!ml(n,u,x)){let p=o[x];p!==void 0&&(i[x]=u,i[u]=o[u]=p,c=y)}}}})}),{root:o,align:i}}function xl(e,t,n,r,o=!1){let i={},s=wl(e,t,n,o),a=o?"borderLeft":"borderRight";function c(h,g){let x=s.nodes().slice(),y={},p=x.pop();for(;p;){if(y[p])h(p);else{y[p]=!0,x.push(p);for(let b of g(p))x.push(b)}p=x.pop()}}function u(h){let g=s.inEdges(h);g?i[h]=g.reduce((x,y)=>{var p;let b=(p=i[y.v])!=null?p:0,m=s.edge(y);return Math.max(x,b+(m!==void 0?m:0))},0):i[h]=0}function d(h){let g=s.outEdges(h),x=Number.POSITIVE_INFINITY;g&&(x=g.reduce((p,b)=>{let m=i[b.w],w=s.edge(b);return Math.min(p,(m!==void 0?m:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let y=e.node(h);x!==Number.POSITIVE_INFINITY&&y.borderType!==a&&(i[h]=Math.max(i[h]!==void 0?i[h]:0,x))}function l(h){return s.predecessors(h)||[]}function f(h){return s.successors(h)||[]}return c(u,l),c(d,f),Object.keys(r).forEach(h=>{var g;let x=n[h];x!==void 0&&(i[h]=(g=i[x])!=null?g:0)}),i}function wl(e,t,n,r){let o=new de,i=e.graph(),s=Nl(i.nodesep,i.edgesep,r);return t.forEach(a=>{let c;a.forEach(u=>{let d=n[u];if(d!==void 0){if(o.setNode(d),c!==void 0){let l=n[c];if(l!==void 0){let f=o.edge(l,d);o.setEdge(l,d,Math.max(s(e,u,c),f||0))}}c=u}})}),o}function vl(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([a,c])=>{let u=Sl(e,a)/2;o=Math.max(c+u,o),i=Math.min(c-u,i)});let s=o-i;return s<n[0]&&(n=[s,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function bl(e,t){let n=Object.values(t),r=_e(Math.min,n),o=_e(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let a=i+s,c=e[a];if(!c||c===t)return;let u=Object.values(c),d=r-_e(Math.min,u);s!=="l"&&(d=o-_e(Math.max,u)),d&&(e[a]=ln(c,l=>l+d))})})}function _l(e,t=void 0){let n=e.ul;return n?ln(n,(r,o)=>{var i,s;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[o]!==void 0)return u[o]}let a=Object.values(e).map(c=>{let u=c[o];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=a[1])!=null?i:0)+((s=a[2])!=null?s:0))/2}):{}}function El(e){let t=kt(e),n=Object.assign(hl(e,t),gl(e,t)),r={},o;["u","d"].forEach(s=>{o=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(a=>{a==="r"&&(o=o.map(d=>Object.values(d).reverse()));let c=yl(e,o,n,d=>(s==="u"?e.predecessors(d):e.successors(d))||[]),u=xl(e,o,c.root,c.align,a==="r");a==="r"&&(u=ln(u,d=>-d)),r[s+a]=u})});let i=vl(e,r);return bl(r,i),_l(r,e.graph().align)}function Nl(e,t,n){return(r,o,i)=>{let s=r.node(o),a=r.node(i),c=0,u;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(s.dummy?t:e)/2,c+=(a.dummy?t:e)/2,c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=a.width/2;break;case"r":u=-a.width/2;break}return u&&(c+=n?u:-u),c}}function Sl(e,t){return e.node(t).width}function Ml(e){e=wi(e),kl(e),Object.entries(El(e)).forEach(([t,n])=>e.node(t).x=n)}function kl(e){let t=kt(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(s=>{let a=s.reduce((c,u)=>{var d;let l=(d=e.node(u).height)!=null?d:0;return c>l?c:l},0);s.forEach(c=>{let u=e.node(c);o==="top"?u.y=i+u.height/2:o==="bottom"?u.y=i+a-u.height/2:u.y=i+a/2}),i+=a+r})}function Cl(e,t={}){let n=t.debugTiming?_i:Ei;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>zl(e));return n(" runLayout",()=>Il(r,n,t)),n(" updateInputGraph",()=>Al(e,r)),r})}function Il(e,t,n){t(" makeSpaceForEdgeLabels",()=>jl(e)),t(" removeSelfEdges",()=>ql(e)),t(" acyclic",()=>xu(e)),t(" nestingGraph.run",()=>Bu(e)),t(" rank",()=>Lu(wi(e))),t(" injectEdgeLabelProxies",()=>Hl(e)),t(" removeEmptyRanks",()=>ou(e)),t(" nestingGraph.cleanup",()=>Xu(e)),t(" normalizeRanks",()=>ru(e)),t(" assignRankMinMax",()=>Vl(e)),t(" removeEdgeLabelProxies",()=>Bl(e)),t(" normalize.run",()=>bu(e)),t(" parentDummyChains",()=>zu(e)),t(" addBorderSegments",()=>Wu(e)),t(" order",()=>Ti(e,n)),t(" insertSelfEdges",()=>Ul(e)),t(" adjustCoordinateSystem",()=>qu(e)),t(" position",()=>Ml(e)),t(" positionSelfEdges",()=>Kl(e)),t(" removeBorderNodes",()=>Gl(e)),t(" normalize.undo",()=>Eu(e)),t(" fixupEdgeLabelCoords",()=>Xl(e)),t(" undoCoordinateSystem",()=>Uu(e)),t(" translateGraph",()=>Fl(e)),t(" assignNodeIntersects",()=>Yl(e)),t(" reversePoints",()=>Wl(e)),t(" acyclic.undo",()=>vu(e))}function Al(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var $l=["nodesep","edgesep","ranksep","marginx","marginy"],Pl={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Tl=["acyclicer","ranker","rankdir","align","rankalign"],Ll=["width","height","rank"],Kr={width:0,height:0},Dl=["minlen","weight","width","height","labeloffset"],Ol={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Rl=["labelpos"];function zl(e){let t=new de({multigraph:!0,compound:!0}),n=$n(e.graph());return t.setGraph(Object.assign({},Pl,An(n,$l),Zt(n,Tl))),e.nodes().forEach(r=>{let o=$n(e.node(r)),i=An(o,Ll);Object.keys(Kr).forEach(a=>{i[a]===void 0&&(i[a]=Kr[a])}),t.setNode(r,i);let s=e.parent(r);s!==void 0&&t.setParent(r,s)}),e.edges().forEach(r=>{let o=$n(e.edge(r));t.setEdge(r,Object.assign({},Ol,An(o,Dl),Zt(o,Rl)))}),t}function jl(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let 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 Hl(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};ct(e,"edge-proxy",o,"_ep")}})}function Vl(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Bl(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Fl(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,a=i.marginy||0;function c(u){let d=u.x,l=u.y,f=u.width,h=u.height;t=Math.min(t,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,l-h/2),o=Math.max(o,l+h/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=s,r-=a,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(l=>{l.x-=t,l.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=o-r+a}function Yl(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(Hr(r,i)),n.points.push(Hr(o,s))})}function Xl(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(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 Wl(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Gl(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function ql(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Ul(e){kt(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(s=>{ct(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++n,e:s.e,label:s.label},"_se")}),delete i.selfEdges})})}function Kl(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,o=e.node(r.e.v),i=o.x+o.width/2,s=o.y,a=n.x-i,c=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*a/3,y:s-c},{x:i+5*a/6,y:s-c},{x:i+a,y:s},{x:i+5*a/6,y:s+c},{x:i+2*a/3,y:s+c}],r.label.x=n.x,r.label.y=n.y}})}function An(e,t){return ln(Zt(e,t),Number)}function $n(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Zl(e){let t=kt(e),n=new de({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,a)=>(n.setEdge(s,a,{style:"invis"}),a))}),n}var Ql={graphlib:li,version:uu,layout:Cl,debug:Zl,util:{time:_i,notime:Ei}},Zr=Ql;/*! For license information please see dagre.esm.js.LEGAL.txt */function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jl={value:()=>{}};function fn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Yt(n)}function Yt(e){this._=e}function ed(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Yt.prototype=fn.prototype={constructor:Yt,on:function(e,t){var n=this._,r=ed(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=td(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Qr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Qr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function td(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Qr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Jl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wn="http://www.w3.org/1999/xhtml";const Jr={svg:"http://www.w3.org/2000/svg",xhtml:Wn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Jr.hasOwnProperty(t)?{space:Jr[t],local:e}:e}function nd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wn&&t.documentElement.namespaceURI===Wn?t.createElement(e):t.createElementNS(n,e)}}function rd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Di(e){var t=hn(e);return(t.local?rd:nd)(t)}function od(){}function fr(e){return e==null?od:function(){return this.querySelector(e)}}function id(e){typeof e!="function"&&(e=fr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,u,d=0;d<s;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),a[d]=u);return new ue(r,this._parents)}function sd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ad(){return[]}function Oi(e){return e==null?ad:function(){return this.querySelectorAll(e)}}function cd(e){return function(){return sd(e.apply(this,arguments))}}function ud(e){typeof e=="function"?e=cd(e):e=Oi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(e.call(c,c.__data__,u,s)),o.push(c));return new ue(r,o)}function Ri(e){return function(){return this.matches(e)}}function zi(e){return function(t){return t.matches(e)}}var ld=Array.prototype.find;function dd(e){return function(){return ld.call(this.children,e)}}function fd(){return this.firstElementChild}function hd(e){return this.select(e==null?fd:dd(typeof e=="function"?e:zi(e)))}var gd=Array.prototype.filter;function pd(){return Array.from(this.children)}function md(e){return function(){return gd.call(this.children,e)}}function yd(e){return this.selectAll(e==null?pd:md(typeof e=="function"?e:zi(e)))}function xd(e){typeof e!="function"&&(e=Ri(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new ue(r,this._parents)}function ji(e){return new Array(e.length)}function wd(){return new ue(this._enter||this._groups.map(ji),this._parents)}function Qt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qt.prototype={constructor:Qt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function vd(e){return function(){return e}}function bd(e,t,n,r,o,i){for(var s=0,a,c=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Qt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function _d(e,t,n,r,o,i,s){var a,c,u=new Map,d=t.length,l=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<l;++a)h=s.call(e,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Qt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&u.get(f[a])===c&&(o[a]=c)}function Ed(e){return e.__data__}function Nd(e,t){if(!arguments.length)return Array.from(this,Ed);var n=t?_d:bd,r=this._parents,o=this._groups;typeof e!="function"&&(e=vd(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],l=o[u],f=l.length,h=Sd(e.call(d,d&&d.__data__,u,r)),g=h.length,x=a[u]=new Array(g),y=s[u]=new Array(g),p=c[u]=new Array(f);n(d,l,x,y,p,h,t);for(var b=0,m=0,w,N;b<g;++b)if(w=x[b]){for(b>=m&&(m=b+1);!(N=y[m])&&++m<g;);w._next=N||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Sd(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Md(){return new ue(this._exit||this._groups.map(ji),this._parents)}function kd(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Cd(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],d=r[c],l=u.length,f=a[c]=new Array(l),h,g=0;g<l;++g)(h=u[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Id(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Ad(e){e||(e=$d);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),u,d=0;d<a;++d)(u=s[d])&&(c[d]=u);c.sort(t)}return new ue(o,this._parents).order()}function $d(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Pd(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Td(){return Array.from(this)}function Ld(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Dd(){let e=0;for(const t of this)++e;return e}function Od(){return!this.node()}function Rd(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function zd(e){return function(){this.removeAttribute(e)}}function jd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hd(e,t){return function(){this.setAttribute(e,t)}}function Vd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Yd(e,t){var n=hn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?jd:zd:typeof t=="function"?n.local?Fd:Bd:n.local?Vd:Hd)(n,t))}function Hi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xd(e){return function(){this.style.removeProperty(e)}}function Wd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Gd(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qd(e,t,n){return arguments.length>1?this.each((t==null?Xd:typeof t=="function"?Gd:Wd)(e,t,n??"")):tt(this.node(),e)}function tt(e,t){return e.style.getPropertyValue(t)||Hi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ud(e){return function(){delete this[e]}}function Kd(e,t){return function(){this[e]=t}}function Zd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Qd(e,t){return arguments.length>1?this.each((t==null?Ud:typeof t=="function"?Zd:Kd)(e,t)):this.node()[e]}function Vi(e){return e.trim().split(/^|\s+/)}function hr(e){return e.classList||new Bi(e)}function Bi(e){this._node=e,this._names=Vi(e.getAttribute("class")||"")}Bi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Fi(e,t){for(var n=hr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Yi(e,t){for(var n=hr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Jd(e){return function(){Fi(this,e)}}function ef(e){return function(){Yi(this,e)}}function tf(e,t){return function(){(t.apply(this,arguments)?Fi:Yi)(this,e)}}function nf(e,t){var n=Vi(e+"");if(arguments.length<2){for(var r=hr(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?tf:t?Jd:ef)(n,t))}function rf(){this.textContent=""}function of(e){return function(){this.textContent=e}}function sf(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function af(e){return arguments.length?this.each(e==null?rf:(typeof e=="function"?sf:of)(e)):this.node().textContent}function cf(){this.innerHTML=""}function uf(e){return function(){this.innerHTML=e}}function lf(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function df(e){return arguments.length?this.each(e==null?cf:(typeof e=="function"?lf:uf)(e)):this.node().innerHTML}function ff(){this.nextSibling&&this.parentNode.appendChild(this)}function hf(){return this.each(ff)}function gf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pf(){return this.each(gf)}function mf(e){var t=typeof e=="function"?e:Di(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yf(){return null}function xf(e,t){var n=typeof e=="function"?e:Di(e),r=t==null?yf:typeof t=="function"?t:fr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function wf(){var e=this.parentNode;e&&e.removeChild(this)}function vf(){return this.each(wf)}function bf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _f(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ef(e){return this.select(e?_f:bf)}function Nf(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Sf(e){return function(t){e.call(this,t,this.__data__)}}function Mf(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function kf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Cf(e,t,n){return function(){var r=this.__on,o,i=Sf(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function If(e,t,n){var r=Mf(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,d;c<u;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Cf:kf,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function Xi(e,t,n){var r=Hi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Af(e,t){return function(){return Xi(this,e,t)}}function $f(e,t){return function(){return Xi(this,e,t.apply(this,arguments))}}function Pf(e,t){return this.each((typeof t=="function"?$f:Af)(e,t))}function*Tf(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Wi=[null];function ue(e,t){this._groups=e,this._parents=t}function Ct(){return new ue([[document.documentElement]],Wi)}function Lf(){return this}ue.prototype=Ct.prototype={constructor:ue,select:id,selectAll:ud,selectChild:hd,selectChildren:yd,filter:xd,data:Nd,enter:wd,exit:Md,join:kd,merge:Cd,selection:Lf,order:Id,sort:Ad,call:Pd,nodes:Td,node:Ld,size:Dd,empty:Od,each:Rd,attr:Yd,style:qd,property:Qd,classed:nf,text:af,html:df,raise:hf,lower:pf,append:mf,insert:xf,remove:vf,clone:Ef,datum:Nf,on:If,dispatch:Pf,[Symbol.iterator]:Tf};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Wi)}function Df(e){let t;for(;t=e.sourceEvent;)e=t;return e}function he(e,t){if(e=Df(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Of={passive:!1},xt={capture:!0,passive:!1};function Pn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Gi(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,xt);"onselectstart"in t?n.on("selectstart.drag",Qe,xt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function qi(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,xt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dt=e=>()=>e;function Gn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Gn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rf(e){return!e.ctrlKey&&!e.button}function zf(){return this.parentNode}function jf(e,t){return t??{x:e.x,y:e.y}}function Hf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ui(){var e=Rf,t=zf,n=jf,r=Hf,o={},i=fn("start","drag","end"),s=0,a,c,u,d,l=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",y).on("touchmove.drag",p,Of).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(d||!e.call(this,w,N))){var _=m(this,t.call(this,w,N),w,N,"mouse");_&&(ce(w.view).on("mousemove.drag",g,xt).on("mouseup.drag",x,xt),Gi(w.view),Pn(w),u=!1,a=w.clientX,c=w.clientY,_("start",w))}}function g(w){if(Qe(w),!u){var N=w.clientX-a,_=w.clientY-c;u=N*N+_*_>l}o.mouse("drag",w)}function x(w){ce(w.view).on("mousemove.drag mouseup.drag",null),qi(w.view,u),Qe(w),o.mouse("end",w)}function y(w,N){if(e.call(this,w,N)){var _=w.changedTouches,k=t.call(this,w,N),$=_.length,P,V;for(P=0;P<$;++P)(V=m(this,k,w,N,_[P].identifier,_[P]))&&(Pn(w),V("start",w,_[P]))}}function p(w){var N=w.changedTouches,_=N.length,k,$;for(k=0;k<_;++k)($=o[N[k].identifier])&&(Qe(w),$("drag",w,N[k]))}function b(w){var N=w.changedTouches,_=N.length,k,$;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<_;++k)($=o[N[k].identifier])&&(Pn(w),$("end",w,N[k]))}function m(w,N,_,k,$,P){var V=i.copy(),S=he(P||_,N),T,H,v;if((v=n.call(w,new Gn("beforestart",{sourceEvent:_,target:f,identifier:$,active:s,x:S[0],y:S[1],dx:0,dy:0,dispatch:V}),k))!=null)return T=v.x-S[0]||0,H=v.y-S[1]||0,function I(E,A,L){var C=S,z;switch(E){case"start":o[$]=I,z=s++;break;case"end":delete o[$],--s;case"drag":S=he(L||A,N),z=s;break}V.call(E,w,new Gn(E,{sourceEvent:A,subject:v,target:f,identifier:$,active:z,x:S[0]+T,y:S[1]+H,dx:S[0]-C[0],dy:S[1]-C[1],dispatch:V}),k)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Dt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Dt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Dt(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Dt(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(l=(w=+w)*w,f):Math.sqrt(l)},f}function gr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ki(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function It(){}var wt=.7,Jt=1/wt,Je="\\s*([+-]?\\d+)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vf=/^#([0-9a-f]{3,8})$/,Bf=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Ff=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Yf=new RegExp(`^rgba\\(${Je},${Je},${Je},${vt}\\)$`),Xf=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${vt}\\)$`),Wf=new RegExp(`^hsl\\(${vt},${Ee},${Ee}\\)$`),Gf=new RegExp(`^hsla\\(${vt},${Ee},${Ee},${vt}\\)$`),eo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gr(It,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:to,formatHex:to,formatHex8:qf,formatHsl:Uf,formatRgb:no,toString:no});function to(){return this.rgb().formatHex()}function qf(){return this.rgb().formatHex8()}function Uf(){return Zi(this).formatHsl()}function no(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Vf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ro(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ot(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ot(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bf.exec(e))?new ae(t[1],t[2],t[3],1):(t=Ff.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Yf.exec(e))?Ot(t[1],t[2],t[3],t[4]):(t=Xf.exec(e))?Ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wf.exec(e))?so(t[1],t[2]/100,t[3]/100,1):(t=Gf.exec(e))?so(t[1],t[2]/100,t[3]/100,t[4]):eo.hasOwnProperty(e)?ro(eo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function ro(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ot(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function Kf(e){return e instanceof It||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function qn(e,t,n,r){return arguments.length===1?Kf(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gr(ae,qn,Ki(It,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wt:Math.pow(wt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),en(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oo,formatHex:oo,formatHex8:Zf,formatRgb:io,toString:io}));function oo(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function Zf(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function io(){const e=en(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function en(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function so(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ge(e,t,n,r)}function Zi(e){if(e instanceof ge)return new ge(e.h,e.s,e.l,e.opacity);if(e instanceof It||(e=Fe(e)),!e)return new ge;if(e instanceof ge)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new ge(s,a,c,e.opacity)}function Qf(e,t,n,r){return arguments.length===1?Zi(e):new ge(e,t,n,r??1)}function ge(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gr(ge,Qf,Ki(It,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new ge(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wt:Math.pow(wt,e),new ge(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(Tn(e>=240?e-240:e+120,o,r),Tn(e,o,r),Tn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ge(ao(this.h),Rt(this.s),Rt(this.l),en(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=en(this.opacity);return`${e===1?"hsl(":"hsla("}${ao(this.h)}, ${Rt(this.s)*100}%, ${Rt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ao(e){return e=(e||0)%360,e<0?e+360:e}function Rt(e){return Math.max(0,Math.min(1,e||0))}function Tn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const pr=e=>()=>e;function Jf(e,t){return function(n){return e+n*t}}function eh(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function th(e){return(e=+e)==1?Qi:function(t,n){return n-t?eh(t,n,e):pr(isNaN(t)?n:t)}}function Qi(e,t){var n=t-e;return n?Jf(e,n):pr(isNaN(e)?t:e)}const tn=(function e(t){var n=th(t);function r(o,i){var s=n((o=qn(o)).r,(i=qn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=Qi(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=u(d),o+""}}return r.gamma=e,r})(1);function nh(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function rh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function oh(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=pt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function ih(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function sh(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=pt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Un=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ln=new RegExp(Un.source,"g");function ah(e){return function(){return e}}function ch(e){return function(t){return e(t)+""}}function Ji(e,t){var n=Un.lastIndex=Ln.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Un.exec(e))&&(o=Ln.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:be(r,o)})),n=Ln.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?ch(c[0].x):ah(t):(t=c.length,function(u){for(var d=0,l;d<t;++d)a[(l=c[d]).i]=l.x(u);return a.join("")})}function pt(e,t){var n=typeof t,r;return t==null||n==="boolean"?pr(t):(n==="number"?be:n==="string"?(r=Fe(t))?(t=r,tn):Ji:t instanceof Fe?tn:t instanceof Date?ih:rh(t)?nh:Array.isArray(t)?oh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?sh:be)(e,t)}var co=180/Math.PI,Kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function es(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*co,skewX:Math.atan(c)*co,scaleX:s,scaleY:a}}var zt;function uh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kn:es(t.a,t.b,t.c,t.d,t.e,t.f)}function lh(e){return e==null||(zt||(zt=document.createElementNS("http://www.w3.org/2000/svg","g")),zt.setAttribute("transform",e),!(e=zt.transform.baseVal.consolidate()))?Kn:(e=e.matrix,es(e.a,e.b,e.c,e.d,e.e,e.f))}function ts(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,d,l,f,h,g){if(u!==l||d!==f){var x=h.push("translate(",null,t,null,n);g.push({i:x-4,x:be(u,l)},{i:x-2,x:be(d,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function s(u,d,l,f){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:be(u,d)})):d&&l.push(o(l)+"rotate("+d+r)}function a(u,d,l,f){u!==d?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:be(u,d)}):d&&l.push(o(l)+"skewX("+d+r)}function c(u,d,l,f,h,g){if(u!==l||d!==f){var x=h.push(o(h)+"scale(",null,",",null,")");g.push({i:x-4,x:be(u,l)},{i:x-2,x:be(d,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(u,d){var l=[],f=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,l,f),s(u.rotate,d.rotate,l,f),a(u.skewX,d.skewX,l,f),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,l,f),u=d=null,function(h){for(var g=-1,x=f.length,y;++g<x;)l[(y=f[g]).i]=y.x(h);return l.join("")}}}var dh=ts(uh,"px, ","px)","deg)"),fh=ts(lh,", ",")",")"),hh=1e-12;function uo(e){return((e=Math.exp(e))+1/e)/2}function gh(e){return((e=Math.exp(e))-1/e)/2}function ph(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xt=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],d=s[0],l=s[1],f=s[2],h=d-a,g=l-c,x=h*h+g*g,y,p;if(x<hh)p=Math.log(f/u)/t,y=function(k){return[a+k*h,c+k*g,u*Math.exp(t*k*p)]};else{var b=Math.sqrt(x),m=(f*f-u*u+r*x)/(2*u*n*b),w=(f*f-u*u-r*x)/(2*f*n*b),N=Math.log(Math.sqrt(m*m+1)-m),_=Math.log(Math.sqrt(w*w+1)-w);p=(_-N)/t,y=function(k){var $=k*p,P=uo(N),V=u/(n*b)*(P*ph(t*$+N)-gh(N));return[a+V*h,c+V*g,u*P/uo(t*$+N)]}}return y.duration=p*1e3*t/Math.SQRT2,y}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var nt=0,ht=0,lt=0,ns=1e3,nn,gt,rn=0,Ye=0,gn=0,bt=typeof performance=="object"&&performance.now?performance:Date,rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mr(){return Ye||(rs(mh),Ye=bt.now()+gn)}function mh(){Ye=0}function on(){this._call=this._time=this._next=null}on.prototype=os.prototype={constructor:on,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mr():+n)+(t==null?0:+t),!this._next&>!==this&&(gt?gt._next=this:nn=this,gt=this),this._call=e,this._time=n,Zn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zn())}};function os(e,t,n){var r=new on;return r.restart(e,t,n),r}function yh(){mr(),++nt;for(var e=nn,t;e;)(t=Ye-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nt}function lo(){Ye=(rn=bt.now())+gn,nt=ht=0;try{yh()}finally{nt=0,wh(),Ye=0}}function xh(){var e=bt.now(),t=e-rn;t>ns&&(gn-=t,rn=e)}function wh(){for(var e,t=nn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:nn=n);gt=e,Zn(r)}function Zn(e){if(!nt){ht&&(ht=clearTimeout(ht));var t=e-Ye;t>24?(e<1/0&&(ht=setTimeout(lo,e-bt.now()-gn)),lt&&(lt=clearInterval(lt))):(lt||(rn=bt.now(),lt=setInterval(xh,ns)),nt=1,rs(lo))}}function fo(e,t,n){var r=new on;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var vh=fn("start","end","cancel","interrupt"),bh=[],is=0,ho=1,Qn=2,Wt=3,go=4,Jn=5,Gt=6;function pn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;_h(e,n,{name:t,index:r,group:o,on:vh,tween:bh,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:is})}function yr(e,t){var n=xe(e,t);if(n.state>is)throw new Error("too late; already scheduled");return n}function Ne(e,t){var n=xe(e,t);if(n.state>Wt)throw new Error("too late; already running");return n}function xe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function _h(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=os(i,0,n.time);function i(u){n.state=ho,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,l,f,h;if(n.state!==ho)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Wt)return fo(s);h.state===go?(h.state=Gt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Gt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(fo(function(){n.state===Wt&&(n.state=go,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Qn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Qn){for(n.state=Wt,o=new Array(f=n.tween.length),d=0,l=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Jn,1),l=-1,f=o.length;++l<f;)o[l].call(e,d);n.state===Jn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gt,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Qn&&r.state<Jn,r.state=Gt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Eh(e){return this.each(function(){qt(this,e)})}function Nh(e,t){var n,r;return function(){var o=Ne(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Sh(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Ne(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===t){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Mh(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=xe(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Nh:Sh)(n,e,t))}function xr(e,t,n){var r=e._id;return e.each(function(){var o=Ne(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return xe(o,r).value[t]}}function ss(e,t){var n;return(typeof t=="number"?be:t instanceof Fe?tn:(n=Fe(t))?(t=n,tn):Ji)(e,t)}function kh(e){return function(){this.removeAttribute(e)}}function Ch(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ih(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ah(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function $h(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Ph(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Th(e,t){var n=hn(e),r=n==="transform"?fh:ss;return this.attrTween(e,typeof t=="function"?(n.local?Ph:$h)(n,r,xr(this,"attr."+e,t)):t==null?(n.local?Ch:kh)(n):(n.local?Ah:Ih)(n,r,t))}function Lh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dh(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Oh(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Dh(e,i)),n}return o._value=t,o}function Rh(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Lh(e,i)),n}return o._value=t,o}function zh(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=hn(e);return this.tween(n,(r.local?Oh:Rh)(r,t))}function jh(e,t){return function(){yr(this,e).delay=+t.apply(this,arguments)}}function Hh(e,t){return t=+t,function(){yr(this,e).delay=t}}function Vh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jh:Hh)(t,e)):xe(this.node(),t).delay}function Bh(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}function Fh(e,t){return t=+t,function(){Ne(this,e).duration=t}}function Yh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Bh:Fh)(t,e)):xe(this.node(),t).duration}function Xh(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}function Wh(e){var t=this._id;return arguments.length?this.each(Xh(t,e)):xe(this.node(),t).ease}function Gh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}function qh(e){if(typeof e!="function")throw new Error;return this.each(Gh(this._id,e))}function Uh(e){typeof e!="function"&&(e=Ri(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Ae(r,this._parents,this._name,this._id)}function Kh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],d=c.length,l=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||u[h])&&(l[h]=f);for(;a<r;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function Zh(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qh(e,t,n){var r,o,i=Zh(t)?yr:Ne;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function Jh(e,t){var n=this._id;return arguments.length<2?xe(this.node(),n).on.on(e):this.each(Qh(n,e,t))}function eg(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function tg(){return this.on("end.remove",eg(this._id))}function ng(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fr(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,u=i[s]=new Array(c),d,l,f=0;f<c;++f)(d=a[f])&&(l=e.call(d,d.__data__,f,a))&&("__data__"in d&&(l.__data__=d.__data__),u[f]=l,pn(u[f],t,n,f,u,xe(d,n)));return new Ae(i,this._parents,t,n)}function rg(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Oi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,d,l=0;l<u;++l)if(d=c[l]){for(var f=e.call(d,d.__data__,l,c),h,g=xe(d,n),x=0,y=f.length;x<y;++x)(h=f[x])&&pn(h,t,n,x,f,g);i.push(f),s.push(d)}return new Ae(i,s,t,n)}var og=Ct.prototype.constructor;function ig(){return new og(this._groups,this._parents)}function sg(e,t){var n,r,o;return function(){var i=tt(this,e),s=(this.style.removeProperty(e),tt(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function as(e){return function(){this.style.removeProperty(e)}}function ag(e,t,n){var r,o=n+"",i;return function(){var s=tt(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function cg(e,t,n){var r,o,i;return function(){var s=tt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),tt(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function ug(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Ne(this,e),u=c.on,d=c.value[i]==null?a||(a=as(t)):void 0;(u!==n||o!==d)&&(r=(n=u).copy()).on(s,o=d),c.on=r}}function lg(e,t,n){var r=(e+="")=="transform"?dh:ss;return t==null?this.styleTween(e,sg(e,r)).on("end.style."+e,as(e)):typeof t=="function"?this.styleTween(e,cg(e,r,xr(this,"style."+e,t))).each(ug(this._id,e)):this.styleTween(e,ag(e,r,t),n).on("end.style."+e,null)}function dg(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function fg(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&dg(e,s,n)),r}return i._value=t,i}function hg(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,fg(e,t,n??""))}function gg(e){return function(){this.textContent=e}}function pg(e){return function(){var t=e(this);this.textContent=t??""}}function mg(e){return this.tween("text",typeof e=="function"?pg(xr(this,"text",e)):gg(e==null?"":e+""))}function yg(e){return function(t){this.textContent=e.call(this,t)}}function xg(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&yg(o)),t}return r._value=e,r}function wg(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,xg(e))}function vg(){for(var e=this._name,t=this._id,n=cs(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var d=xe(c,t);pn(c,e,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ae(r,this._parents,e,n)}function bg(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var u=Ne(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),o===0&&i()})}var _g=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function cs(){return++_g}var Ce=Ct.prototype;Ae.prototype={constructor:Ae,select:ng,selectAll:rg,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Uh,merge:Kh,selection:ig,transition:vg,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:Jh,attr:Th,attrTween:zh,style:lg,styleTween:hg,text:mg,textTween:wg,remove:tg,tween:Mh,delay:Vh,duration:Yh,ease:Wh,easeVarying:qh,end:bg,[Symbol.iterator]:Ce[Symbol.iterator]};function Eg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ng={time:null,delay:0,duration:250,ease:Eg};function Sg(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Mg(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=cs(),(n=Ng).time=mr(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&pn(c,e,t,u,s,n||Sg(c,t));return new Ae(r,this._parents,e,t)}Ct.prototype.interrupt=Eh;Ct.prototype.transition=Mg;const jt=e=>()=>e;function kg(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var mn=new Ie(1,0,0);us.prototype=Ie.prototype;function us(e){for(;!e.__zoom;)if(!(e=e.parentNode))return mn;return e.__zoom}function Dn(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function Cg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ig(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function po(){return this.__zoom||mn}function Ag(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $g(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pg(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ls(){var e=Cg,t=Ig,n=Pg,r=Ag,o=$g,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Xt,u=fn("start","zoom","end"),d,l,f,h=500,g=150,x=0,y=10;function p(v){v.property("__zoom",po).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",V).filter(o).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(v,I,E,A){var L=v.selection?v.selection():v;L.property("__zoom",po),v!==L?N(v,I,E,A):L.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},p.scaleBy=function(v,I,E,A){p.scaleTo(v,function(){var L=this.__zoom.k,C=typeof I=="function"?I.apply(this,arguments):I;return L*C},E,A)},p.scaleTo=function(v,I,E,A){p.transform(v,function(){var L=t.apply(this,arguments),C=this.__zoom,z=E==null?w(L):typeof E=="function"?E.apply(this,arguments):E,j=C.invert(z),R=typeof I=="function"?I.apply(this,arguments):I;return n(m(b(C,R),z,j),L,s)},E,A)},p.translateBy=function(v,I,E,A){p.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},p.translateTo=function(v,I,E,A,L){p.transform(v,function(){var C=t.apply(this,arguments),z=this.__zoom,j=A==null?w(C):typeof A=="function"?A.apply(this,arguments):A;return n(mn.translate(j[0],j[1]).scale(z.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),C,s)},A,L)};function b(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new Ie(I,v.x,v.y)}function m(v,I,E){var A=I[0]-E[0]*v.k,L=I[1]-E[1]*v.k;return A===v.x&&L===v.y?v:new Ie(v.k,A,L)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,I,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var L=this,C=arguments,z=_(L,C).event(A),j=t.apply(L,C),R=E==null?w(j):typeof E=="function"?E.apply(L,C):E,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=L.__zoom,U=typeof I=="function"?I.apply(L,C):I,Q=c(Y.invert(R).concat(F/Y.k),U.invert(R).concat(F/U.k));return function(q){if(q===1)q=U;else{var O=Q(q),B=F/O[2];q=new Ie(B,R[0]-O[0]*B,R[1]-O[1]*B)}z.zoom(null,q)}})}function _(v,I,E){return!E&&v.__zooming||new k(v,I)}function k(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,I),this.taps=0}k.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=ce(this.that).datum();u.call(v,this.that,new kg(v,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:u}),I)}};function $(v,...I){if(!e.apply(this,arguments))return;var E=_(this,I).event(v),A=this.__zoom,L=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),C=he(v);if(E.wheel)(E.mouse[0][0]!==C[0]||E.mouse[0][1]!==C[1])&&(E.mouse[1]=A.invert(E.mouse[0]=C)),clearTimeout(E.wheel);else{if(A.k===L)return;E.mouse=[C,A.invert(C)],qt(this),E.start()}dt(v),E.wheel=setTimeout(z,g),E.zoom("mouse",n(m(b(A,L),E.mouse[0],E.mouse[1]),E.extent,s));function z(){E.wheel=null,E.end()}}function P(v,...I){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,I,!0).event(v),L=ce(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),C=he(v,E),z=v.clientX,j=v.clientY;Gi(v.view),Dn(v),A.mouse=[C,this.__zoom.invert(C)],qt(this),A.start();function R(Y){if(dt(Y),!A.moved){var U=Y.clientX-z,Q=Y.clientY-j;A.moved=U*U+Q*Q>x}A.event(Y).zoom("mouse",n(m(A.that.__zoom,A.mouse[0]=he(Y,E),A.mouse[1]),A.extent,s))}function F(Y){L.on("mousemove.zoom mouseup.zoom",null),qi(Y.view,A.moved),dt(Y),A.event(Y).end()}}function V(v,...I){if(e.apply(this,arguments)){var E=this.__zoom,A=he(v.changedTouches?v.changedTouches[0]:v,this),L=E.invert(A),C=E.k*(v.shiftKey?.5:2),z=n(m(b(E,C),A,L),t.apply(this,I),s);dt(v),a>0?ce(this).transition().duration(a).call(N,z,A,v):ce(this).call(p.transform,z,A,v)}}function S(v,...I){if(e.apply(this,arguments)){var E=v.touches,A=E.length,L=_(this,I,v.changedTouches.length===A).event(v),C,z,j,R;for(Dn(v),z=0;z<A;++z)j=E[z],R=he(j,this),R=[R,this.__zoom.invert(R),j.identifier],L.touch0?!L.touch1&&L.touch0[2]!==R[2]&&(L.touch1=R,L.taps=0):(L.touch0=R,C=!0,L.taps=1+!!d);d&&(d=clearTimeout(d)),C&&(L.taps<2&&(l=R[0],d=setTimeout(function(){d=null},h)),qt(this),L.start())}}function T(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,L=A.length,C,z,j,R;for(dt(v),C=0;C<L;++C)z=A[C],j=he(z,this),E.touch0&&E.touch0[2]===z.identifier?E.touch0[0]=j:E.touch1&&E.touch1[2]===z.identifier&&(E.touch1[0]=j);if(z=E.that.__zoom,E.touch1){var F=E.touch0[0],Y=E.touch0[1],U=E.touch1[0],Q=E.touch1[1],q=(q=U[0]-F[0])*q+(q=U[1]-F[1])*q,O=(O=Q[0]-Y[0])*O+(O=Q[1]-Y[1])*O;z=b(z,Math.sqrt(q/O)),j=[(F[0]+U[0])/2,(F[1]+U[1])/2],R=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2]}else if(E.touch0)j=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(m(z,j,R),E.extent,s))}}function H(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,L=A.length,C,z;for(Dn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),C=0;C<L;++C)z=A[C],E.touch0&&E.touch0[2]===z.identifier?delete E.touch0:E.touch1&&E.touch1[2]===z.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(z=he(z,this),Math.hypot(l[0]-z[0],l[1]-z[1])<y)){var j=ce(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return p.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:jt(+v),p):r},p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:jt(!!v),p):e},p.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:jt(!!v),p):o},p.extent=function(v){return arguments.length?(t=typeof v=="function"?v:jt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),p):t},p.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],p):[i[0],i[1]]},p.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(v){return arguments.length?(n=v,p):n},p.duration=function(v){return arguments.length?(a=+v,p):a},p.interpolate=function(v){return arguments.length?(c=v,p):c},p.on=function(){var v=u.on.apply(u,arguments);return v===u?p:v},p.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,p):Math.sqrt(x)},p.tapDistance=function(v){return arguments.length?(y=+v,p):y},p}const ye={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},_t=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ds=["Enter"," ","Escape"],fs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var rt;(function(e){e.Strict="strict",e.Loose="loose"})(rt||(rt={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var Et;(function(e){e.Partial="partial",e.Full="full"})(Et||(Et={}));const hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Le;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Le||(Le={}));var sn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(sn||(sn={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const mo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function gs(e){return e===null?null:e?"valid":"invalid"}const ps=e=>"id"in e&&"source"in e&&"target"in e,Tg=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),wr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),At=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Lg=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):wr(o)?o:t.nodeLookup.get(o.id));const a=s?an(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return yn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xn(n)},$t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=yn(n,an(o)),r=!0)}),r?xn(n):{x:0,y:0,width:0,height:0}},vr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/o,c=(t.y-r)/o,u=t.width/o,d=t.height/o,l=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:x=!1}=f;if(s&&!g||x)continue;const y=h.width??f.width??f.initialWidth??0,p=h.height??f.height??f.initialHeight??0,{x:b,y:m}=f.internals.positionAbsolute,w=ws(a,c,u,d,b,m,y,p),N=y*p,_=i&&w>0;(!f.internals.handleBounds||_||w>=N||f.dragging)&&l.push(f)}return l},Dg=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Og(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Rg({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Og(e,s),c=$t(a),u=_r(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ms({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let l=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ye.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(l=[[c,u],[c+h,u+g]])}else a&&We(s.extent)&&(l=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const f=We(l)?Xe(t,l,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ye.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-u+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function zg({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(x=>x.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=Dg(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const l=await o({nodes:s,edges:d});return typeof l=="boolean"?l?{edges:d,nodes:s}:{edges:[],nodes:[]}:l}const ot=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:ot(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ot(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ys(e,t,n){const{width:r,height:o}=$e(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+r,s+o]],t)}const yo=(e,t,n)=>e<t?ot(Math.abs(e-t),1,t)/t:e>n?-ot(Math.abs(e-n),1,t)/t:0,br=(e,t,n=15,r=40)=>{const o=yo(e.x,r,t.width-r)*n,i=yo(e.y,r,t.height-r)*n;return[o,i]},yn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),er=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),xn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Nt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=wr(e)?e.internals.positionAbsolute:At(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},an=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=wr(e)?e.internals.positionAbsolute:At(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},xs=(e,t)=>xn(yn(er(e),er(t))),ws=(e,t,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(e+n,o+s)-Math.max(e,o)),u=Math.max(0,Math.min(t+r,i+a)-Math.max(t,i));return Math.ceil(c*u)},cn=(e,t)=>ws(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),xo=e=>pe(e.width)&&pe(e.height)&&pe(e.x)&&pe(e.y),pe=e=>!isNaN(e)&&isFinite(e),vs=(e,t)=>(n,r)=>{},Pt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?Pt(a,s):a},it=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ue(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function jg(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ue(e,n),o=Ue(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ue(e.top??e.y??0,n),o=Ue(e.bottom??e.y??0,n),i=Ue(e.left??e.x??0,t),s=Ue(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hg(e,t,n,r,o,i){const{x:s,y:a}=it(e,[t,n,r]),{x:c,y:u}=it({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,l=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(l)}}const _r=(e,t,n,r,o,i)=>{const s=jg(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,u=Math.min(a,c),d=ot(u,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*d,g=n/2-f*d,x=Hg(e,h,g,d,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},St=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function We(e){return e!=null&&e!=="parent"}function $e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function bs(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function _s(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function wo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vg(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Bg(e){return{...fs,...e||{}}}function mt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=me(e),a=Tt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?Pt(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const Er=e=>({width:e.offsetWidth,height:e.offsetHeight}),Es=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Fg=["INPUT","SELECT","TEXTAREA"];function Ns(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Fg.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ss=e=>"clientX"in e,me=(e,t)=>{var i,s;const n=Ss(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},vo=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Er(s)}})};function Ms({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),l=Math.abs(u-t);return[c,u,d,l]}function Ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function bo({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case W.Left:return[t-Ht(t-r,i),n];case W.Right:return[t+Ht(r-t,i),n];case W.Top:return[t,n-Ht(n-o,i)];case W.Bottom:return[t,n+Ht(o-n,i)]}}function ks({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=bo({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,d]=bo({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[l,f,h,g]=Ms({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${c} ${u},${d} ${r},${o}`,l,f,h,g]}function Cs({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function Yg({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function Xg({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=yn(an(e),an(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return cn(s,xn(i))>0}const Wg=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Gg=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),qg=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",ye.error006()),t;const r=n.getEdgeId||Wg;let o;return ps(e)?o={...e}:o={...e,id:r(e)},Gg(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Is({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Cs({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const _o={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Ug=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Eo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Kg({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:o,offset:i,stepPosition:s}){const a=_o[t],c=_o[r],u={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},l=Ug({source:u,sourcePosition:t,target:d}),f=l.x!==0?"x":"y",h=l[f];let g=[],x,y;const p={x:0,y:0},b={x:0,y:0},[,,m,w]=Cs({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??u.x+(d.x-u.x)*s,y=o.y??(u.y+d.y)/2):(x=o.x??(u.x+d.x)/2,y=o.y??u.y+(d.y-u.y)*s);const $=[{x,y:u.y},{x,y:d.y}],P=[{x:u.x,y},{x:d.x,y}];a[f]===h?g=f==="x"?$:P:g=f==="x"?P:$}else{const $=[{x:u.x,y:d.y}],P=[{x:d.x,y:u.y}];if(f==="x"?g=a.x===h?P:$:g=a.y===h?$:P,t===r){const v=Math.abs(e[f]-n[f]);if(v<=i){const I=Math.min(i-1,i-v);a[f]===h?p[f]=(u[f]>e[f]?-1:1)*I:b[f]=(d[f]>n[f]?-1:1)*I}}if(t!==r){const v=f==="x"?"y":"x",I=a[f]===c[v],E=u[v]>d[v],A=u[v]<d[v];(a[f]===1&&(!I&&E||I&&A)||a[f]!==1&&(!I&&A||I&&E))&&(g=f==="x"?$:P)}const V={x:u.x+p.x,y:u.y+p.y},S={x:d.x+b.x,y:d.y+b.y},T=Math.max(Math.abs(V.x-g[0].x),Math.abs(S.x-g[0].x)),H=Math.max(Math.abs(V.y-g[0].y),Math.abs(S.y-g[0].y));T>=H?(x=(V.x+S.x)/2,y=g[0].y):(x=g[0].x,y=(V.y+S.y)/2)}const N={x:u.x+p.x,y:u.y+p.y},_={x:d.x+b.x,y:d.y+b.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],x,y,m,w]}function Zg(e,t,n,r){const o=Math.min(Eo(e,t)/2,Eo(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function tr({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:d=.5}){const[l,f,h,g,x]=Kg({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:d});let y=`M${l[0].x} ${l[0].y}`;for(let p=1;p<l.length-1;p++)y+=Zg(l[p-1],l[p],l[p+1],s);return y+=`L${l[l.length-1].x} ${l[l.length-1].y}`,[y,f,h,g,x]}function No(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Qg(e){var l;const{sourceNode:t,targetNode:n}=e;if(!No(t)||!No(n))return null;const r=t.internals.handleBounds||So(t.handles),o=n.internals.handleBounds||So(n.handles),i=Mo((r==null?void 0:r.source)??[],e.sourceHandle),s=Mo(e.connectionMode===rt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(l=e.onError)==null||l.call(e,"008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,u=Ge(t,i,a),d=Ge(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function So(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Ge(e,t,n=W.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??$e(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:o+s/2,y:i};case W.Right:return{x:o+s,y:i+a/2};case W.Bottom:return{x:o+s/2,y:i+a};case W.Left:return{x:o,y:i+a/2}}}function Mo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function nr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Jg(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=nr(c,t);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const As=1e3,ep=10,Nr={nodeOrigin:[0,0],nodeExtent:_t,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},tp={...Nr,checkEquality:!0};function Sr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function np(e,t,n){const r=Sr(Nr,n);for(const o of e.values())if(o.parentId)kr(o,e,t,r);else{const i=At(o,r.nodeOrigin),s=We(o.extent)?o.extent:r.nodeExtent,a=Xe(i,s,$e(o));o.internals.positionAbsolute=a}}function rp(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function Mr(e){return e==="manual"}function rr(e,t,n,r={}){var d,l;const o=Sr(tp,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Mr(o.zIndexMode)?As:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=At(f,o.nodeOrigin),x=We(f.extent)?f.extent:o.nodeExtent,y=Xe(g,x,$e(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(l=f.measured)==null?void 0:l.height},internals:{positionAbsolute:y,handleBounds:rp(f,h),z:$s(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&kr(h,t,n,r,i),u||(u=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function op(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Sr(Nr,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}op(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*ep),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const l=i&&!Mr(c)?As:0,{x:f,y:h,z:g}=ip(e,d,s,a,l,c),{positionAbsolute:x}=e.internals,y=f!==x.x||h!==x.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:x,z:g}})}function $s(e,t,n){const r=pe(e.zIndex)?e.zIndex:0;return Mr(n)?r:r+(e.selected?t:0)}function ip(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=$e(e),u=At(e,n),d=We(e.extent)?Xe(u,e.extent,c):u;let l=Xe({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(l=ys(l,c,t));const f=$s(e,o,i),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function Cr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Nt(c),d=xs(u,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,l=$e(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(l.width,Math.round(a.width)),y=Math.max(l.height,Math.round(a.height)),p=(x-l.width)*f[0],b=(y-l.height)*f[1];(h>0||g>0||p||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+p,y:c.position.y-g+b}}),(m=n.get(u))==null||m.forEach(w=>{e.some(N=>N.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(l.width<a.width||l.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-p:0),height:y+(g?f[1]*g-b:0)}})}),o}function sp(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Er(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),m=We(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ys(w,x,t.get(g.parentId)):m&&(w=Xe(w,m,x));const N={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:vo("source",h.nodeElement,b,l,g.id),target:vo("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,N),g.parentId&&kr(N,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,y&&(u.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Nt(N,o)}))}}if(f.length>0){const h=Cr(f,t,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function ap({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function ko(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function Ps(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},u=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;ko("source",c,d,e,o,s),ko("target",c,u,e,i,a),t.set(r.id,r)}}function Ts(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ts(n,t):!1}function Co(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function cp(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Ts(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function On({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,d]of t){const l=(s=n.get(u))==null?void 0:s.internals.userNode;l&&o.push({...l,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function up({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Pt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function lp({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},d=null,l=!1,f=null,h=!1,g=!1,x=null;function y({noDragClassName:b,handleSelector:m,domNode:w,isSelectable:N,nodeId:_,nodeClickDistance:k=0}){f=ce(w);function $({x:T,y:H}){const{nodeLookup:v,nodeExtent:I,snapGrid:E,snapToGrid:A,nodeOrigin:L,onNodeDrag:C,onSelectionDrag:z,onError:j,updateNodePositions:R}=t();i={x:T,y:H};let F=!1;const Y=a.size>1,U=Y&&I?er($t(a)):null,Q=Y&&A?up({dragItems:a,snapGrid:E,x:T,y:H}):null;for(const[q,O]of a){if(!v.has(q))continue;let B={x:T-O.distance.x,y:H-O.distance.y};A&&(B=Q?{x:Math.round(B.x+Q.x),y:Math.round(B.y+Q.y)}:Pt(B,E));let Z=null;if(Y&&I&&!O.extent&&U){const{positionAbsolute:X}=O.internals,J=X.x-U.x+I[0][0],te=X.x+O.measured.width-U.x2+I[1][0],ne=X.y-U.y+I[0][1],ie=X.y+O.measured.height-U.y2+I[1][1];Z=[[J,ne],[te,ie]]}const{position:K,positionAbsolute:G}=ms({nodeId:q,nextPosition:B,nodeLookup:v,nodeExtent:Z||I,nodeOrigin:L,onError:j});F=F||O.position.x!==K.x||O.position.y!==K.y,O.position=K,O.internals.positionAbsolute=G}if(g=g||F,!!F&&(R(a,!0),x&&(r||C||!_&&z))){const[q,O]=On({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(x,a,q,O),C==null||C(x,q,O),_||z==null||z(x,O)}}async function P(){if(!d)return;const{transform:T,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(s);return}const[E,A]=br(u,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/T[2],i.y=(i.y??0)-A/T[2],await H({x:E,y:A})&&$(i)),s=requestAnimationFrame(P)}function V(T){var Y;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:I,transform:E,snapGrid:A,snapToGrid:L,selectNodesOnDrag:C,onNodeDragStart:z,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();l=!0,(!C||!N)&&!v&&_&&((Y=H.get(_))!=null&&Y.selected||R()),N&&C&&_&&(e==null||e(_));const F=mt(T.sourceEvent,{transform:E,snapGrid:A,snapToGrid:L,containerBounds:d});if(i=F,a=cp(H,I,F,_),a.size>0&&(n||z||!_&&j)){const[U,Q]=On({nodeId:_,dragItems:a,nodeLookup:H});n==null||n(T.sourceEvent,a,U,Q),z==null||z(T.sourceEvent,U,Q),_||j==null||j(T.sourceEvent,Q)}}const S=Ui().clickDistance(k).on("start",T=>{const{domNode:H,nodeDragThreshold:v,transform:I,snapGrid:E,snapToGrid:A}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,x=T.sourceEvent,v===0&&V(T),i=mt(T.sourceEvent,{transform:I,snapGrid:E,snapToGrid:A,containerBounds:d}),u=me(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:I,snapToGrid:E,nodeDragThreshold:A,nodeLookup:L}=t(),C=mt(T.sourceEvent,{transform:v,snapGrid:I,snapToGrid:E,containerBounds:d});if(x=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||_&&!L.has(_))&&(h=!0),!h){if(!c&&H&&l&&(c=!0,P()),!l){const z=me(T.sourceEvent,d),j=z.x-u.x,R=z.y-u.y;Math.sqrt(j*j+R*R)>A&&V(T)}(i.x!==C.xSnapped||i.y!==C.ySnapped)&&a&&l&&(u=me(T.sourceEvent,d),$(C))}}).on("end",T=>{if(!l||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,l=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||I||!_&&E){const[A,L]=On({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});o==null||o(T.sourceEvent,a,A,L),I==null||I(T.sourceEvent,A,L),_||E==null||E(T.sourceEvent,L)}}}).filter(T=>{const H=T.target;return!T.button&&(!b||!Co(H,`.${b}`,w))&&(!m||Co(H,m,w))});f.call(S)}function p(){f==null||f.on(".drag",null)}return{update:y,destroy:p}}function dp(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())cn(o,Nt(i))>0&&r.push(i);return r}const fp=250;function hp(e,t,n,r){var a,c;let o=[],i=1/0;const s=dp(e,n,t+fp);for(const u of s){const d=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of d){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=Ge(u,l,l.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...l,x:f,y:h}],i=g):g===i&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(d=>d.type===u)??o[0]}return o[0]}function Ls(e,t,n,r,o,i=!1){var u,d,l;const s=r.get(e);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((l=s.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Ge(s,c,c.position,!0)}:c}function Ds(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function gp(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Os=()=>!0;function pp(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:l,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:p=Os,onReconnectEnd:b,updateConnection:m,getTransform:w,getFromHandle:N,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:$}){const P=Es(e.target);let V=0,S;const{x:T,y:H}=me(e),v=Ds(i,$),I=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!I||!v)return;const A=Ls(o,v,r,c,t);if(!A)return;let L=me(e,I),C=!1,z=null,j=!1,R=null;function F(){if(!d||!I)return;const[K,G]=br(L,I,_);f({x:K,y:G}),V=requestAnimationFrame(F)}const Y={...A,nodeId:o,type:v,position:A.position},U=c.get(o);let q={inProgress:!0,isValid:null,from:Ge(U,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:U,to:L,toHandle:null,toPosition:mo[Y.position],toNode:null,pointer:L};function O(){E=!0,m(q),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}k===0&&O();function B(K){if(!E){const{x:ie,y:le}=me(K),we=ie-T,ve=le-H;if(!(we*we+ve*ve>k*k))return;O()}if(!N()||!Y){Z(K);return}const G=w();L=me(K,I),S=hp(Tt(L,G,!1,[1,1]),n,c,Y),C||(F(),C=!0);const X=Rs(K,{handle:S,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:p,doc:P,lib:u,flowId:l,nodeLookup:c});R=X.handleDomNode,z=X.connection,j=gp(!!S,X.isValid);const J=c.get(o),te=J?Ge(J,Y,W.Left,!0):q.from,ne={...q,from:te,isValid:j,to:X.toHandle&&j?it({x:X.toHandle.x,y:X.toHandle.y},G):L,toHandle:X.toHandle,toPosition:j&&X.toHandle?X.toHandle.position:mo[Y.position],toNode:X.toHandle?c.get(X.toHandle.nodeId):null,pointer:L};m(ne),q=ne}function Z(K){if(!("touches"in K&&K.touches.length>0)){if(E){(S||R)&&z&&j&&(x==null||x(z));const{inProgress:G,...X}=q,J={...X,toPosition:q.toHandle?q.toPosition:null};y==null||y(K,J),i&&(b==null||b(K,J))}h(),cancelAnimationFrame(V),C=!1,j=!1,z=null,R=null,P.removeEventListener("mousemove",B),P.removeEventListener("mouseup",Z),P.removeEventListener("touchmove",B),P.removeEventListener("touchend",Z)}}P.addEventListener("mousemove",B),P.addEventListener("mouseup",Z),P.addEventListener("touchmove",B),P.addEventListener("touchend",Z)}function Rs(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=Os,nodeLookup:d}){const l=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=me(e),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,p={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=Ds(void 0,y),m=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!m||!b)return p;const k={source:l?m:r,sourceHandle:l?w:o,target:l?r:m,targetHandle:l?o:w};p.connection=k;const P=N&&_&&(n===rt.Strict?l&&b==="source"||!l&&b==="target":m!==r||w!==o);p.isValid=P&&u(k),p.toHandle=Ls(m,b,w,d,n,!0)}return p}const or={onPointerDown:pp,isValid:Rs};function mp({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:u,zoomStep:d=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=m.sourceEvent.ctrlKey&&St()?10:1,_=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,_*N);t.scaleTo(k)};let x=[0,0];const y=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},p=m=>{const w=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const N=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],_=[N[0]-x[0],N[1]-x[1]];x=N;const k=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-_[0]*k,y:w[1]-_[1]*k},P=[[0,0],[c,u]];t.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},P,a)},b=ls().on("start",y).on("zoom",l?p:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:he}}const wn=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>mn.translate(e,t).scale(n),Ke=(e,t)=>e.target.closest(`.${t}`),zs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),yp=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,zn=(e,t=0,n=yp,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},js=e=>{const t=e.ctrlKey&&St()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function xp({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Ke(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(d.ctrlKey&&s){const y=he(d),p=js(d),b=l*Math.pow(2,p);r.scaleTo(n,b,y,d);return}const f=d.deltaMode===1?20:1;let h=o===Be.Vertical?0:d.deltaX*f,g=o===Be.Horizontal?0:d.deltaY*f;!St()&&d.shiftKey&&o!==Be.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/l)*i,-(g/l)*i,{internal:!0});const x=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,x),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,x))}}function wp({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Ke(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function vp({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=wn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function bp({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&zs(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,wn(i.transform)))}}function _p({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&zs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=wn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Ep({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:d}){return l=>{var y;const f=e||t,h=n&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(Ke(l,`${u}-flow__node`)||Ke(l,`${u}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Ke(l,a)&&g||Ke(l,c)&&(!g||o&&g&&!e)||!n&&l.ctrlKey&&g)return!1;if(!n&&l.type==="touchstart"&&((y=l.touches)==null?void 0:y.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&x}}function Np({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),l=ls().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(l);b({x:o.x,y:o.y,zoom:ot(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");l.wheelDelta(js);async function x(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).transform(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}function y({noWheelClassName:S,noPanClassName:T,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:I,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:C,zoomOnPinch:z,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:Y,onTransformChange:U,connectionInProgress:Q,paneClickDistance:q,selectionOnDrag:O}){v&&!u.isZoomingOrPanning&&p();const B=I&&!F&&!v;l.clickDistance(O?1/0:!pe(q)||q<0?0:q);const Z=B?xp({zoomPanValues:u,noWheelClassName:S,d3Selection:f,d3Zoom:l,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:z,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):wp({noWheelClassName:S,preventScrolling:C,d3ZoomHandler:h});f.on("wheel.zoom",Z,{passive:!1});const K=vp({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});l.on("start",K);const G=bp({zoomPanValues:u,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:U});l.on("zoom",G);const X=_p({zoomPanValues:u,panOnDrag:E,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});l.on("end",X);const J=Ep({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:j,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:z,userSelectionActive:v,noPanClassName:T,noWheelClassName:S,lib:Y,connectionInProgress:Q});l.filter(J),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function p(){l.on("zoom",null)}async function b(S,T,H){const v=Rn(S),I=l==null?void 0:l.constrain()(v,T,H);return I&&await x(I),I}async function m(S,T){const H=Rn(S);return await x(H,T),H}function w(S){if(f){const T=Rn(S),H=f.property("__zoom");(H.k!==S.zoom||H.x!==S.x||H.y!==S.y)&&(l==null||l.transform(f,T,null,{sync:!0}))}}function N(){const S=f?us(f.node()):{x:0,y:0,k:1};return{x:S.x,y:S.y,zoom:S.k}}async function _(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).scaleTo(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}async function k(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).scaleBy(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}function $(S){l==null||l.scaleExtent(S)}function P(S){l==null||l.translateExtent(S)}function V(S){const T=!pe(S)||S<0?0:S;l==null||l.clickDistance(T)}return{update:y,destroy:p,setViewport:m,setViewportConstrained:b,getViewport:N,scaleTo:_,scaleBy:k,setScaleExtent:$,setTranslateExtent:P,syncViewport:w,setClickDistance:V}}var st;(function(e){e.Line="line",e.Handle="handle"})(st||(st={}));function Sp({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Io(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Pe(e,t){return Math.max(0,t-e)}function Te(e,t){return Math.max(0,e-t)}function Vt(e,t,n){return Math.max(0,t-e,e-n)}function Ao(e,t){return e?!t:t}function Mp(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:l}=t,f=d&&l,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:p,maxHeight:b}=r,{x:m,y:w,width:N,height:_,aspectRatio:k}=e;let $=Math.floor(d?h-e.pointerX:0),P=Math.floor(l?g-e.pointerY:0);const V=N+(c?-$:$),S=_+(u?-P:P),T=-i[0]*N,H=-i[1]*_;let v=Vt(V,x,y),I=Vt(S,p,b);if(s){let L=0,C=0;c&&$<0?L=Pe(m+$+T,s[0][0]):!c&&$>0&&(L=Te(m+V+T,s[1][0])),u&&P<0?C=Pe(w+P+H,s[0][1]):!u&&P>0&&(C=Te(w+S+H,s[1][1])),v=Math.max(v,L),I=Math.max(I,C)}if(a){let L=0,C=0;c&&$>0?L=Te(m+$,a[0][0]):!c&&$<0&&(L=Pe(m+V,a[1][0])),u&&P>0?C=Te(w+P,a[0][1]):!u&&P<0&&(C=Pe(w+S,a[1][1])),v=Math.max(v,L),I=Math.max(I,C)}if(o){if(d){const L=Vt(V/k,p,b)*k;if(v=Math.max(v,L),s){let C=0;!c&&!u||c&&!u&&f?C=Te(w+H+V/k,s[1][1])*k:C=Pe(w+H+(c?$:-$)/k,s[0][1])*k,v=Math.max(v,C)}if(a){let C=0;!c&&!u||c&&!u&&f?C=Pe(w+V/k,a[1][1])*k:C=Te(w+(c?$:-$)/k,a[0][1])*k,v=Math.max(v,C)}}if(l){const L=Vt(S*k,x,y)/k;if(I=Math.max(I,L),s){let C=0;!c&&!u||u&&!c&&f?C=Te(m+S*k+T,s[1][0])/k:C=Pe(m+(u?P:-P)*k+T,s[0][0])/k,I=Math.max(I,C)}if(a){let C=0;!c&&!u||u&&!c&&f?C=Pe(m+S*k,a[1][0])/k:C=Te(m+(u?P:-P)*k,a[0][0])/k,I=Math.max(I,C)}}}P=P+(P<0?I:-I),$=$+($<0?v:-v),o&&(f?V>S*k?P=(Ao(c,u)?-$:$)/k:$=(Ao(c,u)?-P:P)*k:d?(P=$/k,u=c):($=P*k,c=u));const E=c?m+$:m,A=u?w+P:w;return{width:N+(c?-$:$),height:_+(u?-P:P),x:i[0]*$*(c?-1:1)+E,y:i[1]*P*(u?-1:1)+A}}const Hs={width:0,height:0,x:0,y:0},kp={...Hs,pointerX:0,pointerY:0,aspectRatio:1};function Cp(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Ip({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:Io("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:d,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let p={...Hs},b={...kp};s={boundaries:d,resizeDirection:f,keepAspectRatio:l,controlDirection:Io(u)};let m,w=null,N=[],_,k,$,P=!1;const V=Ui().on("start",S=>{const{nodeLookup:T,transform:H,snapGrid:v,snapToGrid:I,nodeOrigin:E,paneDomNode:A}=n();if(m=T.get(t),!m)return;w=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:C}=mt(S.sourceEvent,{transform:H,snapGrid:v,snapToGrid:I,containerBounds:w});p={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},b={...p,pointerX:L,pointerY:C,aspectRatio:p.width/p.height},_=void 0,k=We(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(_=T.get(m.parentId)),_&&m.extent==="parent"&&(k=[[0,0],[_.measured.width,_.measured.height]]),N=[],$=void 0;for(const[z,j]of T)if(j.parentId===t&&(N.push({id:z,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Cp(j,m,j.origin??E);$?$=[[Math.min(R[0][0],$[0][0]),Math.min(R[0][1],$[0][1])],[Math.max(R[1][0],$[1][0]),Math.max(R[1][1],$[1][1])]]:$=R}h==null||h(S,{...p})}).on("drag",S=>{const{transform:T,snapGrid:H,snapToGrid:v,nodeOrigin:I}=n(),E=mt(S.sourceEvent,{transform:T,snapGrid:H,snapToGrid:v,containerBounds:w}),A=[];if(!m)return;const{x:L,y:C,width:z,height:j}=p,R={},F=m.origin??I,{width:Y,height:U,x:Q,y:q}=Mp(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,k,$),O=Y!==z,B=U!==j,Z=Q!==L&&O,K=q!==C&&B;if(!Z&&!K&&!O&&!B)return;if((Z||K||F[0]===1||F[1]===1)&&(R.x=Z?Q:p.x,R.y=K?q:p.y,p.x=R.x,p.y=R.y,N.length>0)){const te=Q-L,ne=q-C;for(const ie of N)ie.position={x:ie.position.x-te+F[0]*(Y-z),y:ie.position.y-ne+F[1]*(U-j)},A.push(ie)}if((O||B)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:p.width,R.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:p.height,p.width=R.width,p.height=R.height),_&&m.expandParent){const te=F[0]*(R.width??0);R.x&&R.x<te&&(p.x=te,b.x=b.x-(R.x-te));const ne=F[1]*(R.height??0);R.y&&R.y<ne&&(p.y=ne,b.y=b.y-(R.y-ne))}const G=Sp({width:p.width,prevWidth:z,height:p.height,prevHeight:j,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),X={...p,direction:G};(y==null?void 0:y(S,X))!==!1&&(P=!0,g==null||g(S,X),r(R,A))}).on("end",S=>{P&&(x==null||x(S,{...p}),o==null||o({...p}),P=!1)});i.call(V)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var jn={exports:{}},Hn={},Vn={exports:{}},Bn={};/**
|
|
1
|
+
import{r as ci,g as Sc,R as Mc,a as D,j as M,B as kc,n as Cc}from"./index-D3fMyvfo.js";var ui=Object.defineProperty,Ic=(e,t,n)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ac=(e,t)=>{for(var n in t)ui(e,n,{get:t[n],enumerable:!0})},$c=(e,t,n)=>Ic(e,t+"",n),li={};Ac(li,{Graph:()=>de,alg:()=>ar,json:()=>fi,version:()=>Lc});var Pc=Object.defineProperty,di=(e,t)=>{for(var n in t)Pc(e,n,{get:t[n],enumerable:!0})},de=class{constructor(e){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},e&&(this._isDirected="directed"in e?e.directed:!0,this._isMultigraph="multigraph"in e?e.multigraph:!1,this._isCompound="compound"in e?e.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return typeof e!="function"?this._defaultNodeLabelFn=()=>e:this._defaultNodeLabelFn=e,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(e=>Object.keys(this._in[e]).length===0)}sinks(){return this.nodes().filter(e=>Object.keys(this._out[e]).length===0)}setNodes(e,t){return e.forEach(n=>{t!==void 0?this.setNode(n,t):this.setNode(n)}),this}setNode(e,t){return e in this._nodes?(arguments.length>1&&(this._nodes[e]=t),this):(this._nodes[e]=arguments.length>1?t:this._defaultNodeLabelFn(e),this._isCompound&&(this._parent[e]="\0",this._children[e]={},this._children["\0"][e]=!0),this._in[e]={},this._preds[e]={},this._out[e]={},this._sucs[e]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return e in this._nodes}removeNode(e){if(e in this._nodes){let t=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(n=>{this.setParent(n)}),delete this._children[e]),Object.keys(this._in[e]).forEach(t),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(t),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(e,t){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(t===void 0)t="\0";else{t+="";for(let n=t;n!==void 0;n=this.parent(n))if(n===e)throw new Error("Setting "+t+" as parent of "+e+" would create a cycle");this.setNode(t)}return this.setNode(e),this._removeFromParentsChildList(e),this._parent[e]=t,this._children[t][e]=!0,this}parent(e){if(this._isCompound){let t=this._parent[e];if(t!=="\0")return t}}children(e="\0"){if(this._isCompound){let t=this._children[e];if(t)return Object.keys(t)}else{if(e==="\0")return this.nodes();if(this.hasNode(e))return[]}return[]}predecessors(e){let t=this._preds[e];if(t)return Object.keys(t)}successors(e){let t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){let t=this.predecessors(e);if(t){let n=new Set(t);for(let r of this.successors(e))n.add(r);return Array.from(n.values())}}isLeaf(e){let t;return this.isDirected()?t=this.successors(e):t=this.neighbors(e),t.length===0}filterNodes(e){let t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,i])=>{e(o)&&t.setNode(o,i)}),Object.values(this._edgeObjs).forEach(o=>{t.hasNode(o.v)&&t.hasNode(o.w)&&t.setEdge(o,this.edge(o))});let n={},r=o=>{let i=this.parent(o);return!i||t.hasNode(i)?(n[o]=i??void 0,i??void 0):i in n?n[i]:r(i)};return this._isCompound&&t.nodes().forEach(o=>t.setParent(o,r(o))),t}setDefaultEdgeLabel(e){return typeof e!="function"?this._defaultEdgeLabelFn=()=>e:this._defaultEdgeLabelFn=e,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){return e.reduce((n,r)=>(t!==void 0?this.setEdge(n,r,t):this.setEdge(n,r),r)),this}setEdge(e,t,n,r){let o,i,s,a,c=!1;typeof e=="object"&&e!==null&&"v"in e?(o=e.v,i=e.w,s=e.name,arguments.length===2&&(a=t,c=!0)):(o=e,i=t,s=r,arguments.length>2&&(a=n,c=!0)),o=""+o,i=""+i,s!==void 0&&(s=""+s);let u=ft(this._isDirected,o,i,s);if(u in this._edgeLabels)return c&&(this._edgeLabels[u]=a),this;if(s!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(i),this._edgeLabels[u]=c?a:this._defaultEdgeLabelFn(o,i,s);let d=Tc(this._isDirected,o,i,s);return o=d.v,i=d.w,Object.freeze(d),this._edgeObjs[u]=d,zr(this._preds[i],o),zr(this._sucs[o],i),this._in[i][u]=d,this._out[o][u]=d,this._edgeCount++,this}edge(e,t,n){let r=arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n);return this._edgeLabels[r]}edgeAsObj(e,t,n){let r=arguments.length===1?this.edge(e):this.edge(e,t,n);return typeof r!="object"?{label:r}:r}hasEdge(e,t,n){return(arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n))in this._edgeLabels}removeEdge(e,t,n){let r=arguments.length===1?Mn(this._isDirected,e):ft(this._isDirected,e,t,n),o=this._edgeObjs[r];if(o){let i=o.v,s=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],jr(this._preds[s],i),jr(this._sucs[i],s),delete this._in[s][r],delete this._out[i][r],this._edgeCount--}return this}inEdges(e,t){return this.isDirected()?this.filterEdges(this._in[e],e,t):this.nodeEdges(e,t)}outEdges(e,t){return this.isDirected()?this.filterEdges(this._out[e],e,t):this.nodeEdges(e,t)}nodeEdges(e,t){if(e in this._nodes)return this.filterEdges({...this._in[e],...this._out[e]},e,t)}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}filterEdges(e,t,n){if(!e)return;let r=Object.values(e);return n?r.filter(o=>o.v===t&&o.w===n||o.v===n&&o.w===t):r}};function zr(e,t){e[t]?e[t]++:e[t]=1}function jr(e,t){e[t]!==void 0&&!--e[t]&&delete e[t]}function ft(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let s=o;o=i,i=s}return o+""+i+""+(r===void 0?"\0":r)}function Tc(e,t,n,r){let o=""+t,i=""+n;if(!e&&o>i){let a=o;o=i,i=a}let s={v:o,w:i};return r&&(s.name=r),s}function Mn(e,t){return ft(e,t.v,t.w,t.name)}var Lc="4.0.1",fi={};di(fi,{read:()=>zc,write:()=>Dc});function Dc(e){let t={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:Oc(e),edges:Rc(e)},n=e.graph();return n!==void 0&&(t.value=structuredClone(n)),t}function Oc(e){return e.nodes().map(t=>{let n=e.node(t),r=e.parent(t),o={v:t};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function Rc(e){return e.edges().map(t=>{let n=e.edge(t),r={v:t.v,w:t.w};return t.name!==void 0&&(r.name=t.name),n!==void 0&&(r.value=n),r})}function zc(e){let t=new de(e.options);return e.value!==void 0&&t.setGraph(e.value),e.nodes.forEach(n=>{t.setNode(n.v,n.value),n.parent&&t.setParent(n.v,n.parent)}),e.edges.forEach(n=>{t.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),t}var ar={};di(ar,{CycleException:()=>Kt,bellmanFord:()=>hi,components:()=>Vc,dijkstra:()=>Ut,dijkstraAll:()=>Yc,findCycles:()=>Xc,floydWarshall:()=>Gc,isAcyclic:()=>Uc,postorder:()=>Zc,preorder:()=>Qc,prim:()=>Jc,shortestPaths:()=>eu,tarjan:()=>pi,topsort:()=>mi});var jc=()=>1;function hi(e,t,n,r){return Hc(e,String(t),n||jc,r||function(o){return e.outEdges(o)})}function Hc(e,t,n,r){let o={},i,s=0,a=e.nodes(),c=function(l){let f=n(l);o[l.v].distance+f<o[l.w].distance&&(o[l.w]={distance:o[l.v].distance+f,predecessor:l.v},i=!0)},u=function(){a.forEach(function(l){r(l).forEach(function(f){let h=f.v===l?f.v:f.w,g=h===f.v?f.w:f.v;c({v:h,w:g})})})};a.forEach(function(l){let f=l===t?0:Number.POSITIVE_INFINITY;o[l]={distance:f,predecessor:""}});let d=a.length;for(let l=1;l<d&&(i=!1,s++,u(),!!i);l++);if(s===d-1&&(i=!1,u(),i))throw new Error("The graph contains a negative weight cycle");return o}function Vc(e){let t={},n=[],r;function o(i){i in t||(t[i]=!0,r.push(i),e.successors(i).forEach(o),e.predecessors(i).forEach(o))}return e.nodes().forEach(function(i){r=[],o(i),r.length&&n.push(r)}),n}var gi=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(e=>e.key)}has(e){return e in this._keyIndices}priority(e){let t=this._keyIndices[e];if(t!==void 0)return this._arr[t].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(e,t){let n=this._keyIndices,r=String(e);if(!(r in n)){let o=this._arr,i=o.length;return n[r]=i,o.push({key:r,priority:t}),this._decrease(i),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){let n=this._keyIndices[e];if(n===void 0)throw new Error(`Key not found: ${e}`);let r=this._arr[n].priority;if(t>r)throw new Error(`New priority is greater than current priority. Key: ${e} Old: ${r} New: ${t}`);this._arr[n].priority=t,this._decrease(n)}_heapify(e){let t=this._arr,n=2*e,r=n+1,o=e;n<t.length&&(o=t[n].priority<t[o].priority?n:o,r<t.length&&(o=t[r].priority<t[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))}_decrease(e){let t=this._arr,n=t[e].priority,r;for(;e!==0&&(r=e>>1,!(t[r].priority<n));)this._swap(e,r),e=r}_swap(e,t){let n=this._arr,r=this._keyIndices,o=n[e],i=n[t];n[e]=i,n[t]=o,r[i.key]=e,r[o.key]=t}},Bc=()=>1;function Ut(e,t,n,r){let o=function(i){return e.outEdges(i)};return Fc(e,String(t),n||Bc,r||o)}function Fc(e,t,n,r){let o={},i=new gi,s,a,c=function(u){let d=u.v!==s?u.v:u.w,l=o[d],f=n(u),h=a.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+u+" Weight: "+f);h<l.distance&&(l.distance=h,l.predecessor=s,i.decrease(d,h))};for(e.nodes().forEach(function(u){let d=u===t?0:Number.POSITIVE_INFINITY;o[u]={distance:d,predecessor:""},i.add(u,d)});i.size()>0&&(s=i.removeMin(),a=o[s],a.distance!==Number.POSITIVE_INFINITY);)r(s).forEach(c);return o}function Yc(e,t,n){return e.nodes().reduce(function(r,o){return r[o]=Ut(e,o,t,n),r},{})}function pi(e){let t=0,n=[],r={},o=[];function i(s){let a=r[s]={onStack:!0,lowlink:t,index:t++};if(n.push(s),e.successors(s).forEach(function(c){c in r?r[c].onStack&&(a.lowlink=Math.min(a.lowlink,r[c].index)):(i(c),a.lowlink=Math.min(a.lowlink,r[c].lowlink))}),a.lowlink===a.index){let c=[],u;do u=n.pop(),r[u].onStack=!1,c.push(u);while(s!==u);o.push(c)}}return e.nodes().forEach(function(s){s in r||i(s)}),o}function Xc(e){return pi(e).filter(function(t){return t.length>1||t.length===1&&e.hasEdge(t[0],t[0])})}var Wc=()=>1;function Gc(e,t,n){return qc(e,t||Wc,n||function(r){return e.outEdges(r)})}function qc(e,t,n){let r={},o=e.nodes();return o.forEach(function(i){r[i]={},r[i][i]={distance:0,predecessor:""},o.forEach(function(s){i!==s&&(r[i][s]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(i).forEach(function(s){let a=s.v===i?s.w:s.v,c=t(s);r[i][a]={distance:c,predecessor:i}})}),o.forEach(function(i){let s=r[i];o.forEach(function(a){let c=r[a];o.forEach(function(u){let d=c[i],l=s[u],f=c[u],h=d.distance+l.distance;h<f.distance&&(f.distance=h,f.predecessor=l.predecessor)})})}),r}var Kt=class extends Error{constructor(...e){super(...e)}};function mi(e){let t={},n={},r=[];function o(i){if(i in n)throw new Kt;i in t||(n[i]=!0,t[i]=!0,e.predecessors(i).forEach(o),delete n[i],r.push(i))}if(e.sinks().forEach(o),Object.keys(t).length!==e.nodeCount())throw new Kt;return r}function Uc(e){try{mi(e)}catch(t){if(t instanceof Kt)return!1;throw t}return!0}function Kc(e,t,n,r,o){Array.isArray(t)||(t=[t]);let i=(a=>{var c;return(c=e.isDirected()?e.successors(a):e.neighbors(a))!=null?c:[]}),s={};return t.forEach(function(a){if(!e.hasNode(a))throw new Error("Graph does not have node: "+a);o=yi(e,a,n==="post",s,i,r,o)}),o}function yi(e,t,n,r,o,i,s){return t in r||(r[t]=!0,n||(s=i(s,t)),o(t).forEach(function(a){s=yi(e,a,n,r,o,i,s)}),n&&(s=i(s,t))),s}function xi(e,t,n){return Kc(e,t,n,function(r,o){return r.push(o),r},[])}function Zc(e,t){return xi(e,t,"post")}function Qc(e,t){return xi(e,t,"pre")}function Jc(e,t){let n=new de,r={},o=new gi,i;function s(c){let u=c.v===i?c.w:c.v,d=o.priority(u);if(d!==void 0){let l=t(c);l<d&&(r[u]=i,o.decrease(u,l))}}if(e.nodeCount()===0)return n;e.nodes().forEach(function(c){o.add(c,Number.POSITIVE_INFINITY),n.setNode(c)}),o.decrease(e.nodes()[0],0);let a=!1;for(;o.size()>0;){if(i=o.removeMin(),i in r)n.setEdge(i,r[i]);else{if(a)throw new Error("Input graph is not connected: "+e);a=!0}e.nodeEdges(i).forEach(s)}return n}function eu(e,t,n,r){return tu(e,t,n,r??(o=>{let i=e.outEdges(o);return i??[]}))}function tu(e,t,n,r){if(n===void 0)return Ut(e,t,n,r);let o=!1,i=e.nodes();for(let s=0;s<i.length;s++){let a=r(i[s]);for(let c=0;c<a.length;c++){let u=a[c],d=u.v===i[s]?u.v:u.w,l=d===u.v?u.w:u.v;n({v:d,w:l})<0&&(o=!0)}if(o)return hi(e,t,n,r)}return Ut(e,t,n,r)}function ct(e,t,n,r){let o=r;for(;e.hasNode(o);)o=cr(r);return n.dummy=t,e.setNode(o,n),o}function nu(e){let t=new de().setGraph(e.graph());return e.nodes().forEach(n=>t.setNode(n,e.node(n))),e.edges().forEach(n=>{let r=t.edge(n.v,n.w)||{weight:0,minlen:1},o=e.edge(n);t.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),t}function wi(e){let t=new de({multigraph:e.isMultigraph()}).setGraph(e.graph());return e.nodes().forEach(n=>{e.children(n).length||t.setNode(n,e.node(n))}),e.edges().forEach(n=>{t.setEdge(n,e.edge(n))}),t}function Hr(e,t){let n=e.x,r=e.y,o=t.x-n,i=t.y-r,s=e.width/2,a=e.height/2;if(!o&&!i)throw new Error("Not possible to find intersection inside of the rectangle");let c,u;return Math.abs(i)*s>Math.abs(o)*a?(i<0&&(a=-a),c=a*o/i,u=a):(o<0&&(s=-s),c=s,u=s*i/o),{x:n+c,y:r+u}}function kt(e){let t=yt(bi(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let r=e.node(n),o=r.rank;o!==void 0&&(t[o]||(t[o]=[]),t[o][r.order]=n)}),t}function ru(e){let t=e.nodes().map(r=>{let o=e.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=_e(Math.min,t);e.nodes().forEach(r=>{let o=e.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function ou(e){let t=e.nodes().map(s=>e.node(s).rank).filter(s=>s!==void 0),n=_e(Math.min,t),r=[];e.nodes().forEach(s=>{let a=e.node(s).rank-n;r[a]||(r[a]=[]),r[a].push(s)});let o=0,i=e.graph().nodeRankFactor;Array.from(r).forEach((s,a)=>{s===void 0&&a%i!==0?--o:s!==void 0&&o&&s.forEach(c=>e.node(c).rank+=o)})}function Vr(e,t,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),ct(e,"border",o,t)}function iu(e,t=vi){let n=[];for(let r=0;r<e.length;r+=t){let o=e.slice(r,r+t);n.push(o)}return n}var vi=65535;function _e(e,t){if(t.length>vi){let n=iu(t);return e(...n.map(r=>e(...r)))}else return e(...t)}function bi(e){let t=e.nodes().map(n=>{let r=e.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return _e(Math.max,t)}function su(e,t){let n={lhs:[],rhs:[]};return e.forEach(r=>{t(r)?n.lhs.push(r):n.rhs.push(r)}),n}function _i(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}}function Ei(e,t){return t()}var au=0;function cr(e){let t=++au;return e+(""+t)}function yt(e,t,n=1){t==null&&(t=e,e=0);let r=i=>i<t;n<0&&(r=i=>t<i);let o=[];for(let i=e;r(i);i+=n)o.push(i);return o}function Zt(e,t){let n={};for(let r of t)e[r]!==void 0&&(n[r]=e[r]);return n}function ln(e,t){let n;return typeof t=="string"?n=r=>r[t]:n=t,Object.entries(e).reduce((r,[o,i])=>(r[o]=n(i,o),r),{})}function cu(e,t){return e.reduce((n,r,o)=>(n[r]=t[o],n),{})}var dn="\0",uu="3.0.0",lu=class{constructor(){$c(this,"_sentinel");let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let e=this._sentinel,t=e._prev;if(t!==e)return Br(t),t}enqueue(e){let t=this._sentinel;e._prev&&e._next&&Br(e),e._next=t._next,t._next._prev=e,t._next=e,e._prev=t}toString(){let e=[],t=this._sentinel,n=t._prev;for(;n!==t;)e.push(JSON.stringify(n,du)),n=n._prev;return"["+e.join(", ")+"]"}};function Br(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function du(e,t){if(e!=="_next"&&e!=="_prev")return t}var fu=lu,hu=()=>1;function gu(e,t){if(e.nodeCount()<=1)return[];let n=mu(e,t||hu);return pu(n.graph,n.buckets,n.zeroIdx).flatMap(r=>e.outEdges(r.v,r.w)||[])}function pu(e,t,n){var r;let o=[],i=t[t.length-1],s=t[0],a;for(;e.nodeCount();){for(;a=s.dequeue();)kn(e,t,n,a);for(;a=i.dequeue();)kn(e,t,n,a);if(e.nodeCount()){for(let c=t.length-2;c>0;--c)if(a=(r=t[c])==null?void 0:r.dequeue(),a){o=o.concat(kn(e,t,n,a,!0)||[]);break}}}return o}function kn(e,t,n,r,o){let i=[],s=o?i:void 0;return(e.inEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),u=e.node(a.v);o&&i.push({v:a.v,w:a.w}),u.out-=c,Xn(t,n,u)}),(e.outEdges(r.v)||[]).forEach(a=>{let c=e.edge(a),u=a.w,d=e.node(u);d.in-=c,Xn(t,n,d)}),e.removeNode(r.v),s}function mu(e,t){let n=new de,r=0,o=0;e.nodes().forEach(a=>{n.setNode(a,{v:a,in:0,out:0})}),e.edges().forEach(a=>{let c=n.edge(a.v,a.w)||0,u=t(a),d=c+u;n.setEdge(a.v,a.w,d);let l=n.node(a.v),f=n.node(a.w);o=Math.max(o,l.out+=u),r=Math.max(r,f.in+=u)});let i=yu(o+r+3).map(()=>new fu),s=r+1;return n.nodes().forEach(a=>{Xn(i,s,n.node(a))}),{graph:n,buckets:i,zeroIdx:s}}function Xn(e,t,n){var r,o,i;n.out?n.in?(i=e[n.out-n.in+t])==null||i.enqueue(n):(o=e[e.length-1])==null||o.enqueue(n):(r=e[0])==null||r.enqueue(n)}function yu(e){let t=[];for(let n=0;n<e;n++)t.push(n);return t}function xu(e){(e.graph().acyclicer==="greedy"?gu(e,t(e)):wu(e)).forEach(n=>{let r=e.edge(n);e.removeEdge(n),r.forwardName=n.name,r.reversed=!0,e.setEdge(n.w,n.v,r,cr("rev"))});function t(n){return r=>n.edge(r).weight}}function wu(e){let t=[],n={},r={};function o(i){Object.hasOwn(r,i)||(r[i]=!0,n[i]=!0,e.outEdges(i).forEach(s=>{Object.hasOwn(n,s.w)?t.push(s):o(s.w)}),delete n[i])}return e.nodes().forEach(o),t}function vu(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let r=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,r)}})}function bu(e){e.graph().dummyChains=[],e.edges().forEach(t=>_u(e,t))}function _u(e,t){let n=t.v,r=e.node(n).rank,o=t.w,i=e.node(o).rank,s=t.name,a=e.edge(t),c=a.labelRank;if(i===r+1)return;e.removeEdge(t);let u,d,l;for(l=0,++r;r<i;++l,++r)a.points=[],d={width:0,height:0,edgeLabel:a,edgeObj:t,rank:r},u=ct(e,"edge",d,"_d"),r===c&&(d.width=a.width,d.height=a.height,d.dummy="edge-label",d.labelpos=a.labelpos),e.setEdge(n,u,{weight:a.weight},s),l===0&&e.graph().dummyChains.push(u),n=u;e.setEdge(n,o,{weight:a.weight},s)}function Eu(e){e.graph().dummyChains.forEach(t=>{let n=e.node(t),r=n.edgeLabel,o;for(e.setEdge(n.edgeObj,r);n.dummy;)o=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=o,n=e.node(t)})}function ur(e){let t={};function n(r){let o=e.node(r);if(Object.hasOwn(t,r))return o.rank;t[r]=!0;let i=e.outEdges(r),s=i?i.map(c=>c==null?Number.POSITIVE_INFINITY:n(c.w)-e.edge(c).minlen):[],a=_e(Math.min,s);return a===Number.POSITIVE_INFINITY&&(a=0),o.rank=a}e.sources().forEach(n)}function et(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}var Ni=Nu;function Nu(e){let t=new de({directed:!1}),n=e.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=e.nodeCount();t.setNode(r,{});let i,s;for(;Su(t,e)<o&&(i=Mu(t,e),!!i);)s=t.hasNode(i.v)?et(e,i):-et(e,i),ku(t,e,s);return t}function Su(e,t){function n(r){let o=t.nodeEdges(r);o&&o.forEach(i=>{let s=i.v,a=r===s?i.w:s;!e.hasNode(a)&&!et(t,i)&&(e.setNode(a,{}),e.setEdge(r,a,{}),n(a))})}return e.nodes().forEach(n),e.nodeCount()}function Mu(e,t){return t.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(o=et(t,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function ku(e,t,n){e.nodes().forEach(r=>t.node(r).rank+=n)}var{preorder:Cu,postorder:Iu}=ar,Au=qe;qe.initLowLimValues=dr;qe.initCutValues=lr;qe.calcCutValue=Si;qe.leaveEdge=ki;qe.enterEdge=Ci;qe.exchangeEdges=Ii;function qe(e){e=nu(e),ur(e);let t=Ni(e);dr(t),lr(t,e);let n,r;for(;n=ki(t);)r=Ci(t,e,n),Ii(t,e,n,r)}function lr(e,t){let n=Iu(e,e.nodes());n=n.slice(0,n.length-1),n.forEach(r=>$u(e,t,r))}function $u(e,t,n){let r=e.node(n).parent,o=e.edge(n,r);o.cutvalue=Si(e,t,n)}function Si(e,t,n){let r=e.node(n).parent,o=!0,i=t.edge(n,r),s=0;i||(o=!1,i=t.edge(r,n)),s=i.weight;let a=t.nodeEdges(n);return a&&a.forEach(c=>{let u=c.v===n,d=u?c.w:c.v;if(d!==r){let l=u===o,f=t.edge(c).weight;if(s+=l?f:-f,Tu(e,n,d)){let h=e.edge(n,d).cutvalue;s+=l?-h:h}}}),s}function dr(e,t){arguments.length<2&&(t=e.nodes()[0]),Mi(e,{},1,t)}function Mi(e,t,n,r,o){let i=n,s=e.node(r);t[r]=!0;let a=e.neighbors(r);return a&&a.forEach(c=>{Object.hasOwn(t,c)||(n=Mi(e,t,n,c,r))}),s.low=i,s.lim=n++,o?s.parent=o:delete s.parent,n}function ki(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function Ci(e,t,n){let r=n.v,o=n.w;t.hasEdge(r,o)||(r=n.w,o=n.v);let i=e.node(r),s=e.node(o),a=i,c=!1;return i.lim>s.lim&&(a=s,c=!0),t.edges().filter(u=>c===Fr(e,e.node(u.v),a)&&c!==Fr(e,e.node(u.w),a)).reduce((u,d)=>et(t,d)<et(t,u)?d:u)}function Ii(e,t,n,r){let o=n.v,i=n.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),dr(e),lr(e,t),Pu(e,t)}function Pu(e,t){let n=e.nodes().find(o=>!e.node(o).parent);if(!n)return;let r=Cu(e,[n]);r=r.slice(1),r.forEach(o=>{let i=e.node(o).parent,s=t.edge(o,i),a=!1;s||(s=t.edge(i,o),a=!0),t.node(o).rank=t.node(i).rank+(a?s.minlen:-s.minlen)})}function Tu(e,t,n){return e.hasEdge(t,n)}function Fr(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}var Lu=Du;function Du(e){let t=e.graph().ranker;if(typeof t=="function")return t(e);switch(t){case"network-simplex":Yr(e);break;case"tight-tree":Ru(e);break;case"longest-path":Ou(e);break;case"none":break;default:Yr(e)}}var Ou=ur;function Ru(e){ur(e),Ni(e)}function Yr(e){Au(e)}var zu=ju;function ju(e){let t=Vu(e);e.graph().dummyChains.forEach(n=>{let r=e.node(n),o=r.edgeObj,i=Hu(e,t,o.v,o.w),s=i.path,a=i.lca,c=0,u=s[c],d=!0;for(;n!==o.w;){if(r=e.node(n),d){for(;(u=s[c])!==a&&e.node(u).maxRank<r.rank;)c++;u===a&&(d=!1)}if(!d){for(;c<s.length-1&&e.node(s[c+1]).minRank<=r.rank;)c++;u=s[c]}u!==void 0&&e.setParent(n,u),n=e.successors(n)[0]}})}function Hu(e,t,n,r){let o=[],i=[],s=Math.min(t[n].low,t[r].low),a=Math.max(t[n].lim,t[r].lim),c;c=n;do c=e.parent(c),o.push(c);while(c&&(t[c].low>s||a>t[c].lim));let u=c,d=r;for(;(d=e.parent(d))!==u;)i.push(d);return{path:o.concat(i.reverse()),lca:u}}function Vu(e){let t={},n=0;function r(o){let i=n;e.children(o).forEach(r),t[o]={low:i,lim:n++}}return e.children(dn).forEach(r),t}function Bu(e){let t=ct(e,"root",{},"_root"),n=Fu(e),r=Object.values(n),o=_e(Math.max,r)-1,i=2*o+1;e.graph().nestingRoot=t,e.edges().forEach(a=>e.edge(a).minlen*=i);let s=Yu(e)+1;e.children(dn).forEach(a=>Ai(e,t,i,s,o,n,a)),e.graph().nodeRankFactor=i}function Ai(e,t,n,r,o,i,s){var a;let c=e.children(s);if(!c.length){s!==t&&e.setEdge(t,s,{weight:0,minlen:n});return}let u=Vr(e,"_bt"),d=Vr(e,"_bb"),l=e.node(s);e.setParent(u,s),l.borderTop=u,e.setParent(d,s),l.borderBottom=d,c.forEach(f=>{var h;Ai(e,t,n,r,o,i,f);let g=e.node(f),x=g.borderTop?g.borderTop:f,y=g.borderBottom?g.borderBottom:f,p=g.borderTop?r:2*r,b=x!==y?1:o-((h=i[s])!=null?h:0)+1;e.setEdge(u,x,{weight:p,minlen:b,nestingEdge:!0}),e.setEdge(y,d,{weight:p,minlen:b,nestingEdge:!0})}),e.parent(s)||e.setEdge(t,u,{weight:0,minlen:o+((a=i[s])!=null?a:0)})}function Fu(e){let t={};function n(r,o){let i=e.children(r);i&&i.length&&i.forEach(s=>n(s,o+1)),t[r]=o}return e.children(dn).forEach(r=>n(r,1)),t}function Yu(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}function Xu(e){let t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(n=>{e.edge(n).nestingEdge&&e.removeEdge(n)})}var Wu=Gu;function Gu(e){function t(n){let r=e.children(n),o=e.node(n);if(r.length&&r.forEach(t),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let i=o.minRank,s=o.maxRank+1;i<s;++i)Xr(e,"borderLeft","_bl",n,o,i),Xr(e,"borderRight","_br",n,o,i)}}e.children(dn).forEach(t)}function Xr(e,t,n,r,o,i){let s={width:0,height:0,rank:i,borderType:t},a=o[t][i-1],c=ct(e,"border",s,n);o[t][i]=c,e.setParent(c,r),a&&e.setEdge(a,c,{weight:1})}function qu(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="lr"||n==="rl")&&$i(e)}function Uu(e){var t;let n=(t=e.graph().rankdir)==null?void 0:t.toLowerCase();(n==="bt"||n==="rl")&&Ku(e),(n==="lr"||n==="rl")&&(Zu(e),$i(e))}function $i(e){e.nodes().forEach(t=>Wr(e.node(t))),e.edges().forEach(t=>Wr(e.edge(t)))}function Wr(e){let t=e.width;e.width=e.height,e.height=t}function Ku(e){e.nodes().forEach(t=>Cn(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(Cn),Object.hasOwn(r,"y")&&Cn(r)})}function Cn(e){e.y=-e.y}function Zu(e){e.nodes().forEach(t=>In(e.node(t))),e.edges().forEach(t=>{var n;let r=e.edge(t);(n=r.points)==null||n.forEach(In),Object.hasOwn(r,"x")&&In(r)})}function In(e){let t=e.x;e.x=e.y,e.y=t}function Qu(e){let t={},n=e.nodes().filter(a=>!e.children(a).length),r=n.map(a=>e.node(a).rank),o=_e(Math.max,r),i=yt(o+1).map(()=>[]);function s(a){if(t[a])return;t[a]=!0;let c=e.node(a);i[c.rank].push(a);let u=e.successors(a);u&&u.forEach(s)}return n.sort((a,c)=>e.node(a).rank-e.node(c).rank).forEach(s),i}function Ju(e,t){let n=0;for(let r=1;r<t.length;++r)n+=el(e,t[r-1],t[r]);return n}function el(e,t,n){let r=cu(n,n.map((u,d)=>d)),o=t.flatMap(u=>{let d=e.outEdges(u);return d?d.map(l=>({pos:r[l.w],weight:e.edge(l).weight})).sort((l,f)=>l.pos-f.pos):[]}),i=1;for(;i<n.length;)i<<=1;let s=2*i-1;i-=1;let a=new Array(s).fill(0),c=0;return o.forEach(u=>{let d=u.pos+i;a[d]+=u.weight;let l=0;for(;d>0;)d%2&&(l+=a[d+1]),d=d-1>>1,a[d]+=u.weight;c+=u.weight*l}),c}function tl(e,t=[]){return t.map(n=>{let r=e.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((i,s)=>{let a=e.edge(s),c=e.node(s.v);return{sum:i.sum+a.weight*c.order,weight:i.weight+a.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function nl(e,t){let n={};e.forEach((o,i)=>{let s={indegree:0,in:[],out:[],vs:[o.v],i};o.barycenter!==void 0&&(s.barycenter=o.barycenter,s.weight=o.weight),n[o.v]=s}),t.edges().forEach(o=>{let i=n[o.v],s=n[o.w];i!==void 0&&s!==void 0&&(s.indegree++,i.out.push(s))});let r=Object.values(n).filter(o=>!o.indegree);return rl(r)}function rl(e){let t=[];function n(o){return i=>{i.merged||(i.barycenter===void 0||o.barycenter===void 0||i.barycenter>=o.barycenter)&&ol(o,i)}}function r(o){return i=>{i.in.push(o),--i.indegree===0&&e.push(i)}}for(;e.length;){let o=e.pop();t.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return t.filter(o=>!o.merged).map(o=>Zt(o,["vs","i","barycenter","weight"]))}function ol(e,t){let 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 il(e,t){let n=su(e,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,l)=>l.i-d.i),i=[],s=0,a=0,c=0;r.sort(sl(!!t)),c=Gr(i,o,c),r.forEach(d=>{c+=d.vs.length,i.push(d.vs),s+=d.barycenter*d.weight,a+=d.weight,c=Gr(i,o,c)});let u={vs:i.flat(1)};return a&&(u.barycenter=s/a,u.weight=a),u}function Gr(e,t,n){let r;for(;t.length&&(r=t[t.length-1]).i<=n;)t.pop(),e.push(r.vs),n++;return n}function sl(e){return(t,n)=>t.barycenter<n.barycenter?-1:t.barycenter>n.barycenter?1:e?n.i-t.i:t.i-n.i}function Pi(e,t,n,r){let o=e.children(t),i=e.node(t),s=i?i.borderLeft:void 0,a=i?i.borderRight:void 0,c={};s&&(o=o.filter(f=>f!==s&&f!==a));let u=tl(e,o);u.forEach(f=>{if(e.children(f.v).length){let h=Pi(e,f.v,n,r);c[f.v]=h,Object.hasOwn(h,"barycenter")&&cl(f,h)}});let d=nl(u,n);al(d,c);let l=il(d,r);if(s&&a){l.vs=[s,l.vs,a].flat(1);let f=e.predecessors(s);if(f&&f.length){let h=e.node(f[0]),g=e.predecessors(a),x=e.node(g[0]);Object.hasOwn(l,"barycenter")||(l.barycenter=0,l.weight=0),l.barycenter=(l.barycenter*l.weight+h.order+x.order)/(l.weight+2),l.weight+=2}}return l}function al(e,t){e.forEach(n=>{n.vs=n.vs.flatMap(r=>t[r]?t[r].vs:r)})}function cl(e,t){e.barycenter!==void 0?(e.barycenter=(e.barycenter*e.weight+t.barycenter*t.weight)/(e.weight+t.weight),e.weight+=t.weight):(e.barycenter=t.barycenter,e.weight=t.weight)}function ul(e,t,n,r){r||(r=e.nodes());let o=ll(e),i=new de({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(s=>e.node(s));return r.forEach(s=>{let a=e.node(s),c=e.parent(s);if(a.rank===t||a.minRank<=t&&t<=a.maxRank){i.setNode(s),i.setParent(s,c||o);let u=e[n](s);u&&u.forEach(d=>{let l=d.v===s?d.w:d.v,f=i.edge(l,s),h=f!==void 0?f.weight:0;i.setEdge(l,s,{weight:e.edge(d).weight+h})}),Object.hasOwn(a,"minRank")&&i.setNode(s,{borderLeft:a.borderLeft[t],borderRight:a.borderRight[t]})}}),i}function ll(e){let t;for(;e.hasNode(t=cr("_root")););return t}function dl(e,t,n){let r={},o;n.forEach(i=>{let s=e.parent(i),a,c;for(;s;){if(a=e.parent(s),a?(c=r[a],r[a]=s):(c=o,o=s),c&&c!==s){t.setEdge(c,s);return}s=a}})}function Ti(e,t={}){if(typeof t.customOrder=="function"){t.customOrder(e,Ti);return}let n=bi(e),r=qr(e,yt(1,n+1),"inEdges"),o=qr(e,yt(n-1,-1,-1),"outEdges"),i=Qu(e);if(Ur(e,i),t.disableOptimalOrderHeuristic)return;let s=Number.POSITIVE_INFINITY,a,c=t.constraints||[];for(let u=0,d=0;d<4;++u,++d){fl(u%2?r:o,u%4>=2,c),i=kt(e);let l=Ju(e,i);l<s?(d=0,a=Object.assign({},i),s=l):l===s&&(a=structuredClone(i))}Ur(e,a)}function qr(e,t,n){let r=new Map,o=(i,s)=>{r.has(i)||r.set(i,[]),r.get(i).push(s)};for(let i of e.nodes()){let s=e.node(i);if(typeof s.rank=="number"&&o(s.rank,i),typeof s.minRank=="number"&&typeof s.maxRank=="number")for(let a=s.minRank;a<=s.maxRank;a++)a!==s.rank&&o(a,i)}return t.map(function(i){return ul(e,i,n,r.get(i)||[])})}function fl(e,t,n){let r=new de;e.forEach(function(o){n.forEach(a=>r.setEdge(a.left,a.right));let i=o.graph().root,s=Pi(o,i,r,t);s.vs.forEach((a,c)=>o.node(a).order=c),dl(o,r,s.vs)})}function Ur(e,t){Object.values(t).forEach(n=>n.forEach((r,o)=>e.node(r).order=o))}function hl(e,t){let n={};function r(o,i){let s=0,a=0,c=o.length,u=i[i.length-1];return i.forEach((d,l)=>{let f=pl(e,d),h=f?e.node(f).order:c;(f||d===u)&&(i.slice(a,l+1).forEach(g=>{let x=e.predecessors(g);x&&x.forEach(y=>{let p=e.node(y),b=p.order;(b<s||h<b)&&!(p.dummy&&e.node(g).dummy)&&Li(n,y,g)})}),a=l+1,s=h)}),i}return t.length&&t.reduce(r),n}function gl(e,t){let n={};function r(i,s,a,c,u){yt(s,a).forEach(d=>{let l=i[d];if(l!==void 0&&e.node(l).dummy){let f=e.predecessors(l);f&&f.forEach(h=>{if(h===void 0)return;let g=e.node(h);g.dummy&&(g.order<c||g.order>u)&&Li(n,h,l)})}})}function o(i,s){let a=-1,c=-1,u=0;return s.forEach((d,l)=>{if(e.node(d).dummy==="border"){let f=e.predecessors(d);if(f&&f.length){let h=f[0];if(h===void 0)return;c=e.node(h).order,r(s,u,l,a,c),u=l,a=c}}r(s,u,s.length,c,i.length)}),s}return t.length&&t.reduce(o),n}function pl(e,t){if(e.node(t).dummy){let n=e.predecessors(t);if(n)return n.find(r=>e.node(r).dummy)}}function Li(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];r||(e[t]=r={}),r[n]=!0}function ml(e,t,n){if(t>n){let o=t;t=n,n=o}let r=e[t];return r!==void 0&&Object.hasOwn(r,n)}function yl(e,t,n,r){let o={},i={},s={};return t.forEach(a=>{a.forEach((c,u)=>{o[c]=c,i[c]=c,s[c]=u})}),t.forEach(a=>{let c=-1;a.forEach(u=>{let d=r(u);if(d&&d.length){let l=d.sort((h,g)=>{let x=s[h],y=s[g];return(x!==void 0?x:0)-(y!==void 0?y:0)}),f=(l.length-1)/2;for(let h=Math.floor(f),g=Math.ceil(f);h<=g;++h){let x=l[h];if(x===void 0)continue;let y=s[x];if(y!==void 0&&i[u]===u&&c<y&&!ml(n,u,x)){let p=o[x];p!==void 0&&(i[x]=u,i[u]=o[u]=p,c=y)}}}})}),{root:o,align:i}}function xl(e,t,n,r,o=!1){let i={},s=wl(e,t,n,o),a=o?"borderLeft":"borderRight";function c(h,g){let x=s.nodes().slice(),y={},p=x.pop();for(;p;){if(y[p])h(p);else{y[p]=!0,x.push(p);for(let b of g(p))x.push(b)}p=x.pop()}}function u(h){let g=s.inEdges(h);g?i[h]=g.reduce((x,y)=>{var p;let b=(p=i[y.v])!=null?p:0,m=s.edge(y);return Math.max(x,b+(m!==void 0?m:0))},0):i[h]=0}function d(h){let g=s.outEdges(h),x=Number.POSITIVE_INFINITY;g&&(x=g.reduce((p,b)=>{let m=i[b.w],w=s.edge(b);return Math.min(p,(m!==void 0?m:0)-(w!==void 0?w:0))},Number.POSITIVE_INFINITY));let y=e.node(h);x!==Number.POSITIVE_INFINITY&&y.borderType!==a&&(i[h]=Math.max(i[h]!==void 0?i[h]:0,x))}function l(h){return s.predecessors(h)||[]}function f(h){return s.successors(h)||[]}return c(u,l),c(d,f),Object.keys(r).forEach(h=>{var g;let x=n[h];x!==void 0&&(i[h]=(g=i[x])!=null?g:0)}),i}function wl(e,t,n,r){let o=new de,i=e.graph(),s=Nl(i.nodesep,i.edgesep,r);return t.forEach(a=>{let c;a.forEach(u=>{let d=n[u];if(d!==void 0){if(o.setNode(d),c!==void 0){let l=n[c];if(l!==void 0){let f=o.edge(l,d);o.setEdge(l,d,Math.max(s(e,u,c),f||0))}}c=u}})}),o}function vl(e,t){return Object.values(t).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,i=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([a,c])=>{let u=Sl(e,a)/2;o=Math.max(c+u,o),i=Math.min(c-u,i)});let s=o-i;return s<n[0]&&(n=[s,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function bl(e,t){let n=Object.values(t),r=_e(Math.min,n),o=_e(Math.max,n);["u","d"].forEach(i=>{["l","r"].forEach(s=>{let a=i+s,c=e[a];if(!c||c===t)return;let u=Object.values(c),d=r-_e(Math.min,u);s!=="l"&&(d=o-_e(Math.max,u)),d&&(e[a]=ln(c,l=>l+d))})})}function _l(e,t=void 0){let n=e.ul;return n?ln(n,(r,o)=>{var i,s;if(t){let c=t.toLowerCase(),u=e[c];if(u&&u[o]!==void 0)return u[o]}let a=Object.values(e).map(c=>{let u=c[o];return u!==void 0?u:0}).sort((c,u)=>c-u);return(((i=a[1])!=null?i:0)+((s=a[2])!=null?s:0))/2}):{}}function El(e){let t=kt(e),n=Object.assign(hl(e,t),gl(e,t)),r={},o;["u","d"].forEach(s=>{o=s==="u"?t:Object.values(t).reverse(),["l","r"].forEach(a=>{a==="r"&&(o=o.map(d=>Object.values(d).reverse()));let c=yl(e,o,n,d=>(s==="u"?e.predecessors(d):e.successors(d))||[]),u=xl(e,o,c.root,c.align,a==="r");a==="r"&&(u=ln(u,d=>-d)),r[s+a]=u})});let i=vl(e,r);return bl(r,i),_l(r,e.graph().align)}function Nl(e,t,n){return(r,o,i)=>{let s=r.node(o),a=r.node(i),c=0,u;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":u=-s.width/2;break;case"r":u=s.width/2;break}if(u&&(c+=n?u:-u),u=void 0,c+=(s.dummy?t:e)/2,c+=(a.dummy?t:e)/2,c+=a.width/2,Object.hasOwn(a,"labelpos"))switch(a.labelpos.toLowerCase()){case"l":u=a.width/2;break;case"r":u=-a.width/2;break}return u&&(c+=n?u:-u),c}}function Sl(e,t){return e.node(t).width}function Ml(e){e=wi(e),kl(e),Object.entries(El(e)).forEach(([t,n])=>e.node(t).x=n)}function kl(e){let t=kt(e),n=e.graph(),r=n.ranksep,o=n.rankalign,i=0;t.forEach(s=>{let a=s.reduce((c,u)=>{var d;let l=(d=e.node(u).height)!=null?d:0;return c>l?c:l},0);s.forEach(c=>{let u=e.node(c);o==="top"?u.y=i+u.height/2:o==="bottom"?u.y=i+a-u.height/2:u.y=i+a/2}),i+=a+r})}function Cl(e,t={}){let n=t.debugTiming?_i:Ei;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>zl(e));return n(" runLayout",()=>Il(r,n,t)),n(" updateInputGraph",()=>Al(e,r)),r})}function Il(e,t,n){t(" makeSpaceForEdgeLabels",()=>jl(e)),t(" removeSelfEdges",()=>ql(e)),t(" acyclic",()=>xu(e)),t(" nestingGraph.run",()=>Bu(e)),t(" rank",()=>Lu(wi(e))),t(" injectEdgeLabelProxies",()=>Hl(e)),t(" removeEmptyRanks",()=>ou(e)),t(" nestingGraph.cleanup",()=>Xu(e)),t(" normalizeRanks",()=>ru(e)),t(" assignRankMinMax",()=>Vl(e)),t(" removeEdgeLabelProxies",()=>Bl(e)),t(" normalize.run",()=>bu(e)),t(" parentDummyChains",()=>zu(e)),t(" addBorderSegments",()=>Wu(e)),t(" order",()=>Ti(e,n)),t(" insertSelfEdges",()=>Ul(e)),t(" adjustCoordinateSystem",()=>qu(e)),t(" position",()=>Ml(e)),t(" positionSelfEdges",()=>Kl(e)),t(" removeBorderNodes",()=>Gl(e)),t(" normalize.undo",()=>Eu(e)),t(" fixupEdgeLabelCoords",()=>Xl(e)),t(" undoCoordinateSystem",()=>Uu(e)),t(" translateGraph",()=>Fl(e)),t(" assignNodeIntersects",()=>Yl(e)),t(" reversePoints",()=>Wl(e)),t(" acyclic.undo",()=>vu(e))}function Al(e,t){e.nodes().forEach(n=>{let r=e.node(n),o=t.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,t.children(n).length&&(r.width=o.width,r.height=o.height))}),e.edges().forEach(n=>{let r=e.edge(n),o=t.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}var $l=["nodesep","edgesep","ranksep","marginx","marginy"],Pl={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},Tl=["acyclicer","ranker","rankdir","align","rankalign"],Ll=["width","height","rank"],Kr={width:0,height:0},Dl=["minlen","weight","width","height","labeloffset"],Ol={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Rl=["labelpos"];function zl(e){let t=new de({multigraph:!0,compound:!0}),n=$n(e.graph());return t.setGraph(Object.assign({},Pl,An(n,$l),Zt(n,Tl))),e.nodes().forEach(r=>{let o=$n(e.node(r)),i=An(o,Ll);Object.keys(Kr).forEach(a=>{i[a]===void 0&&(i[a]=Kr[a])}),t.setNode(r,i);let s=e.parent(r);s!==void 0&&t.setParent(r,s)}),e.edges().forEach(r=>{let o=$n(e.edge(r));t.setEdge(r,Object.assign({},Ol,An(o,Dl),Zt(o,Rl)))}),t}function jl(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let 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 Hl(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let r=e.node(t.v),o={rank:(e.node(t.w).rank-r.rank)/2+r.rank,e:t};ct(e,"edge-proxy",o,"_ep")}})}function Vl(e){let t=0;e.nodes().forEach(n=>{let r=e.node(n);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,t=Math.max(t,r.maxRank))}),e.graph().maxRank=t}function Bl(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="edge-proxy"){let r=n;e.edge(r.e).labelRank=n.rank,e.removeNode(t)}})}function Fl(e){let t=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),s=i.marginx||0,a=i.marginy||0;function c(u){let d=u.x,l=u.y,f=u.width,h=u.height;t=Math.min(t,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,l-h/2),o=Math.max(o,l+h/2)}e.nodes().forEach(u=>c(e.node(u))),e.edges().forEach(u=>{let d=e.edge(u);Object.hasOwn(d,"x")&&c(d)}),t-=s,r-=a,e.nodes().forEach(u=>{let d=e.node(u);d.x-=t,d.y-=r}),e.edges().forEach(u=>{let d=e.edge(u);d.points.forEach(l=>{l.x-=t,l.y-=r}),Object.hasOwn(d,"x")&&(d.x-=t),Object.hasOwn(d,"y")&&(d.y-=r)}),i.width=n-t+s,i.height=o-r+a}function Yl(e){e.edges().forEach(t=>{let n=e.edge(t),r=e.node(t.v),o=e.node(t.w),i,s;n.points?(i=n.points[0],s=n.points[n.points.length-1]):(n.points=[],i=o,s=r),n.points.unshift(Hr(r,i)),n.points.push(Hr(o,s))})}function Xl(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(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 Wl(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}function Gl(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),r=e.node(n.borderTop),o=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),s=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(s.x-i.x),n.height=Math.abs(o.y-r.y),n.x=i.x+n.width/2,n.y=r.y+n.height/2}}),e.nodes().forEach(t=>{e.node(t).dummy==="border"&&e.removeNode(t)})}function ql(e){e.edges().forEach(t=>{if(t.v===t.w){let n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}function Ul(e){kt(e).forEach(t=>{let n=0;t.forEach((r,o)=>{let i=e.node(r);i.order=o+n,(i.selfEdges||[]).forEach(s=>{ct(e,"selfedge",{width:s.label.width,height:s.label.height,rank:i.rank,order:o+ ++n,e:s.e,label:s.label},"_se")}),delete i.selfEdges})})}function Kl(e){e.nodes().forEach(t=>{let n=e.node(t);if(n.dummy==="selfedge"){let r=n,o=e.node(r.e.v),i=o.x+o.width/2,s=o.y,a=n.x-i,c=o.height/2;e.setEdge(r.e,r.label),e.removeNode(t),r.label.points=[{x:i+2*a/3,y:s-c},{x:i+5*a/6,y:s-c},{x:i+a,y:s},{x:i+5*a/6,y:s+c},{x:i+2*a/3,y:s+c}],r.label.x=n.x,r.label.y=n.y}})}function An(e,t){return ln(Zt(e,t),Number)}function $n(e){let t={};return e&&Object.entries(e).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),t[n]=r}),t}function Zl(e){let t=kt(e),n=new de({compound:!0,multigraph:!0}).setGraph({});return e.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+e.node(r).rank)}),e.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),t.forEach((r,o)=>{let i="layer"+o;n.setNode(i,{rank:"same"}),r.reduce((s,a)=>(n.setEdge(s,a,{style:"invis"}),a))}),n}var Ql={graphlib:li,version:uu,layout:Cl,debug:Zl,util:{time:_i,notime:Ei}},Zr=Ql;/*! For license information please see dagre.esm.js.LEGAL.txt */function se(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=se(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var Jl={value:()=>{}};function fn(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Yt(n)}function Yt(e){this._=e}function ed(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Yt.prototype=fn.prototype={constructor:Yt,on:function(e,t){var n=this._,r=ed(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=td(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=Qr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=Qr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Yt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function td(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function Qr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=Jl,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Wn="http://www.w3.org/1999/xhtml";const Jr={svg:"http://www.w3.org/2000/svg",xhtml:Wn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function hn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Jr.hasOwnProperty(t)?{space:Jr[t],local:e}:e}function nd(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Wn&&t.documentElement.namespaceURI===Wn?t.createElement(e):t.createElementNS(n,e)}}function rd(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Di(e){var t=hn(e);return(t.local?rd:nd)(t)}function od(){}function fr(e){return e==null?od:function(){return this.querySelector(e)}}function id(e){typeof e!="function"&&(e=fr(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,u,d=0;d<s;++d)(c=i[d])&&(u=e.call(c,c.__data__,d,i))&&("__data__"in c&&(u.__data__=c.__data__),a[d]=u);return new ue(r,this._parents)}function sd(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ad(){return[]}function Oi(e){return e==null?ad:function(){return this.querySelectorAll(e)}}function cd(e){return function(){return sd(e.apply(this,arguments))}}function ud(e){typeof e=="function"?e=cd(e):e=Oi(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&(r.push(e.call(c,c.__data__,u,s)),o.push(c));return new ue(r,o)}function Ri(e){return function(){return this.matches(e)}}function zi(e){return function(t){return t.matches(e)}}var ld=Array.prototype.find;function dd(e){return function(){return ld.call(this.children,e)}}function fd(){return this.firstElementChild}function hd(e){return this.select(e==null?fd:dd(typeof e=="function"?e:zi(e)))}var gd=Array.prototype.filter;function pd(){return Array.from(this.children)}function md(e){return function(){return gd.call(this.children,e)}}function yd(e){return this.selectAll(e==null?pd:md(typeof e=="function"?e:zi(e)))}function xd(e){typeof e!="function"&&(e=Ri(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new ue(r,this._parents)}function ji(e){return new Array(e.length)}function wd(){return new ue(this._enter||this._groups.map(ji),this._parents)}function Qt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qt.prototype={constructor:Qt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function vd(e){return function(){return e}}function bd(e,t,n,r,o,i){for(var s=0,a,c=t.length,u=i.length;s<u;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Qt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function _d(e,t,n,r,o,i,s){var a,c,u=new Map,d=t.length,l=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",u.has(h)?o[a]=c:u.set(h,c));for(a=0;a<l;++a)h=s.call(e,i[a],a,i)+"",(c=u.get(h))?(r[a]=c,c.__data__=i[a],u.delete(h)):n[a]=new Qt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&u.get(f[a])===c&&(o[a]=c)}function Ed(e){return e.__data__}function Nd(e,t){if(!arguments.length)return Array.from(this,Ed);var n=t?_d:bd,r=this._parents,o=this._groups;typeof e!="function"&&(e=vd(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),u=0;u<i;++u){var d=r[u],l=o[u],f=l.length,h=Sd(e.call(d,d&&d.__data__,u,r)),g=h.length,x=a[u]=new Array(g),y=s[u]=new Array(g),p=c[u]=new Array(f);n(d,l,x,y,p,h,t);for(var b=0,m=0,w,N;b<g;++b)if(w=x[b]){for(b>=m&&(m=b+1);!(N=y[m])&&++m<g;);w._next=N||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Sd(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Md(){return new ue(this._exit||this._groups.map(ji),this._parents)}function kd(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Cd(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var u=n[c],d=r[c],l=u.length,f=a[c]=new Array(l),h,g=0;g<l;++g)(h=u[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Id(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Ad(e){e||(e=$d);function t(l,f){return l&&f?e(l.__data__,f.__data__):!l-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),u,d=0;d<a;++d)(u=s[d])&&(c[d]=u);c.sort(t)}return new ue(o,this._parents).order()}function $d(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Pd(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Td(){return Array.from(this)}function Ld(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function Dd(){let e=0;for(const t of this)++e;return e}function Od(){return!this.node()}function Rd(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function zd(e){return function(){this.removeAttribute(e)}}function jd(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Hd(e,t){return function(){this.setAttribute(e,t)}}function Vd(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Fd(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Yd(e,t){var n=hn(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?jd:zd:typeof t=="function"?n.local?Fd:Bd:n.local?Vd:Hd)(n,t))}function Hi(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xd(e){return function(){this.style.removeProperty(e)}}function Wd(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Gd(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function qd(e,t,n){return arguments.length>1?this.each((t==null?Xd:typeof t=="function"?Gd:Wd)(e,t,n??"")):tt(this.node(),e)}function tt(e,t){return e.style.getPropertyValue(t)||Hi(e).getComputedStyle(e,null).getPropertyValue(t)}function Ud(e){return function(){delete this[e]}}function Kd(e,t){return function(){this[e]=t}}function Zd(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function Qd(e,t){return arguments.length>1?this.each((t==null?Ud:typeof t=="function"?Zd:Kd)(e,t)):this.node()[e]}function Vi(e){return e.trim().split(/^|\s+/)}function hr(e){return e.classList||new Bi(e)}function Bi(e){this._node=e,this._names=Vi(e.getAttribute("class")||"")}Bi.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Fi(e,t){for(var n=hr(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Yi(e,t){for(var n=hr(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function Jd(e){return function(){Fi(this,e)}}function ef(e){return function(){Yi(this,e)}}function tf(e,t){return function(){(t.apply(this,arguments)?Fi:Yi)(this,e)}}function nf(e,t){var n=Vi(e+"");if(arguments.length<2){for(var r=hr(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?tf:t?Jd:ef)(n,t))}function rf(){this.textContent=""}function of(e){return function(){this.textContent=e}}function sf(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function af(e){return arguments.length?this.each(e==null?rf:(typeof e=="function"?sf:of)(e)):this.node().textContent}function cf(){this.innerHTML=""}function uf(e){return function(){this.innerHTML=e}}function lf(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function df(e){return arguments.length?this.each(e==null?cf:(typeof e=="function"?lf:uf)(e)):this.node().innerHTML}function ff(){this.nextSibling&&this.parentNode.appendChild(this)}function hf(){return this.each(ff)}function gf(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pf(){return this.each(gf)}function mf(e){var t=typeof e=="function"?e:Di(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function yf(){return null}function xf(e,t){var n=typeof e=="function"?e:Di(e),r=t==null?yf:typeof t=="function"?t:fr(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function wf(){var e=this.parentNode;e&&e.removeChild(this)}function vf(){return this.each(wf)}function bf(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _f(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ef(e){return this.select(e?_f:bf)}function Nf(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Sf(e){return function(t){e.call(this,t,this.__data__)}}function Mf(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function kf(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Cf(e,t,n){return function(){var r=this.__on,o,i=Sf(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function If(e,t,n){var r=Mf(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,u=a.length,d;c<u;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Cf:kf,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function Xi(e,t,n){var r=Hi(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Af(e,t){return function(){return Xi(this,e,t)}}function $f(e,t){return function(){return Xi(this,e,t.apply(this,arguments))}}function Pf(e,t){return this.each((typeof t=="function"?$f:Af)(e,t))}function*Tf(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Wi=[null];function ue(e,t){this._groups=e,this._parents=t}function Ct(){return new ue([[document.documentElement]],Wi)}function Lf(){return this}ue.prototype=Ct.prototype={constructor:ue,select:id,selectAll:ud,selectChild:hd,selectChildren:yd,filter:xd,data:Nd,enter:wd,exit:Md,join:kd,merge:Cd,selection:Lf,order:Id,sort:Ad,call:Pd,nodes:Td,node:Ld,size:Dd,empty:Od,each:Rd,attr:Yd,style:qd,property:Qd,classed:nf,text:af,html:df,raise:hf,lower:pf,append:mf,insert:xf,remove:vf,clone:Ef,datum:Nf,on:If,dispatch:Pf,[Symbol.iterator]:Tf};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],Wi)}function Df(e){let t;for(;t=e.sourceEvent;)e=t;return e}function he(e,t){if(e=Df(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const Of={passive:!1},xt={capture:!0,passive:!1};function Pn(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Gi(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,xt);"onselectstart"in t?n.on("selectstart.drag",Qe,xt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function qi(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",Qe,xt),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Dt=e=>()=>e;function Gn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:u,dispatch:d}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:d}})}Gn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Rf(e){return!e.ctrlKey&&!e.button}function zf(){return this.parentNode}function jf(e,t){return t??{x:e.x,y:e.y}}function Hf(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ui(){var e=Rf,t=zf,n=jf,r=Hf,o={},i=fn("start","drag","end"),s=0,a,c,u,d,l=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",y).on("touchmove.drag",p,Of).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(d||!e.call(this,w,N))){var _=m(this,t.call(this,w,N),w,N,"mouse");_&&(ce(w.view).on("mousemove.drag",g,xt).on("mouseup.drag",x,xt),Gi(w.view),Pn(w),u=!1,a=w.clientX,c=w.clientY,_("start",w))}}function g(w){if(Qe(w),!u){var N=w.clientX-a,_=w.clientY-c;u=N*N+_*_>l}o.mouse("drag",w)}function x(w){ce(w.view).on("mousemove.drag mouseup.drag",null),qi(w.view,u),Qe(w),o.mouse("end",w)}function y(w,N){if(e.call(this,w,N)){var _=w.changedTouches,k=t.call(this,w,N),$=_.length,P,V;for(P=0;P<$;++P)(V=m(this,k,w,N,_[P].identifier,_[P]))&&(Pn(w),V("start",w,_[P]))}}function p(w){var N=w.changedTouches,_=N.length,k,$;for(k=0;k<_;++k)($=o[N[k].identifier])&&(Qe(w),$("drag",w,N[k]))}function b(w){var N=w.changedTouches,_=N.length,k,$;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),k=0;k<_;++k)($=o[N[k].identifier])&&(Pn(w),$("end",w,N[k]))}function m(w,N,_,k,$,P){var V=i.copy(),S=he(P||_,N),T,H,v;if((v=n.call(w,new Gn("beforestart",{sourceEvent:_,target:f,identifier:$,active:s,x:S[0],y:S[1],dx:0,dy:0,dispatch:V}),k))!=null)return T=v.x-S[0]||0,H=v.y-S[1]||0,function I(E,A,L){var C=S,z;switch(E){case"start":o[$]=I,z=s++;break;case"end":delete o[$],--s;case"drag":S=he(L||A,N),z=s;break}V.call(E,w,new Gn(E,{sourceEvent:A,subject:v,target:f,identifier:$,active:z,x:S[0]+T,y:S[1]+H,dx:S[0]-C[0],dy:S[1]-C[1],dispatch:V}),k)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Dt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Dt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Dt(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Dt(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(l=(w=+w)*w,f):Math.sqrt(l)},f}function gr(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ki(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function It(){}var wt=.7,Jt=1/wt,Je="\\s*([+-]?\\d+)\\s*",vt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Vf=/^#([0-9a-f]{3,8})$/,Bf=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Ff=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Yf=new RegExp(`^rgba\\(${Je},${Je},${Je},${vt}\\)$`),Xf=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${vt}\\)$`),Wf=new RegExp(`^hsl\\(${vt},${Ee},${Ee}\\)$`),Gf=new RegExp(`^hsla\\(${vt},${Ee},${Ee},${vt}\\)$`),eo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};gr(It,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:to,formatHex:to,formatHex8:qf,formatHsl:Uf,formatRgb:no,toString:no});function to(){return this.rgb().formatHex()}function qf(){return this.rgb().formatHex8()}function Uf(){return Zi(this).formatHsl()}function no(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Vf.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?ro(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ot(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ot(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Bf.exec(e))?new ae(t[1],t[2],t[3],1):(t=Ff.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Yf.exec(e))?Ot(t[1],t[2],t[3],t[4]):(t=Xf.exec(e))?Ot(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wf.exec(e))?so(t[1],t[2]/100,t[3]/100,1):(t=Gf.exec(e))?so(t[1],t[2]/100,t[3]/100,t[4]):eo.hasOwnProperty(e)?ro(eo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function ro(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ot(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function Kf(e){return e instanceof It||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function qn(e,t,n,r){return arguments.length===1?Kf(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}gr(ae,qn,Ki(It,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?wt:Math.pow(wt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),en(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:oo,formatHex:oo,formatHex8:Zf,formatRgb:io,toString:io}));function oo(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function Zf(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function io(){const e=en(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function en(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function He(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function so(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ge(e,t,n,r)}function Zi(e){if(e instanceof ge)return new ge(e.h,e.s,e.l,e.opacity);if(e instanceof It||(e=Fe(e)),!e)return new ge;if(e instanceof ge)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new ge(s,a,c,e.opacity)}function Qf(e,t,n,r){return arguments.length===1?Zi(e):new ge(e,t,n,r??1)}function ge(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}gr(ge,Qf,Ki(It,{brighter(e){return e=e==null?Jt:Math.pow(Jt,e),new ge(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?wt:Math.pow(wt,e),new ge(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(Tn(e>=240?e-240:e+120,o,r),Tn(e,o,r),Tn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ge(ao(this.h),Rt(this.s),Rt(this.l),en(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=en(this.opacity);return`${e===1?"hsl(":"hsla("}${ao(this.h)}, ${Rt(this.s)*100}%, ${Rt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function ao(e){return e=(e||0)%360,e<0?e+360:e}function Rt(e){return Math.max(0,Math.min(1,e||0))}function Tn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const pr=e=>()=>e;function Jf(e,t){return function(n){return e+n*t}}function eh(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function th(e){return(e=+e)==1?Qi:function(t,n){return n-t?eh(t,n,e):pr(isNaN(t)?n:t)}}function Qi(e,t){var n=t-e;return n?Jf(e,n):pr(isNaN(e)?t:e)}const tn=(function e(t){var n=th(t);function r(o,i){var s=n((o=qn(o)).r,(i=qn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),u=Qi(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=u(d),o+""}}return r.gamma=e,r})(1);function nh(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function rh(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function oh(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=pt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function ih(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function be(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function sh(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=pt(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Un=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ln=new RegExp(Un.source,"g");function ah(e){return function(){return e}}function ch(e){return function(t){return e(t)+""}}function Ji(e,t){var n=Un.lastIndex=Ln.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=Un.exec(e))&&(o=Ln.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:be(r,o)})),n=Ln.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?ch(c[0].x):ah(t):(t=c.length,function(u){for(var d=0,l;d<t;++d)a[(l=c[d]).i]=l.x(u);return a.join("")})}function pt(e,t){var n=typeof t,r;return t==null||n==="boolean"?pr(t):(n==="number"?be:n==="string"?(r=Fe(t))?(t=r,tn):Ji:t instanceof Fe?tn:t instanceof Date?ih:rh(t)?nh:Array.isArray(t)?oh:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?sh:be)(e,t)}var co=180/Math.PI,Kn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function es(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*co,skewX:Math.atan(c)*co,scaleX:s,scaleY:a}}var zt;function uh(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Kn:es(t.a,t.b,t.c,t.d,t.e,t.f)}function lh(e){return e==null||(zt||(zt=document.createElementNS("http://www.w3.org/2000/svg","g")),zt.setAttribute("transform",e),!(e=zt.transform.baseVal.consolidate()))?Kn:(e=e.matrix,es(e.a,e.b,e.c,e.d,e.e,e.f))}function ts(e,t,n,r){function o(u){return u.length?u.pop()+" ":""}function i(u,d,l,f,h,g){if(u!==l||d!==f){var x=h.push("translate(",null,t,null,n);g.push({i:x-4,x:be(u,l)},{i:x-2,x:be(d,f)})}else(l||f)&&h.push("translate("+l+t+f+n)}function s(u,d,l,f){u!==d?(u-d>180?d+=360:d-u>180&&(u+=360),f.push({i:l.push(o(l)+"rotate(",null,r)-2,x:be(u,d)})):d&&l.push(o(l)+"rotate("+d+r)}function a(u,d,l,f){u!==d?f.push({i:l.push(o(l)+"skewX(",null,r)-2,x:be(u,d)}):d&&l.push(o(l)+"skewX("+d+r)}function c(u,d,l,f,h,g){if(u!==l||d!==f){var x=h.push(o(h)+"scale(",null,",",null,")");g.push({i:x-4,x:be(u,l)},{i:x-2,x:be(d,f)})}else(l!==1||f!==1)&&h.push(o(h)+"scale("+l+","+f+")")}return function(u,d){var l=[],f=[];return u=e(u),d=e(d),i(u.translateX,u.translateY,d.translateX,d.translateY,l,f),s(u.rotate,d.rotate,l,f),a(u.skewX,d.skewX,l,f),c(u.scaleX,u.scaleY,d.scaleX,d.scaleY,l,f),u=d=null,function(h){for(var g=-1,x=f.length,y;++g<x;)l[(y=f[g]).i]=y.x(h);return l.join("")}}}var dh=ts(uh,"px, ","px)","deg)"),fh=ts(lh,", ",")",")"),hh=1e-12;function uo(e){return((e=Math.exp(e))+1/e)/2}function gh(e){return((e=Math.exp(e))-1/e)/2}function ph(e){return((e=Math.exp(2*e))-1)/(e+1)}const Xt=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],u=i[2],d=s[0],l=s[1],f=s[2],h=d-a,g=l-c,x=h*h+g*g,y,p;if(x<hh)p=Math.log(f/u)/t,y=function(k){return[a+k*h,c+k*g,u*Math.exp(t*k*p)]};else{var b=Math.sqrt(x),m=(f*f-u*u+r*x)/(2*u*n*b),w=(f*f-u*u-r*x)/(2*f*n*b),N=Math.log(Math.sqrt(m*m+1)-m),_=Math.log(Math.sqrt(w*w+1)-w);p=(_-N)/t,y=function(k){var $=k*p,P=uo(N),V=u/(n*b)*(P*ph(t*$+N)-gh(N));return[a+V*h,c+V*g,u*P/uo(t*$+N)]}}return y.duration=p*1e3*t/Math.SQRT2,y}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var nt=0,ht=0,lt=0,ns=1e3,nn,gt,rn=0,Ye=0,gn=0,bt=typeof performance=="object"&&performance.now?performance:Date,rs=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function mr(){return Ye||(rs(mh),Ye=bt.now()+gn)}function mh(){Ye=0}function on(){this._call=this._time=this._next=null}on.prototype=os.prototype={constructor:on,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?mr():+n)+(t==null?0:+t),!this._next&>!==this&&(gt?gt._next=this:nn=this,gt=this),this._call=e,this._time=n,Zn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zn())}};function os(e,t,n){var r=new on;return r.restart(e,t,n),r}function yh(){mr(),++nt;for(var e=nn,t;e;)(t=Ye-e._time)>=0&&e._call.call(void 0,t),e=e._next;--nt}function lo(){Ye=(rn=bt.now())+gn,nt=ht=0;try{yh()}finally{nt=0,wh(),Ye=0}}function xh(){var e=bt.now(),t=e-rn;t>ns&&(gn-=t,rn=e)}function wh(){for(var e,t=nn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:nn=n);gt=e,Zn(r)}function Zn(e){if(!nt){ht&&(ht=clearTimeout(ht));var t=e-Ye;t>24?(e<1/0&&(ht=setTimeout(lo,e-bt.now()-gn)),lt&&(lt=clearInterval(lt))):(lt||(rn=bt.now(),lt=setInterval(xh,ns)),nt=1,rs(lo))}}function fo(e,t,n){var r=new on;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var vh=fn("start","end","cancel","interrupt"),bh=[],is=0,ho=1,Qn=2,Wt=3,go=4,Jn=5,Gt=6;function pn(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;_h(e,n,{name:t,index:r,group:o,on:vh,tween:bh,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:is})}function yr(e,t){var n=xe(e,t);if(n.state>is)throw new Error("too late; already scheduled");return n}function Ne(e,t){var n=xe(e,t);if(n.state>Wt)throw new Error("too late; already running");return n}function xe(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function _h(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=os(i,0,n.time);function i(u){n.state=ho,n.timer.restart(s,n.delay,n.time),n.delay<=u&&s(u-n.delay)}function s(u){var d,l,f,h;if(n.state!==ho)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Wt)return fo(s);h.state===go?(h.state=Gt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Gt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(fo(function(){n.state===Wt&&(n.state=go,n.timer.restart(a,n.delay,n.time),a(u))}),n.state=Qn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Qn){for(n.state=Wt,o=new Array(f=n.tween.length),d=0,l=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++l]=h);o.length=l+1}}function a(u){for(var d=u<n.duration?n.ease.call(null,u/n.duration):(n.timer.restart(c),n.state=Jn,1),l=-1,f=o.length;++l<f;)o[l].call(e,d);n.state===Jn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Gt,n.timer.stop(),delete r[t];for(var u in r)return;delete e.__transition}}function qt(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>Qn&&r.state<Jn,r.state=Gt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function Eh(e){return this.each(function(){qt(this,e)})}function Nh(e,t){var n,r;return function(){var o=Ne(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Sh(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=Ne(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,u=o.length;c<u;++c)if(o[c].name===t){o[c]=a;break}c===u&&o.push(a)}i.tween=o}}function Mh(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=xe(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Nh:Sh)(n,e,t))}function xr(e,t,n){var r=e._id;return e.each(function(){var o=Ne(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return xe(o,r).value[t]}}function ss(e,t){var n;return(typeof t=="number"?be:t instanceof Fe?tn:(n=Fe(t))?(t=n,tn):Ji)(e,t)}function kh(e){return function(){this.removeAttribute(e)}}function Ch(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Ih(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Ah(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function $h(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Ph(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Th(e,t){var n=hn(e),r=n==="transform"?fh:ss;return this.attrTween(e,typeof t=="function"?(n.local?Ph:$h)(n,r,xr(this,"attr."+e,t)):t==null?(n.local?Ch:kh)(n):(n.local?Ah:Ih)(n,r,t))}function Lh(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Dh(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Oh(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Dh(e,i)),n}return o._value=t,o}function Rh(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Lh(e,i)),n}return o._value=t,o}function zh(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=hn(e);return this.tween(n,(r.local?Oh:Rh)(r,t))}function jh(e,t){return function(){yr(this,e).delay=+t.apply(this,arguments)}}function Hh(e,t){return t=+t,function(){yr(this,e).delay=t}}function Vh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?jh:Hh)(t,e)):xe(this.node(),t).delay}function Bh(e,t){return function(){Ne(this,e).duration=+t.apply(this,arguments)}}function Fh(e,t){return t=+t,function(){Ne(this,e).duration=t}}function Yh(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Bh:Fh)(t,e)):xe(this.node(),t).duration}function Xh(e,t){if(typeof t!="function")throw new Error;return function(){Ne(this,e).ease=t}}function Wh(e){var t=this._id;return arguments.length?this.each(Xh(t,e)):xe(this.node(),t).ease}function Gh(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Ne(this,e).ease=n}}function qh(e){if(typeof e!="function")throw new Error;return this.each(Gh(this._id,e))}function Uh(e){typeof e!="function"&&(e=Ri(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,u=0;u<s;++u)(c=i[u])&&e.call(c,c.__data__,u,i)&&a.push(c);return new Ae(r,this._parents,this._name,this._id)}function Kh(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],u=n[a],d=c.length,l=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||u[h])&&(l[h]=f);for(;a<r;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function Zh(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function Qh(e,t,n){var r,o,i=Zh(t)?yr:Ne;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function Jh(e,t){var n=this._id;return arguments.length<2?xe(this.node(),n).on.on(e):this.each(Qh(n,e,t))}function eg(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function tg(){return this.on("end.remove",eg(this._id))}function ng(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fr(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,u=i[s]=new Array(c),d,l,f=0;f<c;++f)(d=a[f])&&(l=e.call(d,d.__data__,f,a))&&("__data__"in d&&(l.__data__=d.__data__),u[f]=l,pn(u[f],t,n,f,u,xe(d,n)));return new Ae(i,this._parents,t,n)}function rg(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Oi(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],u=c.length,d,l=0;l<u;++l)if(d=c[l]){for(var f=e.call(d,d.__data__,l,c),h,g=xe(d,n),x=0,y=f.length;x<y;++x)(h=f[x])&&pn(h,t,n,x,f,g);i.push(f),s.push(d)}return new Ae(i,s,t,n)}var og=Ct.prototype.constructor;function ig(){return new og(this._groups,this._parents)}function sg(e,t){var n,r,o;return function(){var i=tt(this,e),s=(this.style.removeProperty(e),tt(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function as(e){return function(){this.style.removeProperty(e)}}function ag(e,t,n){var r,o=n+"",i;return function(){var s=tt(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function cg(e,t,n){var r,o,i;return function(){var s=tt(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),tt(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function ug(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=Ne(this,e),u=c.on,d=c.value[i]==null?a||(a=as(t)):void 0;(u!==n||o!==d)&&(r=(n=u).copy()).on(s,o=d),c.on=r}}function lg(e,t,n){var r=(e+="")=="transform"?dh:ss;return t==null?this.styleTween(e,sg(e,r)).on("end.style."+e,as(e)):typeof t=="function"?this.styleTween(e,cg(e,r,xr(this,"style."+e,t))).each(ug(this._id,e)):this.styleTween(e,ag(e,r,t),n).on("end.style."+e,null)}function dg(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function fg(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&dg(e,s,n)),r}return i._value=t,i}function hg(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,fg(e,t,n??""))}function gg(e){return function(){this.textContent=e}}function pg(e){return function(){var t=e(this);this.textContent=t??""}}function mg(e){return this.tween("text",typeof e=="function"?pg(xr(this,"text",e)):gg(e==null?"":e+""))}function yg(e){return function(t){this.textContent=e.call(this,t)}}function xg(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&yg(o)),t}return r._value=e,r}function wg(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,xg(e))}function vg(){for(var e=this._name,t=this._id,n=cs(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)if(c=s[u]){var d=xe(c,t);pn(c,e,n,u,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new Ae(r,this._parents,e,n)}function bg(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var u=Ne(this,r),d=u.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),u.on=t}),o===0&&i()})}var _g=0;function Ae(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function cs(){return++_g}var Ce=Ct.prototype;Ae.prototype={constructor:Ae,select:ng,selectAll:rg,selectChild:Ce.selectChild,selectChildren:Ce.selectChildren,filter:Uh,merge:Kh,selection:ig,transition:vg,call:Ce.call,nodes:Ce.nodes,node:Ce.node,size:Ce.size,empty:Ce.empty,each:Ce.each,on:Jh,attr:Th,attrTween:zh,style:lg,styleTween:hg,text:mg,textTween:wg,remove:tg,tween:Mh,delay:Vh,duration:Yh,ease:Wh,easeVarying:qh,end:bg,[Symbol.iterator]:Ce[Symbol.iterator]};function Eg(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Ng={time:null,delay:0,duration:250,ease:Eg};function Sg(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Mg(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=cs(),(n=Ng).time=mr(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,u=0;u<a;++u)(c=s[u])&&pn(c,e,t,u,s,n||Sg(c,t));return new Ae(r,this._parents,e,t)}Ct.prototype.interrupt=Eh;Ct.prototype.transition=Mg;const jt=e=>()=>e;function kg(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var mn=new Ie(1,0,0);us.prototype=Ie.prototype;function us(e){for(;!e.__zoom;)if(!(e=e.parentNode))return mn;return e.__zoom}function Dn(e){e.stopImmediatePropagation()}function dt(e){e.preventDefault(),e.stopImmediatePropagation()}function Cg(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Ig(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function po(){return this.__zoom||mn}function Ag(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $g(){return navigator.maxTouchPoints||"ontouchstart"in this}function Pg(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function ls(){var e=Cg,t=Ig,n=Pg,r=Ag,o=$g,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=Xt,u=fn("start","zoom","end"),d,l,f,h=500,g=150,x=0,y=10;function p(v){v.property("__zoom",po).on("wheel.zoom",$,{passive:!1}).on("mousedown.zoom",P).on("dblclick.zoom",V).filter(o).on("touchstart.zoom",S).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(v,I,E,A){var L=v.selection?v.selection():v;L.property("__zoom",po),v!==L?N(v,I,E,A):L.interrupt().each(function(){_(this,arguments).event(A).start().zoom(null,typeof I=="function"?I.apply(this,arguments):I).end()})},p.scaleBy=function(v,I,E,A){p.scaleTo(v,function(){var L=this.__zoom.k,C=typeof I=="function"?I.apply(this,arguments):I;return L*C},E,A)},p.scaleTo=function(v,I,E,A){p.transform(v,function(){var L=t.apply(this,arguments),C=this.__zoom,z=E==null?w(L):typeof E=="function"?E.apply(this,arguments):E,j=C.invert(z),R=typeof I=="function"?I.apply(this,arguments):I;return n(m(b(C,R),z,j),L,s)},E,A)},p.translateBy=function(v,I,E,A){p.transform(v,function(){return n(this.__zoom.translate(typeof I=="function"?I.apply(this,arguments):I,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,A)},p.translateTo=function(v,I,E,A,L){p.transform(v,function(){var C=t.apply(this,arguments),z=this.__zoom,j=A==null?w(C):typeof A=="function"?A.apply(this,arguments):A;return n(mn.translate(j[0],j[1]).scale(z.k).translate(typeof I=="function"?-I.apply(this,arguments):-I,typeof E=="function"?-E.apply(this,arguments):-E),C,s)},A,L)};function b(v,I){return I=Math.max(i[0],Math.min(i[1],I)),I===v.k?v:new Ie(I,v.x,v.y)}function m(v,I,E){var A=I[0]-E[0]*v.k,L=I[1]-E[1]*v.k;return A===v.x&&L===v.y?v:new Ie(v.k,A,L)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,I,E,A){v.on("start.zoom",function(){_(this,arguments).event(A).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(A).end()}).tween("zoom",function(){var L=this,C=arguments,z=_(L,C).event(A),j=t.apply(L,C),R=E==null?w(j):typeof E=="function"?E.apply(L,C):E,F=Math.max(j[1][0]-j[0][0],j[1][1]-j[0][1]),Y=L.__zoom,U=typeof I=="function"?I.apply(L,C):I,Q=c(Y.invert(R).concat(F/Y.k),U.invert(R).concat(F/U.k));return function(q){if(q===1)q=U;else{var O=Q(q),B=F/O[2];q=new Ie(B,R[0]-O[0]*B,R[1]-O[1]*B)}z.zoom(null,q)}})}function _(v,I,E){return!E&&v.__zooming||new k(v,I)}function k(v,I){this.that=v,this.args=I,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,I),this.taps=0}k.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,I){return this.mouse&&v!=="mouse"&&(this.mouse[1]=I.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=I.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=I.invert(this.touch1[0])),this.that.__zoom=I,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var I=ce(this.that).datum();u.call(v,this.that,new kg(v,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:u}),I)}};function $(v,...I){if(!e.apply(this,arguments))return;var E=_(this,I).event(v),A=this.__zoom,L=Math.max(i[0],Math.min(i[1],A.k*Math.pow(2,r.apply(this,arguments)))),C=he(v);if(E.wheel)(E.mouse[0][0]!==C[0]||E.mouse[0][1]!==C[1])&&(E.mouse[1]=A.invert(E.mouse[0]=C)),clearTimeout(E.wheel);else{if(A.k===L)return;E.mouse=[C,A.invert(C)],qt(this),E.start()}dt(v),E.wheel=setTimeout(z,g),E.zoom("mouse",n(m(b(A,L),E.mouse[0],E.mouse[1]),E.extent,s));function z(){E.wheel=null,E.end()}}function P(v,...I){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,A=_(this,I,!0).event(v),L=ce(v.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",F,!0),C=he(v,E),z=v.clientX,j=v.clientY;Gi(v.view),Dn(v),A.mouse=[C,this.__zoom.invert(C)],qt(this),A.start();function R(Y){if(dt(Y),!A.moved){var U=Y.clientX-z,Q=Y.clientY-j;A.moved=U*U+Q*Q>x}A.event(Y).zoom("mouse",n(m(A.that.__zoom,A.mouse[0]=he(Y,E),A.mouse[1]),A.extent,s))}function F(Y){L.on("mousemove.zoom mouseup.zoom",null),qi(Y.view,A.moved),dt(Y),A.event(Y).end()}}function V(v,...I){if(e.apply(this,arguments)){var E=this.__zoom,A=he(v.changedTouches?v.changedTouches[0]:v,this),L=E.invert(A),C=E.k*(v.shiftKey?.5:2),z=n(m(b(E,C),A,L),t.apply(this,I),s);dt(v),a>0?ce(this).transition().duration(a).call(N,z,A,v):ce(this).call(p.transform,z,A,v)}}function S(v,...I){if(e.apply(this,arguments)){var E=v.touches,A=E.length,L=_(this,I,v.changedTouches.length===A).event(v),C,z,j,R;for(Dn(v),z=0;z<A;++z)j=E[z],R=he(j,this),R=[R,this.__zoom.invert(R),j.identifier],L.touch0?!L.touch1&&L.touch0[2]!==R[2]&&(L.touch1=R,L.taps=0):(L.touch0=R,C=!0,L.taps=1+!!d);d&&(d=clearTimeout(d)),C&&(L.taps<2&&(l=R[0],d=setTimeout(function(){d=null},h)),qt(this),L.start())}}function T(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,L=A.length,C,z,j,R;for(dt(v),C=0;C<L;++C)z=A[C],j=he(z,this),E.touch0&&E.touch0[2]===z.identifier?E.touch0[0]=j:E.touch1&&E.touch1[2]===z.identifier&&(E.touch1[0]=j);if(z=E.that.__zoom,E.touch1){var F=E.touch0[0],Y=E.touch0[1],U=E.touch1[0],Q=E.touch1[1],q=(q=U[0]-F[0])*q+(q=U[1]-F[1])*q,O=(O=Q[0]-Y[0])*O+(O=Q[1]-Y[1])*O;z=b(z,Math.sqrt(q/O)),j=[(F[0]+U[0])/2,(F[1]+U[1])/2],R=[(Y[0]+Q[0])/2,(Y[1]+Q[1])/2]}else if(E.touch0)j=E.touch0[0],R=E.touch0[1];else return;E.zoom("touch",n(m(z,j,R),E.extent,s))}}function H(v,...I){if(this.__zooming){var E=_(this,I).event(v),A=v.changedTouches,L=A.length,C,z;for(Dn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),C=0;C<L;++C)z=A[C],E.touch0&&E.touch0[2]===z.identifier?delete E.touch0:E.touch1&&E.touch1[2]===z.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(z=he(z,this),Math.hypot(l[0]-z[0],l[1]-z[1])<y)){var j=ce(this).on("dblclick.zoom");j&&j.apply(this,arguments)}}}return p.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:jt(+v),p):r},p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:jt(!!v),p):e},p.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:jt(!!v),p):o},p.extent=function(v){return arguments.length?(t=typeof v=="function"?v:jt([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),p):t},p.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],p):[i[0],i[1]]},p.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(v){return arguments.length?(n=v,p):n},p.duration=function(v){return arguments.length?(a=+v,p):a},p.interpolate=function(v){return arguments.length?(c=v,p):c},p.on=function(){var v=u.on.apply(u,arguments);return v===u?p:v},p.clickDistance=function(v){return arguments.length?(x=(v=+v)*v,p):Math.sqrt(x)},p.tapDistance=function(v){return arguments.length?(y=+v,p):y},p}const ye={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},_t=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ds=["Enter"," ","Escape"],fs={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var rt;(function(e){e.Strict="strict",e.Loose="loose"})(rt||(rt={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var Et;(function(e){e.Partial="partial",e.Full="full"})(Et||(Et={}));const hs={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Le;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Le||(Le={}));var sn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(sn||(sn={}));var W;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(W||(W={}));const mo={[W.Left]:W.Right,[W.Right]:W.Left,[W.Top]:W.Bottom,[W.Bottom]:W.Top};function gs(e){return e===null?null:e?"valid":"invalid"}const ps=e=>"id"in e&&"source"in e&&"target"in e,Tg=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),wr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),At=(e,t=[0,0])=>{const{width:n,height:r}=$e(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Lg=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):wr(o)?o:t.nodeLookup.get(o.id));const a=s?an(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return yn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return xn(n)},$t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=yn(n,an(o)),r=!0)}),r?xn(n):{x:0,y:0,width:0,height:0}},vr=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/o,c=(t.y-r)/o,u=t.width/o,d=t.height/o,l=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:x=!1}=f;if(s&&!g||x)continue;const y=h.width??f.width??f.initialWidth??0,p=h.height??f.height??f.initialHeight??0,{x:b,y:m}=f.internals.positionAbsolute,w=ws(a,c,u,d,b,m,y,p),N=y*p,_=i&&w>0;(!f.internals.handleBounds||_||w>=N||f.dragging)&&l.push(f)}return l},Dg=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function Og(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Rg({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return!0;const a=Og(e,s),c=$t(a),u=_r(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(u,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),!0}function ms({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:u}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let l=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ye.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(l=[[c,u],[c+h,u+g]])}else a&&We(s.extent)&&(l=[[s.extent[0][0]+c,s.extent[0][1]+u],[s.extent[1][0]+c,s.extent[1][1]+u]]);const f=We(l)?Xe(t,l,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ye.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-u+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function zg({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(x=>x.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=Dg(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const l=await o({nodes:s,edges:d});return typeof l=="boolean"?l?{edges:d,nodes:s}:{edges:[],nodes:[]}:l}const ot=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:ot(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:ot(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ys(e,t,n){const{width:r,height:o}=$e(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+r,s+o]],t)}const yo=(e,t,n)=>e<t?ot(Math.abs(e-t),1,t)/t:e>n?-ot(Math.abs(e-n),1,t)/t:0,br=(e,t,n=15,r=40)=>{const o=yo(e.x,r,t.width-r)*n,i=yo(e.y,r,t.height-r)*n;return[o,i]},yn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),er=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),xn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Nt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=wr(e)?e.internals.positionAbsolute:At(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},an=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=wr(e)?e.internals.positionAbsolute:At(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},xs=(e,t)=>xn(yn(er(e),er(t))),ws=(e,t,n,r,o,i,s,a)=>{const c=Math.max(0,Math.min(e+n,o+s)-Math.max(e,o)),u=Math.max(0,Math.min(t+r,i+a)-Math.max(t,i));return Math.ceil(c*u)},cn=(e,t)=>ws(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),xo=e=>pe(e.width)&&pe(e.height)&&pe(e.x)&&pe(e.y),pe=e=>!isNaN(e)&&isFinite(e),vs=(e,t)=>(n,r)=>{},Pt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Tt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?Pt(a,s):a},it=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Ue(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function jg(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Ue(e,n),o=Ue(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Ue(e.top??e.y??0,n),o=Ue(e.bottom??e.y??0,n),i=Ue(e.left??e.x??0,t),s=Ue(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hg(e,t,n,r,o,i){const{x:s,y:a}=it(e,[t,n,r]),{x:c,y:u}=it({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,l=i-u;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(l)}}const _r=(e,t,n,r,o,i)=>{const s=jg(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,u=Math.min(a,c),d=ot(u,r,o),l=e.x+e.width/2,f=e.y+e.height/2,h=t/2-l*d,g=n/2-f*d,x=Hg(e,h,g,d,t,n),y={left:Math.min(x.left-s.left,0),top:Math.min(x.top-s.top,0),right:Math.min(x.right-s.right,0),bottom:Math.min(x.bottom-s.bottom,0)};return{x:h-y.left+y.right,y:g-y.top+y.bottom,zoom:d}},St=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function We(e){return e!=null&&e!=="parent"}function $e(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function bs(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function _s(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function wo(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Vg(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function Bg(e){return{...fs,...e||{}}}function mt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=me(e),a=Tt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:u}=n?Pt(a,t):a;return{xSnapped:c,ySnapped:u,...a}}const Er=e=>({width:e.offsetWidth,height:e.offsetHeight}),Es=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},Fg=["INPUT","SELECT","TEXTAREA"];function Ns(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:Fg.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ss=e=>"clientX"in e,me=(e,t)=>{var i,s;const n=Ss(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},vo=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Er(s)}})};function Ms({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,u=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),l=Math.abs(u-t);return[c,u,d,l]}function Ht(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function bo({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case W.Left:return[t-Ht(t-r,i),n];case W.Right:return[t+Ht(r-t,i),n];case W.Top:return[t,n-Ht(n-o,i)];case W.Bottom:return[t,n+Ht(o-n,i)]}}function ks({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,curvature:s=.25}){const[a,c]=bo({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[u,d]=bo({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[l,f,h,g]=Ms({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:u,targetControlY:d});return[`M${e},${t} C${a},${c} ${u},${d} ${r},${o}`,l,f,h,g]}function Cs({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function Yg({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function Xg({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=yn(an(e),an(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return cn(s,xn(i))>0}const Wg=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,Gg=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),qg=(e,t,n={})=>{var i;if(!e.source||!e.target)return(i=n.onError)==null||i.call(n,"006",ye.error006()),t;const r=n.getEdgeId||Wg;let o;return ps(e)?o={...e}:o={...e,id:r(e)},Gg(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function Is({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=Cs({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const _o={[W.Left]:{x:-1,y:0},[W.Right]:{x:1,y:0},[W.Top]:{x:0,y:-1},[W.Bottom]:{x:0,y:1}},Ug=({source:e,sourcePosition:t=W.Bottom,target:n})=>t===W.Left||t===W.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Eo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Kg({source:e,sourcePosition:t=W.Bottom,target:n,targetPosition:r=W.Top,center:o,offset:i,stepPosition:s}){const a=_o[t],c=_o[r],u={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},l=Ug({source:u,sourcePosition:t,target:d}),f=l.x!==0?"x":"y",h=l[f];let g=[],x,y;const p={x:0,y:0},b={x:0,y:0},[,,m,w]=Cs({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(x=o.x??u.x+(d.x-u.x)*s,y=o.y??(u.y+d.y)/2):(x=o.x??(u.x+d.x)/2,y=o.y??u.y+(d.y-u.y)*s);const $=[{x,y:u.y},{x,y:d.y}],P=[{x:u.x,y},{x:d.x,y}];a[f]===h?g=f==="x"?$:P:g=f==="x"?P:$}else{const $=[{x:u.x,y:d.y}],P=[{x:d.x,y:u.y}];if(f==="x"?g=a.x===h?P:$:g=a.y===h?$:P,t===r){const v=Math.abs(e[f]-n[f]);if(v<=i){const I=Math.min(i-1,i-v);a[f]===h?p[f]=(u[f]>e[f]?-1:1)*I:b[f]=(d[f]>n[f]?-1:1)*I}}if(t!==r){const v=f==="x"?"y":"x",I=a[f]===c[v],E=u[v]>d[v],A=u[v]<d[v];(a[f]===1&&(!I&&E||I&&A)||a[f]!==1&&(!I&&A||I&&E))&&(g=f==="x"?$:P)}const V={x:u.x+p.x,y:u.y+p.y},S={x:d.x+b.x,y:d.y+b.y},T=Math.max(Math.abs(V.x-g[0].x),Math.abs(S.x-g[0].x)),H=Math.max(Math.abs(V.y-g[0].y),Math.abs(S.y-g[0].y));T>=H?(x=(V.x+S.x)/2,y=g[0].y):(x=g[0].x,y=(V.y+S.y)/2)}const N={x:u.x+p.x,y:u.y+p.y},_={x:d.x+b.x,y:d.y+b.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,..._.x!==g[g.length-1].x||_.y!==g[g.length-1].y?[_]:[],n],x,y,m,w]}function Zg(e,t,n,r){const o=Math.min(Eo(e,t)/2,Eo(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const u=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*u},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function tr({sourceX:e,sourceY:t,sourcePosition:n=W.Bottom,targetX:r,targetY:o,targetPosition:i=W.Top,borderRadius:s=5,centerX:a,centerY:c,offset:u=20,stepPosition:d=.5}){const[l,f,h,g,x]=Kg({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:u,stepPosition:d});let y=`M${l[0].x} ${l[0].y}`;for(let p=1;p<l.length-1;p++)y+=Zg(l[p-1],l[p],l[p+1],s);return y+=`L${l[l.length-1].x} ${l[l.length-1].y}`,[y,f,h,g,x]}function No(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Qg(e){var l;const{sourceNode:t,targetNode:n}=e;if(!No(t)||!No(n))return null;const r=t.internals.handleBounds||So(t.handles),o=n.internals.handleBounds||So(n.handles),i=Mo((r==null?void 0:r.source)??[],e.sourceHandle),s=Mo(e.connectionMode===rt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(l=e.onError)==null||l.call(e,"008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||W.Bottom,c=(s==null?void 0:s.position)||W.Top,u=Ge(t,i,a),d=Ge(n,s,c);return{sourceX:u.x,sourceY:u.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function So(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function Ge(e,t,n=W.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??$e(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case W.Top:return{x:o+s/2,y:i};case W.Right:return{x:o+s,y:i+a/2};case W.Bottom:return{x:o+s/2,y:i+a};case W.Left:return{x:o,y:i+a/2}}}function Mo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function nr(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function Jg(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const u=nr(c,t);i.has(u)||(s.push({id:u,color:c.color||n,...c}),i.add(u))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const As=1e3,ep=10,Nr={nodeOrigin:[0,0],nodeExtent:_t,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},tp={...Nr,checkEquality:!0};function Sr(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function np(e,t,n){const r=Sr(Nr,n);for(const o of e.values())if(o.parentId)kr(o,e,t,r);else{const i=At(o,r.nodeOrigin),s=We(o.extent)?o.extent:r.nodeExtent,a=Xe(i,s,$e(o));o.internals.positionAbsolute=a}}function rp(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function Mr(e){return e==="manual"}function rr(e,t,n,r={}){var d,l;const o=Sr(tp,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Mr(o.zIndexMode)?As:0;let c=e.length>0,u=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(o.checkEquality&&f===(h==null?void 0:h.internals.userNode))t.set(f.id,h);else{const g=At(f,o.nodeOrigin),x=We(f.extent)?f.extent:o.nodeExtent,y=Xe(g,x,$e(f));h={...o.defaults,...f,measured:{width:(d=f.measured)==null?void 0:d.width,height:(l=f.measured)==null?void 0:l.height},internals:{positionAbsolute:y,handleBounds:rp(f,h),z:$s(f,a,o.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&kr(h,t,n,r,i),u||(u=f.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:u}}function op(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function kr(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Sr(Nr,r),u=e.parentId,d=t.get(u);if(!d){console.warn(`Parent node ${u} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}op(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*ep),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const l=i&&!Mr(c)?As:0,{x:f,y:h,z:g}=ip(e,d,s,a,l,c),{positionAbsolute:x}=e.internals,y=f!==x.x||h!==x.y;(y||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:y?{x:f,y:h}:x,z:g}})}function $s(e,t,n){const r=pe(e.zIndex)?e.zIndex:0;return Mr(n)?r:r+(e.selected?t:0)}function ip(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=$e(e),u=At(e,n),d=We(e.extent)?Xe(u,e.extent,c):u;let l=Xe({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(l=ys(l,c,t));const f=$s(e,o,i),h=t.internals.z??0;return{x:l.x,y:l.y,z:h>=f?h+1:f}}function Cr(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const u=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Nt(c),d=xs(u,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},u)=>{var m;const d=c.internals.positionAbsolute,l=$e(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,x=Math.max(l.width,Math.round(a.width)),y=Math.max(l.height,Math.round(a.height)),p=(x-l.width)*f[0],b=(y-l.height)*f[1];(h>0||g>0||p||b)&&(o.push({id:u,type:"position",position:{x:c.position.x-h+p,y:c.position.y-g+b}}),(m=n.get(u))==null||m.forEach(w=>{e.some(N=>N.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(l.width<a.width||l.height<a.height||h||g)&&o.push({id:u,type:"dimensions",setAttributes:!0,dimensions:{width:x+(h?f[0]*h-p:0),height:y+(g?f[1]*g-b:0)}})}),o}function sp(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const u=[],d=window.getComputedStyle(a),{m22:l}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const x=Er(h.nodeElement),y=g.measured.width!==x.width||g.measured.height!==x.height;if(!!(x.width&&x.height&&(y||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),m=We(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ys(w,x,t.get(g.parentId)):m&&(w=Xe(w,m,x));const N={...g,measured:x,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:vo("source",h.nodeElement,b,l,g.id),target:vo("target",h.nodeElement,b,l,g.id)}}};t.set(g.id,N),g.parentId&&kr(N,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,y&&(u.push({id:g.id,type:"dimensions",dimensions:x}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Nt(N,o)}))}}if(f.length>0){const h=Cr(f,t,n,o);u.push(...h)}return{changes:u,updatedInternals:c}}async function ap({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function ko(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const u=r.get(s)||new Map;r.set(s,u.set(n,t))}}function Ps(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},u=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;ko("source",c,d,e,o,s),ko("target",c,u,e,i,a),t.set(r.id,r)}}function Ts(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:Ts(n,t):!1}function Co(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function cp(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!Ts(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function On({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[u,d]of t){const l=(s=n.get(u))==null?void 0:s.internals.userNode;l&&o.push({...l,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function up({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=Pt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function lp({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,u={x:0,y:0},d=null,l=!1,f=null,h=!1,g=!1,x=null;function y({noDragClassName:b,handleSelector:m,domNode:w,isSelectable:N,nodeId:_,nodeClickDistance:k=0}){f=ce(w);function $({x:T,y:H}){const{nodeLookup:v,nodeExtent:I,snapGrid:E,snapToGrid:A,nodeOrigin:L,onNodeDrag:C,onSelectionDrag:z,onError:j,updateNodePositions:R}=t();i={x:T,y:H};let F=!1;const Y=a.size>1,U=Y&&I?er($t(a)):null,Q=Y&&A?up({dragItems:a,snapGrid:E,x:T,y:H}):null;for(const[q,O]of a){if(!v.has(q))continue;let B={x:T-O.distance.x,y:H-O.distance.y};A&&(B=Q?{x:Math.round(B.x+Q.x),y:Math.round(B.y+Q.y)}:Pt(B,E));let Z=null;if(Y&&I&&!O.extent&&U){const{positionAbsolute:X}=O.internals,J=X.x-U.x+I[0][0],te=X.x+O.measured.width-U.x2+I[1][0],ne=X.y-U.y+I[0][1],ie=X.y+O.measured.height-U.y2+I[1][1];Z=[[J,ne],[te,ie]]}const{position:K,positionAbsolute:G}=ms({nodeId:q,nextPosition:B,nodeLookup:v,nodeExtent:Z||I,nodeOrigin:L,onError:j});F=F||O.position.x!==K.x||O.position.y!==K.y,O.position=K,O.internals.positionAbsolute=G}if(g=g||F,!!F&&(R(a,!0),x&&(r||C||!_&&z))){const[q,O]=On({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(x,a,q,O),C==null||C(x,q,O),_||z==null||z(x,O)}}async function P(){if(!d)return;const{transform:T,panBy:H,autoPanSpeed:v,autoPanOnNodeDrag:I}=t();if(!I){c=!1,cancelAnimationFrame(s);return}const[E,A]=br(u,d,v);(E!==0||A!==0)&&(i.x=(i.x??0)-E/T[2],i.y=(i.y??0)-A/T[2],await H({x:E,y:A})&&$(i)),s=requestAnimationFrame(P)}function V(T){var Y;const{nodeLookup:H,multiSelectionActive:v,nodesDraggable:I,transform:E,snapGrid:A,snapToGrid:L,selectNodesOnDrag:C,onNodeDragStart:z,onSelectionDragStart:j,unselectNodesAndEdges:R}=t();l=!0,(!C||!N)&&!v&&_&&((Y=H.get(_))!=null&&Y.selected||R()),N&&C&&_&&(e==null||e(_));const F=mt(T.sourceEvent,{transform:E,snapGrid:A,snapToGrid:L,containerBounds:d});if(i=F,a=cp(H,I,F,_),a.size>0&&(n||z||!_&&j)){const[U,Q]=On({nodeId:_,dragItems:a,nodeLookup:H});n==null||n(T.sourceEvent,a,U,Q),z==null||z(T.sourceEvent,U,Q),_||j==null||j(T.sourceEvent,Q)}}const S=Ui().clickDistance(k).on("start",T=>{const{domNode:H,nodeDragThreshold:v,transform:I,snapGrid:E,snapToGrid:A}=t();d=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,x=T.sourceEvent,v===0&&V(T),i=mt(T.sourceEvent,{transform:I,snapGrid:E,snapToGrid:A,containerBounds:d}),u=me(T.sourceEvent,d)}).on("drag",T=>{const{autoPanOnNodeDrag:H,transform:v,snapGrid:I,snapToGrid:E,nodeDragThreshold:A,nodeLookup:L}=t(),C=mt(T.sourceEvent,{transform:v,snapGrid:I,snapToGrid:E,containerBounds:d});if(x=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||_&&!L.has(_))&&(h=!0),!h){if(!c&&H&&l&&(c=!0,P()),!l){const z=me(T.sourceEvent,d),j=z.x-u.x,R=z.y-u.y;Math.sqrt(j*j+R*R)>A&&V(T)}(i.x!==C.xSnapped||i.y!==C.ySnapped)&&a&&l&&(u=me(T.sourceEvent,d),$(C))}}).on("end",T=>{if(!l||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,l=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:H,updateNodePositions:v,onNodeDragStop:I,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||I||!_&&E){const[A,L]=On({nodeId:_,dragItems:a,nodeLookup:H,dragging:!1});o==null||o(T.sourceEvent,a,A,L),I==null||I(T.sourceEvent,A,L),_||E==null||E(T.sourceEvent,L)}}}).filter(T=>{const H=T.target;return!T.button&&(!b||!Co(H,`.${b}`,w))&&(!m||Co(H,m,w))});f.call(S)}function p(){f==null||f.on(".drag",null)}return{update:y,destroy:p}}function dp(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())cn(o,Nt(i))>0&&r.push(i);return r}const fp=250;function hp(e,t,n,r){var a,c;let o=[],i=1/0;const s=dp(e,n,t+fp);for(const u of s){const d=[...((a=u.internals.handleBounds)==null?void 0:a.source)??[],...((c=u.internals.handleBounds)==null?void 0:c.target)??[]];for(const l of d){if(r.nodeId===l.nodeId&&r.type===l.type&&r.id===l.id)continue;const{x:f,y:h}=Ge(u,l,l.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...l,x:f,y:h}],i=g):g===i&&o.push({...l,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const u=r.type==="source"?"target":"source";return o.find(d=>d.type===u)??o[0]}return o[0]}function Ls(e,t,n,r,o,i=!1){var u,d,l;const s=r.get(e);if(!s)return null;const a=o==="strict"?(u=s.internals.handleBounds)==null?void 0:u[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((l=s.internals.handleBounds)==null?void 0:l.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...Ge(s,c,c.position,!0)}:c}function Ds(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function gp(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Os=()=>!0;function pp(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:u,autoPanOnConnect:d,flowId:l,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:x,onConnectEnd:y,isValidConnection:p=Os,onReconnectEnd:b,updateConnection:m,getTransform:w,getFromHandle:N,autoPanSpeed:_,dragThreshold:k=1,handleDomNode:$}){const P=Es(e.target);let V=0,S;const{x:T,y:H}=me(e),v=Ds(i,$),I=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!I||!v)return;const A=Ls(o,v,r,c,t);if(!A)return;let L=me(e,I),C=!1,z=null,j=!1,R=null;function F(){if(!d||!I)return;const[K,G]=br(L,I,_);f({x:K,y:G}),V=requestAnimationFrame(F)}const Y={...A,nodeId:o,type:v,position:A.position},U=c.get(o);let q={inProgress:!0,isValid:null,from:Ge(U,Y,W.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:U,to:L,toHandle:null,toPosition:mo[Y.position],toNode:null,pointer:L};function O(){E=!0,m(q),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}k===0&&O();function B(K){if(!E){const{x:ie,y:le}=me(K),we=ie-T,ve=le-H;if(!(we*we+ve*ve>k*k))return;O()}if(!N()||!Y){Z(K);return}const G=w();L=me(K,I),S=hp(Tt(L,G,!1,[1,1]),n,c,Y),C||(F(),C=!0);const X=Rs(K,{handle:S,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:p,doc:P,lib:u,flowId:l,nodeLookup:c});R=X.handleDomNode,z=X.connection,j=gp(!!S,X.isValid);const J=c.get(o),te=J?Ge(J,Y,W.Left,!0):q.from,ne={...q,from:te,isValid:j,to:X.toHandle&&j?it({x:X.toHandle.x,y:X.toHandle.y},G):L,toHandle:X.toHandle,toPosition:j&&X.toHandle?X.toHandle.position:mo[Y.position],toNode:X.toHandle?c.get(X.toHandle.nodeId):null,pointer:L};m(ne),q=ne}function Z(K){if(!("touches"in K&&K.touches.length>0)){if(E){(S||R)&&z&&j&&(x==null||x(z));const{inProgress:G,...X}=q,J={...X,toPosition:q.toHandle?q.toPosition:null};y==null||y(K,J),i&&(b==null||b(K,J))}h(),cancelAnimationFrame(V),C=!1,j=!1,z=null,R=null,P.removeEventListener("mousemove",B),P.removeEventListener("mouseup",Z),P.removeEventListener("touchmove",B),P.removeEventListener("touchend",Z)}}P.addEventListener("mousemove",B),P.addEventListener("mouseup",Z),P.addEventListener("touchmove",B),P.addEventListener("touchend",Z)}function Rs(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:u=Os,nodeLookup:d}){const l=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=me(e),x=s.elementFromPoint(h,g),y=x!=null&&x.classList.contains(`${a}-flow__handle`)?x:f,p={handleDomNode:y,isValid:!1,connection:null,toHandle:null};if(y){const b=Ds(void 0,y),m=y.getAttribute("data-nodeid"),w=y.getAttribute("data-handleid"),N=y.classList.contains("connectable"),_=y.classList.contains("connectableend");if(!m||!b)return p;const k={source:l?m:r,sourceHandle:l?w:o,target:l?r:m,targetHandle:l?o:w};p.connection=k;const P=N&&_&&(n===rt.Strict?l&&b==="source"||!l&&b==="target":m!==r||w!==o);p.isValid=P&&u(k),p.toHandle=Ls(m,b,w,d,n,!0)}return p}const or={onPointerDown:pp,isValid:Rs};function mp({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:u,zoomStep:d=1,pannable:l=!0,zoomable:f=!0,inversePan:h=!1}){const g=m=>{if(m.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=m.sourceEvent.ctrlKey&&St()?10:1,_=-m.sourceEvent.deltaY*(m.sourceEvent.deltaMode===1?.05:m.sourceEvent.deltaMode?1:.002)*d,k=w[2]*Math.pow(2,_*N);t.scaleTo(k)};let x=[0,0];const y=m=>{(m.sourceEvent.type==="mousedown"||m.sourceEvent.type==="touchstart")&&(x=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY])},p=m=>{const w=n();if(m.sourceEvent.type!=="mousemove"&&m.sourceEvent.type!=="touchmove"||!t)return;const N=[m.sourceEvent.clientX??m.sourceEvent.touches[0].clientX,m.sourceEvent.clientY??m.sourceEvent.touches[0].clientY],_=[N[0]-x[0],N[1]-x[1]];x=N;const k=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),$={x:w[0]-_[0]*k,y:w[1]-_[1]*k},P=[[0,0],[c,u]];t.setViewportConstrained({x:$.x,y:$.y,zoom:w[2]},P,a)},b=ls().on("start",y).on("zoom",l?p:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:he}}const wn=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>mn.translate(e,t).scale(n),Ke=(e,t)=>e.target.closest(`.${t}`),zs=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),yp=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,zn=(e,t=0,n=yp,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},js=e=>{const t=e.ctrlKey&&St()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function xp({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:u}){return d=>{if(Ke(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const l=n.property("__zoom").k||1;if(d.ctrlKey&&s){const y=he(d),p=js(d),b=l*Math.pow(2,p);r.scaleTo(n,b,y,d);return}const f=d.deltaMode===1?20:1;let h=o===Be.Vertical?0:d.deltaX*f,g=o===Be.Horizontal?0:d.deltaY*f;!St()&&d.shiftKey&&o!==Be.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/l)*i,-(g/l)*i,{internal:!0});const x=wn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,x),e.panScrollTimeout=setTimeout(()=>{u==null||u(d,x),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,x))}}function wp({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Ke(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function vp({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=wn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function bp({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&zs(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,wn(i.transform)))}}function _p({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&zs(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=wn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Ep({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:u,connectionInProgress:d}){return l=>{var y;const f=e||t,h=n&&l.ctrlKey,g=l.type==="wheel";if(l.button===1&&l.type==="mousedown"&&(Ke(l,`${u}-flow__node`)||Ke(l,`${u}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Ke(l,a)&&g||Ke(l,c)&&(!g||o&&g&&!e)||!n&&l.ctrlKey&&g)return!1;if(!n&&l.type==="touchstart"&&((y=l.touches)==null?void 0:y.length)>1)return l.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(l.type==="mousedown"||l.type==="touchstart")||Array.isArray(r)&&!r.includes(l.button)&&l.type==="mousedown")return!1;const x=Array.isArray(r)&&r.includes(l.button)||!l.button||l.button<=1;return(!l.ctrlKey||g)&&x}}function Np({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),l=ls().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(l);b({x:o.x,y:o.y,zoom:ot(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");l.wheelDelta(js);async function x(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).transform(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}function y({noWheelClassName:S,noPanClassName:T,onPaneContextMenu:H,userSelectionActive:v,panOnScroll:I,panOnDrag:E,panOnScrollMode:A,panOnScrollSpeed:L,preventScrolling:C,zoomOnPinch:z,zoomOnScroll:j,zoomOnDoubleClick:R,zoomActivationKeyPressed:F,lib:Y,onTransformChange:U,connectionInProgress:Q,paneClickDistance:q,selectionOnDrag:O}){v&&!u.isZoomingOrPanning&&p();const B=I&&!F&&!v;l.clickDistance(O?1/0:!pe(q)||q<0?0:q);const Z=B?xp({zoomPanValues:u,noWheelClassName:S,d3Selection:f,d3Zoom:l,panOnScrollMode:A,panOnScrollSpeed:L,zoomOnPinch:z,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):wp({noWheelClassName:S,preventScrolling:C,d3ZoomHandler:h});f.on("wheel.zoom",Z,{passive:!1});const K=vp({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});l.on("start",K);const G=bp({zoomPanValues:u,panOnDrag:E,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:U});l.on("zoom",G);const X=_p({zoomPanValues:u,panOnDrag:E,panOnScroll:I,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:c});l.on("end",X);const J=Ep({zoomActivationKeyPressed:F,panOnDrag:E,zoomOnScroll:j,panOnScroll:I,zoomOnDoubleClick:R,zoomOnPinch:z,userSelectionActive:v,noPanClassName:T,noWheelClassName:S,lib:Y,connectionInProgress:Q});l.filter(J),R?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function p(){l.on("zoom",null)}async function b(S,T,H){const v=Rn(S),I=l==null?void 0:l.constrain()(v,T,H);return I&&await x(I),I}async function m(S,T){const H=Rn(S);return await x(H,T),H}function w(S){if(f){const T=Rn(S),H=f.property("__zoom");(H.k!==S.zoom||H.x!==S.x||H.y!==S.y)&&(l==null||l.transform(f,T,null,{sync:!0}))}}function N(){const S=f?us(f.node()):{x:0,y:0,k:1};return{x:S.x,y:S.y,zoom:S.k}}async function _(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).scaleTo(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}async function k(S,T){return f?new Promise(H=>{l==null||l.interpolate((T==null?void 0:T.interpolate)==="linear"?pt:Xt).scaleBy(zn(f,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>H(!0)),S)}):!1}function $(S){l==null||l.scaleExtent(S)}function P(S){l==null||l.translateExtent(S)}function V(S){const T=!pe(S)||S<0?0:S;l==null||l.clickDistance(T)}return{update:y,destroy:p,setViewport:m,setViewportConstrained:b,getViewport:N,scaleTo:_,scaleBy:k,setScaleExtent:$,setTranslateExtent:P,syncViewport:w,setClickDistance:V}}var st;(function(e){e.Line="line",e.Handle="handle"})(st||(st={}));function Sp({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Io(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Pe(e,t){return Math.max(0,t-e)}function Te(e,t){return Math.max(0,e-t)}function Vt(e,t,n){return Math.max(0,t-e,e-n)}function Ao(e,t){return e?!t:t}function Mp(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:u}=t;const{isHorizontal:d,isVertical:l}=t,f=d&&l,{xSnapped:h,ySnapped:g}=n,{minWidth:x,maxWidth:y,minHeight:p,maxHeight:b}=r,{x:m,y:w,width:N,height:_,aspectRatio:k}=e;let $=Math.floor(d?h-e.pointerX:0),P=Math.floor(l?g-e.pointerY:0);const V=N+(c?-$:$),S=_+(u?-P:P),T=-i[0]*N,H=-i[1]*_;let v=Vt(V,x,y),I=Vt(S,p,b);if(s){let L=0,C=0;c&&$<0?L=Pe(m+$+T,s[0][0]):!c&&$>0&&(L=Te(m+V+T,s[1][0])),u&&P<0?C=Pe(w+P+H,s[0][1]):!u&&P>0&&(C=Te(w+S+H,s[1][1])),v=Math.max(v,L),I=Math.max(I,C)}if(a){let L=0,C=0;c&&$>0?L=Te(m+$,a[0][0]):!c&&$<0&&(L=Pe(m+V,a[1][0])),u&&P>0?C=Te(w+P,a[0][1]):!u&&P<0&&(C=Pe(w+S,a[1][1])),v=Math.max(v,L),I=Math.max(I,C)}if(o){if(d){const L=Vt(V/k,p,b)*k;if(v=Math.max(v,L),s){let C=0;!c&&!u||c&&!u&&f?C=Te(w+H+V/k,s[1][1])*k:C=Pe(w+H+(c?$:-$)/k,s[0][1])*k,v=Math.max(v,C)}if(a){let C=0;!c&&!u||c&&!u&&f?C=Pe(w+V/k,a[1][1])*k:C=Te(w+(c?$:-$)/k,a[0][1])*k,v=Math.max(v,C)}}if(l){const L=Vt(S*k,x,y)/k;if(I=Math.max(I,L),s){let C=0;!c&&!u||u&&!c&&f?C=Te(m+S*k+T,s[1][0])/k:C=Pe(m+(u?P:-P)*k+T,s[0][0])/k,I=Math.max(I,C)}if(a){let C=0;!c&&!u||u&&!c&&f?C=Pe(m+S*k,a[1][0])/k:C=Te(m+(u?P:-P)*k,a[0][0])/k,I=Math.max(I,C)}}}P=P+(P<0?I:-I),$=$+($<0?v:-v),o&&(f?V>S*k?P=(Ao(c,u)?-$:$)/k:$=(Ao(c,u)?-P:P)*k:d?(P=$/k,u=c):($=P*k,c=u));const E=c?m+$:m,A=u?w+P:w;return{width:N+(c?-$:$),height:_+(u?-P:P),x:i[0]*$*(c?-1:1)+E,y:i[1]*P*(u?-1:1)+A}}const Hs={width:0,height:0,x:0,y:0},kp={...Hs,pointerX:0,pointerY:0,aspectRatio:1};function Cp(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Ip({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:Io("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:u,boundaries:d,keepAspectRatio:l,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:x,shouldResize:y}){let p={...Hs},b={...kp};s={boundaries:d,resizeDirection:f,keepAspectRatio:l,controlDirection:Io(u)};let m,w=null,N=[],_,k,$,P=!1;const V=Ui().on("start",S=>{const{nodeLookup:T,transform:H,snapGrid:v,snapToGrid:I,nodeOrigin:E,paneDomNode:A}=n();if(m=T.get(t),!m)return;w=(A==null?void 0:A.getBoundingClientRect())??null;const{xSnapped:L,ySnapped:C}=mt(S.sourceEvent,{transform:H,snapGrid:v,snapToGrid:I,containerBounds:w});p={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},b={...p,pointerX:L,pointerY:C,aspectRatio:p.width/p.height},_=void 0,k=We(m.extent)?m.extent:void 0,m.parentId&&(m.extent==="parent"||m.expandParent)&&(_=T.get(m.parentId)),_&&m.extent==="parent"&&(k=[[0,0],[_.measured.width,_.measured.height]]),N=[],$=void 0;for(const[z,j]of T)if(j.parentId===t&&(N.push({id:z,position:{...j.position},extent:j.extent}),j.extent==="parent"||j.expandParent)){const R=Cp(j,m,j.origin??E);$?$=[[Math.min(R[0][0],$[0][0]),Math.min(R[0][1],$[0][1])],[Math.max(R[1][0],$[1][0]),Math.max(R[1][1],$[1][1])]]:$=R}h==null||h(S,{...p})}).on("drag",S=>{const{transform:T,snapGrid:H,snapToGrid:v,nodeOrigin:I}=n(),E=mt(S.sourceEvent,{transform:T,snapGrid:H,snapToGrid:v,containerBounds:w}),A=[];if(!m)return;const{x:L,y:C,width:z,height:j}=p,R={},F=m.origin??I,{width:Y,height:U,x:Q,y:q}=Mp(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,F,k,$),O=Y!==z,B=U!==j,Z=Q!==L&&O,K=q!==C&&B;if(!Z&&!K&&!O&&!B)return;if((Z||K||F[0]===1||F[1]===1)&&(R.x=Z?Q:p.x,R.y=K?q:p.y,p.x=R.x,p.y=R.y,N.length>0)){const te=Q-L,ne=q-C;for(const ie of N)ie.position={x:ie.position.x-te+F[0]*(Y-z),y:ie.position.y-ne+F[1]*(U-j)},A.push(ie)}if((O||B)&&(R.width=O&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:p.width,R.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?U:p.height,p.width=R.width,p.height=R.height),_&&m.expandParent){const te=F[0]*(R.width??0);R.x&&R.x<te&&(p.x=te,b.x=b.x-(R.x-te));const ne=F[1]*(R.height??0);R.y&&R.y<ne&&(p.y=ne,b.y=b.y-(R.y-ne))}const G=Sp({width:p.width,prevWidth:z,height:p.height,prevHeight:j,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),X={...p,direction:G};(y==null?void 0:y(S,X))!==!1&&(P=!0,g==null||g(S,X),r(R,A))}).on("end",S=>{P&&(x==null||x(S,{...p}),o==null||o({...p}),P=!1)});i.call(V)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var jn={exports:{}},Hn={},Vn={exports:{}},Bn={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|