Files
mai-bot/dashboard/dist/assets/reactflow-Bd-f2Ch7.js

3 lines
216 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{u as Dy,R as L,r as D}from"./router-zNjPR4CY.js";import{i as Ly,c as tc,a as rc,b as Fy,d as zy,e as By,f as Hy}from"./charts-C6WIfXk3.js";import{r as wt,a as Te,b as Ge,c as Ue,d as $y,e as vr,f as $t,g as Vy,h as Gy}from"./uppy-S0BLpioz.js";function pe(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,n;r<e.length;r++)(n=pe(e[r]))!==""&&(t+=(t&&" ")+n);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}const Uy={},nc=e=>{let t;const r=new Set,n=(c,f)=>{const d=typeof c=="function"?c(t):c;if(!Object.is(d,t)){const h=t;t=f??(typeof d!="object"||d===null)?d:Object.assign({},t,d),r.forEach(_=>_(t,h))}},i=()=>t,u={setState:n,getState:i,getInitialState:()=>l,subscribe:c=>(r.add(c),()=>r.delete(c)),destroy:()=>{(Uy?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},l=t=e(n,i,u);return u},Ky=e=>e?nc(e):nc,{useDebugValue:jy}=L,{useSyncExternalStoreWithSelector:Yy}=Dy,Wy=e=>e;function Vp(e,t=Wy,r){const n=Yy(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return jy(n),n}const ic=(e,t)=>{const r=Ky(e),n=(i,a=t)=>Vp(r,i,a);return Object.assign(n,r),n},Zy=(e,t)=>e?ic(e,t):ic;function he(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,i]of e)if(!Object.is(i,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const n of r)if(!Object.prototype.hasOwnProperty.call(t,n)||!Object.is(e[n],t[n]))return!1;return!0}var Xy={value:()=>{}};function gr(){for(var e=0,t=arguments.length,r={},n;e<t;++e){if(!(n=arguments[e]+"")||n in r||/[\s.]/.test(n))throw new Error("illegal type: "+n);r[n]=[]}return new rr(r)}function rr(e){this._=e}function Jy(e,t){return e.trim().split(/^|\s+/).map(function(r){var n="",i=r.indexOf(".");if(i>=0&&(n=r.slice(i+1),r=r.slice(0,i)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:n}})}rr.prototype=gr.prototype={constructor:rr,on:function(e,t){var r=this._,n=Jy(e+"",r),i,a=-1,o=n.length;if(arguments.length<2){for(;++a<o;)if((i=(e=n[a]).type)&&(i=Qy(r[i],e.name)))return i;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++a<o;)if(i=(e=n[a]).type)r[i]=ac(r[i],e.name,t);else if(t==null)for(i in r)r[i]=ac(r[i],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new rr(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var r=new Array(i),n=0,i,a;n<i;++n)r[n]=arguments[n+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(a=this._[e],n=0,i=a.length;n<i;++n)a[n].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var n=this._[e],i=0,a=n.length;i<a;++i)n[i].value.apply(t,r)}};function Qy(e,t){for(var r=0,n=e.length,i;r<n;++r)if((i=e[r]).name===t)return i.value}function ac(e,t,r){for(var n=0,i=e.length;n<i;++n)if(e[n].name===t){e[n]=Xy,e=e.slice(0,n).concat(e.slice(n+1));break}return r!=null&&e.push({name:t,value:r}),e}var iu="http://www.w3.org/1999/xhtml";const oc={svg:"http://www.w3.org/2000/svg",xhtml:iu,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yr(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),oc.hasOwnProperty(t)?{space:oc[t],local:e}:e}function em(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===iu&&t.documentElement.namespaceURI===iu?t.createElement(e):t.createElementNS(r,e)}}function tm(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Gp(e){var t=yr(e);return(t.local?tm:em)(t)}function rm(){}function yu(e){return e==null?rm:function(){return this.querySelector(e)}}function nm(e){typeof e!="function"&&(e=yu(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=new Array(o),u,l,c=0;c<o;++c)(u=a[c])&&(l=e.call(u,u.__data__,c,a))&&("__data__"in u&&(l.__data__=u.__data__),s[c]=l);return new Ee(n,this._parents)}function im(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function am(){return[]}function Up(e){return e==null?am:function(){return this.querySelectorAll(e)}}function om(e){return function(){return im(e.apply(this,arguments))}}function sm(e){typeof e=="function"?e=om(e):e=Up(e);for(var t=this._groups,r=t.length,n=[],i=[],a=0;a<r;++a)for(var o=t[a],s=o.length,u,l=0;l<s;++l)(u=o[l])&&(n.push(e.call(u,u.__data__,l,o)),i.push(u));return new Ee(n,i)}function Kp(e){return function(){return this.matches(e)}}function jp(e){return function(t){return t.matches(e)}}var um=Array.prototype.find;function cm(e){return function(){return um.call(this.children,e)}}function lm(){return this.firstElementChild}function fm(e){return this.select(e==null?lm:cm(typeof e=="function"?e:jp(e)))}var dm=Array.prototype.filter;function hm(){return Array.from(this.children)}function pm(e){return function(){return dm.call(this.children,e)}}function vm(e){return this.selectAll(e==null?hm:pm(typeof e=="function"?e:jp(e)))}function gm(e){typeof e!="function"&&(e=Kp(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=[],u,l=0;l<o;++l)(u=a[l])&&e.call(u,u.__data__,l,a)&&s.push(u);return new Ee(n,this._parents)}function Yp(e){return new Array(e.length)}function ym(){return new Ee(this._enter||this._groups.map(Yp),this._parents)}function or(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}or.prototype={constructor:or,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 mm(e){return function(){return e}}function _m(e,t,r,n,i,a){for(var o=0,s,u=t.length,l=a.length;o<l;++o)(s=t[o])?(s.__data__=a[o],n[o]=s):r[o]=new or(e,a[o]);for(;o<u;++o)(s=t[o])&&(i[o]=s)}function bm(e,t,r,n,i,a,o){var s,u,l=new Map,c=t.length,f=a.length,d=new Array(c),h;for(s=0;s<c;++s)(u=t[s])&&(d[s]=h=o.call(u,u.__data__,s,t)+"",l.has(h)?i[s]=u:l.set(h,u));for(s=0;s<f;++s)h=o.call(e,a[s],s,a)+"",(u=l.get(h))?(n[s]=u,u.__data__=a[s],l.delete(h)):r[s]=new or(e,a[s]);for(s=0;s<c;++s)(u=t[s])&&l.get(d[s])===u&&(i[s]=u)}function wm(e){return e.__data__}function Em(e,t){if(!arguments.length)return Array.from(this,wm);var r=t?bm:_m,n=this._parents,i=this._groups;typeof e!="function"&&(e=mm(e));for(var a=i.length,o=new Array(a),s=new Array(a),u=new Array(a),l=0;l<a;++l){var c=n[l],f=i[l],d=f.length,h=xm(e.call(c,c&&c.__data__,l,n)),_=h.length,g=s[l]=new Array(_),v=o[l]=new Array(_),p=u[l]=new Array(d);r(c,f,g,v,p,h,t);for(var y=0,b=0,m,E;y<_;++y)if(m=g[y]){for(y>=b&&(b=y+1);!(E=v[b])&&++b<_;);m._next=E||null}}return o=new Ee(o,n),o._enter=s,o._exit=u,o}function xm(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Sm(){return new Ee(this._exit||this._groups.map(Yp),this._parents)}function qm(e,t,r){var n=this.enter(),i=this,a=this.exit();return typeof e=="function"?(n=e(n),n&&(n=n.selection())):n=n.append(e+""),t!=null&&(i=t(i),i&&(i=i.selection())),r==null?a.remove():r(a),n&&i?n.merge(i).order():i}function Cm(e){for(var t=e.selection?e.selection():e,r=this._groups,n=t._groups,i=r.length,a=n.length,o=Math.min(i,a),s=new Array(i),u=0;u<o;++u)for(var l=r[u],c=n[u],f=l.length,d=s[u]=new Array(f),h,_=0;_<f;++_)(h=l[_]||c[_])&&(d[_]=h);for(;u<i;++u)s[u]=r[u];return new Ee(s,this._parents)}function Rm(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var n=e[t],i=n.length-1,a=n[i],o;--i>=0;)(o=n[i])&&(a&&o.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(o,a),a=o);return this}function Am(e){e||(e=Nm);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}for(var r=this._groups,n=r.length,i=new Array(n),a=0;a<n;++a){for(var o=r[a],s=o.length,u=i[a]=new Array(s),l,c=0;c<s;++c)(l=o[c])&&(u[c]=l);u.sort(t)}return new Ee(i,this._parents).order()}function Nm(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Im(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Tm(){return Array.from(this)}function Mm(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length;i<a;++i){var o=n[i];if(o)return o}return null}function Pm(){let e=0;for(const t of this)++e;return e}function km(){return!this.node()}function Om(e){for(var t=this._groups,r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length,s;a<o;++a)(s=i[a])&&e.call(s,s.__data__,a,i);return this}function Dm(e){return function(){this.removeAttribute(e)}}function Lm(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Fm(e,t){return function(){this.setAttribute(e,t)}}function zm(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Bm(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Hm(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function $m(e,t){var r=yr(e);if(arguments.length<2){var n=this.node();return r.local?n.getAttributeNS(r.space,r.local):n.getAttribute(r)}return this.each((t==null?r.local?Lm:Dm:typeof t=="function"?r.local?Hm:Bm:r.local?zm:Fm)(r,t))}function Wp(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Vm(e){return function(){this.style.removeProperty(e)}}function Gm(e,t,r){return function(){this.style.setProperty(e,t,r)}}function Um(e,t,r){return function(){var n=t.apply(this,arguments);n==null?this.style.removeProperty(e):this.style.setProperty(e,n,r)}}function Km(e,t,r){return arguments.length>1?this.each((t==null?Vm:typeof t=="function"?Um:Gm)(e,t,r??"")):mt(this.node(),e)}function mt(e,t){return e.style.getPropertyValue(t)||Wp(e).getComputedStyle(e,null).getPropertyValue(t)}function jm(e){return function(){delete this[e]}}function Ym(e,t){return function(){this[e]=t}}function Wm(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function Zm(e,t){return arguments.length>1?this.each((t==null?jm:typeof t=="function"?Wm:Ym)(e,t)):this.node()[e]}function Zp(e){return e.trim().split(/^|\s+/)}function mu(e){return e.classList||new Xp(e)}function Xp(e){this._node=e,this._names=Zp(e.getAttribute("class")||"")}Xp.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 Jp(e,t){for(var r=mu(e),n=-1,i=t.length;++n<i;)r.add(t[n])}function Qp(e,t){for(var r=mu(e),n=-1,i=t.length;++n<i;)r.remove(t[n])}function Xm(e){return function(){Jp(this,e)}}function Jm(e){return function(){Qp(this,e)}}function Qm(e,t){return function(){(t.apply(this,arguments)?Jp:Qp)(this,e)}}function e_(e,t){var r=Zp(e+"");if(arguments.length<2){for(var n=mu(this.node()),i=-1,a=r.length;++i<a;)if(!n.contains(r[i]))return!1;return!0}return this.each((typeof t=="function"?Qm:t?Xm:Jm)(r,t))}function t_(){this.textContent=""}function r_(e){return function(){this.textContent=e}}function n_(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function i_(e){return arguments.length?this.each(e==null?t_:(typeof e=="function"?n_:r_)(e)):this.node().textContent}function a_(){this.innerHTML=""}function o_(e){return function(){this.innerHTML=e}}function s_(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function u_(e){return arguments.length?this.each(e==null?a_:(typeof e=="function"?s_:o_)(e)):this.node().innerHTML}function c_(){this.nextSibling&&this.parentNode.appendChild(this)}function l_(){return this.each(c_)}function f_(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function d_(){return this.each(f_)}function h_(e){var t=typeof e=="function"?e:Gp(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function p_(){return null}function v_(e,t){var r=typeof e=="function"?e:Gp(e),n=t==null?p_:typeof t=="function"?t:yu(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),n.apply(this,arguments)||null)})}function g_(){var e=this.parentNode;e&&e.removeChild(this)}function y_(){return this.each(g_)}function m_(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function __(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function b_(e){return this.select(e?__:m_)}function w_(e){return arguments.length?this.property("__data__",e):this.node().__data__}function E_(e){return function(t){e.call(this,t,this.__data__)}}function x_(e){return e.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");return n>=0&&(r=t.slice(n+1),t=t.slice(0,n)),{type:t,name:r}})}function S_(e){return function(){var t=this.__on;if(t){for(var r=0,n=-1,i=t.length,a;r<i;++r)a=t[r],(!e.type||a.type===e.type)&&a.name===e.name?this.removeEventListener(a.type,a.listener,a.options):t[++n]=a;++n?t.length=n:delete this.__on}}}function q_(e,t,r){return function(){var n=this.__on,i,a=E_(t);if(n){for(var o=0,s=n.length;o<s;++o)if((i=n[o]).type===e.type&&i.name===e.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=a,i.options=r),i.value=t;return}}this.addEventListener(e.type,a,r),i={type:e.type,name:e.name,value:t,listener:a,options:r},n?n.push(i):this.__on=[i]}}function C_(e,t,r){var n=x_(e+""),i,a=n.length,o;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,l=s.length,c;u<l;++u)for(i=0,c=s[u];i<a;++i)if((o=n[i]).type===c.type&&o.name===c.name)return c.value}return}for(s=t?q_:S_,i=0;i<a;++i)this.each(s(n[i],t,r));return this}function ev(e,t,r){var n=Wp(e),i=n.CustomEvent;typeof i=="function"?i=new i(t,r):(i=n.document.createEvent("Event"),r?(i.initEvent(t,r.bubbles,r.cancelable),i.detail=r.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function R_(e,t){return function(){return ev(this,e,t)}}function A_(e,t){return function(){return ev(this,e,t.apply(this,arguments))}}function N_(e,t){return this.each((typeof t=="function"?A_:R_)(e,t))}function*I_(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var n=e[t],i=0,a=n.length,o;i<a;++i)(o=n[i])&&(yield o)}var tv=[null];function Ee(e,t){this._groups=e,this._parents=t}function Vt(){return new Ee([[document.documentElement]],tv)}function T_(){return this}Ee.prototype=Vt.prototype={constructor:Ee,select:nm,selectAll:sm,selectChild:fm,selectChildren:vm,filter:gm,data:Em,enter:ym,exit:Sm,join:qm,merge:Cm,selection:T_,order:Rm,sort:Am,call:Im,nodes:Tm,node:Mm,size:Pm,empty:km,each:Om,attr:$m,style:Km,property:Zm,classed:e_,text:i_,html:u_,raise:l_,lower:d_,append:h_,insert:v_,remove:y_,clone:b_,datum:w_,on:C_,dispatch:N_,[Symbol.iterator]:I_};function xe(e){return typeof e=="string"?new Ee([[document.querySelector(e)]],[document.documentElement]):new Ee([[e]],tv)}function M_(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Ae(e,t){if(e=M_(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var n=r.createSVGPoint();return n.x=e.clientX,n.y=e.clientY,n=n.matrixTransform(t.getScreenCTM().inverse()),[n.x,n.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}const P_={passive:!1},Lt={capture:!0,passive:!1};function Gr(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function rv(e){var t=e.document.documentElement,r=xe(e).on("dragstart.drag",gt,Lt);"onselectstart"in t?r.on("selectstart.drag",gt,Lt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function nv(e,t){var r=e.document.documentElement,n=xe(e).on("dragstart.drag",null);t&&(n.on("click.drag",gt,Lt),setTimeout(function(){n.on("click.drag",null)},0)),"onselectstart"in r?n.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const Zt=e=>()=>e;function au(e,{sourceEvent:t,subject:r,target:n,identifier:i,active:a,x:o,y:s,dx:u,dy:l,dispatch:c}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:c}})}au.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function k_(e){return!e.ctrlKey&&!e.button}function O_(){return this.parentNode}function D_(e,t){return t??{x:e.x,y:e.y}}function L_(){return navigator.maxTouchPoints||"ontouchstart"in this}function F_(){var e=k_,t=O_,r=D_,n=L_,i={},a=gr("start","drag","end"),o=0,s,u,l,c,f=0;function d(m){m.on("mousedown.drag",h).filter(n).on("touchstart.drag",v).on("touchmove.drag",p,P_).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(m,E){if(!(c||!e.call(this,m,E))){var x=b(this,t.call(this,m,E),m,E,"mouse");x&&(xe(m.view).on("mousemove.drag",_,Lt).on("mouseup.drag",g,Lt),rv(m.view),Gr(m),l=!1,s=m.clientX,u=m.clientY,x("start",m))}}function _(m){if(gt(m),!l){var E=m.clientX-s,x=m.clientY-u;l=E*E+x*x>f}i.mouse("drag",m)}function g(m){xe(m.view).on("mousemove.drag mouseup.drag",null),nv(m.view,l),gt(m),i.mouse("end",m)}function v(m,E){if(e.call(this,m,E)){var x=m.changedTouches,S=t.call(this,m,E),N=x.length,q,A;for(q=0;q<N;++q)(A=b(this,S,m,E,x[q].identifier,x[q]))&&(Gr(m),A("start",m,x[q]))}}function p(m){var E=m.changedTouches,x=E.length,S,N;for(S=0;S<x;++S)(N=i[E[S].identifier])&&(gt(m),N("drag",m,E[S]))}function y(m){var E=m.changedTouches,x=E.length,S,N;for(c&&clearTimeout(c),c=setTimeout(function(){c=null},500),S=0;S<x;++S)(N=i[E[S].identifier])&&(Gr(m),N("end",m,E[S]))}function b(m,E,x,S,N,q){var A=a.copy(),I=Ae(q||x,E),O,k,w;if((w=r.call(m,new au("beforestart",{sourceEvent:x,target:d,identifier:N,active:o,x:I[0],y:I[1],dx:0,dy:0,dispatch:A}),S))!=null)return O=w.x-I[0]||0,k=w.y-I[1]||0,function T(R,z,H){var M=I,B;switch(R){case"start":i[N]=T,B=o++;break;case"end":delete i[N],--o;case"drag":I=Ae(H||z,E),B=o;break}A.call(R,m,new au(R,{sourceEvent:z,subject:w,target:d,identifier:N,active:B,x:I[0]+O,y:I[1]+k,dx:I[0]-M[0],dy:I[1]-M[1],dispatch:A}),S)}}return d.filter=function(m){return arguments.length?(e=typeof m=="function"?m:Zt(!!m),d):e},d.container=function(m){return arguments.length?(t=typeof m=="function"?m:Zt(m),d):t},d.subject=function(m){return arguments.length?(r=typeof m=="function"?m:Zt(m),d):r},d.touchable=function(m){return arguments.length?(n=typeof m=="function"?m:Zt(!!m),d):n},d.on=function(){var m=a.on.apply(a,arguments);return m===a?d:m},d.clickDistance=function(m){return arguments.length?(f=(m=+m)*m,d):Math.sqrt(f)},d}var _t=0,Tt=0,Ct=0,iv=1e3,sr,Mt,ur=0,at=0,mr=0,Ft=typeof performance=="object"&&performance.now?performance:Date,av=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function _u(){return at||(av(z_),at=Ft.now()+mr)}function z_(){at=0}function cr(){this._call=this._time=this._next=null}cr.prototype=ov.prototype={constructor:cr,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?_u():+r)+(t==null?0:+t),!this._next&&Mt!==this&&(Mt?Mt._next=this:sr=this,Mt=this),this._call=e,this._time=r,ou()},stop:function(){this._call&&(this._call=null,this._time=1/0,ou())}};function ov(e,t,r){var n=new cr;return n.restart(e,t,r),n}function B_(){_u(),++_t;for(var e=sr,t;e;)(t=at-e._time)>=0&&e._call.call(void 0,t),e=e._next;--_t}function sc(){at=(ur=Ft.now())+mr,_t=Tt=0;try{B_()}finally{_t=0,$_(),at=0}}function H_(){var e=Ft.now(),t=e-ur;t>iv&&(mr-=t,ur=e)}function $_(){for(var e,t=sr,r,n=1/0;t;)t._call?(n>t._time&&(n=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:sr=r);Mt=e,ou(n)}function ou(e){if(!_t){Tt&&(Tt=clearTimeout(Tt));var t=e-at;t>24?(e<1/0&&(Tt=setTimeout(sc,e-Ft.now()-mr)),Ct&&(Ct=clearInterval(Ct))):(Ct||(ur=Ft.now(),Ct=setInterval(H_,iv)),_t=1,av(sc))}}function uc(e,t,r){var n=new cr;return t=t==null?0:+t,n.restart(i=>{n.stop(),e(i+t)},t,r),n}var V_=gr("start","end","cancel","interrupt"),G_=[],sv=0,cc=1,su=2,nr=3,lc=4,uu=5,ir=6;function _r(e,t,r,n,i,a){var o=e.__transition;if(!o)e.__transition={};else if(r in o)return;U_(e,r,{name:t,index:n,group:i,on:V_,tween:G_,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:sv})}function bu(e,t){var r=Me(e,t);if(r.state>sv)throw new Error("too late; already scheduled");return r}function De(e,t){var r=Me(e,t);if(r.state>nr)throw new Error("too late; already running");return r}function Me(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function U_(e,t,r){var n=e.__transition,i;n[t]=r,r.timer=ov(a,0,r.time);function a(l){r.state=cc,r.timer.restart(o,r.delay,r.time),r.delay<=l&&o(l-r.delay)}function o(l){var c,f,d,h;if(r.state!==cc)return u();for(c in n)if(h=n[c],h.name===r.name){if(h.state===nr)return uc(o);h.state===lc?(h.state=ir,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete n[c]):+c<t&&(h.state=ir,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete n[c])}if(uc(function(){r.state===nr&&(r.state=lc,r.timer.restart(s,r.delay,r.time),s(l))}),r.state=su,r.on.call("start",e,e.__data__,r.index,r.group),r.state===su){for(r.state=nr,i=new Array(d=r.tween.length),c=0,f=-1;c<d;++c)(h=r.tween[c].value.call(e,e.__data__,r.index,r.group))&&(i[++f]=h);i.length=f+1}}function s(l){for(var c=l<r.duration?r.ease.call(null,l/r.duration):(r.timer.restart(u),r.state=uu,1),f=-1,d=i.length;++f<d;)i[f].call(e,c);r.state===uu&&(r.on.call("end",e,e.__data__,r.index,r.group),u())}function u(){r.state=ir,r.timer.stop(),delete n[t];for(var l in n)return;delete e.__transition}}function ar(e,t){var r=e.__transition,n,i,a=!0,o;if(r){t=t==null?null:t+"";for(o in r){if((n=r[o]).name!==t){a=!1;continue}i=n.state>su&&n.state<uu,n.state=ir,n.timer.stop(),n.on.call(i?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[o]}a&&delete e.__transition}}function K_(e){return this.each(function(){ar(this,e)})}function j_(e,t){var r,n;return function(){var i=De(this,e),a=i.tween;if(a!==r){n=r=a;for(var o=0,s=n.length;o<s;++o)if(n[o].name===t){n=n.slice(),n.splice(o,1);break}}i.tween=n}}function Y_(e,t,r){var n,i;if(typeof r!="function")throw new Error;return function(){var a=De(this,e),o=a.tween;if(o!==n){i=(n=o).slice();for(var s={name:t,value:r},u=0,l=i.length;u<l;++u)if(i[u].name===t){i[u]=s;break}u===l&&i.push(s)}a.tween=i}}function W_(e,t){var r=this._id;if(e+="",arguments.length<2){for(var n=Me(this.node(),r).tween,i=0,a=n.length,o;i<a;++i)if((o=n[i]).name===e)return o.value;return null}return this.each((t==null?j_:Y_)(r,e,t))}function wu(e,t,r){var n=e._id;return e.each(function(){var i=De(this,n);(i.value||(i.value={}))[t]=r.apply(this,arguments)}),function(i){return Me(i,n).value[t]}}function uv(e,t){var r;return(typeof t=="number"?Ly:t instanceof tc?rc:(r=tc(t))?(t=r,rc):Fy)(e,t)}function Z_(e){return function(){this.removeAttribute(e)}}function X_(e){return function(){this.removeAttributeNS(e.space,e.local)}}function J_(e,t,r){var n,i=r+"",a;return function(){var o=this.getAttribute(e);return o===i?null:o===n?a:a=t(n=o,r)}}function Q_(e,t,r){var n,i=r+"",a;return function(){var o=this.getAttributeNS(e.space,e.local);return o===i?null:o===n?a:a=t(n=o,r)}}function eb(e,t,r){var n,i,a;return function(){var o,s=r(this),u;return s==null?void this.removeAttribute(e):(o=this.getAttribute(e),u=s+"",o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s)))}}function tb(e,t,r){var n,i,a;return function(){var o,s=r(this),u;return s==null?void this.removeAttributeNS(e.space,e.local):(o=this.getAttributeNS(e.space,e.local),u=s+"",o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s)))}}function rb(e,t){var r=yr(e),n=r==="transform"?zy:uv;return this.attrTween(e,typeof t=="function"?(r.local?tb:eb)(r,n,wu(this,"attr."+e,t)):t==null?(r.local?X_:Z_)(r):(r.local?Q_:J_)(r,n,t))}function nb(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function ib(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function ab(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&ib(e,a)),r}return i._value=t,i}function ob(e,t){var r,n;function i(){var a=t.apply(this,arguments);return a!==n&&(r=(n=a)&&nb(e,a)),r}return i._value=t,i}function sb(e,t){var r="attr."+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;var n=yr(e);return this.tween(r,(n.local?ab:ob)(n,t))}function ub(e,t){return function(){bu(this,e).delay=+t.apply(this,arguments)}}function cb(e,t){return t=+t,function(){bu(this,e).delay=t}}function lb(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ub:cb)(t,e)):Me(this.node(),t).delay}function fb(e,t){return function(){De(this,e).duration=+t.apply(this,arguments)}}function db(e,t){return t=+t,function(){De(this,e).duration=t}}function hb(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?fb:db)(t,e)):Me(this.node(),t).duration}function pb(e,t){if(typeof t!="function")throw new Error;return function(){De(this,e).ease=t}}function vb(e){var t=this._id;return arguments.length?this.each(pb(t,e)):Me(this.node(),t).ease}function gb(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;De(this,e).ease=r}}function yb(e){if(typeof e!="function")throw new Error;return this.each(gb(this._id,e))}function mb(e){typeof e!="function"&&(e=Kp(e));for(var t=this._groups,r=t.length,n=new Array(r),i=0;i<r;++i)for(var a=t[i],o=a.length,s=n[i]=[],u,l=0;l<o;++l)(u=a[l])&&e.call(u,u.__data__,l,a)&&s.push(u);return new $e(n,this._parents,this._name,this._id)}function _b(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,n=t.length,i=r.length,a=Math.min(n,i),o=new Array(n),s=0;s<a;++s)for(var u=t[s],l=r[s],c=u.length,f=o[s]=new Array(c),d,h=0;h<c;++h)(d=u[h]||l[h])&&(f[h]=d);for(;s<n;++s)o[s]=t[s];return new $e(o,this._parents,this._name,this._id)}function bb(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function wb(e,t,r){var n,i,a=bb(t)?bu:De;return function(){var o=a(this,e),s=o.on;s!==n&&(i=(n=s).copy()).on(t,r),o.on=i}}function Eb(e,t){var r=this._id;return arguments.length<2?Me(this.node(),r).on.on(e):this.each(wb(r,e,t))}function xb(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function Sb(){return this.on("end.remove",xb(this._id))}function qb(e){var t=this._name,r=this._id;typeof e!="function"&&(e=yu(e));for(var n=this._groups,i=n.length,a=new Array(i),o=0;o<i;++o)for(var s=n[o],u=s.length,l=a[o]=new Array(u),c,f,d=0;d<u;++d)(c=s[d])&&(f=e.call(c,c.__data__,d,s))&&("__data__"in c&&(f.__data__=c.__data__),l[d]=f,_r(l[d],t,r,d,l,Me(c,r)));return new $e(a,this._parents,t,r)}function Cb(e){var t=this._name,r=this._id;typeof e!="function"&&(e=Up(e));for(var n=this._groups,i=n.length,a=[],o=[],s=0;s<i;++s)for(var u=n[s],l=u.length,c,f=0;f<l;++f)if(c=u[f]){for(var d=e.call(c,c.__data__,f,u),h,_=Me(c,r),g=0,v=d.length;g<v;++g)(h=d[g])&&_r(h,t,r,g,d,_);a.push(d),o.push(c)}return new $e(a,o,t,r)}var Rb=Vt.prototype.constructor;function Ab(){return new Rb(this._groups,this._parents)}function Nb(e,t){var r,n,i;return function(){var a=mt(this,e),o=(this.style.removeProperty(e),mt(this,e));return a===o?null:a===r&&o===n?i:i=t(r=a,n=o)}}function cv(e){return function(){this.style.removeProperty(e)}}function Ib(e,t,r){var n,i=r+"",a;return function(){var o=mt(this,e);return o===i?null:o===n?a:a=t(n=o,r)}}function Tb(e,t,r){var n,i,a;return function(){var o=mt(this,e),s=r(this),u=s+"";return s==null&&(u=s=(this.style.removeProperty(e),mt(this,e))),o===u?null:o===n&&u===i?a:(i=u,a=t(n=o,s))}}function Mb(e,t){var r,n,i,a="style."+t,o="end."+a,s;return function(){var u=De(this,e),l=u.on,c=u.value[a]==null?s||(s=cv(t)):void 0;(l!==r||i!==c)&&(n=(r=l).copy()).on(o,i=c),u.on=n}}function Pb(e,t,r){var n=(e+="")=="transform"?By:uv;return t==null?this.styleTween(e,Nb(e,n)).on("end.style."+e,cv(e)):typeof t=="function"?this.styleTween(e,Tb(e,n,wu(this,"style."+e,t))).each(Mb(this._id,e)):this.styleTween(e,Ib(e,n,t),r).on("end.style."+e,null)}function kb(e,t,r){return function(n){this.style.setProperty(e,t.call(this,n),r)}}function Ob(e,t,r){var n,i;function a(){var o=t.apply(this,arguments);return o!==i&&(n=(i=o)&&kb(e,o,r)),n}return a._value=t,a}function Db(e,t,r){var n="style."+(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;return this.tween(n,Ob(e,t,r??""))}function Lb(e){return function(){this.textContent=e}}function Fb(e){return function(){var t=e(this);this.textContent=t??""}}function zb(e){return this.tween("text",typeof e=="function"?Fb(wu(this,"text",e)):Lb(e==null?"":e+""))}function Bb(e){return function(t){this.textContent=e.call(this,t)}}function Hb(e){var t,r;function n(){var i=e.apply(this,arguments);return i!==r&&(t=(r=i)&&Bb(i)),t}return n._value=e,n}function $b(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,Hb(e))}function Vb(){for(var e=this._name,t=this._id,r=lv(),n=this._groups,i=n.length,a=0;a<i;++a)for(var o=n[a],s=o.length,u,l=0;l<s;++l)if(u=o[l]){var c=Me(u,t);_r(u,e,r,l,o,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new $e(n,this._parents,e,r)}function Gb(){var e,t,r=this,n=r._id,i=r.size();return new Promise(function(a,o){var s={value:o},u={value:function(){--i===0&&a()}};r.each(function(){var l=De(this,n),c=l.on;c!==e&&(t=(e=c).copy(),t._.cancel.push(s),t._.interrupt.push(s),t._.end.push(u)),l.on=t}),i===0&&a()})}var Ub=0;function $e(e,t,r,n){this._groups=e,this._parents=t,this._name=r,this._id=n}function lv(){return++Ub}var ze=Vt.prototype;$e.prototype={constructor:$e,select:qb,selectAll:Cb,selectChild:ze.selectChild,selectChildren:ze.selectChildren,filter:mb,merge:_b,selection:Ab,transition:Vb,call:ze.call,nodes:ze.nodes,node:ze.node,size:ze.size,empty:ze.empty,each:ze.each,on:Eb,attr:rb,attrTween:sb,style:Pb,styleTween:Db,text:zb,textTween:$b,remove:Sb,tween:W_,delay:lb,duration:hb,ease:vb,easeVarying:yb,end:Gb,[Symbol.iterator]:ze[Symbol.iterator]};function Kb(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var jb={time:null,delay:0,duration:250,ease:Kb};function Yb(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function Wb(e){var t,r;e instanceof $e?(t=e._id,e=e._name):(t=lv(),(r=jb).time=_u(),e=e==null?null:e+"");for(var n=this._groups,i=n.length,a=0;a<i;++a)for(var o=n[a],s=o.length,u,l=0;l<s;++l)(u=o[l])&&_r(u,e,t,l,o,r||Yb(u,t));return new $e(n,this._parents,e,t)}Vt.prototype.interrupt=K_;Vt.prototype.transition=Wb;const Xt=e=>()=>e;function Zb(e,{sourceEvent:t,target:r,transform:n,dispatch:i}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:n,enumerable:!0,configurable:!0},_:{value:i}})}function Be(e,t,r){this.k=e,this.x=t,this.y=r}Be.prototype={constructor:Be,scale:function(e){return e===1?this:new Be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Be(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 He=new Be(1,0,0);Be.prototype;function Ur(e){e.stopImmediatePropagation()}function Rt(e){e.preventDefault(),e.stopImmediatePropagation()}function Xb(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Jb(){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 fc(){return this.__zoom||He}function Qb(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function e0(){return navigator.maxTouchPoints||"ontouchstart"in this}function t0(e,t,r){var n=e.invertX(t[0][0])-r[0][0],i=e.invertX(t[1][0])-r[1][0],a=e.invertY(t[0][1])-r[0][1],o=e.invertY(t[1][1])-r[1][1];return e.translate(i>n?(n+i)/2:Math.min(0,n)||Math.max(0,i),o>a?(a+o)/2:Math.min(0,a)||Math.max(0,o))}function fv(){var e=Xb,t=Jb,r=t0,n=Qb,i=e0,a=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],s=250,u=Hy,l=gr("start","zoom","end"),c,f,d,h=500,_=150,g=0,v=10;function p(w){w.property("__zoom",fc).on("wheel.zoom",N,{passive:!1}).on("mousedown.zoom",q).on("dblclick.zoom",A).filter(i).on("touchstart.zoom",I).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",k).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(w,T,R,z){var H=w.selection?w.selection():w;H.property("__zoom",fc),w!==H?E(w,T,R,z):H.interrupt().each(function(){x(this,arguments).event(z).start().zoom(null,typeof T=="function"?T.apply(this,arguments):T).end()})},p.scaleBy=function(w,T,R,z){p.scaleTo(w,function(){var H=this.__zoom.k,M=typeof T=="function"?T.apply(this,arguments):T;return H*M},R,z)},p.scaleTo=function(w,T,R,z){p.transform(w,function(){var H=t.apply(this,arguments),M=this.__zoom,B=R==null?m(H):typeof R=="function"?R.apply(this,arguments):R,V=M.invert(B),G=typeof T=="function"?T.apply(this,arguments):T;return r(b(y(M,G),B,V),H,o)},R,z)},p.translateBy=function(w,T,R,z){p.transform(w,function(){return r(this.__zoom.translate(typeof T=="function"?T.apply(this,arguments):T,typeof R=="function"?R.apply(this,arguments):R),t.apply(this,arguments),o)},null,z)},p.translateTo=function(w,T,R,z,H){p.transform(w,function(){var M=t.apply(this,arguments),B=this.__zoom,V=z==null?m(M):typeof z=="function"?z.apply(this,arguments):z;return r(He.translate(V[0],V[1]).scale(B.k).translate(typeof T=="function"?-T.apply(this,arguments):-T,typeof R=="function"?-R.apply(this,arguments):-R),M,o)},z,H)};function y(w,T){return T=Math.max(a[0],Math.min(a[1],T)),T===w.k?w:new Be(T,w.x,w.y)}function b(w,T,R){var z=T[0]-R[0]*w.k,H=T[1]-R[1]*w.k;return z===w.x&&H===w.y?w:new Be(w.k,z,H)}function m(w){return[(+w[0][0]+ +w[1][0])/2,(+w[0][1]+ +w[1][1])/2]}function E(w,T,R,z){w.on("start.zoom",function(){x(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){x(this,arguments).event(z).end()}).tween("zoom",function(){var H=this,M=arguments,B=x(H,M).event(z),V=t.apply(H,M),G=R==null?m(V):typeof R=="function"?R.apply(H,M):R,U=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),C=H.__zoom,P=typeof T=="function"?T.apply(H,M):T,F=u(C.invert(G).concat(U/C.k),P.invert(G).concat(U/P.k));return function($){if($===1)$=P;else{var K=F($),W=U/K[2];$=new Be(W,G[0]-K[0]*W,G[1]-K[1]*W)}B.zoom(null,$)}})}function x(w,T,R){return!R&&w.__zooming||new S(w,T)}function S(w,T){this.that=w,this.args=T,this.active=0,this.sourceEvent=null,this.extent=t.apply(w,T),this.taps=0}S.prototype={event:function(w){return w&&(this.sourceEvent=w),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(w,T){return this.mouse&&w!=="mouse"&&(this.mouse[1]=T.invert(this.mouse[0])),this.touch0&&w!=="touch"&&(this.touch0[1]=T.invert(this.touch0[0])),this.touch1&&w!=="touch"&&(this.touch1[1]=T.invert(this.touch1[0])),this.that.__zoom=T,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(w){var T=xe(this.that).datum();l.call(w,this.that,new Zb(w,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:l}),T)}};function N(w,...T){if(!e.apply(this,arguments))return;var R=x(this,T).event(w),z=this.__zoom,H=Math.max(a[0],Math.min(a[1],z.k*Math.pow(2,n.apply(this,arguments)))),M=Ae(w);if(R.wheel)(R.mouse[0][0]!==M[0]||R.mouse[0][1]!==M[1])&&(R.mouse[1]=z.invert(R.mouse[0]=M)),clearTimeout(R.wheel);else{if(z.k===H)return;R.mouse=[M,z.invert(M)],ar(this),R.start()}Rt(w),R.wheel=setTimeout(B,_),R.zoom("mouse",r(b(y(z,H),R.mouse[0],R.mouse[1]),R.extent,o));function B(){R.wheel=null,R.end()}}function q(w,...T){if(d||!e.apply(this,arguments))return;var R=w.currentTarget,z=x(this,T,!0).event(w),H=xe(w.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",U,!0),M=Ae(w,R),B=w.clientX,V=w.clientY;rv(w.view),Ur(w),z.mouse=[M,this.__zoom.invert(M)],ar(this),z.start();function G(C){if(Rt(C),!z.moved){var P=C.clientX-B,F=C.clientY-V;z.moved=P*P+F*F>g}z.event(C).zoom("mouse",r(b(z.that.__zoom,z.mouse[0]=Ae(C,R),z.mouse[1]),z.extent,o))}function U(C){H.on("mousemove.zoom mouseup.zoom",null),nv(C.view,z.moved),Rt(C),z.event(C).end()}}function A(w,...T){if(e.apply(this,arguments)){var R=this.__zoom,z=Ae(w.changedTouches?w.changedTouches[0]:w,this),H=R.invert(z),M=R.k*(w.shiftKey?.5:2),B=r(b(y(R,M),z,H),t.apply(this,T),o);Rt(w),s>0?xe(this).transition().duration(s).call(E,B,z,w):xe(this).call(p.transform,B,z,w)}}function I(w,...T){if(e.apply(this,arguments)){var R=w.touches,z=R.length,H=x(this,T,w.changedTouches.length===z).event(w),M,B,V,G;for(Ur(w),B=0;B<z;++B)V=R[B],G=Ae(V,this),G=[G,this.__zoom.invert(G),V.identifier],H.touch0?!H.touch1&&H.touch0[2]!==G[2]&&(H.touch1=G,H.taps=0):(H.touch0=G,M=!0,H.taps=1+!!c);c&&(c=clearTimeout(c)),M&&(H.taps<2&&(f=G[0],c=setTimeout(function(){c=null},h)),ar(this),H.start())}}function O(w,...T){if(this.__zooming){var R=x(this,T).event(w),z=w.changedTouches,H=z.length,M,B,V,G;for(Rt(w),M=0;M<H;++M)B=z[M],V=Ae(B,this),R.touch0&&R.touch0[2]===B.identifier?R.touch0[0]=V:R.touch1&&R.touch1[2]===B.identifier&&(R.touch1[0]=V);if(B=R.that.__zoom,R.touch1){var U=R.touch0[0],C=R.touch0[1],P=R.touch1[0],F=R.touch1[1],$=($=P[0]-U[0])*$+($=P[1]-U[1])*$,K=(K=F[0]-C[0])*K+(K=F[1]-C[1])*K;B=y(B,Math.sqrt($/K)),V=[(U[0]+P[0])/2,(U[1]+P[1])/2],G=[(C[0]+F[0])/2,(C[1]+F[1])/2]}else if(R.touch0)V=R.touch0[0],G=R.touch0[1];else return;R.zoom("touch",r(b(B,V,G),R.extent,o))}}function k(w,...T){if(this.__zooming){var R=x(this,T).event(w),z=w.changedTouches,H=z.length,M,B;for(Ur(w),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<H;++M)B=z[M],R.touch0&&R.touch0[2]===B.identifier?delete R.touch0:R.touch1&&R.touch1[2]===B.identifier&&delete R.touch1;if(R.touch1&&!R.touch0&&(R.touch0=R.touch1,delete R.touch1),R.touch0)R.touch0[1]=this.__zoom.invert(R.touch0[0]);else if(R.end(),R.taps===2&&(B=Ae(B,this),Math.hypot(f[0]-B[0],f[1]-B[1])<v)){var V=xe(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return p.wheelDelta=function(w){return arguments.length?(n=typeof w=="function"?w:Xt(+w),p):n},p.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Xt(!!w),p):e},p.touchable=function(w){return arguments.length?(i=typeof w=="function"?w:Xt(!!w),p):i},p.extent=function(w){return arguments.length?(t=typeof w=="function"?w:Xt([[+w[0][0],+w[0][1]],[+w[1][0],+w[1][1]]]),p):t},p.scaleExtent=function(w){return arguments.length?(a[0]=+w[0],a[1]=+w[1],p):[a[0],a[1]]},p.translateExtent=function(w){return arguments.length?(o[0][0]=+w[0][0],o[1][0]=+w[1][0],o[0][1]=+w[0][1],o[1][1]=+w[1][1],p):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},p.constrain=function(w){return arguments.length?(r=w,p):r},p.duration=function(w){return arguments.length?(s=+w,p):s},p.interpolate=function(w){return arguments.length?(u=w,p):u},p.on=function(){var w=l.on.apply(l,arguments);return w===l?p:w},p.clickDistance=function(w){return arguments.length?(g=(w=+w)*w,p):Math.sqrt(g)},p.tapDistance=function(w){return arguments.length?(v=+w,p):v},p}const br=D.createContext(null),r0=br.Provider,Ve={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.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 React Flow 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,t)=>`Couldn't create edge for ${e?"target":"source"} handle id: "${e?t.targetHandle:t.sourceHandle}", edge id: ${t.id}.`,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.`},dv=Ve.error001();function ne(e,t){const r=D.useContext(br);if(r===null)throw new Error(dv);return Vp(r,e,t)}const fe=()=>{const e=D.useContext(br);if(e===null)throw new Error(dv);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe,destroy:e.destroy}),[e])},n0=e=>e.userSelectionActive?"none":"all";function Eu({position:e,children:t,className:r,style:n,...i}){const a=ne(n0),o=`${e}`.split("-");return L.createElement("div",{className:pe(["react-flow__panel",r,...o]),style:{...n,pointerEvents:a},...i},t)}function i0({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:L.createElement(Eu,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},L.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const a0=({x:e,y:t,label:r,labelStyle:n={},labelShowBg:i=!0,labelBgStyle:a={},labelBgPadding:o=[2,4],labelBgBorderRadius:s=2,children:u,className:l,...c})=>{const f=D.useRef(null),[d,h]=D.useState({x:0,y:0,width:0,height:0}),_=pe(["react-flow__edge-textwrapper",l]);return D.useEffect(()=>{if(f.current){const g=f.current.getBBox();h({x:g.x,y:g.y,width:g.width,height:g.height})}},[r]),typeof r>"u"||!r?null:L.createElement("g",{transform:`translate(${e-d.width/2} ${t-d.height/2})`,className:_,visibility:d.width?"visible":"hidden",...c},i&&L.createElement("rect",{width:d.width+2*o[0],x:-o[0],y:-o[1],height:d.height+2*o[1],className:"react-flow__edge-textbg",style:a,rx:s,ry:s}),L.createElement("text",{className:"react-flow__edge-text",y:d.height/2,dy:"0.3em",ref:f,style:n},r),u)};var o0=D.memo(a0);const xu=e=>({width:e.offsetWidth,height:e.offsetHeight}),bt=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),Su=(e={x:0,y:0},t)=>({x:bt(e.x,t[0][0],t[1][0]),y:bt(e.y,t[0][1],t[1][1])}),dc=(e,t,r)=>e<t?bt(Math.abs(e-t),1,50)/50:e>r?-bt(Math.abs(e-r),1,50)/50:0,hv=(e,t)=>{const r=dc(e.x,35,t.width-35)*20,n=dc(e.y,35,t.height-35)*20;return[r,n]},pv=e=>e.getRootNode?.()||window?.document,vv=(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)}),zt=({x:e,y:t,width:r,height:n})=>({x:e,y:t,x2:e+r,y2:t+n}),gv=({x:e,y:t,x2:r,y2:n})=>({x:e,y:t,width:r-e,height:n-t}),hc=e=>({...e.positionAbsolute||{x:0,y:0},width:e.width||0,height:e.height||0}),s0=(e,t)=>gv(vv(zt(e),zt(t))),cu=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),n=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*n)},u0=e=>Se(e.width)&&Se(e.height)&&Se(e.x)&&Se(e.y),Se=e=>!isNaN(e)&&isFinite(e),se=Symbol.for("internals"),yv=["Enter"," ","Escape"],c0=(e,t)=>{},l0=e=>"nativeEvent"in e;function lu(e){const r=(l0(e)?e.nativeEvent:e).composedPath?.()?.[0]||e.target;return["INPUT","SELECT","TEXTAREA"].includes(r?.nodeName)||r?.hasAttribute("contenteditable")||!!r?.closest(".nokey")}const mv=e=>"clientX"in e,Je=(e,t)=>{const r=mv(e),n=r?e.clientX:e.touches?.[0].clientX,i=r?e.clientY:e.touches?.[0].clientY;return{x:n-(t?.left??0),y:i-(t?.top??0)}},lr=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Gt=({id:e,path:t,labelX:r,labelY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h=20})=>L.createElement(L.Fragment,null,L.createElement("path",{id:e,style:c,d:t,fill:"none",className:"react-flow__edge-path",markerEnd:f,markerStart:d}),h&&L.createElement("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}),i&&Se(r)&&Se(n)?L.createElement(o0,{x:r,y:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l}):null);Gt.displayName="BaseEdge";function At(e,t,r){return r===void 0?r:n=>{const i=t().edges.find(a=>a.id===e);i&&r(n,{...i})}}function _v({sourceX:e,sourceY:t,targetX:r,targetY:n}){const i=Math.abs(r-e)/2,a=r<e?r+i:r-i,o=Math.abs(n-t)/2,s=n<t?n+o:n-o;return[a,s,i,o]}function bv({sourceX:e,sourceY:t,targetX:r,targetY:n,sourceControlX:i,sourceControlY:a,targetControlX:o,targetControlY:s}){const u=e*.125+i*.375+o*.375+r*.125,l=t*.125+a*.375+s*.375+n*.125,c=Math.abs(u-e),f=Math.abs(l-t);return[u,l,c,f]}var ot;(function(e){e.Strict="strict",e.Loose="loose"})(ot||(ot={}));var nt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(nt||(nt={}));var Bt;(function(e){e.Partial="partial",e.Full="full"})(Bt||(Bt={}));var Xe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Xe||(Xe={}));var fr;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(fr||(fr={}));var J;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(J||(J={}));function pc({pos:e,x1:t,y1:r,x2:n,y2:i}){return e===J.Left||e===J.Right?[.5*(t+n),r]:[t,.5*(r+i)]}function wv({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top}){const[o,s]=pc({pos:r,x1:e,y1:t,x2:n,y2:i}),[u,l]=pc({pos:a,x1:n,y1:i,x2:e,y2:t}),[c,f,d,h]=bv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:o,sourceControlY:s,targetControlX:u,targetControlY:l});return[`M${e},${t} C${o},${s} ${u},${l} ${n},${i}`,c,f,d,h]}const qu=D.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})=>{const[v,p,y]=wv({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a});return L.createElement(Gt,{path:v,labelX:p,labelY:y,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:g})});qu.displayName="SimpleBezierEdge";const vc={[J.Left]:{x:-1,y:0},[J.Right]:{x:1,y:0},[J.Top]:{x:0,y:-1},[J.Bottom]:{x:0,y:1}},f0=({source:e,sourcePosition:t=J.Bottom,target:r})=>t===J.Left||t===J.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},gc=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function d0({source:e,sourcePosition:t=J.Bottom,target:r,targetPosition:n=J.Top,center:i,offset:a}){const o=vc[t],s=vc[n],u={x:e.x+o.x*a,y:e.y+o.y*a},l={x:r.x+s.x*a,y:r.y+s.y*a},c=f0({source:u,sourcePosition:t,target:l}),f=c.x!==0?"x":"y",d=c[f];let h=[],_,g;const v={x:0,y:0},p={x:0,y:0},[y,b,m,E]=_v({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(o[f]*s[f]===-1){_=i.x??y,g=i.y??b;const S=[{x:_,y:u.y},{x:_,y:l.y}],N=[{x:u.x,y:g},{x:l.x,y:g}];o[f]===d?h=f==="x"?S:N:h=f==="x"?N:S}else{const S=[{x:u.x,y:l.y}],N=[{x:l.x,y:u.y}];if(f==="x"?h=o.x===d?N:S:h=o.y===d?S:N,t===n){const k=Math.abs(e[f]-r[f]);if(k<=a){const w=Math.min(a-1,a-k);o[f]===d?v[f]=(u[f]>e[f]?-1:1)*w:p[f]=(l[f]>r[f]?-1:1)*w}}if(t!==n){const k=f==="x"?"y":"x",w=o[f]===s[k],T=u[k]>l[k],R=u[k]<l[k];(o[f]===1&&(!w&&T||w&&R)||o[f]!==1&&(!w&&R||w&&T))&&(h=f==="x"?S:N)}const q={x:u.x+v.x,y:u.y+v.y},A={x:l.x+p.x,y:l.y+p.y},I=Math.max(Math.abs(q.x-h[0].x),Math.abs(A.x-h[0].x)),O=Math.max(Math.abs(q.y-h[0].y),Math.abs(A.y-h[0].y));I>=O?(_=(q.x+A.x)/2,g=h[0].y):(_=h[0].x,g=(q.y+A.y)/2)}return[[e,{x:u.x+v.x,y:u.y+v.y},...h,{x:l.x+p.x,y:l.y+p.y},r],_,g,m,E]}function h0(e,t,r,n){const i=Math.min(gc(e,t)/2,gc(t,r)/2,n),{x:a,y:o}=t;if(e.x===a&&a===r.x||e.y===o&&o===r.y)return`L${a} ${o}`;if(e.y===o){const l=e.x<r.x?-1:1,c=e.y<r.y?1:-1;return`L ${a+i*l},${o}Q ${a},${o} ${a},${o+i*c}`}const s=e.x<r.x?1:-1,u=e.y<r.y?-1:1;return`L ${a},${o+i*u}Q ${a},${o} ${a+i*s},${o}`}function fu({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,borderRadius:o=5,centerX:s,centerY:u,offset:l=20}){const[c,f,d,h,_]=d0({source:{x:e,y:t},sourcePosition:r,target:{x:n,y:i},targetPosition:a,center:{x:s,y:u},offset:l});return[c.reduce((v,p,y)=>{let b="";return y>0&&y<c.length-1?b=h0(c[y-1],p,c[y+1],o):b=`${y===0?"M":"L"}${p.x} ${p.y}`,v+=b,v},""),f,d,h,_]}const wr=D.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,sourcePosition:f=J.Bottom,targetPosition:d=J.Top,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=fu({sourceX:e,sourceY:t,sourcePosition:f,targetX:r,targetY:n,targetPosition:d,borderRadius:g?.borderRadius,offset:g?.offset});return L.createElement(Gt,{path:p,labelX:y,labelY:b,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:h,markerStart:_,interactionWidth:v})});wr.displayName="SmoothStepEdge";const Cu=D.memo(e=>L.createElement(wr,{...e,pathOptions:D.useMemo(()=>({borderRadius:0,offset:e.pathOptions?.offset}),[e.pathOptions?.offset])}));Cu.displayName="StepEdge";function p0({sourceX:e,sourceY:t,targetX:r,targetY:n}){const[i,a,o,s]=_v({sourceX:e,sourceY:t,targetX:r,targetY:n});return[`M ${e},${t}L ${r},${n}`,i,a,o,s]}const Ru=D.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})=>{const[_,g,v]=p0({sourceX:e,sourceY:t,targetX:r,targetY:n});return L.createElement(Gt,{path:_,labelX:g,labelY:v,label:i,labelStyle:a,labelShowBg:o,labelBgStyle:s,labelBgPadding:u,labelBgBorderRadius:l,style:c,markerEnd:f,markerStart:d,interactionWidth:h})});Ru.displayName="StraightEdge";function Jt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function yc({pos:e,x1:t,y1:r,x2:n,y2:i,c:a}){switch(e){case J.Left:return[t-Jt(t-n,a),r];case J.Right:return[t+Jt(n-t,a),r];case J.Top:return[t,r-Jt(r-i,a)];case J.Bottom:return[t,r+Jt(i-r,a)]}}function Ev({sourceX:e,sourceY:t,sourcePosition:r=J.Bottom,targetX:n,targetY:i,targetPosition:a=J.Top,curvature:o=.25}){const[s,u]=yc({pos:r,x1:e,y1:t,x2:n,y2:i,c:o}),[l,c]=yc({pos:a,x1:n,y1:i,x2:e,y2:t,c:o}),[f,d,h,_]=bv({sourceX:e,sourceY:t,targetX:n,targetY:i,sourceControlX:s,sourceControlY:u,targetControlX:l,targetControlY:c});return[`M${e},${t} C${s},${u} ${l},${c} ${n},${i}`,f,d,h,_]}const dr=D.memo(({sourceX:e,sourceY:t,targetX:r,targetY:n,sourcePosition:i=J.Bottom,targetPosition:a=J.Top,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,pathOptions:g,interactionWidth:v})=>{const[p,y,b]=Ev({sourceX:e,sourceY:t,sourcePosition:i,targetX:r,targetY:n,targetPosition:a,curvature:g?.curvature});return L.createElement(Gt,{path:p,labelX:y,labelY:b,label:o,labelStyle:s,labelShowBg:u,labelBgStyle:l,labelBgPadding:c,labelBgBorderRadius:f,style:d,markerEnd:h,markerStart:_,interactionWidth:v})});dr.displayName="BezierEdge";const Au=D.createContext(null),v0=Au.Provider;Au.Consumer;const g0=()=>D.useContext(Au),y0=e=>"id"in e&&"source"in e&&"target"in e,m0=({source:e,sourceHandle:t,target:r,targetHandle:n})=>`reactflow__edge-${e}${t||""}-${r}${n||""}`,du=(e,t)=>typeof e>"u"?"":typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(n=>`${n}=${e[n]}`).join("&")}`,_0=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),b0=(e,t)=>{if(!e.source||!e.target)return t;let r;return y0(e)?r={...e}:r={...e,id:m0(e)},_0(r,t)?t:t.concat(r)},hu=({x:e,y:t},[r,n,i],a,[o,s])=>{const u={x:(e-r)/i,y:(t-n)/i};return a?{x:o*Math.round(u.x/o),y:s*Math.round(u.y/s)}:u},xv=({x:e,y:t},[r,n,i])=>({x:e*i+r,y:t*i+n}),it=(e,t=[0,0])=>{if(!e)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const r=(e.width??0)*t[0],n=(e.height??0)*t[1],i={x:e.position.x-r,y:e.position.y-n};return{...i,positionAbsolute:e.positionAbsolute?{x:e.positionAbsolute.x-r,y:e.positionAbsolute.y-n}:i}},Er=(e,t=[0,0])=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((n,i)=>{const{x:a,y:o}=it(i,t).positionAbsolute;return vv(n,zt({x:a,y:o,width:i.width||0,height:i.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return gv(r)},Sv=(e,t,[r,n,i]=[0,0,1],a=!1,o=!1,s=[0,0])=>{const u={x:(t.x-r)/i,y:(t.y-n)/i,width:t.width/i,height:t.height/i},l=[];return e.forEach(c=>{const{width:f,height:d,selectable:h=!0,hidden:_=!1}=c;if(o&&!h||_)return!1;const{positionAbsolute:g}=it(c,s),v={x:g.x,y:g.y,width:f||0,height:d||0},p=cu(u,v),y=typeof f>"u"||typeof d>"u"||f===null||d===null,b=a&&p>0,m=(f||0)*(d||0);(y||b||p>=m||c.dragging)&&l.push(c)}),l},qv=(e,t)=>{const r=e.map(n=>n.id);return t.filter(n=>r.includes(n.source)||r.includes(n.target))},Cv=(e,t,r,n,i,a=.1)=>{const o=t/(e.width*(1+a)),s=r/(e.height*(1+a)),u=Math.min(o,s),l=bt(u,n,i),c=e.x+e.width/2,f=e.y+e.height/2,d=t/2-c*l,h=r/2-f*l;return{x:d,y:h,zoom:l}},rt=(e,t=0)=>e.transition().duration(t);function mc(e,t,r,n){return(t[r]||[]).reduce((i,a)=>(`${e.id}-${a.id}-${r}`!==n&&i.push({id:a.id||null,type:r,nodeId:e.id,x:(e.positionAbsolute?.x??0)+a.x+a.width/2,y:(e.positionAbsolute?.y??0)+a.y+a.height/2}),i),[])}function w0(e,t,r,n,i,a){const{x:o,y:s}=Je(e),l=t.elementsFromPoint(o,s).find(_=>_.classList.contains("react-flow__handle"));if(l){const _=l.getAttribute("data-nodeid");if(_){const g=Nu(void 0,l),v=l.getAttribute("data-handleid"),p=a({nodeId:_,id:v,type:g});if(p){const y=i.find(b=>b.nodeId===_&&b.type===g&&b.id===v);return{handle:{id:v,type:g,nodeId:_,x:y?.x||r.x,y:y?.y||r.y},validHandleResult:p}}}}let c=[],f=1/0;if(i.forEach(_=>{const g=Math.sqrt((_.x-r.x)**2+(_.y-r.y)**2);if(g<=n){const v=a(_);g<=f&&(g<f?c=[{handle:_,validHandleResult:v}]:g===f&&c.push({handle:_,validHandleResult:v}),f=g)}}),!c.length)return{handle:null,validHandleResult:Rv()};if(c.length===1)return c[0];const d=c.some(({validHandleResult:_})=>_.isValid),h=c.some(({handle:_})=>_.type==="target");return c.find(({handle:_,validHandleResult:g})=>h?_.type==="target":d?g.isValid:!0)||c[0]}const E0={source:null,target:null,sourceHandle:null,targetHandle:null},Rv=()=>({handleDomNode:null,isValid:!1,connection:E0,endHandle:null});function Av(e,t,r,n,i,a,o){const s=i==="target",u=o.querySelector(`.react-flow__handle[data-id="${e?.nodeId}-${e?.id}-${e?.type}"]`),l={...Rv(),handleDomNode:u};if(u){const c=Nu(void 0,u),f=u.getAttribute("data-nodeid"),d=u.getAttribute("data-handleid"),h=u.classList.contains("connectable"),_=u.classList.contains("connectableend"),g={source:s?f:r,sourceHandle:s?d:n,target:s?r:f,targetHandle:s?n:d};l.connection=g,h&&_&&(t===ot.Strict?s&&c==="source"||!s&&c==="target":f!==r||d!==n)&&(l.endHandle={nodeId:f,handleId:d,type:c},l.isValid=a(g))}return l}function x0({nodes:e,nodeId:t,handleId:r,handleType:n}){return e.reduce((i,a)=>{if(a[se]){const{handleBounds:o}=a[se];let s=[],u=[];o&&(s=mc(a,o,"source",`${t}-${r}-${n}`),u=mc(a,o,"target",`${t}-${r}-${n}`)),i.push(...s,...u)}return i},[])}function Nu(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function Kr(e){e?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function S0(e,t){let r=null;return t?r="valid":e&&!t&&(r="invalid"),r}function Nv({event:e,handleId:t,nodeId:r,onConnect:n,isTarget:i,getState:a,setState:o,isValidConnection:s,edgeUpdaterType:u,onReconnectEnd:l}){const c=pv(e.target),{connectionMode:f,domNode:d,autoPanOnConnect:h,connectionRadius:_,onConnectStart:g,panBy:v,getNodes:p,cancelConnection:y}=a();let b=0,m;const{x:E,y:x}=Je(e),S=c?.elementFromPoint(E,x),N=Nu(u,S),q=d?.getBoundingClientRect();if(!q||!N)return;let A,I=Je(e,q),O=!1,k=null,w=!1,T=null;const R=x0({nodes:p(),nodeId:r,handleId:t,handleType:N}),z=()=>{if(!h)return;const[B,V]=hv(I,q);v({x:B,y:V}),b=requestAnimationFrame(z)};o({connectionPosition:I,connectionStatus:null,connectionNodeId:r,connectionHandleId:t,connectionHandleType:N,connectionStartHandle:{nodeId:r,handleId:t,type:N},connectionEndHandle:null}),g?.(e,{nodeId:r,handleId:t,handleType:N});function H(B){const{transform:V}=a();I=Je(B,q);const{handle:G,validHandleResult:U}=w0(B,c,hu(I,V,!1,[1,1]),_,R,C=>Av(C,f,r,t,i?"target":"source",s,c));if(m=G,O||(z(),O=!0),T=U.handleDomNode,k=U.connection,w=U.isValid,o({connectionPosition:m&&w?xv({x:m.x,y:m.y},V):I,connectionStatus:S0(!!m,w),connectionEndHandle:U.endHandle}),!m&&!w&&!T)return Kr(A);k.source!==k.target&&T&&(Kr(A),A=T,T.classList.add("connecting","react-flow__handle-connecting"),T.classList.toggle("valid",w),T.classList.toggle("react-flow__handle-valid",w))}function M(B){(m||T)&&k&&w&&n?.(k),a().onConnectEnd?.(B),u&&l?.(B),Kr(A),y(),cancelAnimationFrame(b),O=!1,w=!1,k=null,T=null,c.removeEventListener("mousemove",H),c.removeEventListener("mouseup",M),c.removeEventListener("touchmove",H),c.removeEventListener("touchend",M)}c.addEventListener("mousemove",H),c.addEventListener("mouseup",M),c.addEventListener("touchmove",H),c.addEventListener("touchend",M)}const _c=()=>!0,q0=e=>({connectionStartHandle:e.connectionStartHandle,connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName}),C0=(e,t,r)=>n=>{const{connectionStartHandle:i,connectionEndHandle:a,connectionClickStartHandle:o}=n;return{connecting:i?.nodeId===e&&i?.handleId===t&&i?.type===r||a?.nodeId===e&&a?.handleId===t&&a?.type===r,clickConnecting:o?.nodeId===e&&o?.handleId===t&&o?.type===r}},Iv=D.forwardRef(({type:e="source",position:t=J.Top,isValidConnection:r,isConnectable:n=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:o,onConnect:s,children:u,className:l,onMouseDown:c,onTouchStart:f,...d},h)=>{const _=o||null,g=e==="target",v=fe(),p=g0(),{connectOnClick:y,noPanClassName:b}=ne(q0,he),{connecting:m,clickConnecting:E}=ne(C0(p,_,e),he);p||v.getState().onError?.("010",Ve.error010());const x=q=>{const{defaultEdgeOptions:A,onConnect:I,hasDefaultEdges:O}=v.getState(),k={...A,...q};if(O){const{edges:w,setEdges:T}=v.getState();T(b0(k,w))}I?.(k),s?.(k)},S=q=>{if(!p)return;const A=mv(q);i&&(A&&q.button===0||!A)&&Nv({event:q,handleId:_,nodeId:p,onConnect:x,isTarget:g,getState:v.getState,setState:v.setState,isValidConnection:r||v.getState().isValidConnection||_c}),A?c?.(q):f?.(q)},N=q=>{const{onClickConnectStart:A,onClickConnectEnd:I,connectionClickStartHandle:O,connectionMode:k,isValidConnection:w}=v.getState();if(!p||!O&&!i)return;if(!O){A?.(q,{nodeId:p,handleId:_,handleType:e}),v.setState({connectionClickStartHandle:{nodeId:p,type:e,handleId:_}});return}const T=pv(q.target),R=r||w||_c,{connection:z,isValid:H}=Av({nodeId:p,id:_,type:e},k,O.nodeId,O.handleId||null,O.type,R,T);H&&x(z),I?.(q),v.setState({connectionClickStartHandle:null})};return L.createElement("div",{"data-handleid":_,"data-nodeid":p,"data-handlepos":t,"data-id":`${p}-${_}-${e}`,className:pe(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",b,l,{source:!g,target:g,connectable:n,connectablestart:i,connectableend:a,connecting:E,connectionindicator:n&&(i&&!m||a&&m)}]),onMouseDown:S,onTouchStart:S,onClick:y?N:void 0,ref:h,...d},u)});Iv.displayName="Handle";var hr=D.memo(Iv);const Tv=({data:e,isConnectable:t,targetPosition:r=J.Top,sourcePosition:n=J.Bottom})=>L.createElement(L.Fragment,null,L.createElement(hr,{type:"target",position:r,isConnectable:t}),e?.label,L.createElement(hr,{type:"source",position:n,isConnectable:t}));Tv.displayName="DefaultNode";var pu=D.memo(Tv);const Mv=({data:e,isConnectable:t,sourcePosition:r=J.Bottom})=>L.createElement(L.Fragment,null,e?.label,L.createElement(hr,{type:"source",position:r,isConnectable:t}));Mv.displayName="InputNode";var Pv=D.memo(Mv);const kv=({data:e,isConnectable:t,targetPosition:r=J.Top})=>L.createElement(L.Fragment,null,L.createElement(hr,{type:"target",position:r,isConnectable:t}),e?.label);kv.displayName="OutputNode";var Ov=D.memo(kv);const Iu=()=>null;Iu.displayName="GroupNode";const R0=e=>({selectedNodes:e.getNodes().filter(t=>t.selected),selectedEdges:e.edges.filter(t=>t.selected).map(t=>({...t}))}),Qt=e=>e.id;function A0(e,t){return he(e.selectedNodes.map(Qt),t.selectedNodes.map(Qt))&&he(e.selectedEdges.map(Qt),t.selectedEdges.map(Qt))}const Dv=D.memo(({onSelectionChange:e})=>{const t=fe(),{selectedNodes:r,selectedEdges:n}=ne(R0,A0);return D.useEffect(()=>{const i={nodes:r,edges:n};e?.(i),t.getState().onSelectionChange.forEach(a=>a(i))},[r,n,e]),null});Dv.displayName="SelectionListener";const N0=e=>!!e.onSelectionChange;function I0({onSelectionChange:e}){const t=ne(N0);return e||t?L.createElement(Dv,{onSelectionChange:e}):null}const T0=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset});function ft(e,t){D.useEffect(()=>{typeof e<"u"&&t(e)},[e])}function Q(e,t,r){D.useEffect(()=>{typeof t<"u"&&r({[e]:t})},[t])}const M0=({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:i,onConnectStart:a,onConnectEnd:o,onClickConnectStart:s,onClickConnectEnd:u,nodesDraggable:l,nodesConnectable:c,nodesFocusable:f,edgesFocusable:d,edgesUpdatable:h,elevateNodesOnSelect:_,minZoom:g,maxZoom:v,nodeExtent:p,onNodesChange:y,onEdgesChange:b,elementsSelectable:m,connectionMode:E,snapGrid:x,snapToGrid:S,translateExtent:N,connectOnClick:q,defaultEdgeOptions:A,fitView:I,fitViewOptions:O,onNodesDelete:k,onEdgesDelete:w,onNodeDrag:T,onNodeDragStart:R,onNodeDragStop:z,onSelectionDrag:H,onSelectionDragStart:M,onSelectionDragStop:B,noPanClassName:V,nodeOrigin:G,rfId:U,autoPanOnConnect:C,autoPanOnNodeDrag:P,onError:F,connectionRadius:$,isValidConnection:K,nodeDragThreshold:W})=>{const{setNodes:Z,setEdges:te,setDefaultNodesAndEdges:ie,setMinZoom:re,setMaxZoom:ee,setTranslateExtent:X,setNodeExtent:ue,reset:j}=ne(T0,he),Y=fe();return D.useEffect(()=>{const oe=n?.map(Ce=>({...Ce,...A}));return ie(r,oe),()=>{j()}},[]),Q("defaultEdgeOptions",A,Y.setState),Q("connectionMode",E,Y.setState),Q("onConnect",i,Y.setState),Q("onConnectStart",a,Y.setState),Q("onConnectEnd",o,Y.setState),Q("onClickConnectStart",s,Y.setState),Q("onClickConnectEnd",u,Y.setState),Q("nodesDraggable",l,Y.setState),Q("nodesConnectable",c,Y.setState),Q("nodesFocusable",f,Y.setState),Q("edgesFocusable",d,Y.setState),Q("edgesUpdatable",h,Y.setState),Q("elementsSelectable",m,Y.setState),Q("elevateNodesOnSelect",_,Y.setState),Q("snapToGrid",S,Y.setState),Q("snapGrid",x,Y.setState),Q("onNodesChange",y,Y.setState),Q("onEdgesChange",b,Y.setState),Q("connectOnClick",q,Y.setState),Q("fitViewOnInit",I,Y.setState),Q("fitViewOnInitOptions",O,Y.setState),Q("onNodesDelete",k,Y.setState),Q("onEdgesDelete",w,Y.setState),Q("onNodeDrag",T,Y.setState),Q("onNodeDragStart",R,Y.setState),Q("onNodeDragStop",z,Y.setState),Q("onSelectionDrag",H,Y.setState),Q("onSelectionDragStart",M,Y.setState),Q("onSelectionDragStop",B,Y.setState),Q("noPanClassName",V,Y.setState),Q("nodeOrigin",G,Y.setState),Q("rfId",U,Y.setState),Q("autoPanOnConnect",C,Y.setState),Q("autoPanOnNodeDrag",P,Y.setState),Q("onError",F,Y.setState),Q("connectionRadius",$,Y.setState),Q("isValidConnection",K,Y.setState),Q("nodeDragThreshold",W,Y.setState),ft(e,Z),ft(t,te),ft(g,re),ft(v,ee),ft(N,X),ft(p,ue),null},bc={display:"none"},P0={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Lv="react-flow__node-desc",Fv="react-flow__edge-desc",k0="react-flow__aria-live",O0=e=>e.ariaLiveMessage;function D0({rfId:e}){const t=ne(O0);return L.createElement("div",{id:`${k0}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:P0},t)}function L0({rfId:e,disableKeyboardA11y:t}){return L.createElement(L.Fragment,null,L.createElement("div",{id:`${Lv}-${e}`,style:bc},"Press enter or space to select a node.",!t&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),L.createElement("div",{id:`${Fv}-${e}`,style:bc},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!t&&L.createElement(D0,{rfId:e}))}var Ht=(e=null,t={actInsideInputWithModifier:!0})=>{const[r,n]=D.useState(!1),i=D.useRef(!1),a=D.useRef(new Set([])),[o,s]=D.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(f=>typeof f=="string").map(f=>f.split("+")),c=l.reduce((f,d)=>f.concat(...d),[]);return[l,c]}return[[],[]]},[e]);return D.useEffect(()=>{const u=typeof document<"u"?document:null,l=t?.target||u;if(e!==null){const c=h=>{if(i.current=h.ctrlKey||h.metaKey||h.shiftKey,(!i.current||i.current&&!t.actInsideInputWithModifier)&&lu(h))return!1;const g=Ec(h.code,s);a.current.add(h[g]),wc(o,a.current,!1)&&(h.preventDefault(),n(!0))},f=h=>{if((!i.current||i.current&&!t.actInsideInputWithModifier)&&lu(h))return!1;const g=Ec(h.code,s);wc(o,a.current,!0)?(n(!1),a.current.clear()):a.current.delete(h[g]),h.key==="Meta"&&a.current.clear(),i.current=!1},d=()=>{a.current.clear(),n(!1)};return l?.addEventListener("keydown",c),l?.addEventListener("keyup",f),window.addEventListener("blur",d),()=>{l?.removeEventListener("keydown",c),l?.removeEventListener("keyup",f),window.removeEventListener("blur",d)}}},[e,n]),r};function wc(e,t,r){return e.filter(n=>r||n.length===t.size).some(n=>n.every(i=>t.has(i)))}function Ec(e,t){return t.includes(e)?"code":"key"}function zv(e,t,r,n){const i=e.parentNode||e.parentId;if(!i)return r;const a=t.get(i),o=it(a,n);return zv(a,t,{x:(r.x??0)+o.x,y:(r.y??0)+o.y,z:(a[se]?.z??0)>(r.z??0)?a[se]?.z??0:r.z??0},n)}function Bv(e,t,r){e.forEach(n=>{const i=n.parentNode||n.parentId;if(i&&!e.has(i))throw new Error(`Parent node ${i} not found`);if(i||r?.[n.id]){const{x:a,y:o,z:s}=zv(n,e,{...n.position,z:n[se]?.z??0},t);n.positionAbsolute={x:a,y:o},n[se].z=s,r?.[n.id]&&(n[se].isParent=!0)}})}function jr(e,t,r,n){const i=new Map,a={},o=n?1e3:0;return e.forEach(s=>{const u=(Se(s.zIndex)?s.zIndex:0)+(s.selected?o:0),l=t.get(s.id),c={...s,positionAbsolute:{x:s.position.x,y:s.position.y}},f=s.parentNode||s.parentId;f&&(a[f]=!0);const d=l?.type&&l?.type!==s.type;Object.defineProperty(c,se,{enumerable:!1,value:{handleBounds:d?void 0:l?.[se]?.handleBounds,z:u}}),i.set(s.id,c)}),Bv(i,r,a),i}function Hv(e,t={}){const{getNodes:r,width:n,height:i,minZoom:a,maxZoom:o,d3Zoom:s,d3Selection:u,fitViewOnInitDone:l,fitViewOnInit:c,nodeOrigin:f}=e(),d=t.initial&&!l&&c;if(s&&u&&(d||!t.initial)){const _=r().filter(v=>{const p=t.includeHiddenNodes?v.width&&v.height:!v.hidden;return t.nodes?.length?p&&t.nodes.some(y=>y.id===v.id):p}),g=_.every(v=>v.width&&v.height);if(_.length>0&&g){const v=Er(_,f),{x:p,y,zoom:b}=Cv(v,n,i,t.minZoom??a,t.maxZoom??o,t.padding??.1),m=He.translate(p,y).scale(b);return typeof t.duration=="number"&&t.duration>0?s.transform(rt(u,t.duration),m):s.transform(u,m),!0}}return!1}function F0(e,t){return e.forEach(r=>{const n=t.get(r.id);n&&t.set(n.id,{...n,[se]:n[se],selected:r.selected})}),new Map(t)}function z0(e,t){return t.map(r=>{const n=e.find(i=>i.id===r.id);return n&&(r.selected=n.selected),r})}function er({changedNodes:e,changedEdges:t,get:r,set:n}){const{nodeInternals:i,edges:a,onNodesChange:o,onEdgesChange:s,hasDefaultNodes:u,hasDefaultEdges:l}=r();e?.length&&(u&&n({nodeInternals:F0(e,i)}),o?.(e)),t?.length&&(l&&n({edges:z0(t,a)}),s?.(t))}const dt=()=>{},B0={zoomIn:dt,zoomOut:dt,zoomTo:dt,getZoom:()=>1,setViewport:dt,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:dt,fitBounds:dt,project:e=>e,screenToFlowPosition:e=>e,flowToScreenPosition:e=>e,viewportInitialized:!1},H0=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}),$0=()=>{const e=fe(),{d3Zoom:t,d3Selection:r}=ne(H0,he);return D.useMemo(()=>r&&t?{zoomIn:i=>t.scaleBy(rt(r,i?.duration),1.2),zoomOut:i=>t.scaleBy(rt(r,i?.duration),1/1.2),zoomTo:(i,a)=>t.scaleTo(rt(r,a?.duration),i),getZoom:()=>e.getState().transform[2],setViewport:(i,a)=>{const[o,s,u]=e.getState().transform,l=He.translate(i.x??o,i.y??s).scale(i.zoom??u);t.transform(rt(r,a?.duration),l)},getViewport:()=>{const[i,a,o]=e.getState().transform;return{x:i,y:a,zoom:o}},fitView:i=>Hv(e.getState,i),setCenter:(i,a,o)=>{const{width:s,height:u,maxZoom:l}=e.getState(),c=typeof o?.zoom<"u"?o.zoom:l,f=s/2-i*c,d=u/2-a*c,h=He.translate(f,d).scale(c);t.transform(rt(r,o?.duration),h)},fitBounds:(i,a)=>{const{width:o,height:s,minZoom:u,maxZoom:l}=e.getState(),{x:c,y:f,zoom:d}=Cv(i,o,s,u,l,a?.padding??.1),h=He.translate(c,f).scale(d);t.transform(rt(r,a?.duration),h)},project:i=>{const{transform:a,snapToGrid:o,snapGrid:s}=e.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),hu(i,a,o,s)},screenToFlowPosition:i=>{const{transform:a,snapToGrid:o,snapGrid:s,domNode:u}=e.getState();if(!u)return i;const{x:l,y:c}=u.getBoundingClientRect(),f={x:i.x-l,y:i.y-c};return hu(f,a,o,s)},flowToScreenPosition:i=>{const{transform:a,domNode:o}=e.getState();if(!o)return i;const{x:s,y:u}=o.getBoundingClientRect(),l=xv(i,a);return{x:l.x+s,y:l.y+u}},viewportInitialized:!0}:B0,[t,r])};function Tu(){const e=$0(),t=fe(),r=D.useCallback(()=>t.getState().getNodes().map(g=>({...g})),[]),n=D.useCallback(g=>t.getState().nodeInternals.get(g),[]),i=D.useCallback(()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},[]),a=D.useCallback(g=>{const{edges:v=[]}=t.getState();return v.find(p=>p.id===g)},[]),o=D.useCallback(g=>{const{getNodes:v,setNodes:p,hasDefaultNodes:y,onNodesChange:b}=t.getState(),m=v(),E=typeof g=="function"?g(m):g;if(y)p(E);else if(b){const x=E.length===0?m.map(S=>({type:"remove",id:S.id})):E.map(S=>({item:S,type:"reset"}));b(x)}},[]),s=D.useCallback(g=>{const{edges:v=[],setEdges:p,hasDefaultEdges:y,onEdgesChange:b}=t.getState(),m=typeof g=="function"?g(v):g;if(y)p(m);else if(b){const E=m.length===0?v.map(x=>({type:"remove",id:x.id})):m.map(x=>({item:x,type:"reset"}));b(E)}},[]),u=D.useCallback(g=>{const v=Array.isArray(g)?g:[g],{getNodes:p,setNodes:y,hasDefaultNodes:b,onNodesChange:m}=t.getState();if(b){const x=[...p(),...v];y(x)}else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),l=D.useCallback(g=>{const v=Array.isArray(g)?g:[g],{edges:p=[],setEdges:y,hasDefaultEdges:b,onEdgesChange:m}=t.getState();if(b)y([...p,...v]);else if(m){const E=v.map(x=>({item:x,type:"add"}));m(E)}},[]),c=D.useCallback(()=>{const{getNodes:g,edges:v=[],transform:p}=t.getState(),[y,b,m]=p;return{nodes:g().map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:y,y:b,zoom:m}}},[]),f=D.useCallback(({nodes:g,edges:v})=>{const{nodeInternals:p,getNodes:y,edges:b,hasDefaultNodes:m,hasDefaultEdges:E,onNodesDelete:x,onEdgesDelete:S,onNodesChange:N,onEdgesChange:q}=t.getState(),A=(g||[]).map(T=>T.id),I=(v||[]).map(T=>T.id),O=y().reduce((T,R)=>{const z=R.parentNode||R.parentId,H=!A.includes(R.id)&&z&&T.find(B=>B.id===z);return(typeof R.deletable!="boolean"||R.deletable)&&(A.includes(R.id)||H)&&T.push(R),T},[]),k=b.filter(T=>typeof T.deletable=="boolean"?T.deletable:!0),w=k.filter(T=>I.includes(T.id));if(O||w){const T=qv(O,k),R=[...w,...T],z=R.reduce((H,M)=>(H.includes(M.id)||H.push(M.id),H),[]);if((E||m)&&(E&&t.setState({edges:b.filter(H=>!z.includes(H.id))}),m&&(O.forEach(H=>{p.delete(H.id)}),t.setState({nodeInternals:new Map(p)}))),z.length>0&&(S?.(R),q&&q(z.map(H=>({id:H,type:"remove"})))),O.length>0&&(x?.(O),N)){const H=O.map(M=>({id:M.id,type:"remove"}));N(H)}}},[]),d=D.useCallback(g=>{const v=u0(g),p=v?null:t.getState().nodeInternals.get(g.id);return!v&&!p?[null,null,v]:[v?g:hc(p),p,v]},[]),h=D.useCallback((g,v=!0,p)=>{const[y,b,m]=d(g);return y?(p||t.getState().getNodes()).filter(E=>{if(!m&&(E.id===b.id||!E.positionAbsolute))return!1;const x=hc(E),S=cu(x,y);return v&&S>0||S>=y.width*y.height}):[]},[]),_=D.useCallback((g,v,p=!0)=>{const[y]=d(g);if(!y)return!1;const b=cu(y,v);return p&&b>0||b>=y.width*y.height},[]);return D.useMemo(()=>({...e,getNodes:r,getNode:n,getEdges:i,getEdge:a,setNodes:o,setEdges:s,addNodes:u,addEdges:l,toObject:c,deleteElements:f,getIntersectingNodes:h,isNodeIntersecting:_}),[e,r,n,i,a,o,s,u,l,c,f,h,_])}const V0={actInsideInputWithModifier:!1};var G0=({deleteKeyCode:e,multiSelectionKeyCode:t})=>{const r=fe(),{deleteElements:n}=Tu(),i=Ht(e,V0),a=Ht(t);D.useEffect(()=>{if(i){const{edges:o,getNodes:s}=r.getState(),u=s().filter(c=>c.selected),l=o.filter(c=>c.selected);n({nodes:u,edges:l}),r.setState({nodesSelectionActive:!1})}},[i]),D.useEffect(()=>{r.setState({multiSelectionActive:a})},[a])};function U0(e){const t=fe();D.useEffect(()=>{let r;const n=()=>{if(!e.current)return;const i=xu(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Ve.error004()),t.setState({width:i.width||500,height:i.height||500})};return n(),window.addEventListener("resize",n),e.current&&(r=new ResizeObserver(()=>n()),r.observe(e.current)),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}},[])}const Mu={position:"absolute",width:"100%",height:"100%",top:0,left:0},K0=(e,t)=>e.x!==t.x||e.y!==t.y||e.zoom!==t.k,tr=e=>({x:e.x,y:e.y,zoom:e.k}),ht=(e,t)=>e.target.closest(`.${t}`),xc=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Sc=e=>{const t=e.ctrlKey&&lr()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t},j0=e=>({d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler,userSelectionActive:e.userSelectionActive}),Y0=({onMove:e,onMoveStart:t,onMoveEnd:r,onPaneContextMenu:n,zoomOnScroll:i=!0,zoomOnPinch:a=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:u=nt.Free,zoomOnDoubleClick:l=!0,elementsSelectable:c,panOnDrag:f=!0,defaultViewport:d,translateExtent:h,minZoom:_,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:p=!0,children:y,noWheelClassName:b,noPanClassName:m})=>{const E=D.useRef(),x=fe(),S=D.useRef(!1),N=D.useRef(!1),q=D.useRef(null),A=D.useRef({x:0,y:0,zoom:0}),{d3Zoom:I,d3Selection:O,d3ZoomHandler:k,userSelectionActive:w}=ne(j0,he),T=Ht(v),R=D.useRef(0),z=D.useRef(!1),H=D.useRef();return U0(q),D.useEffect(()=>{if(q.current){const M=q.current.getBoundingClientRect(),B=fv().scaleExtent([_,g]).translateExtent(h),V=xe(q.current).call(B),G=He.translate(d.x,d.y).scale(bt(d.zoom,_,g)),U=[[0,0],[M.width,M.height]],C=B.constrain()(G,U,h);B.transform(V,C),B.wheelDelta(Sc),x.setState({d3Zoom:B,d3Selection:V,d3ZoomHandler:V.on("wheel.zoom"),transform:[C.x,C.y,C.k],domNode:q.current.closest(".react-flow")})}},[]),D.useEffect(()=>{O&&I&&(o&&!T&&!w?O.on("wheel.zoom",M=>{if(ht(M,b))return!1;M.preventDefault(),M.stopImmediatePropagation();const B=O.property("__zoom").k||1;if(M.ctrlKey&&a){const K=Ae(M),W=Sc(M),Z=B*Math.pow(2,W);I.scaleTo(O,Z,K,M);return}const V=M.deltaMode===1?20:1;let G=u===nt.Vertical?0:M.deltaX*V,U=u===nt.Horizontal?0:M.deltaY*V;!lr()&&M.shiftKey&&u!==nt.Vertical&&(G=M.deltaY*V,U=0),I.translateBy(O,-(G/B)*s,-(U/B)*s,{internal:!0});const C=tr(O.property("__zoom")),{onViewportChangeStart:P,onViewportChange:F,onViewportChangeEnd:$}=x.getState();clearTimeout(H.current),z.current||(z.current=!0,t?.(M,C),P?.(C)),z.current&&(e?.(M,C),F?.(C),H.current=setTimeout(()=>{r?.(M,C),$?.(C),z.current=!1},150))},{passive:!1}):typeof k<"u"&&O.on("wheel.zoom",function(M,B){if(!p&&M.type==="wheel"&&!M.ctrlKey||ht(M,b))return null;M.preventDefault(),k.call(this,M,B)},{passive:!1}))},[w,o,u,O,I,k,T,a,p,b,t,e,r]),D.useEffect(()=>{I&&I.on("start",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;R.current=M.sourceEvent?.button;const{onViewportChangeStart:B}=x.getState(),V=tr(M.transform);S.current=!0,A.current=V,M.sourceEvent?.type==="mousedown"&&x.setState({paneDragging:!0}),B?.(V),t?.(M.sourceEvent,V)})},[I,t]),D.useEffect(()=>{I&&(w&&!S.current?I.on("zoom",null):w||I.on("zoom",M=>{const{onViewportChange:B}=x.getState();if(x.setState({transform:[M.transform.x,M.transform.y,M.transform.k]}),N.current=!!(n&&xc(f,R.current??0)),(e||B)&&!M.sourceEvent?.internal){const V=tr(M.transform);B?.(V),e?.(M.sourceEvent,V)}}))},[w,I,e,f,n]),D.useEffect(()=>{I&&I.on("end",M=>{if(!M.sourceEvent||M.sourceEvent.internal)return null;const{onViewportChangeEnd:B}=x.getState();if(S.current=!1,x.setState({paneDragging:!1}),n&&xc(f,R.current??0)&&!N.current&&n(M.sourceEvent),N.current=!1,(r||B)&&K0(A.current,M.transform)){const V=tr(M.transform);A.current=V,clearTimeout(E.current),E.current=setTimeout(()=>{B?.(V),r?.(M.sourceEvent,V)},o?150:0)}})},[I,o,f,r,n]),D.useEffect(()=>{I&&I.filter(M=>{const B=T||i,V=a&&M.ctrlKey;if((f===!0||Array.isArray(f)&&f.includes(1))&&M.button===1&&M.type==="mousedown"&&(ht(M,"react-flow__node")||ht(M,"react-flow__edge")))return!0;if(!f&&!B&&!o&&!l&&!a||w||!l&&M.type==="dblclick"||ht(M,b)&&M.type==="wheel"||ht(M,m)&&(M.type!=="wheel"||o&&M.type==="wheel"&&!T)||!a&&M.ctrlKey&&M.type==="wheel"||!B&&!o&&!V&&M.type==="wheel"||!f&&(M.type==="mousedown"||M.type==="touchstart")||Array.isArray(f)&&!f.includes(M.button)&&M.type==="mousedown")return!1;const G=Array.isArray(f)&&f.includes(M.button)||!M.button||M.button<=1;return(!M.ctrlKey||M.type==="wheel")&&G})},[w,I,i,a,o,l,f,c,T]),L.createElement("div",{className:"react-flow__renderer",ref:q,style:Mu},y)},W0=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Z0(){const{userSelectionActive:e,userSelectionRect:t}=ne(W0,he);return e&&t?L.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}function qc(e,t){const r=t.parentNode||t.parentId,n=e.find(i=>i.id===r);if(n){const i=t.position.x+t.width-n.width,a=t.position.y+t.height-n.height;if(i>0||a>0||t.position.x<0||t.position.y<0){if(n.style={...n.style},n.style.width=n.style.width??n.width,n.style.height=n.style.height??n.height,i>0&&(n.style.width+=i),a>0&&(n.style.height+=a),t.position.x<0){const o=Math.abs(t.position.x);n.position.x=n.position.x-o,n.style.width+=o,t.position.x=0}if(t.position.y<0){const o=Math.abs(t.position.y);n.position.y=n.position.y-o,n.style.height+=o,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function X0(e,t){if(e.some(n=>n.type==="reset"))return e.filter(n=>n.type==="reset").map(n=>n.item);const r=e.filter(n=>n.type==="add").map(n=>n.item);return t.reduce((n,i)=>{const a=e.filter(s=>s.id===i.id);if(a.length===0)return n.push(i),n;const o={...i};for(const s of a)if(s)switch(s.type){case"select":{o.selected=s.selected;break}case"position":{typeof s.position<"u"&&(o.position=s.position),typeof s.positionAbsolute<"u"&&(o.positionAbsolute=s.positionAbsolute),typeof s.dragging<"u"&&(o.dragging=s.dragging),o.expandParent&&qc(n,o);break}case"dimensions":{typeof s.dimensions<"u"&&(o.width=s.dimensions.width,o.height=s.dimensions.height),typeof s.updateStyle<"u"&&(o.style={...o.style||{},...s.dimensions}),typeof s.resizing=="boolean"&&(o.resizing=s.resizing),o.expandParent&&qc(n,o);break}case"remove":return n}return n.push(o),n},r)}function J0(e,t){return X0(e,t)}const Ze=(e,t)=>({id:e,type:"select",selected:t});function vt(e,t){return e.reduce((r,n)=>{const i=t.includes(n.id);return!n.selected&&i?(n.selected=!0,r.push(Ze(n.id,!0))):n.selected&&!i&&(n.selected=!1,r.push(Ze(n.id,!1))),r},[])}const Yr=(e,t)=>r=>{r.target===t.current&&e?.(r)},Q0=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}),$v=D.memo(({isSelecting:e,selectionMode:t=Bt.Full,panOnDrag:r,onSelectionStart:n,onSelectionEnd:i,onPaneClick:a,onPaneContextMenu:o,onPaneScroll:s,onPaneMouseEnter:u,onPaneMouseMove:l,onPaneMouseLeave:c,children:f})=>{const d=D.useRef(null),h=fe(),_=D.useRef(0),g=D.useRef(0),v=D.useRef(),{userSelectionActive:p,elementsSelectable:y,dragging:b}=ne(Q0,he),m=()=>{h.setState({userSelectionActive:!1,userSelectionRect:null}),_.current=0,g.current=0},E=k=>{a?.(k),h.getState().resetSelectedElements(),h.setState({nodesSelectionActive:!1})},x=k=>{if(Array.isArray(r)&&r?.includes(2)){k.preventDefault();return}o?.(k)},S=s?k=>s(k):void 0,N=k=>{const{resetSelectedElements:w,domNode:T}=h.getState();if(v.current=T?.getBoundingClientRect(),!y||!e||k.button!==0||k.target!==d.current||!v.current)return;const{x:R,y:z}=Je(k,v.current);w(),h.setState({userSelectionRect:{width:0,height:0,startX:R,startY:z,x:R,y:z}}),n?.(k)},q=k=>{const{userSelectionRect:w,nodeInternals:T,edges:R,transform:z,onNodesChange:H,onEdgesChange:M,nodeOrigin:B,getNodes:V}=h.getState();if(!e||!v.current||!w)return;h.setState({userSelectionActive:!0,nodesSelectionActive:!1});const G=Je(k,v.current),U=w.startX??0,C=w.startY??0,P={...w,x:G.x<U?G.x:U,y:G.y<C?G.y:C,width:Math.abs(G.x-U),height:Math.abs(G.y-C)},F=V(),$=Sv(T,P,z,t===Bt.Partial,!0,B),K=qv($,R).map(Z=>Z.id),W=$.map(Z=>Z.id);if(_.current!==W.length){_.current=W.length;const Z=vt(F,W);Z.length&&H?.(Z)}if(g.current!==K.length){g.current=K.length;const Z=vt(R,K);Z.length&&M?.(Z)}h.setState({userSelectionRect:P})},A=k=>{if(k.button!==0)return;const{userSelectionRect:w}=h.getState();!p&&w&&k.target===d.current&&E?.(k),h.setState({nodesSelectionActive:_.current>0}),m(),i?.(k)},I=k=>{p&&(h.setState({nodesSelectionActive:_.current>0}),i?.(k)),m()},O=y&&(e||p);return L.createElement("div",{className:pe(["react-flow__pane",{dragging:b,selection:e}]),onClick:O?void 0:Yr(E,d),onContextMenu:Yr(x,d),onWheel:Yr(S,d),onMouseEnter:O?void 0:u,onMouseDown:O?N:void 0,onMouseMove:O?q:l,onMouseUp:O?A:void 0,onMouseLeave:O?I:c,ref:d,style:Mu},f,L.createElement(Z0,null))});$v.displayName="Pane";function Vv(e,t){const r=e.parentNode||e.parentId;if(!r)return!1;const n=t.get(r);return n?n.selected?!0:Vv(n,t):!1}function Cc(e,t,r){let n=e;do{if(n?.matches(t))return!0;if(n===r.current)return!1;n=n.parentElement}while(n);return!1}function ew(e,t,r,n){return Array.from(e.values()).filter(i=>(i.selected||i.id===n)&&(!i.parentNode||i.parentId||!Vv(i,e))&&(i.draggable||t&&typeof i.draggable>"u")).map(i=>({id:i.id,position:i.position||{x:0,y:0},positionAbsolute:i.positionAbsolute||{x:0,y:0},distance:{x:r.x-(i.positionAbsolute?.x??0),y:r.y-(i.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:i.extent,parentNode:i.parentNode||i.parentId,parentId:i.parentNode||i.parentId,width:i.width,height:i.height,expandParent:i.expandParent}))}function tw(e,t){return!t||t==="parent"?t:[t[0],[t[1][0]-(e.width||0),t[1][1]-(e.height||0)]]}function Gv(e,t,r,n,i=[0,0],a){const o=tw(e,e.extent||n);let s=o;const u=e.parentNode||e.parentId;if(e.extent==="parent"&&!e.expandParent)if(u&&e.width&&e.height){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=f&&Se(d)&&Se(h)&&Se(f.width)&&Se(f.height)?[[d+e.width*i[0],h+e.height*i[1]],[d+f.width-e.width+e.width*i[0],h+f.height-e.height+e.height*i[1]]]:s}else a?.("005",Ve.error005()),s=o;else if(e.extent&&u&&e.extent!=="parent"){const f=r.get(u),{x:d,y:h}=it(f,i).positionAbsolute;s=[[e.extent[0][0]+d,e.extent[0][1]+h],[e.extent[1][0]+d,e.extent[1][1]+h]]}let l={x:0,y:0};if(u){const f=r.get(u);l=it(f,i).positionAbsolute}const c=s&&s!=="parent"?Su(t,s):t;return{position:{x:c.x-l.x,y:c.y-l.y},positionAbsolute:c}}function Wr({nodeId:e,dragItems:t,nodeInternals:r}){const n=t.map(i=>({...r.get(i.id),position:i.position,positionAbsolute:i.positionAbsolute}));return[e?n.find(i=>i.id===e):n[0],n]}const Rc=(e,t,r,n)=>{const i=t.querySelectorAll(e);if(!i||!i.length)return null;const a=Array.from(i),o=t.getBoundingClientRect(),s={x:o.width*n[0],y:o.height*n[1]};return a.map(u=>{const l=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),position:u.getAttribute("data-handlepos"),x:(l.left-o.left-s.x)/r,y:(l.top-o.top-s.y)/r,...xu(u)}})};function Nt(e,t,r){return r===void 0?r:n=>{const i=t().nodeInternals.get(e);i&&r(n,{...i})}}function vu({id:e,store:t,unselect:r=!1,nodeRef:n}){const{addSelectedNodes:i,unselectNodesAndEdges:a,multiSelectionActive:o,nodeInternals:s,onError:u}=t.getState(),l=s.get(e);if(!l){u?.("012",Ve.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(r||l.selected&&o)&&(a({nodes:[l],edges:[]}),requestAnimationFrame(()=>n?.current?.blur())):i([e])}function rw(){const e=fe();return D.useCallback(({sourceEvent:r})=>{const{transform:n,snapGrid:i,snapToGrid:a}=e.getState(),o=r.touches?r.touches[0].clientX:r.clientX,s=r.touches?r.touches[0].clientY:r.clientY,u={x:(o-n[0])/n[2],y:(s-n[1])/n[2]};return{xSnapped:a?i[0]*Math.round(u.x/i[0]):u.x,ySnapped:a?i[1]*Math.round(u.y/i[1]):u.y,...u}},[])}function Zr(e){return(t,r,n)=>e?.(t,n)}function Uv({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:n,nodeId:i,isSelectable:a,selectNodesOnDrag:o}){const s=fe(),[u,l]=D.useState(!1),c=D.useRef([]),f=D.useRef({x:null,y:null}),d=D.useRef(0),h=D.useRef(null),_=D.useRef({x:0,y:0}),g=D.useRef(null),v=D.useRef(!1),p=D.useRef(!1),y=D.useRef(!1),b=rw();return D.useEffect(()=>{if(e?.current){const m=xe(e.current),E=({x:N,y:q})=>{const{nodeInternals:A,onNodeDrag:I,onSelectionDrag:O,updateNodePositions:k,nodeExtent:w,snapGrid:T,snapToGrid:R,nodeOrigin:z,onError:H}=s.getState();f.current={x:N,y:q};let M=!1,B={x:0,y:0,x2:0,y2:0};if(c.current.length>1&&w){const G=Er(c.current,z);B=zt(G)}if(c.current=c.current.map(G=>{const U={x:N-G.distance.x,y:q-G.distance.y};R&&(U.x=T[0]*Math.round(U.x/T[0]),U.y=T[1]*Math.round(U.y/T[1]));const C=[[w[0][0],w[0][1]],[w[1][0],w[1][1]]];c.current.length>1&&w&&!G.extent&&(C[0][0]=G.positionAbsolute.x-B.x+w[0][0],C[1][0]=G.positionAbsolute.x+(G.width??0)-B.x2+w[1][0],C[0][1]=G.positionAbsolute.y-B.y+w[0][1],C[1][1]=G.positionAbsolute.y+(G.height??0)-B.y2+w[1][1]);const P=Gv(G,U,A,C,z,H);return M=M||G.position.x!==P.position.x||G.position.y!==P.position.y,G.position=P.position,G.positionAbsolute=P.positionAbsolute,G}),!M)return;k(c.current,!0,!0),l(!0);const V=i?I:Zr(O);if(V&&g.current){const[G,U]=Wr({nodeId:i,dragItems:c.current,nodeInternals:A});V(g.current,G,U)}},x=()=>{if(!h.current)return;const[N,q]=hv(_.current,h.current);if(N!==0||q!==0){const{transform:A,panBy:I}=s.getState();f.current.x=(f.current.x??0)-N/A[2],f.current.y=(f.current.y??0)-q/A[2],I({x:N,y:q})&&E(f.current)}d.current=requestAnimationFrame(x)},S=N=>{const{nodeInternals:q,multiSelectionActive:A,nodesDraggable:I,unselectNodesAndEdges:O,onNodeDragStart:k,onSelectionDragStart:w}=s.getState();p.current=!0;const T=i?k:Zr(w);(!o||!a)&&!A&&i&&(q.get(i)?.selected||O()),i&&a&&o&&vu({id:i,store:s,nodeRef:e});const R=b(N);if(f.current=R,c.current=ew(q,I,R,i),T&&c.current){const[z,H]=Wr({nodeId:i,dragItems:c.current,nodeInternals:q});T(N.sourceEvent,z,H)}};if(t)m.on(".drag",null);else{const N=F_().on("start",q=>{const{domNode:A,nodeDragThreshold:I}=s.getState();I===0&&S(q),y.current=!1;const O=b(q);f.current=O,h.current=A?.getBoundingClientRect()||null,_.current=Je(q.sourceEvent,h.current)}).on("drag",q=>{const A=b(q),{autoPanOnNodeDrag:I,nodeDragThreshold:O}=s.getState();if(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1&&(y.current=!0),!y.current){if(!v.current&&p.current&&I&&(v.current=!0,x()),!p.current){const k=A.xSnapped-(f?.current?.x??0),w=A.ySnapped-(f?.current?.y??0);Math.sqrt(k*k+w*w)>O&&S(q)}(f.current.x!==A.xSnapped||f.current.y!==A.ySnapped)&&c.current&&p.current&&(g.current=q.sourceEvent,_.current=Je(q.sourceEvent,h.current),E(A))}}).on("end",q=>{if(!(!p.current||y.current)&&(l(!1),v.current=!1,p.current=!1,cancelAnimationFrame(d.current),c.current)){const{updateNodePositions:A,nodeInternals:I,onNodeDragStop:O,onSelectionDragStop:k}=s.getState(),w=i?O:Zr(k);if(A(c.current,!1,!1),w){const[T,R]=Wr({nodeId:i,dragItems:c.current,nodeInternals:I});w(q.sourceEvent,T,R)}}}).filter(q=>{const A=q.target;return!q.button&&(!r||!Cc(A,`.${r}`,e))&&(!n||Cc(A,n,e))});return m.call(N),()=>{m.on(".drag",null)}}}},[e,t,r,n,a,s,i,o,b]),u}function Kv(){const e=fe();return D.useCallback(r=>{const{nodeInternals:n,nodeExtent:i,updateNodePositions:a,getNodes:o,snapToGrid:s,snapGrid:u,onError:l,nodesDraggable:c}=e.getState(),f=o().filter(y=>y.selected&&(y.draggable||c&&typeof y.draggable>"u")),d=s?u[0]:5,h=s?u[1]:5,_=r.isShiftPressed?4:1,g=r.x*d*_,v=r.y*h*_,p=f.map(y=>{if(y.positionAbsolute){const b={x:y.positionAbsolute.x+g,y:y.positionAbsolute.y+v};s&&(b.x=u[0]*Math.round(b.x/u[0]),b.y=u[1]*Math.round(b.y/u[1]));const{positionAbsolute:m,position:E}=Gv(y,b,n,i,void 0,l);y.position=E,y.positionAbsolute=m}return y});a(p,!0,!1)},[])}const yt={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var It=e=>{const t=({id:r,type:n,data:i,xPos:a,yPos:o,xPosOrigin:s,yPosOrigin:u,selected:l,onClick:c,onMouseEnter:f,onMouseMove:d,onMouseLeave:h,onContextMenu:_,onDoubleClick:g,style:v,className:p,isDraggable:y,isSelectable:b,isConnectable:m,isFocusable:E,selectNodesOnDrag:x,sourcePosition:S,targetPosition:N,hidden:q,resizeObserver:A,dragHandle:I,zIndex:O,isParent:k,noDragClassName:w,noPanClassName:T,initialized:R,disableKeyboardA11y:z,ariaLabel:H,rfId:M,hasHandleBounds:B})=>{const V=fe(),G=D.useRef(null),U=D.useRef(null),C=D.useRef(S),P=D.useRef(N),F=D.useRef(n),$=b||y||c||f||d||h,K=Kv(),W=Nt(r,V.getState,f),Z=Nt(r,V.getState,d),te=Nt(r,V.getState,h),ie=Nt(r,V.getState,_),re=Nt(r,V.getState,g),ee=j=>{const{nodeDragThreshold:Y}=V.getState();if(b&&(!x||!y||Y>0)&&vu({id:r,store:V,nodeRef:G}),c){const oe=V.getState().nodeInternals.get(r);oe&&c(j,{...oe})}},X=j=>{if(!lu(j)&&!z)if(yv.includes(j.key)&&b){const Y=j.key==="Escape";vu({id:r,store:V,unselect:Y,nodeRef:G})}else y&&l&&Object.prototype.hasOwnProperty.call(yt,j.key)&&(V.setState({ariaLiveMessage:`Moved selected node ${j.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~a}, y: ${~~o}`}),K({x:yt[j.key].x,y:yt[j.key].y,isShiftPressed:j.shiftKey}))};D.useEffect(()=>()=>{U.current&&(A?.unobserve(U.current),U.current=null)},[]),D.useEffect(()=>{if(G.current&&!q){const j=G.current;(!R||!B||U.current!==j)&&(U.current&&A?.unobserve(U.current),A?.observe(j),U.current=j)}},[q,R,B]),D.useEffect(()=>{const j=F.current!==n,Y=C.current!==S,oe=P.current!==N;G.current&&(j||Y||oe)&&(j&&(F.current=n),Y&&(C.current=S),oe&&(P.current=N),V.getState().updateNodeDimensions([{id:r,nodeElement:G.current,forceUpdate:!0}]))},[r,n,S,N]);const ue=Uv({nodeRef:G,disabled:q||!y,noDragClassName:w,handleSelector:I,nodeId:r,isSelectable:b,selectNodesOnDrag:x});return q?null:L.createElement("div",{className:pe(["react-flow__node",`react-flow__node-${n}`,{[T]:y},p,{selected:l,selectable:b,parent:k,dragging:ue}]),ref:G,style:{zIndex:O,transform:`translate(${s}px,${u}px)`,pointerEvents:$?"all":"none",visibility:R?"visible":"hidden",...v},"data-id":r,"data-testid":`rf__node-${r}`,onMouseEnter:W,onMouseMove:Z,onMouseLeave:te,onContextMenu:ie,onClick:ee,onDoubleClick:re,onKeyDown:E?X:void 0,tabIndex:E?0:void 0,role:E?"button":void 0,"aria-describedby":z?void 0:`${Lv}-${M}`,"aria-label":H},L.createElement(v0,{value:r},L.createElement(e,{id:r,data:i,type:n,xPos:a,yPos:o,selected:l,isConnectable:m,sourcePosition:S,targetPosition:N,dragging:ue,dragHandle:I,zIndex:O})))};return t.displayName="NodeWrapper",D.memo(t)};const nw=e=>{const t=e.getNodes().filter(r=>r.selected);return{...Er(t,e.nodeOrigin),transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`,userSelectionActive:e.userSelectionActive}};function iw({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const n=fe(),{width:i,height:a,x:o,y:s,transformString:u,userSelectionActive:l}=ne(nw,he),c=Kv(),f=D.useRef(null);if(D.useEffect(()=>{r||f.current?.focus({preventScroll:!0})},[r]),Uv({nodeRef:f}),l||!i||!a)return null;const d=e?_=>{const g=n.getState().getNodes().filter(v=>v.selected);e(_,g)}:void 0,h=_=>{Object.prototype.hasOwnProperty.call(yt,_.key)&&c({x:yt[_.key].x,y:yt[_.key].y,isShiftPressed:_.shiftKey})};return L.createElement("div",{className:pe(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u}},L.createElement("div",{ref:f,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:r?void 0:-1,onKeyDown:r?void 0:h,style:{width:i,height:a,top:s,left:o}}))}var aw=D.memo(iw);const ow=e=>e.nodesSelectionActive,jv=({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,deleteKeyCode:s,onMove:u,onMoveStart:l,onMoveEnd:c,selectionKeyCode:f,selectionOnDrag:d,selectionMode:h,onSelectionStart:_,onSelectionEnd:g,multiSelectionKeyCode:v,panActivationKeyCode:p,zoomActivationKeyCode:y,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:x,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:A,defaultViewport:I,translateExtent:O,minZoom:k,maxZoom:w,preventScrolling:T,onSelectionContextMenu:R,noWheelClassName:z,noPanClassName:H,disableKeyboardA11y:M})=>{const B=ne(ow),V=Ht(f),G=Ht(p),U=G||A,C=G||x,P=V||d&&U!==!0;return G0({deleteKeyCode:s,multiSelectionKeyCode:v}),L.createElement(Y0,{onMove:u,onMoveStart:l,onMoveEnd:c,onPaneContextMenu:a,elementsSelectable:b,zoomOnScroll:m,zoomOnPinch:E,panOnScroll:C,panOnScrollSpeed:S,panOnScrollMode:N,zoomOnDoubleClick:q,panOnDrag:!V&&U,defaultViewport:I,translateExtent:O,minZoom:k,maxZoom:w,zoomActivationKeyCode:y,preventScrolling:T,noWheelClassName:z,noPanClassName:H},L.createElement($v,{onSelectionStart:_,onSelectionEnd:g,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:n,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:o,panOnDrag:U,isSelecting:!!P,selectionMode:h},e,B&&L.createElement(aw,{onSelectionContextMenu:R,noPanClassName:H,disableKeyboardA11y:M})))};jv.displayName="FlowRenderer";var sw=D.memo(jv);function uw(e){return ne(D.useCallback(r=>e?Sv(r.nodeInternals,{x:0,y:0,width:r.width,height:r.height},r.transform,!0):r.getNodes(),[e]))}function cw(e){const t={input:It(e.input||Pv),default:It(e.default||pu),output:It(e.output||Ov),group:It(e.group||Iu)},r={},n=Object.keys(e).filter(i=>!["input","default","output","group"].includes(i)).reduce((i,a)=>(i[a]=It(e[a]||pu),i),r);return{...t,...n}}const lw=({x:e,y:t,width:r,height:n,origin:i})=>!r||!n?{x:e,y:t}:i[0]<0||i[1]<0||i[0]>1||i[1]>1?{x:e,y:t}:{x:e-r*i[0],y:t-n*i[1]},fw=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions,onError:e.onError}),Yv=e=>{const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:n,elementsSelectable:i,updateNodeDimensions:a,onError:o}=ne(fw,he),s=uw(e.onlyRenderVisibleElements),u=D.useRef(),l=D.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const c=new ResizeObserver(f=>{const d=f.map(h=>({id:h.target.getAttribute("data-id"),nodeElement:h.target,forceUpdate:!0}));a(d)});return u.current=c,c},[]);return D.useEffect(()=>()=>{u?.current?.disconnect()},[]),L.createElement("div",{className:"react-flow__nodes",style:Mu},s.map(c=>{let f=c.type||"default";e.nodeTypes[f]||(o?.("003",Ve.error003(f)),f="default");const d=e.nodeTypes[f]||e.nodeTypes.default,h=!!(c.draggable||t&&typeof c.draggable>"u"),_=!!(c.selectable||i&&typeof c.selectable>"u"),g=!!(c.connectable||r&&typeof c.connectable>"u"),v=!!(c.focusable||n&&typeof c.focusable>"u"),p=e.nodeExtent?Su(c.positionAbsolute,e.nodeExtent):c.positionAbsolute,y=p?.x??0,b=p?.y??0,m=lw({x:y,y:b,width:c.width??0,height:c.height??0,origin:e.nodeOrigin});return L.createElement(d,{key:c.id,id:c.id,className:c.className,style:c.style,type:f,data:c.data,sourcePosition:c.sourcePosition||J.Bottom,targetPosition:c.targetPosition||J.Top,hidden:c.hidden,xPos:y,yPos:b,xPosOrigin:m.x,yPosOrigin:m.y,selectNodesOnDrag:e.selectNodesOnDrag,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,selected:!!c.selected,isDraggable:h,isSelectable:_,isConnectable:g,isFocusable:v,resizeObserver:l,dragHandle:c.dragHandle,zIndex:c[se]?.z??0,isParent:!!c[se]?.isParent,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,initialized:!!c.width&&!!c.height,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,ariaLabel:c.ariaLabel,hasHandleBounds:!!c[se]?.handleBounds})}))};Yv.displayName="NodeRenderer";var dw=D.memo(Yv);const hw=(e,t,r)=>r===J.Left?e-t:r===J.Right?e+t:e,pw=(e,t,r)=>r===J.Top?e-t:r===J.Bottom?e+t:e,Ac="react-flow__edgeupdater",Nc=({position:e,centerX:t,centerY:r,radius:n=10,onMouseDown:i,onMouseEnter:a,onMouseOut:o,type:s})=>L.createElement("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:o,className:pe([Ac,`${Ac}-${s}`]),cx:hw(t,n,e),cy:pw(r,n,e),r:n,stroke:"transparent",fill:"transparent"}),vw=()=>!0;var pt=e=>{const t=({id:r,className:n,type:i,data:a,onClick:o,onEdgeDoubleClick:s,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,style:v,source:p,target:y,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,elementsSelectable:q,hidden:A,sourceHandleId:I,targetHandleId:O,onContextMenu:k,onMouseEnter:w,onMouseMove:T,onMouseLeave:R,reconnectRadius:z,onReconnect:H,onReconnectStart:M,onReconnectEnd:B,markerEnd:V,markerStart:G,rfId:U,ariaLabel:C,isFocusable:P,isReconnectable:F,pathOptions:$,interactionWidth:K,disableKeyboardA11y:W})=>{const Z=D.useRef(null),[te,ie]=D.useState(!1),[re,ee]=D.useState(!1),X=fe(),ue=D.useMemo(()=>`url('#${du(G,U)}')`,[G,U]),j=D.useMemo(()=>`url('#${du(V,U)}')`,[V,U]);if(A)return null;const Y=de=>{const{edges:we,addSelectedEdges:ve,unselectNodesAndEdges:ye,multiSelectionActive:lt}=X.getState(),Oe=we.find(et=>et.id===r);Oe&&(q&&(X.setState({nodesSelectionActive:!1}),Oe.selected&&lt?(ye({nodes:[],edges:[Oe]}),Z.current?.blur()):ve([r])),o&&o(de,Oe))},oe=At(r,X.getState,s),Ce=At(r,X.getState,k),Pe=At(r,X.getState,w),ge=At(r,X.getState,T),ce=At(r,X.getState,R),me=(de,we)=>{if(de.button!==0)return;const{edges:ve,isValidConnection:ye}=X.getState(),lt=we?y:p,Oe=(we?O:I)||null,et=we?"target":"source",Br=ye||vw,Hr=we,qt=ve.find(tt=>tt.id===r);ee(!0),M?.(de,qt,et);const $r=tt=>{ee(!1),B?.(tt,qt,et)};Nv({event:de,handleId:Oe,nodeId:lt,onConnect:tt=>H?.(qt,tt),isTarget:Hr,getState:X.getState,setState:X.setState,isValidConnection:Br,edgeUpdaterType:et,onReconnectEnd:$r})},Re=de=>me(de,!0),Le=de=>me(de,!1),ke=()=>ie(!0),be=()=>ie(!1),Fe=!q&&!o,Ye=de=>{if(!W&&yv.includes(de.key)&&q){const{unselectNodesAndEdges:we,addSelectedEdges:ve,edges:ye}=X.getState();de.key==="Escape"?(Z.current?.blur(),we({edges:[ye.find(Oe=>Oe.id===r)]})):ve([r])}};return L.createElement("g",{className:pe(["react-flow__edge",`react-flow__edge-${i}`,n,{selected:u,animated:l,inactive:Fe,updating:te}]),onClick:Y,onDoubleClick:oe,onContextMenu:Ce,onMouseEnter:Pe,onMouseMove:ge,onMouseLeave:ce,onKeyDown:P?Ye:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-testid":`rf__edge-${r}`,"aria-label":C===null?void 0:C||`Edge from ${p} to ${y}`,"aria-describedby":P?`${Fv}-${U}`:void 0,ref:Z},!re&&L.createElement(e,{id:r,source:p,target:y,selected:u,animated:l,label:c,labelStyle:f,labelShowBg:d,labelBgStyle:h,labelBgPadding:_,labelBgBorderRadius:g,data:a,style:v,sourceX:b,sourceY:m,targetX:E,targetY:x,sourcePosition:S,targetPosition:N,sourceHandleId:I,targetHandleId:O,markerStart:ue,markerEnd:j,pathOptions:$,interactionWidth:K}),F&&L.createElement(L.Fragment,null,(F==="source"||F===!0)&&L.createElement(Nc,{position:S,centerX:b,centerY:m,radius:z,onMouseDown:Re,onMouseEnter:ke,onMouseOut:be,type:"source"}),(F==="target"||F===!0)&&L.createElement(Nc,{position:N,centerX:E,centerY:x,radius:z,onMouseDown:Le,onMouseEnter:ke,onMouseOut:be,type:"target"})))};return t.displayName="EdgeWrapper",D.memo(t)};function gw(e){const t={default:pt(e.default||dr),straight:pt(e.bezier||Ru),step:pt(e.step||Cu),smoothstep:pt(e.step||wr),simplebezier:pt(e.simplebezier||qu)},r={},n=Object.keys(e).filter(i=>!["default","bezier"].includes(i)).reduce((i,a)=>(i[a]=pt(e[a]||dr),i),r);return{...t,...n}}function Ic(e,t,r=null){const n=(r?.x||0)+t.x,i=(r?.y||0)+t.y,a=r?.width||t.width,o=r?.height||t.height;switch(e){case J.Top:return{x:n+a/2,y:i};case J.Right:return{x:n+a,y:i+o/2};case J.Bottom:return{x:n+a/2,y:i+o};case J.Left:return{x:n,y:i+o/2}}}function Tc(e,t){return e?e.length===1||!t?e[0]:t&&e.find(r=>r.id===t)||null:null}const yw=(e,t,r,n,i,a)=>{const o=Ic(r,e,t),s=Ic(a,n,i);return{sourceX:o.x,sourceY:o.y,targetX:s.x,targetY:s.y}};function mw({sourcePos:e,targetPos:t,sourceWidth:r,sourceHeight:n,targetWidth:i,targetHeight:a,width:o,height:s,transform:u}){const l={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+r,t.x+i),y2:Math.max(e.y+n,t.y+a)};l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c=zt({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:o/u[2],height:s/u[2]}),f=Math.max(0,Math.min(c.x2,l.x2)-Math.max(c.x,l.x)),d=Math.max(0,Math.min(c.y2,l.y2)-Math.max(c.y,l.y));return Math.ceil(f*d)>0}function Mc(e){const t=e?.[se]?.handleBounds||null,r=t&&e?.width&&e?.height&&typeof e?.positionAbsolute?.x<"u"&&typeof e?.positionAbsolute?.y<"u";return[{x:e?.positionAbsolute?.x||0,y:e?.positionAbsolute?.y||0,width:e?.width||0,height:e?.height||0},t,!!r]}const _w=[{level:0,isMaxLevel:!0,edges:[]}];function bw(e,t,r=!1){let n=-1;const i=e.reduce((o,s)=>{const u=Se(s.zIndex);let l=u?s.zIndex:0;if(r){const c=t.get(s.target),f=t.get(s.source),d=s.selected||c?.selected||f?.selected,h=Math.max(f?.[se]?.z||0,c?.[se]?.z||0,1e3);l=(u?s.zIndex:0)+(d?h:0)}return o[l]?o[l].push(s):o[l]=[s],n=l>n?l:n,o},{}),a=Object.entries(i).map(([o,s])=>{const u=+o;return{edges:s,level:u,isMaxLevel:u===n}});return a.length===0?_w:a}function ww(e,t,r){const n=ne(D.useCallback(i=>e?i.edges.filter(a=>{const o=t.get(a.source),s=t.get(a.target);return o?.width&&o?.height&&s?.width&&s?.height&&mw({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:s.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:s.width,targetHeight:s.height,width:i.width,height:i.height,transform:i.transform})}):i.edges,[e,t]));return bw(n,t,r)}const Ew=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),xw=({color:e="none",strokeWidth:t=1})=>L.createElement("polyline",{style:{stroke:e,fill:e,strokeWidth:t},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),Pc={[fr.Arrow]:Ew,[fr.ArrowClosed]:xw};function Sw(e){const t=fe();return D.useMemo(()=>Object.prototype.hasOwnProperty.call(Pc,e)?Pc[e]:(t.getState().onError?.("009",Ve.error009(e)),null),[e])}const qw=({id:e,type:t,color:r,width:n=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:o,orient:s="auto-start-reverse"})=>{const u=Sw(t);return u?L.createElement("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${n}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:s,refX:"0",refY:"0"},L.createElement(u,{color:r,strokeWidth:o})):null},Cw=({defaultColor:e,rfId:t})=>r=>{const n=[];return r.edges.reduce((i,a)=>([a.markerStart,a.markerEnd].forEach(o=>{if(o&&typeof o=="object"){const s=du(o,t);n.includes(s)||(i.push({id:s,color:o.color||e,...o}),n.push(s))}}),i),[]).sort((i,a)=>i.id.localeCompare(a.id))},Wv=({defaultColor:e,rfId:t})=>{const r=ne(D.useCallback(Cw({defaultColor:e,rfId:t}),[e,t]),(n,i)=>!(n.length!==i.length||n.some((a,o)=>a.id!==i[o].id)));return L.createElement("defs",null,r.map(n=>L.createElement(qw,{id:n.id,key:n.id,type:n.type,color:n.color,width:n.width,height:n.height,markerUnits:n.markerUnits,strokeWidth:n.strokeWidth,orient:n.orient})))};Wv.displayName="MarkerDefinitions";var Rw=D.memo(Wv);const Aw=e=>({nodesConnectable:e.nodesConnectable,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals,onError:e.onError}),Zv=({defaultMarkerColor:e,onlyRenderVisibleElements:t,elevateEdgesOnSelect:r,rfId:n,edgeTypes:i,noPanClassName:a,onEdgeContextMenu:o,onEdgeMouseEnter:s,onEdgeMouseMove:u,onEdgeMouseLeave:l,onEdgeClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,children:v,disableKeyboardA11y:p})=>{const{edgesFocusable:y,edgesUpdatable:b,elementsSelectable:m,width:E,height:x,connectionMode:S,nodeInternals:N,onError:q}=ne(Aw,he),A=ww(t,N,r);return E?L.createElement(L.Fragment,null,A.map(({level:I,edges:O,isMaxLevel:k})=>L.createElement("svg",{key:I,style:{zIndex:I},width:E,height:x,className:"react-flow__edges react-flow__container"},k&&L.createElement(Rw,{defaultColor:e,rfId:n}),L.createElement("g",null,O.map(w=>{const[T,R,z]=Mc(N.get(w.source)),[H,M,B]=Mc(N.get(w.target));if(!z||!B)return null;let V=w.type||"default";i[V]||(q?.("011",Ve.error011(V)),V="default");const G=i[V]||i.default,U=S===ot.Strict?M.target:(M.target??[]).concat(M.source??[]),C=Tc(R.source,w.sourceHandle),P=Tc(U,w.targetHandle),F=C?.position||J.Bottom,$=P?.position||J.Top,K=!!(w.focusable||y&&typeof w.focusable>"u"),W=w.reconnectable||w.updatable,Z=typeof d<"u"&&(W||b&&typeof W>"u");if(!C||!P)return q?.("008",Ve.error008(C,w)),null;const{sourceX:te,sourceY:ie,targetX:re,targetY:ee}=yw(T,C,F,H,P,$);return L.createElement(G,{key:w.id,id:w.id,className:pe([w.className,a]),type:V,data:w.data,selected:!!w.selected,animated:!!w.animated,hidden:!!w.hidden,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,style:w.style,source:w.source,target:w.target,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerEnd:w.markerEnd,markerStart:w.markerStart,sourceX:te,sourceY:ie,targetX:re,targetY:ee,sourcePosition:F,targetPosition:$,elementsSelectable:m,onContextMenu:o,onMouseEnter:s,onMouseMove:u,onMouseLeave:l,onClick:c,onEdgeDoubleClick:f,onReconnect:d,onReconnectStart:h,onReconnectEnd:_,reconnectRadius:g,rfId:n,ariaLabel:w.ariaLabel,isFocusable:K,isReconnectable:Z,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth,disableKeyboardA11y:p})})))),v):null};Zv.displayName="EdgeRenderer";var Nw=D.memo(Zv);const Iw=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Tw({children:e}){const t=ne(Iw);return L.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:t}},e)}function Mw(e){const t=Tu(),r=D.useRef(!1);D.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const Pw={[J.Left]:J.Right,[J.Right]:J.Left,[J.Top]:J.Bottom,[J.Bottom]:J.Top},Xv=({nodeId:e,handleType:t,style:r,type:n=Xe.Bezier,CustomComponent:i,connectionStatus:a})=>{const{fromNode:o,handleId:s,toX:u,toY:l,connectionMode:c}=ne(D.useCallback(x=>({fromNode:x.nodeInternals.get(e),handleId:x.connectionHandleId,toX:(x.connectionPosition.x-x.transform[0])/x.transform[2],toY:(x.connectionPosition.y-x.transform[1])/x.transform[2],connectionMode:x.connectionMode}),[e]),he),f=o?.[se]?.handleBounds;let d=f?.[t];if(c===ot.Loose&&(d=d||f?.[t==="source"?"target":"source"]),!o||!d)return null;const h=s?d.find(x=>x.id===s):d[0],_=h?h.x+h.width/2:(o.width??0)/2,g=h?h.y+h.height/2:o.height??0,v=(o.positionAbsolute?.x??0)+_,p=(o.positionAbsolute?.y??0)+g,y=h?.position,b=y?Pw[y]:null;if(!y||!b)return null;if(i)return L.createElement(i,{connectionLineType:n,connectionLineStyle:r,fromNode:o,fromHandle:h,fromX:v,fromY:p,toX:u,toY:l,fromPosition:y,toPosition:b,connectionStatus:a});let m="";const E={sourceX:v,sourceY:p,sourcePosition:y,targetX:u,targetY:l,targetPosition:b};return n===Xe.Bezier?[m]=Ev(E):n===Xe.Step?[m]=fu({...E,borderRadius:0}):n===Xe.SmoothStep?[m]=fu(E):n===Xe.SimpleBezier?[m]=wv(E):m=`M${v},${p} ${u},${l}`,L.createElement("path",{d:m,fill:"none",className:"react-flow__connection-path",style:r})};Xv.displayName="ConnectionLine";const kw=e=>({nodeId:e.connectionNodeId,handleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height});function Ow({containerStyle:e,style:t,type:r,component:n}){const{nodeId:i,handleType:a,nodesConnectable:o,width:s,height:u,connectionStatus:l}=ne(kw,he);return!(i&&a&&s&&o)?null:L.createElement("svg",{style:e,width:s,height:u,className:"react-flow__edges react-flow__connectionline react-flow__container"},L.createElement("g",{className:pe(["react-flow__connection",l])},L.createElement(Xv,{nodeId:i,handleType:a,style:t,type:r,CustomComponent:n,connectionStatus:l})))}function kc(e,t){return D.useRef(null),fe(),D.useMemo(()=>t(e),[e])}const Jv=({nodeTypes:e,edgeTypes:t,onMove:r,onMoveStart:n,onMoveEnd:i,onInit:a,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:u,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,onSelectionContextMenu:_,onSelectionStart:g,onSelectionEnd:v,connectionLineType:p,connectionLineStyle:y,connectionLineComponent:b,connectionLineContainerStyle:m,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,deleteKeyCode:I,onlyRenderVisibleElements:O,elementsSelectable:k,selectNodesOnDrag:w,defaultViewport:T,translateExtent:R,minZoom:z,maxZoom:H,preventScrolling:M,defaultMarkerColor:B,zoomOnScroll:V,zoomOnPinch:G,panOnScroll:U,panOnScrollSpeed:C,panOnScrollMode:P,zoomOnDoubleClick:F,panOnDrag:$,onPaneClick:K,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneScroll:ie,onPaneContextMenu:re,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:j,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Pe,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,elevateEdgesOnSelect:Re,disableKeyboardA11y:Le,nodeOrigin:ke,nodeExtent:be,rfId:Fe})=>{const Ye=kc(e,cw),de=kc(t,gw);return Mw(a),L.createElement(sw,{onPaneClick:K,onPaneMouseEnter:W,onPaneMouseMove:Z,onPaneMouseLeave:te,onPaneContextMenu:re,onPaneScroll:ie,deleteKeyCode:I,selectionKeyCode:E,selectionOnDrag:x,selectionMode:S,onSelectionStart:g,onSelectionEnd:v,multiSelectionKeyCode:N,panActivationKeyCode:q,zoomActivationKeyCode:A,elementsSelectable:k,onMove:r,onMoveStart:n,onMoveEnd:i,zoomOnScroll:V,zoomOnPinch:G,zoomOnDoubleClick:F,panOnScroll:U,panOnScrollSpeed:C,panOnScrollMode:P,panOnDrag:$,defaultViewport:T,translateExtent:R,minZoom:z,maxZoom:H,onSelectionContextMenu:_,preventScrolling:M,noDragClassName:ge,noWheelClassName:ce,noPanClassName:me,disableKeyboardA11y:Le},L.createElement(Tw,null,L.createElement(Nw,{edgeTypes:de,onEdgeClick:s,onEdgeDoubleClick:l,onlyRenderVisibleElements:O,onEdgeContextMenu:ee,onEdgeMouseEnter:X,onEdgeMouseMove:ue,onEdgeMouseLeave:j,onReconnect:Y,onReconnectStart:oe,onReconnectEnd:Ce,reconnectRadius:Pe,defaultMarkerColor:B,noPanClassName:me,elevateEdgesOnSelect:!!Re,disableKeyboardA11y:Le,rfId:Fe},L.createElement(Ow,{style:y,type:p,component:b,containerStyle:m})),L.createElement("div",{className:"react-flow__edgelabel-renderer"}),L.createElement(dw,{nodeTypes:Ye,onNodeClick:o,onNodeDoubleClick:u,onNodeMouseEnter:c,onNodeMouseMove:f,onNodeMouseLeave:d,onNodeContextMenu:h,selectNodesOnDrag:w,onlyRenderVisibleElements:O,noPanClassName:me,noDragClassName:ge,disableKeyboardA11y:Le,nodeOrigin:ke,nodeExtent:be,rfId:Fe})))};Jv.displayName="GraphView";var Dw=D.memo(Jv);const gu=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],We={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:gu,nodeExtent:gu,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ot.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:c0,isValidConnection:void 0},Lw=()=>Zy((e,t)=>({...We,setNodes:r=>{const{nodeInternals:n,nodeOrigin:i,elevateNodesOnSelect:a}=t();e({nodeInternals:jr(r,n,i,a)})},getNodes:()=>Array.from(t().nodeInternals.values()),setEdges:r=>{const{defaultEdgeOptions:n={}}=t();e({edges:r.map(i=>({...n,...i}))})},setDefaultNodesAndEdges:(r,n)=>{const i=typeof r<"u",a=typeof n<"u",o=i?jr(r,new Map,t().nodeOrigin,t().elevateNodesOnSelect):new Map;e({nodeInternals:o,edges:a?n:[],hasDefaultNodes:i,hasDefaultEdges:a})},updateNodeDimensions:r=>{const{onNodesChange:n,nodeInternals:i,fitViewOnInit:a,fitViewOnInitDone:o,fitViewOnInitOptions:s,domNode:u,nodeOrigin:l}=t(),c=u?.querySelector(".react-flow__viewport");if(!c)return;const f=window.getComputedStyle(c),{m22:d}=new window.DOMMatrixReadOnly(f.transform),h=r.reduce((g,v)=>{const p=i.get(v.id);if(p?.hidden)i.set(p.id,{...p,[se]:{...p[se],handleBounds:void 0}});else if(p){const y=xu(v.nodeElement);y.width&&y.height&&(p.width!==y.width||p.height!==y.height||v.forceUpdate)&&(i.set(p.id,{...p,[se]:{...p[se],handleBounds:{source:Rc(".source",v.nodeElement,d,l),target:Rc(".target",v.nodeElement,d,l)}},...y}),g.push({id:p.id,type:"dimensions",dimensions:y}))}return g},[]);Bv(i,l);const _=o||a&&!o&&Hv(t,{initial:!0,...s});e({nodeInternals:new Map(i),fitViewOnInitDone:_}),h?.length>0&&n?.(h)},updateNodePositions:(r,n=!0,i=!1)=>{const{triggerNodeChanges:a}=t(),o=r.map(s=>{const u={id:s.id,type:"position",dragging:i};return n&&(u.positionAbsolute=s.positionAbsolute,u.position=s.position),u});a(o)},triggerNodeChanges:r=>{const{onNodesChange:n,nodeInternals:i,hasDefaultNodes:a,nodeOrigin:o,getNodes:s,elevateNodesOnSelect:u}=t();if(r?.length){if(a){const l=J0(r,s()),c=jr(l,i,o,u);e({nodeInternals:c})}n?.(r)}},addSelectedNodes:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=vt(a(),r),s=vt(i,[])),er({changedNodes:o,changedEdges:s,get:t,set:e})},addSelectedEdges:r=>{const{multiSelectionActive:n,edges:i,getNodes:a}=t();let o,s=null;n?o=r.map(u=>Ze(u,!0)):(o=vt(i,r),s=vt(a(),[])),er({changedNodes:s,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:({nodes:r,edges:n}={})=>{const{edges:i,getNodes:a}=t(),o=r||a(),s=n||i,u=o.map(c=>(c.selected=!1,Ze(c.id,!1))),l=s.map(c=>Ze(c.id,!1));er({changedNodes:u,changedEdges:l,get:t,set:e})},setMinZoom:r=>{const{d3Zoom:n,maxZoom:i}=t();n?.scaleExtent([r,i]),e({minZoom:r})},setMaxZoom:r=>{const{d3Zoom:n,minZoom:i}=t();n?.scaleExtent([i,r]),e({maxZoom:r})},setTranslateExtent:r=>{t().d3Zoom?.translateExtent(r),e({translateExtent:r})},resetSelectedElements:()=>{const{edges:r,getNodes:n}=t(),a=n().filter(s=>s.selected).map(s=>Ze(s.id,!1)),o=r.filter(s=>s.selected).map(s=>Ze(s.id,!1));er({changedNodes:a,changedEdges:o,get:t,set:e})},setNodeExtent:r=>{const{nodeInternals:n}=t();n.forEach(i=>{i.positionAbsolute=Su(i.position,r)}),e({nodeExtent:r,nodeInternals:new Map(n)})},panBy:r=>{const{transform:n,width:i,height:a,d3Zoom:o,d3Selection:s,translateExtent:u}=t();if(!o||!s||!r.x&&!r.y)return!1;const l=He.translate(n[0]+r.x,n[1]+r.y).scale(n[2]),c=[[0,0],[i,a]],f=o?.constrain()(l,c,u);return o.transform(s,f),n[0]!==f.x||n[1]!==f.y||n[2]!==f.k},cancelConnection:()=>e({connectionNodeId:We.connectionNodeId,connectionHandleId:We.connectionHandleId,connectionHandleType:We.connectionHandleType,connectionStatus:We.connectionStatus,connectionStartHandle:We.connectionStartHandle,connectionEndHandle:We.connectionEndHandle}),reset:()=>e({...We})}),Object.is),Qv=({children:e})=>{const t=D.useRef(null);return t.current||(t.current=Lw()),L.createElement(r0,{value:t.current},e)};Qv.displayName="ReactFlowProvider";const eg=({children:e})=>D.useContext(br)?L.createElement(L.Fragment,null,e):L.createElement(Qv,null,e);eg.displayName="ReactFlowWrapper";const Fw={input:Pv,default:pu,output:Ov,group:Iu},zw={default:dr,straight:Ru,step:Cu,smoothstep:wr,simplebezier:qu},Bw=[0,0],Hw=[15,15],$w={x:0,y:0,zoom:1},Vw={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},Gw=D.forwardRef(({nodes:e,edges:t,defaultNodes:r,defaultEdges:n,className:i,nodeTypes:a=Fw,edgeTypes:o=zw,onNodeClick:s,onEdgeClick:u,onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onNodesDelete:A,onEdgesDelete:I,onSelectionChange:O,onSelectionDragStart:k,onSelectionDrag:w,onSelectionDragStop:T,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:H,connectionMode:M=ot.Strict,connectionLineType:B=Xe.Bezier,connectionLineStyle:V,connectionLineComponent:G,connectionLineContainerStyle:U,deleteKeyCode:C="Backspace",selectionKeyCode:P="Shift",selectionOnDrag:F=!1,selectionMode:$=Bt.Full,panActivationKeyCode:K="Space",multiSelectionKeyCode:W=lr()?"Meta":"Control",zoomActivationKeyCode:Z=lr()?"Meta":"Control",snapToGrid:te=!1,snapGrid:ie=Hw,onlyRenderVisibleElements:re=!1,selectNodesOnDrag:ee=!0,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:j,nodeOrigin:Y=Bw,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Pe,defaultViewport:ge=$w,minZoom:ce=.5,maxZoom:me=2,translateExtent:Re=gu,preventScrolling:Le=!0,nodeExtent:ke,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:Fe=!0,zoomOnPinch:Ye=!0,panOnScroll:de=!1,panOnScrollSpeed:we=.5,panOnScrollMode:ve=nt.Free,zoomOnDoubleClick:ye=!0,panOnDrag:lt=!0,onPaneClick:Oe,onPaneMouseEnter:et,onPaneMouseMove:Br,onPaneMouseLeave:Hr,onPaneScroll:qt,onPaneContextMenu:$r,children:Xu,onEdgeContextMenu:tt,onEdgeDoubleClick:ny,onEdgeMouseEnter:iy,onEdgeMouseMove:ay,onEdgeMouseLeave:oy,onEdgeUpdate:sy,onEdgeUpdateStart:uy,onEdgeUpdateEnd:cy,onReconnect:ly,onReconnectStart:fy,onReconnectEnd:dy,reconnectRadius:hy=10,edgeUpdaterRadius:py=10,onNodesChange:vy,onEdgesChange:gy,noDragClassName:yy="nodrag",noWheelClassName:my="nowheel",noPanClassName:Ju="nopan",fitView:_y=!1,fitViewOptions:by,connectOnClick:wy=!0,attributionPosition:Ey,proOptions:xy,defaultEdgeOptions:Sy,elevateNodesOnSelect:qy=!0,elevateEdgesOnSelect:Cy=!1,disableKeyboardA11y:Qu=!1,autoPanOnConnect:Ry=!0,autoPanOnNodeDrag:Ay=!0,connectionRadius:Ny=20,isValidConnection:Iy,onError:Ty,style:My,id:ec,nodeDragThreshold:Py,...ky},Oy)=>{const Vr=ec||"1";return L.createElement("div",{...ky,style:{...My,...Vw},ref:Oy,className:pe(["react-flow",i]),"data-testid":"rf__wrapper",id:ec},L.createElement(eg,null,L.createElement(Dw,{onInit:l,onMove:c,onMoveStart:f,onMoveEnd:d,onNodeClick:s,onEdgeClick:u,onNodeMouseEnter:y,onNodeMouseMove:b,onNodeMouseLeave:m,onNodeContextMenu:E,onNodeDoubleClick:x,nodeTypes:a,edgeTypes:o,connectionLineType:B,connectionLineStyle:V,connectionLineComponent:G,connectionLineContainerStyle:U,selectionKeyCode:P,selectionOnDrag:F,selectionMode:$,deleteKeyCode:C,multiSelectionKeyCode:W,panActivationKeyCode:K,zoomActivationKeyCode:Z,onlyRenderVisibleElements:re,selectNodesOnDrag:ee,defaultViewport:ge,translateExtent:Re,minZoom:ce,maxZoom:me,preventScrolling:Le,zoomOnScroll:Fe,zoomOnPinch:Ye,zoomOnDoubleClick:ye,panOnScroll:de,panOnScrollSpeed:we,panOnScrollMode:ve,panOnDrag:lt,onPaneClick:Oe,onPaneMouseEnter:et,onPaneMouseMove:Br,onPaneMouseLeave:Hr,onPaneScroll:qt,onPaneContextMenu:$r,onSelectionContextMenu:R,onSelectionStart:z,onSelectionEnd:H,onEdgeContextMenu:tt,onEdgeDoubleClick:ny,onEdgeMouseEnter:iy,onEdgeMouseMove:ay,onEdgeMouseLeave:oy,onReconnect:ly??sy,onReconnectStart:fy??uy,onReconnectEnd:dy??cy,reconnectRadius:hy??py,defaultMarkerColor:be,noDragClassName:yy,noWheelClassName:my,noPanClassName:Ju,elevateEdgesOnSelect:Cy,rfId:Vr,disableKeyboardA11y:Qu,nodeOrigin:Y,nodeExtent:ke}),L.createElement(M0,{nodes:e,edges:t,defaultNodes:r,defaultEdges:n,onConnect:h,onConnectStart:_,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:p,nodesDraggable:X,nodesConnectable:ue,nodesFocusable:j,edgesFocusable:oe,edgesUpdatable:Ce,elementsSelectable:Pe,elevateNodesOnSelect:qy,minZoom:ce,maxZoom:me,nodeExtent:ke,onNodesChange:vy,onEdgesChange:gy,snapToGrid:te,snapGrid:ie,connectionMode:M,translateExtent:Re,connectOnClick:wy,defaultEdgeOptions:Sy,fitView:_y,fitViewOptions:by,onNodesDelete:A,onEdgesDelete:I,onNodeDragStart:S,onNodeDrag:N,onNodeDragStop:q,onSelectionDrag:w,onSelectionDragStart:k,onSelectionDragStop:T,noPanClassName:Ju,nodeOrigin:Y,rfId:Vr,autoPanOnConnect:Ry,autoPanOnNodeDrag:Ay,onError:Ty,connectionRadius:Ny,isValidConnection:Iy,nodeDragThreshold:Py}),L.createElement(I0,{onSelectionChange:O}),Xu,L.createElement(i0,{proOptions:xy,position:Ey}),L.createElement(L0,{rfId:Vr,disableKeyboardA11y:Qu})))});Gw.displayName="ReactFlow";const tg=({id:e,x:t,y:r,width:n,height:i,style:a,color:o,strokeColor:s,strokeWidth:u,className:l,borderRadius:c,shapeRendering:f,onClick:d,selected:h})=>{const{background:_,backgroundColor:g}=a||{},v=o||_||g;return L.createElement("rect",{className:pe(["react-flow__minimap-node",{selected:h},l]),x:t,y:r,rx:c,ry:c,width:n,height:i,fill:v,stroke:s,strokeWidth:u,shapeRendering:f,onClick:d?p=>d(p,e):void 0})};tg.displayName="MiniMapNode";var Uw=D.memo(tg);const Kw=e=>e.nodeOrigin,jw=e=>e.getNodes().filter(t=>!t.hidden&&t.width&&t.height),Xr=e=>e instanceof Function?e:()=>e;function Yw({nodeStrokeColor:e="transparent",nodeColor:t="#e2e2e2",nodeClassName:r="",nodeBorderRadius:n=5,nodeStrokeWidth:i=2,nodeComponent:a=Uw,onClick:o}){const s=ne(jw,he),u=ne(Kw),l=Xr(t),c=Xr(e),f=Xr(r),d=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return L.createElement(L.Fragment,null,s.map(h=>{const{x:_,y:g}=it(h,u).positionAbsolute;return L.createElement(a,{key:h.id,x:_,y:g,width:h.width,height:h.height,style:h.style,selected:h.selected,className:f(h),color:l(h),borderRadius:n,strokeColor:c(h),strokeWidth:i,shapeRendering:d,onClick:o,id:h.id})}))}var Ww=D.memo(Yw);const Zw=200,Xw=150,Jw=e=>{const t=e.getNodes(),r={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:r,boundingRect:t.length>0?s0(Er(t,e.nodeOrigin),r):r,rfId:e.rfId}},Qw="react-flow__minimap-desc";function rg({style:e,className:t,nodeStrokeColor:r="transparent",nodeColor:n="#e2e2e2",nodeClassName:i="",nodeBorderRadius:a=5,nodeStrokeWidth:o=2,nodeComponent:s,maskColor:u="rgb(240, 240, 240, 0.6)",maskStrokeColor:l="none",maskStrokeWidth:c=1,position:f="bottom-right",onClick:d,onNodeClick:h,pannable:_=!1,zoomable:g=!1,ariaLabel:v="React Flow mini map",inversePan:p=!1,zoomStep:y=10,offsetScale:b=5}){const m=fe(),E=D.useRef(null),{boundingRect:x,viewBB:S,rfId:N}=ne(Jw,he),q=e?.width??Zw,A=e?.height??Xw,I=x.width/q,O=x.height/A,k=Math.max(I,O),w=k*q,T=k*A,R=b*k,z=x.x-(w-x.width)/2-R,H=x.y-(T-x.height)/2-R,M=w+R*2,B=T+R*2,V=`${Qw}-${N}`,G=D.useRef(0);G.current=k,D.useEffect(()=>{if(E.current){const P=xe(E.current),F=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie}=m.getState();if(W.sourceEvent.type!=="wheel"||!te||!ie)return;const re=-W.sourceEvent.deltaY*(W.sourceEvent.deltaMode===1?.05:W.sourceEvent.deltaMode?1:.002)*y,ee=Z[2]*Math.pow(2,re);ie.scaleTo(te,ee)},$=W=>{const{transform:Z,d3Selection:te,d3Zoom:ie,translateExtent:re,width:ee,height:X}=m.getState();if(W.sourceEvent.type!=="mousemove"||!te||!ie)return;const ue=G.current*Math.max(1,Z[2])*(p?-1:1),j={x:Z[0]-W.sourceEvent.movementX*ue,y:Z[1]-W.sourceEvent.movementY*ue},Y=[[0,0],[ee,X]],oe=He.translate(j.x,j.y).scale(Z[2]),Ce=ie.constrain()(oe,Y,re);ie.transform(te,Ce)},K=fv().on("zoom",_?$:null).on("zoom.wheel",g?F:null);return P.call(K),()=>{P.on("zoom",null)}}},[_,g,p,y]);const U=d?P=>{const F=Ae(P);d(P,{x:F[0],y:F[1]})}:void 0,C=h?(P,F)=>{const $=m.getState().nodeInternals.get(F);h(P,$)}:void 0;return L.createElement(Eu,{position:f,style:e,className:pe(["react-flow__minimap",t]),"data-testid":"rf__minimap"},L.createElement("svg",{width:q,height:A,viewBox:`${z} ${H} ${M} ${B}`,role:"img","aria-labelledby":V,ref:E,onClick:U},v&&L.createElement("title",{id:V},v),L.createElement(Ww,{onClick:C,nodeColor:n,nodeStrokeColor:r,nodeBorderRadius:a,nodeClassName:i,nodeStrokeWidth:o,nodeComponent:s}),L.createElement("path",{className:"react-flow__minimap-mask",d:`M${z-R},${H-R}h${M+R*2}v${B+R*2}h${-M-R*2}z
M${S.x},${S.y}h${S.width}v${S.height}h${-S.width}z`,fill:u,fillRule:"evenodd",stroke:l,strokeWidth:c,pointerEvents:"none"})))}rg.displayName="MiniMap";var ES=D.memo(rg);function e1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},L.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function t1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},L.createElement("path",{d:"M0 0h32v4.2H0z"}))}function r1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},L.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function n1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function i1(){return L.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},L.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}const Pt=({children:e,className:t,...r})=>L.createElement("button",{type:"button",className:pe(["react-flow__controls-button",t]),...r},e);Pt.displayName="ControlButton";const a1=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}),ng=({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:n=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:o,onFitView:s,onInteractiveChange:u,className:l,children:c,position:f="bottom-left"})=>{const d=fe(),[h,_]=D.useState(!1),{isInteractive:g,minZoomReached:v,maxZoomReached:p}=ne(a1,he),{zoomIn:y,zoomOut:b,fitView:m}=Tu();if(D.useEffect(()=>{_(!0)},[]),!h)return null;const E=()=>{y(),a?.()},x=()=>{b(),o?.()},S=()=>{m(i),s?.()},N=()=>{d.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),u?.(!g)};return L.createElement(Eu,{className:pe(["react-flow__controls",l]),position:f,style:e,"data-testid":"rf__controls"},t&&L.createElement(L.Fragment,null,L.createElement(Pt,{onClick:E,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:p},L.createElement(e1,null)),L.createElement(Pt,{onClick:x,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:v},L.createElement(t1,null))),r&&L.createElement(Pt,{className:"react-flow__controls-fitview",onClick:S,title:"fit view","aria-label":"fit view"},L.createElement(r1,null)),n&&L.createElement(Pt,{className:"react-flow__controls-interactive",onClick:N,title:"toggle interactivity","aria-label":"toggle interactivity"},g?L.createElement(i1,null):L.createElement(n1,null)),c)};ng.displayName="Controls";var xS=D.memo(ng),Ne;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ne||(Ne={}));function o1({color:e,dimensions:t,lineWidth:r}){return L.createElement("path",{stroke:e,strokeWidth:r,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`})}function s1({color:e,radius:t}){return L.createElement("circle",{cx:t,cy:t,r:t,fill:e})}const u1={[Ne.Dots]:"#91919a",[Ne.Lines]:"#eee",[Ne.Cross]:"#e2e2e2"},c1={[Ne.Dots]:1,[Ne.Lines]:1,[Ne.Cross]:6},l1=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ig({id:e,variant:t=Ne.Dots,gap:r=20,size:n,lineWidth:i=1,offset:a=2,color:o,style:s,className:u}){const l=D.useRef(null),{transform:c,patternId:f}=ne(l1,he),d=o||u1[t],h=n||c1[t],_=t===Ne.Dots,g=t===Ne.Cross,v=Array.isArray(r)?r:[r,r],p=[v[0]*c[2]||1,v[1]*c[2]||1],y=h*c[2],b=g?[y,y]:p,m=_?[y/a,y/a]:[b[0]/a,b[1]/a];return L.createElement("svg",{className:pe(["react-flow__background",u]),style:{...s,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:l,"data-testid":"rf__background"},L.createElement("pattern",{id:f+e,x:c[0]%p[0],y:c[1]%p[1],width:p[0],height:p[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${m[0]},-${m[1]})`},_?L.createElement(s1,{color:d,radius:y/a}):L.createElement(o1,{dimensions:b,color:d,lineWidth:i})),L.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${f+e})`}))}ig.displayName="Background";var SS=D.memo(ig);function Pu(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Jr,Oc;function f1(){if(Oc)return Jr;Oc=1;function e(){this.__data__=[],this.size=0}return Jr=e,Jr}var Qr,Dc;function Et(){if(Dc)return Qr;Dc=1;function e(t,r){return t===r||t!==t&&r!==r}return Qr=e,Qr}var en,Lc;function xr(){if(Lc)return en;Lc=1;var e=Et();function t(r,n){for(var i=r.length;i--;)if(e(r[i][0],n))return i;return-1}return en=t,en}var tn,Fc;function d1(){if(Fc)return tn;Fc=1;var e=xr(),t=Array.prototype,r=t.splice;function n(i){var a=this.__data__,o=e(a,i);if(o<0)return!1;var s=a.length-1;return o==s?a.pop():r.call(a,o,1),--this.size,!0}return tn=n,tn}var rn,zc;function h1(){if(zc)return rn;zc=1;var e=xr();function t(r){var n=this.__data__,i=e(n,r);return i<0?void 0:n[i][1]}return rn=t,rn}var nn,Bc;function p1(){if(Bc)return nn;Bc=1;var e=xr();function t(r){return e(this.__data__,r)>-1}return nn=t,nn}var an,Hc;function v1(){if(Hc)return an;Hc=1;var e=xr();function t(r,n){var i=this.__data__,a=e(i,r);return a<0?(++this.size,i.push([r,n])):i[a][1]=n,this}return an=t,an}var on,$c;function Sr(){if($c)return on;$c=1;var e=f1(),t=d1(),r=h1(),n=p1(),i=v1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,on=a,on}var sn,Vc;function g1(){if(Vc)return sn;Vc=1;var e=Sr();function t(){this.__data__=new e,this.size=0}return sn=t,sn}var un,Gc;function y1(){if(Gc)return un;Gc=1;function e(t){var r=this.__data__,n=r.delete(t);return this.size=r.size,n}return un=e,un}var cn,Uc;function m1(){if(Uc)return cn;Uc=1;function e(t){return this.__data__.get(t)}return cn=e,cn}var ln,Kc;function _1(){if(Kc)return ln;Kc=1;function e(t){return this.__data__.has(t)}return ln=e,ln}var fn,jc;function Ut(){if(jc)return fn;jc=1;var e=wt(),t=Te(),r="[object AsyncFunction]",n="[object Function]",i="[object GeneratorFunction]",a="[object Proxy]";function o(s){if(!t(s))return!1;var u=e(s);return u==n||u==i||u==r||u==a}return fn=o,fn}var dn,Yc;function b1(){if(Yc)return dn;Yc=1;var e=Ge(),t=e["__core-js_shared__"];return dn=t,dn}var hn,Wc;function w1(){if(Wc)return hn;Wc=1;var e=b1(),t=(function(){var n=/[^.]+$/.exec(e&&e.keys&&e.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""})();function r(n){return!!t&&t in n}return hn=r,hn}var pn,Zc;function ag(){if(Zc)return pn;Zc=1;var e=Function.prototype,t=e.toString;function r(n){if(n!=null){try{return t.call(n)}catch{}try{return n+""}catch{}}return""}return pn=r,pn}var vn,Xc;function E1(){if(Xc)return vn;Xc=1;var e=Ut(),t=w1(),r=Te(),n=ag(),i=/[\\^$.*+?()[\]{}|]/g,a=/^\[object .+?Constructor\]$/,o=Function.prototype,s=Object.prototype,u=o.toString,l=s.hasOwnProperty,c=RegExp("^"+u.call(l).replace(i,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function f(d){if(!r(d)||t(d))return!1;var h=e(d)?c:a;return h.test(n(d))}return vn=f,vn}var gn,Jc;function x1(){if(Jc)return gn;Jc=1;function e(t,r){return t?.[r]}return gn=e,gn}var yn,Qc;function st(){if(Qc)return yn;Qc=1;var e=E1(),t=x1();function r(n,i){var a=t(n,i);return e(a)?a:void 0}return yn=r,yn}var mn,el;function ku(){if(el)return mn;el=1;var e=st(),t=Ge(),r=e(t,"Map");return mn=r,mn}var _n,tl;function qr(){if(tl)return _n;tl=1;var e=st(),t=e(Object,"create");return _n=t,_n}var bn,rl;function S1(){if(rl)return bn;rl=1;var e=qr();function t(){this.__data__=e?e(null):{},this.size=0}return bn=t,bn}var wn,nl;function q1(){if(nl)return wn;nl=1;function e(t){var r=this.has(t)&&delete this.__data__[t];return this.size-=r?1:0,r}return wn=e,wn}var En,il;function C1(){if(il)return En;il=1;var e=qr(),t="__lodash_hash_undefined__",r=Object.prototype,n=r.hasOwnProperty;function i(a){var o=this.__data__;if(e){var s=o[a];return s===t?void 0:s}return n.call(o,a)?o[a]:void 0}return En=i,En}var xn,al;function R1(){if(al)return xn;al=1;var e=qr(),t=Object.prototype,r=t.hasOwnProperty;function n(i){var a=this.__data__;return e?a[i]!==void 0:r.call(a,i)}return xn=n,xn}var Sn,ol;function A1(){if(ol)return Sn;ol=1;var e=qr(),t="__lodash_hash_undefined__";function r(n,i){var a=this.__data__;return this.size+=this.has(n)?0:1,a[n]=e&&i===void 0?t:i,this}return Sn=r,Sn}var qn,sl;function N1(){if(sl)return qn;sl=1;var e=S1(),t=q1(),r=C1(),n=R1(),i=A1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,qn=a,qn}var Cn,ul;function I1(){if(ul)return Cn;ul=1;var e=N1(),t=Sr(),r=ku();function n(){this.size=0,this.__data__={hash:new e,map:new(r||t),string:new e}}return Cn=n,Cn}var Rn,cl;function T1(){if(cl)return Rn;cl=1;function e(t){var r=typeof t;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?t!=="__proto__":t===null}return Rn=e,Rn}var An,ll;function Cr(){if(ll)return An;ll=1;var e=T1();function t(r,n){var i=r.__data__;return e(n)?i[typeof n=="string"?"string":"hash"]:i.map}return An=t,An}var Nn,fl;function M1(){if(fl)return Nn;fl=1;var e=Cr();function t(r){var n=e(this,r).delete(r);return this.size-=n?1:0,n}return Nn=t,Nn}var In,dl;function P1(){if(dl)return In;dl=1;var e=Cr();function t(r){return e(this,r).get(r)}return In=t,In}var Tn,hl;function k1(){if(hl)return Tn;hl=1;var e=Cr();function t(r){return e(this,r).has(r)}return Tn=t,Tn}var Mn,pl;function O1(){if(pl)return Mn;pl=1;var e=Cr();function t(r,n){var i=e(this,r),a=i.size;return i.set(r,n),this.size+=i.size==a?0:1,this}return Mn=t,Mn}var Pn,vl;function Ou(){if(vl)return Pn;vl=1;var e=I1(),t=M1(),r=P1(),n=k1(),i=O1();function a(o){var s=-1,u=o==null?0:o.length;for(this.clear();++s<u;){var l=o[s];this.set(l[0],l[1])}}return a.prototype.clear=e,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=n,a.prototype.set=i,Pn=a,Pn}var kn,gl;function D1(){if(gl)return kn;gl=1;var e=Sr(),t=ku(),r=Ou(),n=200;function i(a,o){var s=this.__data__;if(s instanceof e){var u=s.__data__;if(!t||u.length<n-1)return u.push([a,o]),this.size=++s.size,this;s=this.__data__=new r(u)}return s.set(a,o),this.size=s.size,this}return kn=i,kn}var On,yl;function Rr(){if(yl)return On;yl=1;var e=Sr(),t=g1(),r=y1(),n=m1(),i=_1(),a=D1();function o(s){var u=this.__data__=new e(s);this.size=u.size}return o.prototype.clear=t,o.prototype.delete=r,o.prototype.get=n,o.prototype.has=i,o.prototype.set=a,On=o,On}var Dn,ml;function Du(){if(ml)return Dn;ml=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i&&r(t[n],n,t)!==!1;);return t}return Dn=e,Dn}var Ln,_l;function og(){if(_l)return Ln;_l=1;var e=st(),t=(function(){try{var r=e(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Ln=t,Ln}var Fn,bl;function Ar(){if(bl)return Fn;bl=1;var e=og();function t(r,n,i){n=="__proto__"&&e?e(r,n,{configurable:!0,enumerable:!0,value:i,writable:!0}):r[n]=i}return Fn=t,Fn}var zn,wl;function Nr(){if(wl)return zn;wl=1;var e=Ar(),t=Et(),r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s){var u=a[o];(!(n.call(a,o)&&t(u,s))||s===void 0&&!(o in a))&&e(a,o,s)}return zn=i,zn}var Bn,El;function Kt(){if(El)return Bn;El=1;var e=Nr(),t=Ar();function r(n,i,a,o){var s=!a;a||(a={});for(var u=-1,l=i.length;++u<l;){var c=i[u],f=o?o(a[c],n[c],c,a,n):void 0;f===void 0&&(f=n[c]),s?t(a,c,f):e(a,c,f)}return a}return Bn=r,Bn}var Hn,xl;function L1(){if(xl)return Hn;xl=1;function e(t,r){for(var n=-1,i=Array(t);++n<t;)i[n]=r(n);return i}return Hn=e,Hn}var $n,Sl;function F1(){if(Sl)return $n;Sl=1;var e=wt(),t=Ue(),r="[object Arguments]";function n(i){return t(i)&&e(i)==r}return $n=n,$n}var Vn,ql;function jt(){if(ql)return Vn;ql=1;var e=F1(),t=Ue(),r=Object.prototype,n=r.hasOwnProperty,i=r.propertyIsEnumerable,a=e((function(){return arguments})())?e:function(o){return t(o)&&n.call(o,"callee")&&!i.call(o,"callee")};return Vn=a,Vn}var Gn,Cl;function le(){if(Cl)return Gn;Cl=1;var e=Array.isArray;return Gn=e,Gn}var kt={exports:{}},Un,Rl;function z1(){if(Rl)return Un;Rl=1;function e(){return!1}return Un=e,Un}kt.exports;var Al;function xt(){return Al||(Al=1,(function(e,t){var r=Ge(),n=z1(),i=t&&!t.nodeType&&t,a=i&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===i,s=o?r.Buffer:void 0,u=s?s.isBuffer:void 0,l=u||n;e.exports=l})(kt,kt.exports)),kt.exports}var Kn,Nl;function Ir(){if(Nl)return Kn;Nl=1;var e=9007199254740991,t=/^(?:0|[1-9]\d*)$/;function r(n,i){var a=typeof n;return i=i??e,!!i&&(a=="number"||a!="symbol"&&t.test(n))&&n>-1&&n%1==0&&n<i}return Kn=r,Kn}var jn,Il;function Lu(){if(Il)return jn;Il=1;var e=9007199254740991;function t(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=e}return jn=t,jn}var Yn,Tl;function B1(){if(Tl)return Yn;Tl=1;var e=wt(),t=Lu(),r=Ue(),n="[object Arguments]",i="[object Array]",a="[object Boolean]",o="[object Date]",s="[object Error]",u="[object Function]",l="[object Map]",c="[object Number]",f="[object Object]",d="[object RegExp]",h="[object Set]",_="[object String]",g="[object WeakMap]",v="[object ArrayBuffer]",p="[object DataView]",y="[object Float32Array]",b="[object Float64Array]",m="[object Int8Array]",E="[object Int16Array]",x="[object Int32Array]",S="[object Uint8Array]",N="[object Uint8ClampedArray]",q="[object Uint16Array]",A="[object Uint32Array]",I={};I[y]=I[b]=I[m]=I[E]=I[x]=I[S]=I[N]=I[q]=I[A]=!0,I[n]=I[i]=I[v]=I[a]=I[p]=I[o]=I[s]=I[u]=I[l]=I[c]=I[f]=I[d]=I[h]=I[_]=I[g]=!1;function O(k){return r(k)&&t(k.length)&&!!I[e(k)]}return Yn=O,Yn}var Wn,Ml;function Tr(){if(Ml)return Wn;Ml=1;function e(t){return function(r){return t(r)}}return Wn=e,Wn}var Ot={exports:{}};Ot.exports;var Pl;function Fu(){return Pl||(Pl=1,(function(e,t){var r=$y(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a&&r.process,s=(function(){try{var u=i&&i.require&&i.require("util").types;return u||o&&o.binding&&o.binding("util")}catch{}})();e.exports=s})(Ot,Ot.exports)),Ot.exports}var Zn,kl;function Yt(){if(kl)return Zn;kl=1;var e=B1(),t=Tr(),r=Fu(),n=r&&r.isTypedArray,i=n?t(n):e;return Zn=i,Zn}var Xn,Ol;function sg(){if(Ol)return Xn;Ol=1;var e=L1(),t=jt(),r=le(),n=xt(),i=Ir(),a=Yt(),o=Object.prototype,s=o.hasOwnProperty;function u(l,c){var f=r(l),d=!f&&t(l),h=!f&&!d&&n(l),_=!f&&!d&&!h&&a(l),g=f||d||h||_,v=g?e(l.length,String):[],p=v.length;for(var y in l)(c||s.call(l,y))&&!(g&&(y=="length"||h&&(y=="offset"||y=="parent")||_&&(y=="buffer"||y=="byteLength"||y=="byteOffset")||i(y,p)))&&v.push(y);return v}return Xn=u,Xn}var Jn,Dl;function Mr(){if(Dl)return Jn;Dl=1;var e=Object.prototype;function t(r){var n=r&&r.constructor,i=typeof n=="function"&&n.prototype||e;return r===i}return Jn=t,Jn}var Qn,Ll;function ug(){if(Ll)return Qn;Ll=1;function e(t,r){return function(n){return t(r(n))}}return Qn=e,Qn}var ei,Fl;function H1(){if(Fl)return ei;Fl=1;var e=ug(),t=e(Object.keys,Object);return ei=t,ei}var ti,zl;function zu(){if(zl)return ti;zl=1;var e=Mr(),t=H1(),r=Object.prototype,n=r.hasOwnProperty;function i(a){if(!e(a))return t(a);var o=[];for(var s in Object(a))n.call(a,s)&&s!="constructor"&&o.push(s);return o}return ti=i,ti}var ri,Bl;function Ke(){if(Bl)return ri;Bl=1;var e=Ut(),t=Lu();function r(n){return n!=null&&t(n.length)&&!e(n)}return ri=r,ri}var ni,Hl;function Qe(){if(Hl)return ni;Hl=1;var e=sg(),t=zu(),r=Ke();function n(i){return r(i)?e(i):t(i)}return ni=n,ni}var ii,$l;function $1(){if($l)return ii;$l=1;var e=Kt(),t=Qe();function r(n,i){return n&&e(i,t(i),n)}return ii=r,ii}var ai,Vl;function V1(){if(Vl)return ai;Vl=1;function e(t){var r=[];if(t!=null)for(var n in Object(t))r.push(n);return r}return ai=e,ai}var oi,Gl;function G1(){if(Gl)return oi;Gl=1;var e=Te(),t=Mr(),r=V1(),n=Object.prototype,i=n.hasOwnProperty;function a(o){if(!e(o))return r(o);var s=t(o),u=[];for(var l in o)l=="constructor"&&(s||!i.call(o,l))||u.push(l);return u}return oi=a,oi}var si,Ul;function ut(){if(Ul)return si;Ul=1;var e=sg(),t=G1(),r=Ke();function n(i){return r(i)?e(i,!0):t(i)}return si=n,si}var ui,Kl;function U1(){if(Kl)return ui;Kl=1;var e=Kt(),t=ut();function r(n,i){return n&&e(i,t(i),n)}return ui=r,ui}var Dt={exports:{}};Dt.exports;var jl;function cg(){return jl||(jl=1,(function(e,t){var r=Ge(),n=t&&!t.nodeType&&t,i=n&&!0&&e&&!e.nodeType&&e,a=i&&i.exports===n,o=a?r.Buffer:void 0,s=o?o.allocUnsafe:void 0;function u(l,c){if(c)return l.slice();var f=l.length,d=s?s(f):new l.constructor(f);return l.copy(d),d}e.exports=u})(Dt,Dt.exports)),Dt.exports}var ci,Yl;function lg(){if(Yl)return ci;Yl=1;function e(t,r){var n=-1,i=t.length;for(r||(r=Array(i));++n<i;)r[n]=t[n];return r}return ci=e,ci}var li,Wl;function fg(){if(Wl)return li;Wl=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=0,o=[];++n<i;){var s=t[n];r(s,n,t)&&(o[a++]=s)}return o}return li=e,li}var fi,Zl;function dg(){if(Zl)return fi;Zl=1;function e(){return[]}return fi=e,fi}var di,Xl;function Bu(){if(Xl)return di;Xl=1;var e=fg(),t=dg(),r=Object.prototype,n=r.propertyIsEnumerable,i=Object.getOwnPropertySymbols,a=i?function(o){return o==null?[]:(o=Object(o),e(i(o),function(s){return n.call(o,s)}))}:t;return di=a,di}var hi,Jl;function K1(){if(Jl)return hi;Jl=1;var e=Kt(),t=Bu();function r(n,i){return e(n,t(n),i)}return hi=r,hi}var pi,Ql;function Hu(){if(Ql)return pi;Ql=1;function e(t,r){for(var n=-1,i=r.length,a=t.length;++n<i;)t[a+n]=r[n];return t}return pi=e,pi}var vi,ef;function Pr(){if(ef)return vi;ef=1;var e=ug(),t=e(Object.getPrototypeOf,Object);return vi=t,vi}var gi,tf;function hg(){if(tf)return gi;tf=1;var e=Hu(),t=Pr(),r=Bu(),n=dg(),i=Object.getOwnPropertySymbols,a=i?function(o){for(var s=[];o;)e(s,r(o)),o=t(o);return s}:n;return gi=a,gi}var yi,rf;function j1(){if(rf)return yi;rf=1;var e=Kt(),t=hg();function r(n,i){return e(n,t(n),i)}return yi=r,yi}var mi,nf;function pg(){if(nf)return mi;nf=1;var e=Hu(),t=le();function r(n,i,a){var o=i(n);return t(n)?o:e(o,a(n))}return mi=r,mi}var _i,af;function vg(){if(af)return _i;af=1;var e=pg(),t=Bu(),r=Qe();function n(i){return e(i,r,t)}return _i=n,_i}var bi,of;function Y1(){if(of)return bi;of=1;var e=pg(),t=hg(),r=ut();function n(i){return e(i,r,t)}return bi=n,bi}var wi,sf;function W1(){if(sf)return wi;sf=1;var e=st(),t=Ge(),r=e(t,"DataView");return wi=r,wi}var Ei,uf;function Z1(){if(uf)return Ei;uf=1;var e=st(),t=Ge(),r=e(t,"Promise");return Ei=r,Ei}var xi,cf;function gg(){if(cf)return xi;cf=1;var e=st(),t=Ge(),r=e(t,"Set");return xi=r,xi}var Si,lf;function X1(){if(lf)return Si;lf=1;var e=st(),t=Ge(),r=e(t,"WeakMap");return Si=r,Si}var qi,ff;function St(){if(ff)return qi;ff=1;var e=W1(),t=ku(),r=Z1(),n=gg(),i=X1(),a=wt(),o=ag(),s="[object Map]",u="[object Object]",l="[object Promise]",c="[object Set]",f="[object WeakMap]",d="[object DataView]",h=o(e),_=o(t),g=o(r),v=o(n),p=o(i),y=a;return(e&&y(new e(new ArrayBuffer(1)))!=d||t&&y(new t)!=s||r&&y(r.resolve())!=l||n&&y(new n)!=c||i&&y(new i)!=f)&&(y=function(b){var m=a(b),E=m==u?b.constructor:void 0,x=E?o(E):"";if(x)switch(x){case h:return d;case _:return s;case g:return l;case v:return c;case p:return f}return m}),qi=y,qi}var Ci,df;function J1(){if(df)return Ci;df=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n){var i=n.length,a=new n.constructor(i);return i&&typeof n[0]=="string"&&t.call(n,"index")&&(a.index=n.index,a.input=n.input),a}return Ci=r,Ci}var Ri,hf;function yg(){if(hf)return Ri;hf=1;var e=Ge(),t=e.Uint8Array;return Ri=t,Ri}var Ai,pf;function $u(){if(pf)return Ai;pf=1;var e=yg();function t(r){var n=new r.constructor(r.byteLength);return new e(n).set(new e(r)),n}return Ai=t,Ai}var Ni,vf;function Q1(){if(vf)return Ni;vf=1;var e=$u();function t(r,n){var i=n?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.byteLength)}return Ni=t,Ni}var Ii,gf;function eE(){if(gf)return Ii;gf=1;var e=/\w*$/;function t(r){var n=new r.constructor(r.source,e.exec(r));return n.lastIndex=r.lastIndex,n}return Ii=t,Ii}var Ti,yf;function tE(){if(yf)return Ti;yf=1;var e=vr(),t=e?e.prototype:void 0,r=t?t.valueOf:void 0;function n(i){return r?Object(r.call(i)):{}}return Ti=n,Ti}var Mi,mf;function mg(){if(mf)return Mi;mf=1;var e=$u();function t(r,n){var i=n?e(r.buffer):r.buffer;return new r.constructor(i,r.byteOffset,r.length)}return Mi=t,Mi}var Pi,_f;function rE(){if(_f)return Pi;_f=1;var e=$u(),t=Q1(),r=eE(),n=tE(),i=mg(),a="[object Boolean]",o="[object Date]",s="[object Map]",u="[object Number]",l="[object RegExp]",c="[object Set]",f="[object String]",d="[object Symbol]",h="[object ArrayBuffer]",_="[object DataView]",g="[object Float32Array]",v="[object Float64Array]",p="[object Int8Array]",y="[object Int16Array]",b="[object Int32Array]",m="[object Uint8Array]",E="[object Uint8ClampedArray]",x="[object Uint16Array]",S="[object Uint32Array]";function N(q,A,I){var O=q.constructor;switch(A){case h:return e(q);case a:case o:return new O(+q);case _:return t(q,I);case g:case v:case p:case y:case b:case m:case E:case x:case S:return i(q,I);case s:return new O;case u:case f:return new O(q);case l:return r(q);case c:return new O;case d:return n(q)}}return Pi=N,Pi}var ki,bf;function _g(){if(bf)return ki;bf=1;var e=Te(),t=Object.create,r=(function(){function n(){}return function(i){if(!e(i))return{};if(t)return t(i);n.prototype=i;var a=new n;return n.prototype=void 0,a}})();return ki=r,ki}var Oi,wf;function bg(){if(wf)return Oi;wf=1;var e=_g(),t=Pr(),r=Mr();function n(i){return typeof i.constructor=="function"&&!r(i)?e(t(i)):{}}return Oi=n,Oi}var Di,Ef;function nE(){if(Ef)return Di;Ef=1;var e=St(),t=Ue(),r="[object Map]";function n(i){return t(i)&&e(i)==r}return Di=n,Di}var Li,xf;function iE(){if(xf)return Li;xf=1;var e=nE(),t=Tr(),r=Fu(),n=r&&r.isMap,i=n?t(n):e;return Li=i,Li}var Fi,Sf;function aE(){if(Sf)return Fi;Sf=1;var e=St(),t=Ue(),r="[object Set]";function n(i){return t(i)&&e(i)==r}return Fi=n,Fi}var zi,qf;function oE(){if(qf)return zi;qf=1;var e=aE(),t=Tr(),r=Fu(),n=r&&r.isSet,i=n?t(n):e;return zi=i,zi}var Bi,Cf;function wg(){if(Cf)return Bi;Cf=1;var e=Rr(),t=Du(),r=Nr(),n=$1(),i=U1(),a=cg(),o=lg(),s=K1(),u=j1(),l=vg(),c=Y1(),f=St(),d=J1(),h=rE(),_=bg(),g=le(),v=xt(),p=iE(),y=Te(),b=oE(),m=Qe(),E=ut(),x=1,S=2,N=4,q="[object Arguments]",A="[object Array]",I="[object Boolean]",O="[object Date]",k="[object Error]",w="[object Function]",T="[object GeneratorFunction]",R="[object Map]",z="[object Number]",H="[object Object]",M="[object RegExp]",B="[object Set]",V="[object String]",G="[object Symbol]",U="[object WeakMap]",C="[object ArrayBuffer]",P="[object DataView]",F="[object Float32Array]",$="[object Float64Array]",K="[object Int8Array]",W="[object Int16Array]",Z="[object Int32Array]",te="[object Uint8Array]",ie="[object Uint8ClampedArray]",re="[object Uint16Array]",ee="[object Uint32Array]",X={};X[q]=X[A]=X[C]=X[P]=X[I]=X[O]=X[F]=X[$]=X[K]=X[W]=X[Z]=X[R]=X[z]=X[H]=X[M]=X[B]=X[V]=X[G]=X[te]=X[ie]=X[re]=X[ee]=!0,X[k]=X[w]=X[U]=!1;function ue(j,Y,oe,Ce,Pe,ge){var ce,me=Y&x,Re=Y&S,Le=Y&N;if(oe&&(ce=Pe?oe(j,Ce,Pe,ge):oe(j)),ce!==void 0)return ce;if(!y(j))return j;var ke=g(j);if(ke){if(ce=d(j),!me)return o(j,ce)}else{var be=f(j),Fe=be==w||be==T;if(v(j))return a(j,me);if(be==H||be==q||Fe&&!Pe){if(ce=Re||Fe?{}:_(j),!me)return Re?u(j,i(ce,j)):s(j,n(ce,j))}else{if(!X[be])return Pe?j:{};ce=h(j,be,me)}}ge||(ge=new e);var Ye=ge.get(j);if(Ye)return Ye;ge.set(j,ce),b(j)?j.forEach(function(ve){ce.add(ue(ve,Y,oe,ve,j,ge))}):p(j)&&j.forEach(function(ve,ye){ce.set(ye,ue(ve,Y,oe,ye,j,ge))});var de=Le?Re?c:l:Re?E:m,we=ke?void 0:de(j);return t(we||j,function(ve,ye){we&&(ye=ve,ve=j[ye]),r(ce,ye,ue(ve,Y,oe,ye,j,ge))}),ce}return Bi=ue,Bi}var Hi,Rf;function sE(){if(Rf)return Hi;Rf=1;var e=wg(),t=4;function r(n){return e(n,t)}return Hi=r,Hi}var $i,Af;function Vu(){if(Af)return $i;Af=1;function e(t){return function(){return t}}return $i=e,$i}var Vi,Nf;function uE(){if(Nf)return Vi;Nf=1;function e(t){return function(r,n,i){for(var a=-1,o=Object(r),s=i(r),u=s.length;u--;){var l=s[t?u:++a];if(n(o[l],l,o)===!1)break}return r}}return Vi=e,Vi}var Gi,If;function Gu(){if(If)return Gi;If=1;var e=uE(),t=e();return Gi=t,Gi}var Ui,Tf;function Uu(){if(Tf)return Ui;Tf=1;var e=Gu(),t=Qe();function r(n,i){return n&&e(n,i,t)}return Ui=r,Ui}var Ki,Mf;function cE(){if(Mf)return Ki;Mf=1;var e=Ke();function t(r,n){return function(i,a){if(i==null)return i;if(!e(i))return r(i,a);for(var o=i.length,s=n?o:-1,u=Object(i);(n?s--:++s<o)&&a(u[s],s,u)!==!1;);return i}}return Ki=t,Ki}var ji,Pf;function kr(){if(Pf)return ji;Pf=1;var e=Uu(),t=cE(),r=t(e);return ji=r,ji}var Yi,kf;function ct(){if(kf)return Yi;kf=1;function e(t){return t}return Yi=e,Yi}var Wi,Of;function Eg(){if(Of)return Wi;Of=1;var e=ct();function t(r){return typeof r=="function"?r:e}return Wi=t,Wi}var Zi,Df;function xg(){if(Df)return Zi;Df=1;var e=Du(),t=kr(),r=Eg(),n=le();function i(a,o){var s=n(a)?e:t;return s(a,r(o))}return Zi=i,Zi}var Xi,Lf;function Sg(){return Lf||(Lf=1,Xi=xg()),Xi}var Ji,Ff;function lE(){if(Ff)return Ji;Ff=1;var e=kr();function t(r,n){var i=[];return e(r,function(a,o,s){n(a,o,s)&&i.push(a)}),i}return Ji=t,Ji}var Qi,zf;function fE(){if(zf)return Qi;zf=1;var e="__lodash_hash_undefined__";function t(r){return this.__data__.set(r,e),this}return Qi=t,Qi}var ea,Bf;function dE(){if(Bf)return ea;Bf=1;function e(t){return this.__data__.has(t)}return ea=e,ea}var ta,Hf;function qg(){if(Hf)return ta;Hf=1;var e=Ou(),t=fE(),r=dE();function n(i){var a=-1,o=i==null?0:i.length;for(this.__data__=new e;++a<o;)this.add(i[a])}return n.prototype.add=n.prototype.push=t,n.prototype.has=r,ta=n,ta}var ra,$f;function hE(){if($f)return ra;$f=1;function e(t,r){for(var n=-1,i=t==null?0:t.length;++n<i;)if(r(t[n],n,t))return!0;return!1}return ra=e,ra}var na,Vf;function Cg(){if(Vf)return na;Vf=1;function e(t,r){return t.has(r)}return na=e,na}var ia,Gf;function Rg(){if(Gf)return ia;Gf=1;var e=qg(),t=hE(),r=Cg(),n=1,i=2;function a(o,s,u,l,c,f){var d=u&n,h=o.length,_=s.length;if(h!=_&&!(d&&_>h))return!1;var g=f.get(o),v=f.get(s);if(g&&v)return g==s&&v==o;var p=-1,y=!0,b=u&i?new e:void 0;for(f.set(o,s),f.set(s,o);++p<h;){var m=o[p],E=s[p];if(l)var x=d?l(E,m,p,s,o,f):l(m,E,p,o,s,f);if(x!==void 0){if(x)continue;y=!1;break}if(b){if(!t(s,function(S,N){if(!r(b,N)&&(m===S||c(m,S,u,l,f)))return b.push(N)})){y=!1;break}}else if(!(m===E||c(m,E,u,l,f))){y=!1;break}}return f.delete(o),f.delete(s),y}return ia=a,ia}var aa,Uf;function pE(){if(Uf)return aa;Uf=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i,a){n[++r]=[a,i]}),n}return aa=e,aa}var oa,Kf;function Ku(){if(Kf)return oa;Kf=1;function e(t){var r=-1,n=Array(t.size);return t.forEach(function(i){n[++r]=i}),n}return oa=e,oa}var sa,jf;function vE(){if(jf)return sa;jf=1;var e=vr(),t=yg(),r=Et(),n=Rg(),i=pE(),a=Ku(),o=1,s=2,u="[object Boolean]",l="[object Date]",c="[object Error]",f="[object Map]",d="[object Number]",h="[object RegExp]",_="[object Set]",g="[object String]",v="[object Symbol]",p="[object ArrayBuffer]",y="[object DataView]",b=e?e.prototype:void 0,m=b?b.valueOf:void 0;function E(x,S,N,q,A,I,O){switch(N){case y:if(x.byteLength!=S.byteLength||x.byteOffset!=S.byteOffset)return!1;x=x.buffer,S=S.buffer;case p:return!(x.byteLength!=S.byteLength||!I(new t(x),new t(S)));case u:case l:case d:return r(+x,+S);case c:return x.name==S.name&&x.message==S.message;case h:case g:return x==S+"";case f:var k=i;case _:var w=q&o;if(k||(k=a),x.size!=S.size&&!w)return!1;var T=O.get(x);if(T)return T==S;q|=s,O.set(x,S);var R=n(k(x),k(S),q,A,I,O);return O.delete(x),R;case v:if(m)return m.call(x)==m.call(S)}return!1}return sa=E,sa}var ua,Yf;function gE(){if(Yf)return ua;Yf=1;var e=vg(),t=1,r=Object.prototype,n=r.hasOwnProperty;function i(a,o,s,u,l,c){var f=s&t,d=e(a),h=d.length,_=e(o),g=_.length;if(h!=g&&!f)return!1;for(var v=h;v--;){var p=d[v];if(!(f?p in o:n.call(o,p)))return!1}var y=c.get(a),b=c.get(o);if(y&&b)return y==o&&b==a;var m=!0;c.set(a,o),c.set(o,a);for(var E=f;++v<h;){p=d[v];var x=a[p],S=o[p];if(u)var N=f?u(S,x,p,o,a,c):u(x,S,p,a,o,c);if(!(N===void 0?x===S||l(x,S,s,u,c):N)){m=!1;break}E||(E=p=="constructor")}if(m&&!E){var q=a.constructor,A=o.constructor;q!=A&&"constructor"in a&&"constructor"in o&&!(typeof q=="function"&&q instanceof q&&typeof A=="function"&&A instanceof A)&&(m=!1)}return c.delete(a),c.delete(o),m}return ua=i,ua}var ca,Wf;function yE(){if(Wf)return ca;Wf=1;var e=Rr(),t=Rg(),r=vE(),n=gE(),i=St(),a=le(),o=xt(),s=Yt(),u=1,l="[object Arguments]",c="[object Array]",f="[object Object]",d=Object.prototype,h=d.hasOwnProperty;function _(g,v,p,y,b,m){var E=a(g),x=a(v),S=E?c:i(g),N=x?c:i(v);S=S==l?f:S,N=N==l?f:N;var q=S==f,A=N==f,I=S==N;if(I&&o(g)){if(!o(v))return!1;E=!0,q=!1}if(I&&!q)return m||(m=new e),E||s(g)?t(g,v,p,y,b,m):r(g,v,S,p,y,b,m);if(!(p&u)){var O=q&&h.call(g,"__wrapped__"),k=A&&h.call(v,"__wrapped__");if(O||k){var w=O?g.value():g,T=k?v.value():v;return m||(m=new e),b(w,T,p,y,m)}}return I?(m||(m=new e),n(g,v,p,y,b,m)):!1}return ca=_,ca}var la,Zf;function Ag(){if(Zf)return la;Zf=1;var e=yE(),t=Ue();function r(n,i,a,o,s){return n===i?!0:n==null||i==null||!t(n)&&!t(i)?n!==n&&i!==i:e(n,i,a,o,r,s)}return la=r,la}var fa,Xf;function mE(){if(Xf)return fa;Xf=1;var e=Rr(),t=Ag(),r=1,n=2;function i(a,o,s,u){var l=s.length,c=l,f=!u;if(a==null)return!c;for(a=Object(a);l--;){var d=s[l];if(f&&d[2]?d[1]!==a[d[0]]:!(d[0]in a))return!1}for(;++l<c;){d=s[l];var h=d[0],_=a[h],g=d[1];if(f&&d[2]){if(_===void 0&&!(h in a))return!1}else{var v=new e;if(u)var p=u(_,g,h,a,o,v);if(!(p===void 0?t(g,_,r|n,u,v):p))return!1}}return!0}return fa=i,fa}var da,Jf;function Ng(){if(Jf)return da;Jf=1;var e=Te();function t(r){return r===r&&!e(r)}return da=t,da}var ha,Qf;function _E(){if(Qf)return ha;Qf=1;var e=Ng(),t=Qe();function r(n){for(var i=t(n),a=i.length;a--;){var o=i[a],s=n[o];i[a]=[o,s,e(s)]}return i}return ha=r,ha}var pa,ed;function Ig(){if(ed)return pa;ed=1;function e(t,r){return function(n){return n==null?!1:n[t]===r&&(r!==void 0||t in Object(n))}}return pa=e,pa}var va,td;function bE(){if(td)return va;td=1;var e=mE(),t=_E(),r=Ig();function n(i){var a=t(i);return a.length==1&&a[0][2]?r(a[0][0],a[0][1]):function(o){return o===i||e(o,i,a)}}return va=n,va}var ga,rd;function ju(){if(rd)return ga;rd=1;var e=le(),t=$t(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,n=/^\w*$/;function i(a,o){if(e(a))return!1;var s=typeof a;return s=="number"||s=="symbol"||s=="boolean"||a==null||t(a)?!0:n.test(a)||!r.test(a)||o!=null&&a in Object(o)}return ga=i,ga}var ya,nd;function wE(){if(nd)return ya;nd=1;var e=Ou(),t="Expected a function";function r(n,i){if(typeof n!="function"||i!=null&&typeof i!="function")throw new TypeError(t);var a=function(){var o=arguments,s=i?i.apply(this,o):o[0],u=a.cache;if(u.has(s))return u.get(s);var l=n.apply(this,o);return a.cache=u.set(s,l)||u,l};return a.cache=new(r.Cache||e),a}return r.Cache=e,ya=r,ya}var ma,id;function EE(){if(id)return ma;id=1;var e=wE(),t=500;function r(n){var i=e(n,function(o){return a.size===t&&a.clear(),o}),a=i.cache;return i}return ma=r,ma}var _a,ad;function xE(){if(ad)return _a;ad=1;var e=EE(),t=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,n=e(function(i){var a=[];return i.charCodeAt(0)===46&&a.push(""),i.replace(t,function(o,s,u,l){a.push(u?l.replace(r,"$1"):s||o)}),a});return _a=n,_a}var ba,od;function Or(){if(od)return ba;od=1;function e(t,r){for(var n=-1,i=t==null?0:t.length,a=Array(i);++n<i;)a[n]=r(t[n],n,t);return a}return ba=e,ba}var wa,sd;function SE(){if(sd)return wa;sd=1;var e=vr(),t=Or(),r=le(),n=$t(),i=e?e.prototype:void 0,a=i?i.toString:void 0;function o(s){if(typeof s=="string")return s;if(r(s))return t(s,o)+"";if(n(s))return a?a.call(s):"";var u=s+"";return u=="0"&&1/s==-1/0?"-0":u}return wa=o,wa}var Ea,ud;function Tg(){if(ud)return Ea;ud=1;var e=SE();function t(r){return r==null?"":e(r)}return Ea=t,Ea}var xa,cd;function Dr(){if(cd)return xa;cd=1;var e=le(),t=ju(),r=xE(),n=Tg();function i(a,o){return e(a)?a:t(a,o)?[a]:r(n(a))}return xa=i,xa}var Sa,ld;function Wt(){if(ld)return Sa;ld=1;var e=$t();function t(r){if(typeof r=="string"||e(r))return r;var n=r+"";return n=="0"&&1/r==-1/0?"-0":n}return Sa=t,Sa}var qa,fd;function Lr(){if(fd)return qa;fd=1;var e=Dr(),t=Wt();function r(n,i){i=e(i,n);for(var a=0,o=i.length;n!=null&&a<o;)n=n[t(i[a++])];return a&&a==o?n:void 0}return qa=r,qa}var Ca,dd;function qE(){if(dd)return Ca;dd=1;var e=Lr();function t(r,n,i){var a=r==null?void 0:e(r,n);return a===void 0?i:a}return Ca=t,Ca}var Ra,hd;function CE(){if(hd)return Ra;hd=1;function e(t,r){return t!=null&&r in Object(t)}return Ra=e,Ra}var Aa,pd;function Mg(){if(pd)return Aa;pd=1;var e=Dr(),t=jt(),r=le(),n=Ir(),i=Lu(),a=Wt();function o(s,u,l){u=e(u,s);for(var c=-1,f=u.length,d=!1;++c<f;){var h=a(u[c]);if(!(d=s!=null&&l(s,h)))break;s=s[h]}return d||++c!=f?d:(f=s==null?0:s.length,!!f&&i(f)&&n(h,f)&&(r(s)||t(s)))}return Aa=o,Aa}var Na,vd;function Pg(){if(vd)return Na;vd=1;var e=CE(),t=Mg();function r(n,i){return n!=null&&t(n,i,e)}return Na=r,Na}var Ia,gd;function RE(){if(gd)return Ia;gd=1;var e=Ag(),t=qE(),r=Pg(),n=ju(),i=Ng(),a=Ig(),o=Wt(),s=1,u=2;function l(c,f){return n(c)&&i(f)?a(o(c),f):function(d){var h=t(d,c);return h===void 0&&h===f?r(d,c):e(f,h,s|u)}}return Ia=l,Ia}var Ta,yd;function kg(){if(yd)return Ta;yd=1;function e(t){return function(r){return r?.[t]}}return Ta=e,Ta}var Ma,md;function AE(){if(md)return Ma;md=1;var e=Lr();function t(r){return function(n){return e(n,r)}}return Ma=t,Ma}var Pa,_d;function NE(){if(_d)return Pa;_d=1;var e=kg(),t=AE(),r=ju(),n=Wt();function i(a){return r(a)?e(n(a)):t(a)}return Pa=i,Pa}var ka,bd;function je(){if(bd)return ka;bd=1;var e=bE(),t=RE(),r=ct(),n=le(),i=NE();function a(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?n(o)?t(o[0],o[1]):e(o):i(o)}return ka=a,ka}var Oa,wd;function Og(){if(wd)return Oa;wd=1;var e=fg(),t=lE(),r=je(),n=le();function i(a,o){var s=n(a)?e:t;return s(a,r(o,3))}return Oa=i,Oa}var Da,Ed;function IE(){if(Ed)return Da;Ed=1;var e=Object.prototype,t=e.hasOwnProperty;function r(n,i){return n!=null&&t.call(n,i)}return Da=r,Da}var La,xd;function Dg(){if(xd)return La;xd=1;var e=IE(),t=Mg();function r(n,i){return n!=null&&t(n,i,e)}return La=r,La}var Fa,Sd;function TE(){if(Sd)return Fa;Sd=1;var e=zu(),t=St(),r=jt(),n=le(),i=Ke(),a=xt(),o=Mr(),s=Yt(),u="[object Map]",l="[object Set]",c=Object.prototype,f=c.hasOwnProperty;function d(h){if(h==null)return!0;if(i(h)&&(n(h)||typeof h=="string"||typeof h.splice=="function"||a(h)||s(h)||r(h)))return!h.length;var _=t(h);if(_==u||_==l)return!h.size;if(o(h))return!e(h).length;for(var g in h)if(f.call(h,g))return!1;return!0}return Fa=d,Fa}var za,qd;function Lg(){if(qd)return za;qd=1;function e(t){return t===void 0}return za=e,za}var Ba,Cd;function Fg(){if(Cd)return Ba;Cd=1;var e=kr(),t=Ke();function r(n,i){var a=-1,o=t(n)?Array(n.length):[];return e(n,function(s,u,l){o[++a]=i(s,u,l)}),o}return Ba=r,Ba}var Ha,Rd;function zg(){if(Rd)return Ha;Rd=1;var e=Or(),t=je(),r=Fg(),n=le();function i(a,o){var s=n(a)?e:r;return s(a,t(o,3))}return Ha=i,Ha}var $a,Ad;function ME(){if(Ad)return $a;Ad=1;function e(t,r,n,i){var a=-1,o=t==null?0:t.length;for(i&&o&&(n=t[++a]);++a<o;)n=r(n,t[a],a,t);return n}return $a=e,$a}var Va,Nd;function PE(){if(Nd)return Va;Nd=1;function e(t,r,n,i,a){return a(t,function(o,s,u){n=i?(i=!1,o):r(n,o,s,u)}),n}return Va=e,Va}var Ga,Id;function Bg(){if(Id)return Ga;Id=1;var e=ME(),t=kr(),r=je(),n=PE(),i=le();function a(o,s,u){var l=i(o)?e:n,c=arguments.length<3;return l(o,r(s,4),u,c,t)}return Ga=a,Ga}var Ua,Td;function kE(){if(Td)return Ua;Td=1;var e=wt(),t=le(),r=Ue(),n="[object String]";function i(a){return typeof a=="string"||!t(a)&&r(a)&&e(a)==n}return Ua=i,Ua}var Ka,Md;function OE(){if(Md)return Ka;Md=1;var e=kg(),t=e("length");return Ka=t,Ka}var ja,Pd;function DE(){if(Pd)return ja;Pd=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="\\u200d",s=RegExp("["+o+e+i+a+"]");function u(l){return s.test(l)}return ja=u,ja}var Ya,kd;function LE(){if(kd)return Ya;kd=1;var e="\\ud800-\\udfff",t="\\u0300-\\u036f",r="\\ufe20-\\ufe2f",n="\\u20d0-\\u20ff",i=t+r+n,a="\\ufe0e\\ufe0f",o="["+e+"]",s="["+i+"]",u="\\ud83c[\\udffb-\\udfff]",l="(?:"+s+"|"+u+")",c="[^"+e+"]",f="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",h="\\u200d",_=l+"?",g="["+a+"]?",v="(?:"+h+"(?:"+[c,f,d].join("|")+")"+g+_+")*",p=g+_+v,y="(?:"+[c+s+"?",s,f,d,o].join("|")+")",b=RegExp(u+"(?="+u+")|"+y+p,"g");function m(E){for(var x=b.lastIndex=0;b.test(E);)++x;return x}return Ya=m,Ya}var Wa,Od;function FE(){if(Od)return Wa;Od=1;var e=OE(),t=DE(),r=LE();function n(i){return t(i)?r(i):e(i)}return Wa=n,Wa}var Za,Dd;function zE(){if(Dd)return Za;Dd=1;var e=zu(),t=St(),r=Ke(),n=kE(),i=FE(),a="[object Map]",o="[object Set]";function s(u){if(u==null)return 0;if(r(u))return n(u)?i(u):u.length;var l=t(u);return l==a||l==o?u.size:e(u).length}return Za=s,Za}var Xa,Ld;function BE(){if(Ld)return Xa;Ld=1;var e=Du(),t=_g(),r=Uu(),n=je(),i=Pr(),a=le(),o=xt(),s=Ut(),u=Te(),l=Yt();function c(f,d,h){var _=a(f),g=_||o(f)||l(f);if(d=n(d,4),h==null){var v=f&&f.constructor;g?h=_?new v:[]:u(f)?h=s(v)?t(i(f)):{}:h={}}return(g?e:r)(f,function(p,y,b){return d(h,p,y,b)}),h}return Xa=c,Xa}var Ja,Fd;function HE(){if(Fd)return Ja;Fd=1;var e=vr(),t=jt(),r=le(),n=e?e.isConcatSpreadable:void 0;function i(a){return r(a)||t(a)||!!(n&&a&&a[n])}return Ja=i,Ja}var Qa,zd;function Yu(){if(zd)return Qa;zd=1;var e=Hu(),t=HE();function r(n,i,a,o,s){var u=-1,l=n.length;for(a||(a=t),s||(s=[]);++u<l;){var c=n[u];i>0&&a(c)?i>1?r(c,i-1,a,o,s):e(s,c):o||(s[s.length]=c)}return s}return Qa=r,Qa}var eo,Bd;function $E(){if(Bd)return eo;Bd=1;function e(t,r,n){switch(n.length){case 0:return t.call(r);case 1:return t.call(r,n[0]);case 2:return t.call(r,n[0],n[1]);case 3:return t.call(r,n[0],n[1],n[2])}return t.apply(r,n)}return eo=e,eo}var to,Hd;function Hg(){if(Hd)return to;Hd=1;var e=$E(),t=Math.max;function r(n,i,a){return i=t(i===void 0?n.length-1:i,0),function(){for(var o=arguments,s=-1,u=t(o.length-i,0),l=Array(u);++s<u;)l[s]=o[i+s];s=-1;for(var c=Array(i+1);++s<i;)c[s]=o[s];return c[i]=a(l),e(n,this,c)}}return to=r,to}var ro,$d;function VE(){if($d)return ro;$d=1;var e=Vu(),t=og(),r=ct(),n=t?function(i,a){return t(i,"toString",{configurable:!0,enumerable:!1,value:e(a),writable:!0})}:r;return ro=n,ro}var no,Vd;function GE(){if(Vd)return no;Vd=1;var e=800,t=16,r=Date.now;function n(i){var a=0,o=0;return function(){var s=r(),u=t-(s-o);if(o=s,u>0){if(++a>=e)return arguments[0]}else a=0;return i.apply(void 0,arguments)}}return no=n,no}var io,Gd;function $g(){if(Gd)return io;Gd=1;var e=VE(),t=GE(),r=t(e);return io=r,io}var ao,Ud;function Fr(){if(Ud)return ao;Ud=1;var e=ct(),t=Hg(),r=$g();function n(i,a){return r(t(i,a,e),i+"")}return ao=n,ao}var oo,Kd;function Vg(){if(Kd)return oo;Kd=1;function e(t,r,n,i){for(var a=t.length,o=n+(i?1:-1);i?o--:++o<a;)if(r(t[o],o,t))return o;return-1}return oo=e,oo}var so,jd;function UE(){if(jd)return so;jd=1;function e(t){return t!==t}return so=e,so}var uo,Yd;function KE(){if(Yd)return uo;Yd=1;function e(t,r,n){for(var i=n-1,a=t.length;++i<a;)if(t[i]===r)return i;return-1}return uo=e,uo}var co,Wd;function jE(){if(Wd)return co;Wd=1;var e=Vg(),t=UE(),r=KE();function n(i,a,o){return a===a?r(i,a,o):e(i,t,o)}return co=n,co}var lo,Zd;function YE(){if(Zd)return lo;Zd=1;var e=jE();function t(r,n){var i=r==null?0:r.length;return!!i&&e(r,n,0)>-1}return lo=t,lo}var fo,Xd;function WE(){if(Xd)return fo;Xd=1;function e(t,r,n){for(var i=-1,a=t==null?0:t.length;++i<a;)if(n(r,t[i]))return!0;return!1}return fo=e,fo}var ho,Jd;function ZE(){if(Jd)return ho;Jd=1;function e(){}return ho=e,ho}var po,Qd;function XE(){if(Qd)return po;Qd=1;var e=gg(),t=ZE(),r=Ku(),n=1/0,i=e&&1/r(new e([,-0]))[1]==n?function(a){return new e(a)}:t;return po=i,po}var vo,eh;function JE(){if(eh)return vo;eh=1;var e=qg(),t=YE(),r=WE(),n=Cg(),i=XE(),a=Ku(),o=200;function s(u,l,c){var f=-1,d=t,h=u.length,_=!0,g=[],v=g;if(c)_=!1,d=r;else if(h>=o){var p=l?null:i(u);if(p)return a(p);_=!1,d=n,v=new e}else v=l?[]:g;e:for(;++f<h;){var y=u[f],b=l?l(y):y;if(y=c||y!==0?y:0,_&&b===b){for(var m=v.length;m--;)if(v[m]===b)continue e;l&&v.push(b),g.push(y)}else d(v,b,c)||(v!==g&&v.push(b),g.push(y))}return g}return vo=s,vo}var go,th;function Gg(){if(th)return go;th=1;var e=Ke(),t=Ue();function r(n){return t(n)&&e(n)}return go=r,go}var yo,rh;function QE(){if(rh)return yo;rh=1;var e=Yu(),t=Fr(),r=JE(),n=Gg(),i=t(function(a){return r(e(a,1,n,!0))});return yo=i,yo}var mo,nh;function ex(){if(nh)return mo;nh=1;var e=Or();function t(r,n){return e(n,function(i){return r[i]})}return mo=t,mo}var _o,ih;function Ug(){if(ih)return _o;ih=1;var e=ex(),t=Qe();function r(n){return n==null?[]:e(n,t(n))}return _o=r,_o}var bo,ah;function qe(){if(ah)return bo;ah=1;var e;if(typeof Pu=="function")try{e={clone:sE(),constant:Vu(),each:Sg(),filter:Og(),has:Dg(),isArray:le(),isEmpty:TE(),isFunction:Ut(),isUndefined:Lg(),keys:Qe(),map:zg(),reduce:Bg(),size:zE(),transform:BE(),union:QE(),values:Ug()}}catch{}return e||(e=window._),bo=e,bo}var wo,oh;function Wu(){if(oh)return wo;oh=1;var e=qe();wo=i;var t="\0",r="\0",n="";function i(c){this._isDirected=e.has(c,"directed")?c.directed:!0,this._isMultigraph=e.has(c,"multigraph")?c.multigraph:!1,this._isCompound=e.has(c,"compound")?c.compound:!1,this._label=void 0,this._defaultNodeLabelFn=e.constant(void 0),this._defaultEdgeLabelFn=e.constant(void 0),this._nodes={},this._isCompound&&(this._parent={},this._children={},this._children[r]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}i.prototype._nodeCount=0,i.prototype._edgeCount=0,i.prototype.isDirected=function(){return this._isDirected},i.prototype.isMultigraph=function(){return this._isMultigraph},i.prototype.isCompound=function(){return this._isCompound},i.prototype.setGraph=function(c){return this._label=c,this},i.prototype.graph=function(){return this._label},i.prototype.setDefaultNodeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultNodeLabelFn=c,this},i.prototype.nodeCount=function(){return this._nodeCount},i.prototype.nodes=function(){return e.keys(this._nodes)},i.prototype.sources=function(){var c=this;return e.filter(this.nodes(),function(f){return e.isEmpty(c._in[f])})},i.prototype.sinks=function(){var c=this;return e.filter(this.nodes(),function(f){return e.isEmpty(c._out[f])})},i.prototype.setNodes=function(c,f){var d=arguments,h=this;return e.each(c,function(_){d.length>1?h.setNode(_,f):h.setNode(_)}),this},i.prototype.setNode=function(c,f){return e.has(this._nodes,c)?(arguments.length>1&&(this._nodes[c]=f),this):(this._nodes[c]=arguments.length>1?f:this._defaultNodeLabelFn(c),this._isCompound&&(this._parent[c]=r,this._children[c]={},this._children[r][c]=!0),this._in[c]={},this._preds[c]={},this._out[c]={},this._sucs[c]={},++this._nodeCount,this)},i.prototype.node=function(c){return this._nodes[c]},i.prototype.hasNode=function(c){return e.has(this._nodes,c)},i.prototype.removeNode=function(c){var f=this;if(e.has(this._nodes,c)){var d=function(h){f.removeEdge(f._edgeObjs[h])};delete this._nodes[c],this._isCompound&&(this._removeFromParentsChildList(c),delete this._parent[c],e.each(this.children(c),function(h){f.setParent(h)}),delete this._children[c]),e.each(e.keys(this._in[c]),d),delete this._in[c],delete this._preds[c],e.each(e.keys(this._out[c]),d),delete this._out[c],delete this._sucs[c],--this._nodeCount}return this},i.prototype.setParent=function(c,f){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(f))f=r;else{f+="";for(var d=f;!e.isUndefined(d);d=this.parent(d))if(d===c)throw new Error("Setting "+f+" as parent of "+c+" would create a cycle");this.setNode(f)}return this.setNode(c),this._removeFromParentsChildList(c),this._parent[c]=f,this._children[f][c]=!0,this},i.prototype._removeFromParentsChildList=function(c){delete this._children[this._parent[c]][c]},i.prototype.parent=function(c){if(this._isCompound){var f=this._parent[c];if(f!==r)return f}},i.prototype.children=function(c){if(e.isUndefined(c)&&(c=r),this._isCompound){var f=this._children[c];if(f)return e.keys(f)}else{if(c===r)return this.nodes();if(this.hasNode(c))return[]}},i.prototype.predecessors=function(c){var f=this._preds[c];if(f)return e.keys(f)},i.prototype.successors=function(c){var f=this._sucs[c];if(f)return e.keys(f)},i.prototype.neighbors=function(c){var f=this.predecessors(c);if(f)return e.union(f,this.successors(c))},i.prototype.isLeaf=function(c){var f;return this.isDirected()?f=this.successors(c):f=this.neighbors(c),f.length===0},i.prototype.filterNodes=function(c){var f=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});f.setGraph(this.graph());var d=this;e.each(this._nodes,function(g,v){c(v)&&f.setNode(v,g)}),e.each(this._edgeObjs,function(g){f.hasNode(g.v)&&f.hasNode(g.w)&&f.setEdge(g,d.edge(g))});var h={};function _(g){var v=d.parent(g);return v===void 0||f.hasNode(v)?(h[g]=v,v):v in h?h[v]:_(v)}return this._isCompound&&e.each(f.nodes(),function(g){f.setParent(g,_(g))}),f},i.prototype.setDefaultEdgeLabel=function(c){return e.isFunction(c)||(c=e.constant(c)),this._defaultEdgeLabelFn=c,this},i.prototype.edgeCount=function(){return this._edgeCount},i.prototype.edges=function(){return e.values(this._edgeObjs)},i.prototype.setPath=function(c,f){var d=this,h=arguments;return e.reduce(c,function(_,g){return h.length>1?d.setEdge(_,g,f):d.setEdge(_,g),g}),this},i.prototype.setEdge=function(){var c,f,d,h,_=!1,g=arguments[0];typeof g=="object"&&g!==null&&"v"in g?(c=g.v,f=g.w,d=g.name,arguments.length===2&&(h=arguments[1],_=!0)):(c=g,f=arguments[1],d=arguments[3],arguments.length>2&&(h=arguments[2],_=!0)),c=""+c,f=""+f,e.isUndefined(d)||(d=""+d);var v=s(this._isDirected,c,f,d);if(e.has(this._edgeLabels,v))return _&&(this._edgeLabels[v]=h),this;if(!e.isUndefined(d)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(c),this.setNode(f),this._edgeLabels[v]=_?h:this._defaultEdgeLabelFn(c,f,d);var p=u(this._isDirected,c,f,d);return c=p.v,f=p.w,Object.freeze(p),this._edgeObjs[v]=p,a(this._preds[f],c),a(this._sucs[c],f),this._in[f][v]=p,this._out[c][v]=p,this._edgeCount++,this},i.prototype.edge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return this._edgeLabels[h]},i.prototype.hasEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d);return e.has(this._edgeLabels,h)},i.prototype.removeEdge=function(c,f,d){var h=arguments.length===1?l(this._isDirected,arguments[0]):s(this._isDirected,c,f,d),_=this._edgeObjs[h];return _&&(c=_.v,f=_.w,delete this._edgeLabels[h],delete this._edgeObjs[h],o(this._preds[f],c),o(this._sucs[c],f),delete this._in[f][h],delete this._out[c][h],this._edgeCount--),this},i.prototype.inEdges=function(c,f){var d=this._in[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.v===f}):h}},i.prototype.outEdges=function(c,f){var d=this._out[c];if(d){var h=e.values(d);return f?e.filter(h,function(_){return _.w===f}):h}},i.prototype.nodeEdges=function(c,f){var d=this.inEdges(c,f);if(d)return d.concat(this.outEdges(c,f))};function a(c,f){c[f]?c[f]++:c[f]=1}function o(c,f){--c[f]||delete c[f]}function s(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}return _+n+g+n+(e.isUndefined(h)?t:h)}function u(c,f,d,h){var _=""+f,g=""+d;if(!c&&_>g){var v=_;_=g,g=v}var p={v:_,w:g};return h&&(p.name=h),p}function l(c,f){return s(c,f.v,f.w,f.name)}return wo}var Eo,sh;function tx(){return sh||(sh=1,Eo="2.1.8"),Eo}var xo,uh;function rx(){return uh||(uh=1,xo={Graph:Wu(),version:tx()}),xo}var So,ch;function nx(){if(ch)return So;ch=1;var e=qe(),t=Wu();So={write:r,read:a};function r(o){var s={options:{directed:o.isDirected(),multigraph:o.isMultigraph(),compound:o.isCompound()},nodes:n(o),edges:i(o)};return e.isUndefined(o.graph())||(s.value=e.clone(o.graph())),s}function n(o){return e.map(o.nodes(),function(s){var u=o.node(s),l=o.parent(s),c={v:s};return e.isUndefined(u)||(c.value=u),e.isUndefined(l)||(c.parent=l),c})}function i(o){return e.map(o.edges(),function(s){var u=o.edge(s),l={v:s.v,w:s.w};return e.isUndefined(s.name)||(l.name=s.name),e.isUndefined(u)||(l.value=u),l})}function a(o){var s=new t(o.options).setGraph(o.value);return e.each(o.nodes,function(u){s.setNode(u.v,u.value),u.parent&&s.setParent(u.v,u.parent)}),e.each(o.edges,function(u){s.setEdge({v:u.v,w:u.w,name:u.name},u.value)}),s}return So}var qo,lh;function ix(){if(lh)return qo;lh=1;var e=qe();qo=t;function t(r){var n={},i=[],a;function o(s){e.has(n,s)||(n[s]=!0,a.push(s),e.each(r.successors(s),o),e.each(r.predecessors(s),o))}return e.each(r.nodes(),function(s){a=[],o(s),a.length&&i.push(a)}),i}return qo}var Co,fh;function Kg(){if(fh)return Co;fh=1;var e=qe();Co=t;function t(){this._arr=[],this._keyIndices={}}return t.prototype.size=function(){return this._arr.length},t.prototype.keys=function(){return this._arr.map(function(r){return r.key})},t.prototype.has=function(r){return e.has(this._keyIndices,r)},t.prototype.priority=function(r){var n=this._keyIndices[r];if(n!==void 0)return this._arr[n].priority},t.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},t.prototype.add=function(r,n){var i=this._keyIndices;if(r=String(r),!e.has(i,r)){var a=this._arr,o=a.length;return i[r]=o,a.push({key:r,priority:n}),this._decrease(o),!0}return!1},t.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var r=this._arr.pop();return delete this._keyIndices[r.key],this._heapify(0),r.key},t.prototype.decrease=function(r,n){var i=this._keyIndices[r];if(n>this._arr[i].priority)throw new Error("New priority is greater than current priority. Key: "+r+" Old: "+this._arr[i].priority+" New: "+n);this._arr[i].priority=n,this._decrease(i)},t.prototype._heapify=function(r){var n=this._arr,i=2*r,a=i+1,o=r;i<n.length&&(o=n[i].priority<n[o].priority?i:o,a<n.length&&(o=n[a].priority<n[o].priority?a:o),o!==r&&(this._swap(r,o),this._heapify(o)))},t.prototype._decrease=function(r){for(var n=this._arr,i=n[r].priority,a;r!==0&&(a=r>>1,!(n[a].priority<i));)this._swap(r,a),r=a},t.prototype._swap=function(r,n){var i=this._arr,a=this._keyIndices,o=i[r],s=i[n];i[r]=s,i[n]=o,a[s.key]=r,a[o.key]=n},Co}var Ro,dh;function jg(){if(dh)return Ro;dh=1;var e=qe(),t=Kg();Ro=n;var r=e.constant(1);function n(a,o,s,u){return i(a,String(o),s||r,u||function(l){return a.outEdges(l)})}function i(a,o,s,u){var l={},c=new t,f,d,h=function(_){var g=_.v!==f?_.v:_.w,v=l[g],p=s(_),y=d.distance+p;if(p<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+_+" Weight: "+p);y<v.distance&&(v.distance=y,v.predecessor=f,c.decrease(g,y))};for(a.nodes().forEach(function(_){var g=_===o?0:Number.POSITIVE_INFINITY;l[_]={distance:g},c.add(_,g)});c.size()>0&&(f=c.removeMin(),d=l[f],d.distance!==Number.POSITIVE_INFINITY);)u(f).forEach(h);return l}return Ro}var Ao,hh;function ax(){if(hh)return Ao;hh=1;var e=jg(),t=qe();Ao=r;function r(n,i,a){return t.transform(n.nodes(),function(o,s){o[s]=e(n,s,i,a)},{})}return Ao}var No,ph;function Yg(){if(ph)return No;ph=1;var e=qe();No=t;function t(r){var n=0,i=[],a={},o=[];function s(u){var l=a[u]={onStack:!0,lowlink:n,index:n++};if(i.push(u),r.successors(u).forEach(function(d){e.has(a,d)?a[d].onStack&&(l.lowlink=Math.min(l.lowlink,a[d].index)):(s(d),l.lowlink=Math.min(l.lowlink,a[d].lowlink))}),l.lowlink===l.index){var c=[],f;do f=i.pop(),a[f].onStack=!1,c.push(f);while(u!==f);o.push(c)}}return r.nodes().forEach(function(u){e.has(a,u)||s(u)}),o}return No}var Io,vh;function ox(){if(vh)return Io;vh=1;var e=qe(),t=Yg();Io=r;function r(n){return e.filter(t(n),function(i){return i.length>1||i.length===1&&n.hasEdge(i[0],i[0])})}return Io}var To,gh;function sx(){if(gh)return To;gh=1;var e=qe();To=r;var t=e.constant(1);function r(i,a,o){return n(i,a||t,o||function(s){return i.outEdges(s)})}function n(i,a,o){var s={},u=i.nodes();return u.forEach(function(l){s[l]={},s[l][l]={distance:0},u.forEach(function(c){l!==c&&(s[l][c]={distance:Number.POSITIVE_INFINITY})}),o(l).forEach(function(c){var f=c.v===l?c.w:c.v,d=a(c);s[l][f]={distance:d,predecessor:l}})}),u.forEach(function(l){var c=s[l];u.forEach(function(f){var d=s[f];u.forEach(function(h){var _=d[l],g=c[h],v=d[h],p=_.distance+g.distance;p<v.distance&&(v.distance=p,v.predecessor=g.predecessor)})})}),s}return To}var Mo,yh;function Wg(){if(yh)return Mo;yh=1;var e=qe();Mo=t,t.CycleException=r;function t(n){var i={},a={},o=[];function s(u){if(e.has(a,u))throw new r;e.has(i,u)||(a[u]=!0,i[u]=!0,e.each(n.predecessors(u),s),delete a[u],o.push(u))}if(e.each(n.sinks(),s),e.size(i)!==n.nodeCount())throw new r;return o}function r(){}return r.prototype=new Error,Mo}var Po,mh;function ux(){if(mh)return Po;mh=1;var e=Wg();Po=t;function t(r){try{e(r)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}return Po}var ko,_h;function Zg(){if(_h)return ko;_h=1;var e=qe();ko=t;function t(n,i,a){e.isArray(i)||(i=[i]);var o=(n.isDirected()?n.successors:n.neighbors).bind(n),s=[],u={};return e.each(i,function(l){if(!n.hasNode(l))throw new Error("Graph does not have node: "+l);r(n,l,a==="post",u,o,s)}),s}function r(n,i,a,o,s,u){e.has(o,i)||(o[i]=!0,a||u.push(i),e.each(s(i),function(l){r(n,l,a,o,s,u)}),a&&u.push(i))}return ko}var Oo,bh;function cx(){if(bh)return Oo;bh=1;var e=Zg();Oo=t;function t(r,n){return e(r,n,"post")}return Oo}var Do,wh;function lx(){if(wh)return Do;wh=1;var e=Zg();Do=t;function t(r,n){return e(r,n,"pre")}return Do}var Lo,Eh;function fx(){if(Eh)return Lo;Eh=1;var e=qe(),t=Wu(),r=Kg();Lo=n;function n(i,a){var o=new t,s={},u=new r,l;function c(d){var h=d.v===l?d.w:d.v,_=u.priority(h);if(_!==void 0){var g=a(d);g<_&&(s[h]=l,u.decrease(h,g))}}if(i.nodeCount()===0)return o;e.each(i.nodes(),function(d){u.add(d,Number.POSITIVE_INFINITY),o.setNode(d)}),u.decrease(i.nodes()[0],0);for(var f=!1;u.size()>0;){if(l=u.removeMin(),e.has(s,l))o.setEdge(l,s[l]);else{if(f)throw new Error("Input graph is not connected: "+i);f=!0}i.nodeEdges(l).forEach(c)}return o}return Lo}var Fo,xh;function dx(){return xh||(xh=1,Fo={components:ix(),dijkstra:jg(),dijkstraAll:ax(),findCycles:ox(),floydWarshall:sx(),isAcyclic:ux(),postorder:cx(),preorder:lx(),prim:fx(),tarjan:Yg(),topsort:Wg()}),Fo}var zo,Sh;function hx(){if(Sh)return zo;Sh=1;var e=rx();return zo={Graph:e.Graph,json:nx(),alg:dx(),version:e.version},zo}var Bo,qh;function Ie(){if(qh)return Bo;qh=1;var e;if(typeof Pu=="function")try{e=hx()}catch{}return e||(e=window.graphlib),Bo=e,Bo}var Ho,Ch;function px(){if(Ch)return Ho;Ch=1;var e=wg(),t=1,r=4;function n(i){return e(i,t|r)}return Ho=n,Ho}var $o,Rh;function zr(){if(Rh)return $o;Rh=1;var e=Et(),t=Ke(),r=Ir(),n=Te();function i(a,o,s){if(!n(s))return!1;var u=typeof o;return(u=="number"?t(s)&&r(o,s.length):u=="string"&&o in s)?e(s[o],a):!1}return $o=i,$o}var Vo,Ah;function vx(){if(Ah)return Vo;Ah=1;var e=Fr(),t=Et(),r=zr(),n=ut(),i=Object.prototype,a=i.hasOwnProperty,o=e(function(s,u){s=Object(s);var l=-1,c=u.length,f=c>2?u[2]:void 0;for(f&&r(u[0],u[1],f)&&(c=1);++l<c;)for(var d=u[l],h=n(d),_=-1,g=h.length;++_<g;){var v=h[_],p=s[v];(p===void 0||t(p,i[v])&&!a.call(s,v))&&(s[v]=d[v])}return s});return Vo=o,Vo}var Go,Nh;function gx(){if(Nh)return Go;Nh=1;var e=je(),t=Ke(),r=Qe();function n(i){return function(a,o,s){var u=Object(a);if(!t(a)){var l=e(o,3);a=r(a),o=function(f){return l(u[f],f,u)}}var c=i(a,o,s);return c>-1?u[l?a[c]:c]:void 0}}return Go=n,Go}var Uo,Ih;function Xg(){if(Ih)return Uo;Ih=1;var e=Vy(),t=1/0,r=17976931348623157e292;function n(i){if(!i)return i===0?i:0;if(i=e(i),i===t||i===-t){var a=i<0?-1:1;return a*r}return i===i?i:0}return Uo=n,Uo}var Ko,Th;function yx(){if(Th)return Ko;Th=1;var e=Xg();function t(r){var n=e(r),i=n%1;return n===n?i?n-i:n:0}return Ko=t,Ko}var jo,Mh;function mx(){if(Mh)return jo;Mh=1;var e=Vg(),t=je(),r=yx(),n=Math.max;function i(a,o,s){var u=a==null?0:a.length;if(!u)return-1;var l=s==null?0:r(s);return l<0&&(l=n(u+l,0)),e(a,t(o,3),l)}return jo=i,jo}var Yo,Ph;function _x(){if(Ph)return Yo;Ph=1;var e=gx(),t=mx(),r=e(t);return Yo=r,Yo}var Wo,kh;function Jg(){if(kh)return Wo;kh=1;var e=Yu();function t(r){var n=r==null?0:r.length;return n?e(r,1):[]}return Wo=t,Wo}var Zo,Oh;function bx(){if(Oh)return Zo;Oh=1;var e=Gu(),t=Eg(),r=ut();function n(i,a){return i==null?i:e(i,t(a),r)}return Zo=n,Zo}var Xo,Dh;function wx(){if(Dh)return Xo;Dh=1;function e(t){var r=t==null?0:t.length;return r?t[r-1]:void 0}return Xo=e,Xo}var Jo,Lh;function Ex(){if(Lh)return Jo;Lh=1;var e=Ar(),t=Uu(),r=je();function n(i,a){var o={};return a=r(a,3),t(i,function(s,u,l){e(o,u,a(s,u,l))}),o}return Jo=n,Jo}var Qo,Fh;function Zu(){if(Fh)return Qo;Fh=1;var e=$t();function t(r,n,i){for(var a=-1,o=r.length;++a<o;){var s=r[a],u=n(s);if(u!=null&&(l===void 0?u===u&&!e(u):i(u,l)))var l=u,c=s}return c}return Qo=t,Qo}var es,zh;function xx(){if(zh)return es;zh=1;function e(t,r){return t>r}return es=e,es}var ts,Bh;function Sx(){if(Bh)return ts;Bh=1;var e=Zu(),t=xx(),r=ct();function n(i){return i&&i.length?e(i,r,t):void 0}return ts=n,ts}var rs,Hh;function Qg(){if(Hh)return rs;Hh=1;var e=Ar(),t=Et();function r(n,i,a){(a!==void 0&&!t(n[i],a)||a===void 0&&!(i in n))&&e(n,i,a)}return rs=r,rs}var ns,$h;function qx(){if($h)return ns;$h=1;var e=wt(),t=Pr(),r=Ue(),n="[object Object]",i=Function.prototype,a=Object.prototype,o=i.toString,s=a.hasOwnProperty,u=o.call(Object);function l(c){if(!r(c)||e(c)!=n)return!1;var f=t(c);if(f===null)return!0;var d=s.call(f,"constructor")&&f.constructor;return typeof d=="function"&&d instanceof d&&o.call(d)==u}return ns=l,ns}var is,Vh;function ey(){if(Vh)return is;Vh=1;function e(t,r){if(!(r==="constructor"&&typeof t[r]=="function")&&r!="__proto__")return t[r]}return is=e,is}var as,Gh;function Cx(){if(Gh)return as;Gh=1;var e=Kt(),t=ut();function r(n){return e(n,t(n))}return as=r,as}var os,Uh;function Rx(){if(Uh)return os;Uh=1;var e=Qg(),t=cg(),r=mg(),n=lg(),i=bg(),a=jt(),o=le(),s=Gg(),u=xt(),l=Ut(),c=Te(),f=qx(),d=Yt(),h=ey(),_=Cx();function g(v,p,y,b,m,E,x){var S=h(v,y),N=h(p,y),q=x.get(N);if(q){e(v,y,q);return}var A=E?E(S,N,y+"",v,p,x):void 0,I=A===void 0;if(I){var O=o(N),k=!O&&u(N),w=!O&&!k&&d(N);A=N,O||k||w?o(S)?A=S:s(S)?A=n(S):k?(I=!1,A=t(N,!0)):w?(I=!1,A=r(N,!0)):A=[]:f(N)||a(N)?(A=S,a(S)?A=_(S):(!c(S)||l(S))&&(A=i(N))):I=!1}I&&(x.set(N,A),m(A,N,b,E,x),x.delete(N)),e(v,y,A)}return os=g,os}var ss,Kh;function Ax(){if(Kh)return ss;Kh=1;var e=Rr(),t=Qg(),r=Gu(),n=Rx(),i=Te(),a=ut(),o=ey();function s(u,l,c,f,d){u!==l&&r(l,function(h,_){if(d||(d=new e),i(h))n(u,l,_,c,s,f,d);else{var g=f?f(o(u,_),h,_+"",u,l,d):void 0;g===void 0&&(g=h),t(u,_,g)}},a)}return ss=s,ss}var us,jh;function Nx(){if(jh)return us;jh=1;var e=Fr(),t=zr();function r(n){return e(function(i,a){var o=-1,s=a.length,u=s>1?a[s-1]:void 0,l=s>2?a[2]:void 0;for(u=n.length>3&&typeof u=="function"?(s--,u):void 0,l&&t(a[0],a[1],l)&&(u=s<3?void 0:u,s=1),i=Object(i);++o<s;){var c=a[o];c&&n(i,c,o,u)}return i})}return us=r,us}var cs,Yh;function Ix(){if(Yh)return cs;Yh=1;var e=Ax(),t=Nx(),r=t(function(n,i,a){e(n,i,a)});return cs=r,cs}var ls,Wh;function ty(){if(Wh)return ls;Wh=1;function e(t,r){return t<r}return ls=e,ls}var fs,Zh;function Tx(){if(Zh)return fs;Zh=1;var e=Zu(),t=ty(),r=ct();function n(i){return i&&i.length?e(i,r,t):void 0}return fs=n,fs}var ds,Xh;function Mx(){if(Xh)return ds;Xh=1;var e=Zu(),t=je(),r=ty();function n(i,a){return i&&i.length?e(i,t(a,2),r):void 0}return ds=n,ds}var hs,Jh;function Px(){if(Jh)return hs;Jh=1;var e=Nr(),t=Dr(),r=Ir(),n=Te(),i=Wt();function a(o,s,u,l){if(!n(o))return o;s=t(s,o);for(var c=-1,f=s.length,d=f-1,h=o;h!=null&&++c<f;){var _=i(s[c]),g=u;if(_==="__proto__"||_==="constructor"||_==="prototype")return o;if(c!=d){var v=h[_];g=l?l(v,_,h):void 0,g===void 0&&(g=n(v)?v:r(s[c+1])?[]:{})}e(h,_,g),h=h[_]}return o}return hs=a,hs}var ps,Qh;function kx(){if(Qh)return ps;Qh=1;var e=Lr(),t=Px(),r=Dr();function n(i,a,o){for(var s=-1,u=a.length,l={};++s<u;){var c=a[s],f=e(i,c);o(f,c)&&t(l,r(c,i),f)}return l}return ps=n,ps}var vs,ep;function Ox(){if(ep)return vs;ep=1;var e=kx(),t=Pg();function r(n,i){return e(n,i,function(a,o){return t(n,o)})}return vs=r,vs}var gs,tp;function Dx(){if(tp)return gs;tp=1;var e=Jg(),t=Hg(),r=$g();function n(i){return r(t(i,void 0,e),i+"")}return gs=n,gs}var ys,rp;function Lx(){if(rp)return ys;rp=1;var e=Ox(),t=Dx(),r=t(function(n,i){return n==null?{}:e(n,i)});return ys=r,ys}var ms,np;function Fx(){if(np)return ms;np=1;var e=Math.ceil,t=Math.max;function r(n,i,a,o){for(var s=-1,u=t(e((i-n)/(a||1)),0),l=Array(u);u--;)l[o?u:++s]=n,n+=a;return l}return ms=r,ms}var _s,ip;function zx(){if(ip)return _s;ip=1;var e=Fx(),t=zr(),r=Xg();function n(i){return function(a,o,s){return s&&typeof s!="number"&&t(a,o,s)&&(o=s=void 0),a=r(a),o===void 0?(o=a,a=0):o=r(o),s=s===void 0?a<o?1:-1:r(s),e(a,o,s,i)}}return _s=n,_s}var bs,ap;function Bx(){if(ap)return bs;ap=1;var e=zx(),t=e();return bs=t,bs}var ws,op;function Hx(){if(op)return ws;op=1;function e(t,r){var n=t.length;for(t.sort(r);n--;)t[n]=t[n].value;return t}return ws=e,ws}var Es,sp;function $x(){if(sp)return Es;sp=1;var e=$t();function t(r,n){if(r!==n){var i=r!==void 0,a=r===null,o=r===r,s=e(r),u=n!==void 0,l=n===null,c=n===n,f=e(n);if(!l&&!f&&!s&&r>n||s&&u&&c&&!l&&!f||a&&u&&c||!i&&c||!o)return 1;if(!a&&!s&&!f&&r<n||f&&i&&o&&!a&&!s||l&&i&&o||!u&&o||!c)return-1}return 0}return Es=t,Es}var xs,up;function Vx(){if(up)return xs;up=1;var e=$x();function t(r,n,i){for(var a=-1,o=r.criteria,s=n.criteria,u=o.length,l=i.length;++a<u;){var c=e(o[a],s[a]);if(c){if(a>=l)return c;var f=i[a];return c*(f=="desc"?-1:1)}}return r.index-n.index}return xs=t,xs}var Ss,cp;function Gx(){if(cp)return Ss;cp=1;var e=Or(),t=Lr(),r=je(),n=Fg(),i=Hx(),a=Tr(),o=Vx(),s=ct(),u=le();function l(c,f,d){f.length?f=e(f,function(g){return u(g)?function(v){return t(v,g.length===1?g[0]:g)}:g}):f=[s];var h=-1;f=e(f,a(r));var _=n(c,function(g,v,p){var y=e(f,function(b){return b(g)});return{criteria:y,index:++h,value:g}});return i(_,function(g,v){return o(g,v,d)})}return Ss=l,Ss}var qs,lp;function Ux(){if(lp)return qs;lp=1;var e=Yu(),t=Gx(),r=Fr(),n=zr(),i=r(function(a,o){if(a==null)return[];var s=o.length;return s>1&&n(a,o[0],o[1])?o=[]:s>2&&n(o[0],o[1],o[2])&&(o=[o[0]]),t(a,e(o,1),[])});return qs=i,qs}var Cs,fp;function Kx(){if(fp)return Cs;fp=1;var e=Tg(),t=0;function r(n){var i=++t;return e(n)+i}return Cs=r,Cs}var Rs,dp;function jx(){if(dp)return Rs;dp=1;function e(t,r,n){for(var i=-1,a=t.length,o=r.length,s={};++i<a;){var u=i<o?r[i]:void 0;n(s,t[i],u)}return s}return Rs=e,Rs}var As,hp;function Yx(){if(hp)return As;hp=1;var e=Nr(),t=jx();function r(n,i){return t(n||[],i||[],e)}return As=r,As}var Ns,pp;function ae(){if(pp)return Ns;pp=1;var e;if(typeof Pu=="function")try{e={cloneDeep:px(),constant:Vu(),defaults:vx(),each:Sg(),filter:Og(),find:_x(),flatten:Jg(),forEach:xg(),forIn:bx(),has:Dg(),isUndefined:Lg(),last:wx(),map:zg(),mapValues:Ex(),max:Sx(),merge:Ix(),min:Tx(),minBy:Mx(),now:Gy(),pick:Lx(),range:Bx(),reduce:Bg(),sortBy:Ux(),uniqueId:Kx(),values:Ug(),zipObject:Yx()}}catch{}return e||(e=window._),Ns=e,Ns}var Is,vp;function Wx(){if(vp)return Is;vp=1,Is=e;function e(){var n={};n._next=n._prev=n,this._sentinel=n}e.prototype.dequeue=function(){var n=this._sentinel,i=n._prev;if(i!==n)return t(i),i},e.prototype.enqueue=function(n){var i=this._sentinel;n._prev&&n._next&&t(n),n._next=i._next,i._next._prev=n,i._next=n,n._prev=i},e.prototype.toString=function(){for(var n=[],i=this._sentinel,a=i._prev;a!==i;)n.push(JSON.stringify(a,r)),a=a._prev;return"["+n.join(", ")+"]"};function t(n){n._prev._next=n._next,n._next._prev=n._prev,delete n._next,delete n._prev}function r(n,i){if(n!=="_next"&&n!=="_prev")return i}return Is}var Ts,gp;function Zx(){if(gp)return Ts;gp=1;var e=ae(),t=Ie().Graph,r=Wx();Ts=i;var n=e.constant(1);function i(l,c){if(l.nodeCount()<=1)return[];var f=s(l,c||n),d=a(f.graph,f.buckets,f.zeroIdx);return e.flatten(e.map(d,function(h){return l.outEdges(h.v,h.w)}),!0)}function a(l,c,f){for(var d=[],h=c[c.length-1],_=c[0],g;l.nodeCount();){for(;g=_.dequeue();)o(l,c,f,g);for(;g=h.dequeue();)o(l,c,f,g);if(l.nodeCount()){for(var v=c.length-2;v>0;--v)if(g=c[v].dequeue(),g){d=d.concat(o(l,c,f,g,!0));break}}}return d}function o(l,c,f,d,h){var _=h?[]:void 0;return e.forEach(l.inEdges(d.v),function(g){var v=l.edge(g),p=l.node(g.v);h&&_.push({v:g.v,w:g.w}),p.out-=v,u(c,f,p)}),e.forEach(l.outEdges(d.v),function(g){var v=l.edge(g),p=g.w,y=l.node(p);y.in-=v,u(c,f,y)}),l.removeNode(d.v),_}function s(l,c){var f=new t,d=0,h=0;e.forEach(l.nodes(),function(v){f.setNode(v,{v,in:0,out:0})}),e.forEach(l.edges(),function(v){var p=f.edge(v.v,v.w)||0,y=c(v),b=p+y;f.setEdge(v.v,v.w,b),h=Math.max(h,f.node(v.v).out+=y),d=Math.max(d,f.node(v.w).in+=y)});var _=e.range(h+d+3).map(function(){return new r}),g=d+1;return e.forEach(f.nodes(),function(v){u(_,g,f.node(v))}),{graph:f,buckets:_,zeroIdx:g}}function u(l,c,f){f.out?f.in?l[f.out-f.in+c].enqueue(f):l[l.length-1].enqueue(f):l[0].enqueue(f)}return Ts}var Ms,yp;function Xx(){if(yp)return Ms;yp=1;var e=ae(),t=Zx();Ms={run:r,undo:i};function r(a){var o=a.graph().acyclicer==="greedy"?t(a,s(a)):n(a);e.forEach(o,function(u){var l=a.edge(u);a.removeEdge(u),l.forwardName=u.name,l.reversed=!0,a.setEdge(u.w,u.v,l,e.uniqueId("rev"))});function s(u){return function(l){return u.edge(l).weight}}}function n(a){var o=[],s={},u={};function l(c){e.has(u,c)||(u[c]=!0,s[c]=!0,e.forEach(a.outEdges(c),function(f){e.has(s,f.w)?o.push(f):l(f.w)}),delete s[c])}return e.forEach(a.nodes(),l),o}function i(a){e.forEach(a.edges(),function(o){var s=a.edge(o);if(s.reversed){a.removeEdge(o);var u=s.forwardName;delete s.reversed,delete s.forwardName,a.setEdge(o.w,o.v,s,u)}})}return Ms}var Ps,mp;function _e(){if(mp)return Ps;mp=1;var e=ae(),t=Ie().Graph;Ps={addDummyNode:r,simplify:n,asNonCompoundGraph:i,successorWeights:a,predecessorWeights:o,intersectRect:s,buildLayerMatrix:u,normalizeRanks:l,removeEmptyRanks:c,addBorderNode:f,maxRank:d,partition:h,time:_,notime:g};function r(v,p,y,b){var m;do m=e.uniqueId(b);while(v.hasNode(m));return y.dummy=p,v.setNode(m,y),m}function n(v){var p=new t().setGraph(v.graph());return e.forEach(v.nodes(),function(y){p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){var b=p.edge(y.v,y.w)||{weight:0,minlen:1},m=v.edge(y);p.setEdge(y.v,y.w,{weight:b.weight+m.weight,minlen:Math.max(b.minlen,m.minlen)})}),p}function i(v){var p=new t({multigraph:v.isMultigraph()}).setGraph(v.graph());return e.forEach(v.nodes(),function(y){v.children(y).length||p.setNode(y,v.node(y))}),e.forEach(v.edges(),function(y){p.setEdge(y,v.edge(y))}),p}function a(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.outEdges(y),function(m){b[m.w]=(b[m.w]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function o(v){var p=e.map(v.nodes(),function(y){var b={};return e.forEach(v.inEdges(y),function(m){b[m.v]=(b[m.v]||0)+v.edge(m).weight}),b});return e.zipObject(v.nodes(),p)}function s(v,p){var y=v.x,b=v.y,m=p.x-y,E=p.y-b,x=v.width/2,S=v.height/2;if(!m&&!E)throw new Error("Not possible to find intersection inside of the rectangle");var N,q;return Math.abs(E)*x>Math.abs(m)*S?(E<0&&(S=-S),N=S*m/E,q=S):(m<0&&(x=-x),N=x,q=x*E/m),{x:y+N,y:b+q}}function u(v){var p=e.map(e.range(d(v)+1),function(){return[]});return e.forEach(v.nodes(),function(y){var b=v.node(y),m=b.rank;e.isUndefined(m)||(p[m][b.order]=y)}),p}function l(v){var p=e.min(e.map(v.nodes(),function(y){return v.node(y).rank}));e.forEach(v.nodes(),function(y){var b=v.node(y);e.has(b,"rank")&&(b.rank-=p)})}function c(v){var p=e.min(e.map(v.nodes(),function(E){return v.node(E).rank})),y=[];e.forEach(v.nodes(),function(E){var x=v.node(E).rank-p;y[x]||(y[x]=[]),y[x].push(E)});var b=0,m=v.graph().nodeRankFactor;e.forEach(y,function(E,x){e.isUndefined(E)&&x%m!==0?--b:b&&e.forEach(E,function(S){v.node(S).rank+=b})})}function f(v,p,y,b){var m={width:0,height:0};return arguments.length>=4&&(m.rank=y,m.order=b),r(v,"border",m,p)}function d(v){return e.max(e.map(v.nodes(),function(p){var y=v.node(p).rank;if(!e.isUndefined(y))return y}))}function h(v,p){var y={lhs:[],rhs:[]};return e.forEach(v,function(b){p(b)?y.lhs.push(b):y.rhs.push(b)}),y}function _(v,p){var y=e.now();try{return p()}finally{console.log(v+" time: "+(e.now()-y)+"ms")}}function g(v,p){return p()}return Ps}var ks,_p;function Jx(){if(_p)return ks;_p=1;var e=ae(),t=_e();ks={run:r,undo:i};function r(a){a.graph().dummyChains=[],e.forEach(a.edges(),function(o){n(a,o)})}function n(a,o){var s=o.v,u=a.node(s).rank,l=o.w,c=a.node(l).rank,f=o.name,d=a.edge(o),h=d.labelRank;if(c!==u+1){a.removeEdge(o);var _,g,v;for(v=0,++u;u<c;++v,++u)d.points=[],g={width:0,height:0,edgeLabel:d,edgeObj:o,rank:u},_=t.addDummyNode(a,"edge",g,"_d"),u===h&&(g.width=d.width,g.height=d.height,g.dummy="edge-label",g.labelpos=d.labelpos),a.setEdge(s,_,{weight:d.weight},f),v===0&&a.graph().dummyChains.push(_),s=_;a.setEdge(s,l,{weight:d.weight},f)}}function i(a){e.forEach(a.graph().dummyChains,function(o){var s=a.node(o),u=s.edgeLabel,l;for(a.setEdge(s.edgeObj,u);s.dummy;)l=a.successors(o)[0],a.removeNode(o),u.points.push({x:s.x,y:s.y}),s.dummy==="edge-label"&&(u.x=s.x,u.y=s.y,u.width=s.width,u.height=s.height),o=l,s=a.node(o)})}return ks}var Os,bp;function pr(){if(bp)return Os;bp=1;var e=ae();Os={longestPath:t,slack:r};function t(n){var i={};function a(o){var s=n.node(o);if(e.has(i,o))return s.rank;i[o]=!0;var u=e.min(e.map(n.outEdges(o),function(l){return a(l.w)-n.edge(l).minlen}));return(u===Number.POSITIVE_INFINITY||u===void 0||u===null)&&(u=0),s.rank=u}e.forEach(n.sources(),a)}function r(n,i){return n.node(i.w).rank-n.node(i.v).rank-n.edge(i).minlen}return Os}var Ds,wp;function ry(){if(wp)return Ds;wp=1;var e=ae(),t=Ie().Graph,r=pr().slack;Ds=n;function n(s){var u=new t({directed:!1}),l=s.nodes()[0],c=s.nodeCount();u.setNode(l,{});for(var f,d;i(u,s)<c;)f=a(u,s),d=u.hasNode(f.v)?r(s,f):-r(s,f),o(u,s,d);return u}function i(s,u){function l(c){e.forEach(u.nodeEdges(c),function(f){var d=f.v,h=c===d?f.w:d;!s.hasNode(h)&&!r(u,f)&&(s.setNode(h,{}),s.setEdge(c,h,{}),l(h))})}return e.forEach(s.nodes(),l),s.nodeCount()}function a(s,u){return e.minBy(u.edges(),function(l){if(s.hasNode(l.v)!==s.hasNode(l.w))return r(u,l)})}function o(s,u,l){e.forEach(s.nodes(),function(c){u.node(c).rank+=l})}return Ds}var Ls,Ep;function Qx(){if(Ep)return Ls;Ep=1;var e=ae(),t=ry(),r=pr().slack,n=pr().longestPath,i=Ie().alg.preorder,a=Ie().alg.postorder,o=_e().simplify;Ls=s,s.initLowLimValues=f,s.initCutValues=u,s.calcCutValue=c,s.leaveEdge=h,s.enterEdge=_,s.exchangeEdges=g;function s(b){b=o(b),n(b);var m=t(b);f(m),u(m,b);for(var E,x;E=h(m);)x=_(m,b,E),g(m,b,E,x)}function u(b,m){var E=a(b,b.nodes());E=E.slice(0,E.length-1),e.forEach(E,function(x){l(b,m,x)})}function l(b,m,E){var x=b.node(E),S=x.parent;b.edge(E,S).cutvalue=c(b,m,E)}function c(b,m,E){var x=b.node(E),S=x.parent,N=!0,q=m.edge(E,S),A=0;return q||(N=!1,q=m.edge(S,E)),A=q.weight,e.forEach(m.nodeEdges(E),function(I){var O=I.v===E,k=O?I.w:I.v;if(k!==S){var w=O===N,T=m.edge(I).weight;if(A+=w?T:-T,p(b,E,k)){var R=b.edge(E,k).cutvalue;A+=w?-R:R}}}),A}function f(b,m){arguments.length<2&&(m=b.nodes()[0]),d(b,{},1,m)}function d(b,m,E,x,S){var N=E,q=b.node(x);return m[x]=!0,e.forEach(b.neighbors(x),function(A){e.has(m,A)||(E=d(b,m,E,A,x))}),q.low=N,q.lim=E++,S?q.parent=S:delete q.parent,E}function h(b){return e.find(b.edges(),function(m){return b.edge(m).cutvalue<0})}function _(b,m,E){var x=E.v,S=E.w;m.hasEdge(x,S)||(x=E.w,S=E.v);var N=b.node(x),q=b.node(S),A=N,I=!1;N.lim>q.lim&&(A=q,I=!0);var O=e.filter(m.edges(),function(k){return I===y(b,b.node(k.v),A)&&I!==y(b,b.node(k.w),A)});return e.minBy(O,function(k){return r(m,k)})}function g(b,m,E,x){var S=E.v,N=E.w;b.removeEdge(S,N),b.setEdge(x.v,x.w,{}),f(b),u(b,m),v(b,m)}function v(b,m){var E=e.find(b.nodes(),function(S){return!m.node(S).parent}),x=i(b,E);x=x.slice(1),e.forEach(x,function(S){var N=b.node(S).parent,q=m.edge(S,N),A=!1;q||(q=m.edge(N,S),A=!0),m.node(S).rank=m.node(N).rank+(A?q.minlen:-q.minlen)})}function p(b,m,E){return b.hasEdge(m,E)}function y(b,m,E){return E.low<=m.lim&&m.lim<=E.lim}return Ls}var Fs,xp;function eS(){if(xp)return Fs;xp=1;var e=pr(),t=e.longestPath,r=ry(),n=Qx();Fs=i;function i(u){switch(u.graph().ranker){case"network-simplex":s(u);break;case"tight-tree":o(u);break;case"longest-path":a(u);break;default:s(u)}}var a=t;function o(u){t(u),r(u)}function s(u){n(u)}return Fs}var zs,Sp;function tS(){if(Sp)return zs;Sp=1;var e=ae();zs=t;function t(i){var a=n(i);e.forEach(i.graph().dummyChains,function(o){for(var s=i.node(o),u=s.edgeObj,l=r(i,a,u.v,u.w),c=l.path,f=l.lca,d=0,h=c[d],_=!0;o!==u.w;){if(s=i.node(o),_){for(;(h=c[d])!==f&&i.node(h).maxRank<s.rank;)d++;h===f&&(_=!1)}if(!_){for(;d<c.length-1&&i.node(h=c[d+1]).minRank<=s.rank;)d++;h=c[d]}i.setParent(o,h),o=i.successors(o)[0]}})}function r(i,a,o,s){var u=[],l=[],c=Math.min(a[o].low,a[s].low),f=Math.max(a[o].lim,a[s].lim),d,h;d=o;do d=i.parent(d),u.push(d);while(d&&(a[d].low>c||f>a[d].lim));for(h=d,d=s;(d=i.parent(d))!==h;)l.push(d);return{path:u.concat(l.reverse()),lca:h}}function n(i){var a={},o=0;function s(u){var l=o;e.forEach(i.children(u),s),a[u]={low:l,lim:o++}}return e.forEach(i.children(),s),a}return zs}var Bs,qp;function rS(){if(qp)return Bs;qp=1;var e=ae(),t=_e();Bs={run:r,cleanup:o};function r(s){var u=t.addDummyNode(s,"root",{},"_root"),l=i(s),c=e.max(e.values(l))-1,f=2*c+1;s.graph().nestingRoot=u,e.forEach(s.edges(),function(h){s.edge(h).minlen*=f});var d=a(s)+1;e.forEach(s.children(),function(h){n(s,u,f,d,c,l,h)}),s.graph().nodeRankFactor=f}function n(s,u,l,c,f,d,h){var _=s.children(h);if(!_.length){h!==u&&s.setEdge(u,h,{weight:0,minlen:l});return}var g=t.addBorderNode(s,"_bt"),v=t.addBorderNode(s,"_bb"),p=s.node(h);s.setParent(g,h),p.borderTop=g,s.setParent(v,h),p.borderBottom=v,e.forEach(_,function(y){n(s,u,l,c,f,d,y);var b=s.node(y),m=b.borderTop?b.borderTop:y,E=b.borderBottom?b.borderBottom:y,x=b.borderTop?c:2*c,S=m!==E?1:f-d[h]+1;s.setEdge(g,m,{weight:x,minlen:S,nestingEdge:!0}),s.setEdge(E,v,{weight:x,minlen:S,nestingEdge:!0})}),s.parent(h)||s.setEdge(u,g,{weight:0,minlen:f+d[h]})}function i(s){var u={};function l(c,f){var d=s.children(c);d&&d.length&&e.forEach(d,function(h){l(h,f+1)}),u[c]=f}return e.forEach(s.children(),function(c){l(c,1)}),u}function a(s){return e.reduce(s.edges(),function(u,l){return u+s.edge(l).weight},0)}function o(s){var u=s.graph();s.removeNode(u.nestingRoot),delete u.nestingRoot,e.forEach(s.edges(),function(l){var c=s.edge(l);c.nestingEdge&&s.removeEdge(l)})}return Bs}var Hs,Cp;function nS(){if(Cp)return Hs;Cp=1;var e=ae(),t=_e();Hs=r;function r(i){function a(o){var s=i.children(o),u=i.node(o);if(s.length&&e.forEach(s,a),e.has(u,"minRank")){u.borderLeft=[],u.borderRight=[];for(var l=u.minRank,c=u.maxRank+1;l<c;++l)n(i,"borderLeft","_bl",o,u,l),n(i,"borderRight","_br",o,u,l)}}e.forEach(i.children(),a)}function n(i,a,o,s,u,l){var c={width:0,height:0,rank:l,borderType:a},f=u[a][l-1],d=t.addDummyNode(i,"border",c,o);u[a][l]=d,i.setParent(d,s),f&&i.setEdge(f,d,{weight:1})}return Hs}var $s,Rp;function iS(){if(Rp)return $s;Rp=1;var e=ae();$s={adjust:t,undo:r};function t(l){var c=l.graph().rankdir.toLowerCase();(c==="lr"||c==="rl")&&n(l)}function r(l){var c=l.graph().rankdir.toLowerCase();(c==="bt"||c==="rl")&&a(l),(c==="lr"||c==="rl")&&(s(l),n(l))}function n(l){e.forEach(l.nodes(),function(c){i(l.node(c))}),e.forEach(l.edges(),function(c){i(l.edge(c))})}function i(l){var c=l.width;l.width=l.height,l.height=c}function a(l){e.forEach(l.nodes(),function(c){o(l.node(c))}),e.forEach(l.edges(),function(c){var f=l.edge(c);e.forEach(f.points,o),e.has(f,"y")&&o(f)})}function o(l){l.y=-l.y}function s(l){e.forEach(l.nodes(),function(c){u(l.node(c))}),e.forEach(l.edges(),function(c){var f=l.edge(c);e.forEach(f.points,u),e.has(f,"x")&&u(f)})}function u(l){var c=l.x;l.x=l.y,l.y=c}return $s}var Vs,Ap;function aS(){if(Ap)return Vs;Ap=1;var e=ae();Vs=t;function t(r){var n={},i=e.filter(r.nodes(),function(l){return!r.children(l).length}),a=e.max(e.map(i,function(l){return r.node(l).rank})),o=e.map(e.range(a+1),function(){return[]});function s(l){if(!e.has(n,l)){n[l]=!0;var c=r.node(l);o[c.rank].push(l),e.forEach(r.successors(l),s)}}var u=e.sortBy(i,function(l){return r.node(l).rank});return e.forEach(u,s),o}return Vs}var Gs,Np;function oS(){if(Np)return Gs;Np=1;var e=ae();Gs=t;function t(n,i){for(var a=0,o=1;o<i.length;++o)a+=r(n,i[o-1],i[o]);return a}function r(n,i,a){for(var o=e.zipObject(a,e.map(a,function(d,h){return h})),s=e.flatten(e.map(i,function(d){return e.sortBy(e.map(n.outEdges(d),function(h){return{pos:o[h.w],weight:n.edge(h).weight}}),"pos")}),!0),u=1;u<a.length;)u<<=1;var l=2*u-1;u-=1;var c=e.map(new Array(l),function(){return 0}),f=0;return e.forEach(s.forEach(function(d){var h=d.pos+u;c[h]+=d.weight;for(var _=0;h>0;)h%2&&(_+=c[h+1]),h=h-1>>1,c[h]+=d.weight;f+=d.weight*_})),f}return Gs}var Us,Ip;function sS(){if(Ip)return Us;Ip=1;var e=ae();Us=t;function t(r,n){return e.map(n,function(i){var a=r.inEdges(i);if(a.length){var o=e.reduce(a,function(s,u){var l=r.edge(u),c=r.node(u.v);return{sum:s.sum+l.weight*c.order,weight:s.weight+l.weight}},{sum:0,weight:0});return{v:i,barycenter:o.sum/o.weight,weight:o.weight}}else return{v:i}})}return Us}var Ks,Tp;function uS(){if(Tp)return Ks;Tp=1;var e=ae();Ks=t;function t(i,a){var o={};e.forEach(i,function(u,l){var c=o[u.v]={indegree:0,in:[],out:[],vs:[u.v],i:l};e.isUndefined(u.barycenter)||(c.barycenter=u.barycenter,c.weight=u.weight)}),e.forEach(a.edges(),function(u){var l=o[u.v],c=o[u.w];!e.isUndefined(l)&&!e.isUndefined(c)&&(c.indegree++,l.out.push(o[u.w]))});var s=e.filter(o,function(u){return!u.indegree});return r(s)}function r(i){var a=[];function o(l){return function(c){c.merged||(e.isUndefined(c.barycenter)||e.isUndefined(l.barycenter)||c.barycenter>=l.barycenter)&&n(l,c)}}function s(l){return function(c){c.in.push(l),--c.indegree===0&&i.push(c)}}for(;i.length;){var u=i.pop();a.push(u),e.forEach(u.in.reverse(),o(u)),e.forEach(u.out,s(u))}return e.map(e.filter(a,function(l){return!l.merged}),function(l){return e.pick(l,["vs","i","barycenter","weight"])})}function n(i,a){var o=0,s=0;i.weight&&(o+=i.barycenter*i.weight,s+=i.weight),a.weight&&(o+=a.barycenter*a.weight,s+=a.weight),i.vs=a.vs.concat(i.vs),i.barycenter=o/s,i.weight=s,i.i=Math.min(a.i,i.i),a.merged=!0}return Ks}var js,Mp;function cS(){if(Mp)return js;Mp=1;var e=ae(),t=_e();js=r;function r(a,o){var s=t.partition(a,function(g){return e.has(g,"barycenter")}),u=s.lhs,l=e.sortBy(s.rhs,function(g){return-g.i}),c=[],f=0,d=0,h=0;u.sort(i(!!o)),h=n(c,l,h),e.forEach(u,function(g){h+=g.vs.length,c.push(g.vs),f+=g.barycenter*g.weight,d+=g.weight,h=n(c,l,h)});var _={vs:e.flatten(c,!0)};return d&&(_.barycenter=f/d,_.weight=d),_}function n(a,o,s){for(var u;o.length&&(u=e.last(o)).i<=s;)o.pop(),a.push(u.vs),s++;return s}function i(a){return function(o,s){return o.barycenter<s.barycenter?-1:o.barycenter>s.barycenter?1:a?s.i-o.i:o.i-s.i}}return js}var Ys,Pp;function lS(){if(Pp)return Ys;Pp=1;var e=ae(),t=sS(),r=uS(),n=cS();Ys=i;function i(s,u,l,c){var f=s.children(u),d=s.node(u),h=d?d.borderLeft:void 0,_=d?d.borderRight:void 0,g={};h&&(f=e.filter(f,function(E){return E!==h&&E!==_}));var v=t(s,f);e.forEach(v,function(E){if(s.children(E.v).length){var x=i(s,E.v,l,c);g[E.v]=x,e.has(x,"barycenter")&&o(E,x)}});var p=r(v,l);a(p,g);var y=n(p,c);if(h&&(y.vs=e.flatten([h,y.vs,_],!0),s.predecessors(h).length)){var b=s.node(s.predecessors(h)[0]),m=s.node(s.predecessors(_)[0]);e.has(y,"barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.order+m.order)/(y.weight+2),y.weight+=2}return y}function a(s,u){e.forEach(s,function(l){l.vs=e.flatten(l.vs.map(function(c){return u[c]?u[c].vs:c}),!0)})}function o(s,u){e.isUndefined(s.barycenter)?(s.barycenter=u.barycenter,s.weight=u.weight):(s.barycenter=(s.barycenter*s.weight+u.barycenter*u.weight)/(s.weight+u.weight),s.weight+=u.weight)}return Ys}var Ws,kp;function fS(){if(kp)return Ws;kp=1;var e=ae(),t=Ie().Graph;Ws=r;function r(i,a,o){var s=n(i),u=new t({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(function(l){return i.node(l)});return e.forEach(i.nodes(),function(l){var c=i.node(l),f=i.parent(l);(c.rank===a||c.minRank<=a&&a<=c.maxRank)&&(u.setNode(l),u.setParent(l,f||s),e.forEach(i[o](l),function(d){var h=d.v===l?d.w:d.v,_=u.edge(h,l),g=e.isUndefined(_)?0:_.weight;u.setEdge(h,l,{weight:i.edge(d).weight+g})}),e.has(c,"minRank")&&u.setNode(l,{borderLeft:c.borderLeft[a],borderRight:c.borderRight[a]}))}),u}function n(i){for(var a;i.hasNode(a=e.uniqueId("_root")););return a}return Ws}var Zs,Op;function dS(){if(Op)return Zs;Op=1;var e=ae();Zs=t;function t(r,n,i){var a={},o;e.forEach(i,function(s){for(var u=r.parent(s),l,c;u;){if(l=r.parent(u),l?(c=a[l],a[l]=u):(c=o,o=u),c&&c!==u){n.setEdge(c,u);return}u=l}})}return Zs}var Xs,Dp;function hS(){if(Dp)return Xs;Dp=1;var e=ae(),t=aS(),r=oS(),n=lS(),i=fS(),a=dS(),o=Ie().Graph,s=_e();Xs=u;function u(d){var h=s.maxRank(d),_=l(d,e.range(1,h+1),"inEdges"),g=l(d,e.range(h-1,-1,-1),"outEdges"),v=t(d);f(d,v);for(var p=Number.POSITIVE_INFINITY,y,b=0,m=0;m<4;++b,++m){c(b%2?_:g,b%4>=2),v=s.buildLayerMatrix(d);var E=r(d,v);E<p&&(m=0,y=e.cloneDeep(v),p=E)}f(d,y)}function l(d,h,_){return e.map(h,function(g){return i(d,g,_)})}function c(d,h){var _=new o;e.forEach(d,function(g){var v=g.graph().root,p=n(g,v,_,h);e.forEach(p.vs,function(y,b){g.node(y).order=b}),a(g,_,p.vs)})}function f(d,h){e.forEach(h,function(_){e.forEach(_,function(g,v){d.node(g).order=v})})}return Xs}var Js,Lp;function pS(){if(Lp)return Js;Lp=1;var e=ae(),t=Ie().Graph,r=_e();Js={positionX:_,findType1Conflicts:n,findType2Conflicts:i,addConflict:o,hasConflict:s,verticalAlignment:u,horizontalCompaction:l,alignCoordinates:d,findSmallestWidthAlignment:f,balance:h};function n(p,y){var b={};function m(E,x){var S=0,N=0,q=E.length,A=e.last(x);return e.forEach(x,function(I,O){var k=a(p,I),w=k?p.node(k).order:q;(k||I===A)&&(e.forEach(x.slice(N,O+1),function(T){e.forEach(p.predecessors(T),function(R){var z=p.node(R),H=z.order;(H<S||w<H)&&!(z.dummy&&p.node(T).dummy)&&o(b,R,T)})}),N=O+1,S=w)}),x}return e.reduce(y,m),b}function i(p,y){var b={};function m(x,S,N,q,A){var I;e.forEach(e.range(S,N),function(O){I=x[O],p.node(I).dummy&&e.forEach(p.predecessors(I),function(k){var w=p.node(k);w.dummy&&(w.order<q||w.order>A)&&o(b,k,I)})})}function E(x,S){var N=-1,q,A=0;return e.forEach(S,function(I,O){if(p.node(I).dummy==="border"){var k=p.predecessors(I);k.length&&(q=p.node(k[0]).order,m(S,A,O,N,q),A=O,N=q)}m(S,A,S.length,q,x.length)}),S}return e.reduce(y,E),b}function a(p,y){if(p.node(y).dummy)return e.find(p.predecessors(y),function(b){return p.node(b).dummy})}function o(p,y,b){if(y>b){var m=y;y=b,b=m}var E=p[y];E||(p[y]=E={}),E[b]=!0}function s(p,y,b){if(y>b){var m=y;y=b,b=m}return e.has(p[y],b)}function u(p,y,b,m){var E={},x={},S={};return e.forEach(y,function(N){e.forEach(N,function(q,A){E[q]=q,x[q]=q,S[q]=A})}),e.forEach(y,function(N){var q=-1;e.forEach(N,function(A){var I=m(A);if(I.length){I=e.sortBy(I,function(R){return S[R]});for(var O=(I.length-1)/2,k=Math.floor(O),w=Math.ceil(O);k<=w;++k){var T=I[k];x[A]===A&&q<S[T]&&!s(b,A,T)&&(x[T]=A,x[A]=E[A]=E[T],q=S[T])}}})}),{root:E,align:x}}function l(p,y,b,m,E){var x={},S=c(p,y,b,E),N=E?"borderLeft":"borderRight";function q(O,k){for(var w=S.nodes(),T=w.pop(),R={};T;)R[T]?O(T):(R[T]=!0,w.push(T),w=w.concat(k(T))),T=w.pop()}function A(O){x[O]=S.inEdges(O).reduce(function(k,w){return Math.max(k,x[w.v]+S.edge(w))},0)}function I(O){var k=S.outEdges(O).reduce(function(T,R){return Math.min(T,x[R.w]-S.edge(R))},Number.POSITIVE_INFINITY),w=p.node(O);k!==Number.POSITIVE_INFINITY&&w.borderType!==N&&(x[O]=Math.max(x[O],k))}return q(A,S.predecessors.bind(S)),q(I,S.successors.bind(S)),e.forEach(m,function(O){x[O]=x[b[O]]}),x}function c(p,y,b,m){var E=new t,x=p.graph(),S=g(x.nodesep,x.edgesep,m);return e.forEach(y,function(N){var q;e.forEach(N,function(A){var I=b[A];if(E.setNode(I),q){var O=b[q],k=E.edge(O,I);E.setEdge(O,I,Math.max(S(p,A,q),k||0))}q=A})}),E}function f(p,y){return e.minBy(e.values(y),function(b){var m=Number.NEGATIVE_INFINITY,E=Number.POSITIVE_INFINITY;return e.forIn(b,function(x,S){var N=v(p,S)/2;m=Math.max(x+N,m),E=Math.min(x-N,E)}),m-E})}function d(p,y){var b=e.values(y),m=e.min(b),E=e.max(b);e.forEach(["u","d"],function(x){e.forEach(["l","r"],function(S){var N=x+S,q=p[N],A;if(q!==y){var I=e.values(q);A=S==="l"?m-e.min(I):E-e.max(I),A&&(p[N]=e.mapValues(q,function(O){return O+A}))}})})}function h(p,y){return e.mapValues(p.ul,function(b,m){if(y)return p[y.toLowerCase()][m];var E=e.sortBy(e.map(p,m));return(E[1]+E[2])/2})}function _(p){var y=r.buildLayerMatrix(p),b=e.merge(n(p,y),i(p,y)),m={},E;e.forEach(["u","d"],function(S){E=S==="u"?y:e.values(y).reverse(),e.forEach(["l","r"],function(N){N==="r"&&(E=e.map(E,function(O){return e.values(O).reverse()}));var q=(S==="u"?p.predecessors:p.successors).bind(p),A=u(p,E,b,q),I=l(p,E,A.root,A.align,N==="r");N==="r"&&(I=e.mapValues(I,function(O){return-O})),m[S+N]=I})});var x=f(p,m);return d(m,x),h(m,p.graph().align)}function g(p,y,b){return function(m,E,x){var S=m.node(E),N=m.node(x),q=0,A;if(q+=S.width/2,e.has(S,"labelpos"))switch(S.labelpos.toLowerCase()){case"l":A=-S.width/2;break;case"r":A=S.width/2;break}if(A&&(q+=b?A:-A),A=0,q+=(S.dummy?y:p)/2,q+=(N.dummy?y:p)/2,q+=N.width/2,e.has(N,"labelpos"))switch(N.labelpos.toLowerCase()){case"l":A=N.width/2;break;case"r":A=-N.width/2;break}return A&&(q+=b?A:-A),A=0,q}}function v(p,y){return p.node(y).width}return Js}var Qs,Fp;function vS(){if(Fp)return Qs;Fp=1;var e=ae(),t=_e(),r=pS().positionX;Qs=n;function n(a){a=t.asNonCompoundGraph(a),i(a),e.forEach(r(a),function(o,s){a.node(s).x=o})}function i(a){var o=t.buildLayerMatrix(a),s=a.graph().ranksep,u=0;e.forEach(o,function(l){var c=e.max(e.map(l,function(f){return a.node(f).height}));e.forEach(l,function(f){a.node(f).y=u+c/2}),u+=c+s})}return Qs}var eu,zp;function gS(){if(zp)return eu;zp=1;var e=ae(),t=Xx(),r=Jx(),n=eS(),i=_e().normalizeRanks,a=tS(),o=_e().removeEmptyRanks,s=rS(),u=nS(),l=iS(),c=hS(),f=vS(),d=_e(),h=Ie().Graph;eu=_;function _(C,P){var F=P&&P.debugTiming?d.time:d.notime;F("layout",function(){var $=F(" buildLayoutGraph",function(){return q(C)});F(" runLayout",function(){g($,F)}),F(" updateInputGraph",function(){v(C,$)})})}function g(C,P){P(" makeSpaceForEdgeLabels",function(){A(C)}),P(" removeSelfEdges",function(){M(C)}),P(" acyclic",function(){t.run(C)}),P(" nestingGraph.run",function(){s.run(C)}),P(" rank",function(){n(d.asNonCompoundGraph(C))}),P(" injectEdgeLabelProxies",function(){I(C)}),P(" removeEmptyRanks",function(){o(C)}),P(" nestingGraph.cleanup",function(){s.cleanup(C)}),P(" normalizeRanks",function(){i(C)}),P(" assignRankMinMax",function(){O(C)}),P(" removeEdgeLabelProxies",function(){k(C)}),P(" normalize.run",function(){r.run(C)}),P(" parentDummyChains",function(){a(C)}),P(" addBorderSegments",function(){u(C)}),P(" order",function(){c(C)}),P(" insertSelfEdges",function(){B(C)}),P(" adjustCoordinateSystem",function(){l.adjust(C)}),P(" position",function(){f(C)}),P(" positionSelfEdges",function(){V(C)}),P(" removeBorderNodes",function(){H(C)}),P(" normalize.undo",function(){r.undo(C)}),P(" fixupEdgeLabelCoords",function(){R(C)}),P(" undoCoordinateSystem",function(){l.undo(C)}),P(" translateGraph",function(){w(C)}),P(" assignNodeIntersects",function(){T(C)}),P(" reversePoints",function(){z(C)}),P(" acyclic.undo",function(){t.undo(C)})}function v(C,P){e.forEach(C.nodes(),function(F){var $=C.node(F),K=P.node(F);$&&($.x=K.x,$.y=K.y,P.children(F).length&&($.width=K.width,$.height=K.height))}),e.forEach(C.edges(),function(F){var $=C.edge(F),K=P.edge(F);$.points=K.points,e.has(K,"x")&&($.x=K.x,$.y=K.y)}),C.graph().width=P.graph().width,C.graph().height=P.graph().height}var p=["nodesep","edgesep","ranksep","marginx","marginy"],y={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},b=["acyclicer","ranker","rankdir","align"],m=["width","height"],E={width:0,height:0},x=["minlen","weight","width","height","labeloffset"],S={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},N=["labelpos"];function q(C){var P=new h({multigraph:!0,compound:!0}),F=U(C.graph());return P.setGraph(e.merge({},y,G(F,p),e.pick(F,b))),e.forEach(C.nodes(),function($){var K=U(C.node($));P.setNode($,e.defaults(G(K,m),E)),P.setParent($,C.parent($))}),e.forEach(C.edges(),function($){var K=U(C.edge($));P.setEdge($,e.merge({},S,G(K,x),e.pick(K,N)))}),P}function A(C){var P=C.graph();P.ranksep/=2,e.forEach(C.edges(),function(F){var $=C.edge(F);$.minlen*=2,$.labelpos.toLowerCase()!=="c"&&(P.rankdir==="TB"||P.rankdir==="BT"?$.width+=$.labeloffset:$.height+=$.labeloffset)})}function I(C){e.forEach(C.edges(),function(P){var F=C.edge(P);if(F.width&&F.height){var $=C.node(P.v),K=C.node(P.w),W={rank:(K.rank-$.rank)/2+$.rank,e:P};d.addDummyNode(C,"edge-proxy",W,"_ep")}})}function O(C){var P=0;e.forEach(C.nodes(),function(F){var $=C.node(F);$.borderTop&&($.minRank=C.node($.borderTop).rank,$.maxRank=C.node($.borderBottom).rank,P=e.max(P,$.maxRank))}),C.graph().maxRank=P}function k(C){e.forEach(C.nodes(),function(P){var F=C.node(P);F.dummy==="edge-proxy"&&(C.edge(F.e).labelRank=F.rank,C.removeNode(P))})}function w(C){var P=Number.POSITIVE_INFINITY,F=0,$=Number.POSITIVE_INFINITY,K=0,W=C.graph(),Z=W.marginx||0,te=W.marginy||0;function ie(re){var ee=re.x,X=re.y,ue=re.width,j=re.height;P=Math.min(P,ee-ue/2),F=Math.max(F,ee+ue/2),$=Math.min($,X-j/2),K=Math.max(K,X+j/2)}e.forEach(C.nodes(),function(re){ie(C.node(re))}),e.forEach(C.edges(),function(re){var ee=C.edge(re);e.has(ee,"x")&&ie(ee)}),P-=Z,$-=te,e.forEach(C.nodes(),function(re){var ee=C.node(re);ee.x-=P,ee.y-=$}),e.forEach(C.edges(),function(re){var ee=C.edge(re);e.forEach(ee.points,function(X){X.x-=P,X.y-=$}),e.has(ee,"x")&&(ee.x-=P),e.has(ee,"y")&&(ee.y-=$)}),W.width=F-P+Z,W.height=K-$+te}function T(C){e.forEach(C.edges(),function(P){var F=C.edge(P),$=C.node(P.v),K=C.node(P.w),W,Z;F.points?(W=F.points[0],Z=F.points[F.points.length-1]):(F.points=[],W=K,Z=$),F.points.unshift(d.intersectRect($,W)),F.points.push(d.intersectRect(K,Z))})}function R(C){e.forEach(C.edges(),function(P){var F=C.edge(P);if(e.has(F,"x"))switch((F.labelpos==="l"||F.labelpos==="r")&&(F.width-=F.labeloffset),F.labelpos){case"l":F.x-=F.width/2+F.labeloffset;break;case"r":F.x+=F.width/2+F.labeloffset;break}})}function z(C){e.forEach(C.edges(),function(P){var F=C.edge(P);F.reversed&&F.points.reverse()})}function H(C){e.forEach(C.nodes(),function(P){if(C.children(P).length){var F=C.node(P),$=C.node(F.borderTop),K=C.node(F.borderBottom),W=C.node(e.last(F.borderLeft)),Z=C.node(e.last(F.borderRight));F.width=Math.abs(Z.x-W.x),F.height=Math.abs(K.y-$.y),F.x=W.x+F.width/2,F.y=$.y+F.height/2}}),e.forEach(C.nodes(),function(P){C.node(P).dummy==="border"&&C.removeNode(P)})}function M(C){e.forEach(C.edges(),function(P){if(P.v===P.w){var F=C.node(P.v);F.selfEdges||(F.selfEdges=[]),F.selfEdges.push({e:P,label:C.edge(P)}),C.removeEdge(P)}})}function B(C){var P=d.buildLayerMatrix(C);e.forEach(P,function(F){var $=0;e.forEach(F,function(K,W){var Z=C.node(K);Z.order=W+$,e.forEach(Z.selfEdges,function(te){d.addDummyNode(C,"selfedge",{width:te.label.width,height:te.label.height,rank:Z.rank,order:W+ ++$,e:te.e,label:te.label},"_se")}),delete Z.selfEdges})})}function V(C){e.forEach(C.nodes(),function(P){var F=C.node(P);if(F.dummy==="selfedge"){var $=C.node(F.e.v),K=$.x+$.width/2,W=$.y,Z=F.x-K,te=$.height/2;C.setEdge(F.e,F.label),C.removeNode(P),F.label.points=[{x:K+2*Z/3,y:W-te},{x:K+5*Z/6,y:W-te},{x:K+Z,y:W},{x:K+5*Z/6,y:W+te},{x:K+2*Z/3,y:W+te}],F.label.x=F.x,F.label.y=F.y}})}function G(C,P){return e.mapValues(e.pick(C,P),Number)}function U(C){var P={};return e.forEach(C,function(F,$){P[$.toLowerCase()]=F}),P}return eu}var tu,Bp;function yS(){if(Bp)return tu;Bp=1;var e=ae(),t=_e(),r=Ie().Graph;tu={debugOrdering:n};function n(i){var a=t.buildLayerMatrix(i),o=new r({compound:!0,multigraph:!0}).setGraph({});return e.forEach(i.nodes(),function(s){o.setNode(s,{label:s}),o.setParent(s,"layer"+i.node(s).rank)}),e.forEach(i.edges(),function(s){o.setEdge(s.v,s.w,{},s.name)}),e.forEach(a,function(s,u){var l="layer"+u;o.setNode(l,{rank:"same"}),e.reduce(s,function(c,f){return o.setEdge(c,f,{style:"invis"}),f})}),o}return tu}var ru,Hp;function mS(){return Hp||(Hp=1,ru="0.8.5"),ru}var nu,$p;function qS(){return $p||($p=1,nu={graphlib:Ie(),layout:gS(),debug:yS(),util:{time:_e().time,notime:_e().notime},version:mS()}),nu}export{SS as B,xS as C,hr as H,ES as M,Eu as P,Gw as R,Ne as a,J as b,qS as r};