@aloudata/ink-flow 1.0.16 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/InkFlowProvider/index.d.ts +3 -1
- package/dist/components/InkFlowProvider/index.d.ts.map +1 -1
- package/dist/container/InkFlow/Wrapper.d.ts +3 -1
- package/dist/container/InkFlow/Wrapper.d.ts.map +1 -1
- package/dist/container/InkFlow/index.d.ts.map +1 -1
- package/dist/container/ZoomPane/index.d.ts +1 -1
- package/dist/container/ZoomPane/index.d.ts.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +3 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/store/index.d.ts +3 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/initialState.d.ts +3 -1
- package/dist/store/initialState.d.ts.map +1 -1
- package/dist/utils/graph.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -13,5 +13,5 @@ h=p,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments
|
|
|
13
13
|
*
|
|
14
14
|
* This source code is licensed under the MIT license found in the
|
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
|
16
|
-
*/b.exports=function(){if(m)return w;m=1;var n=e,t=S(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return w.useSyncExternalStoreWithSelector=function(e,n,t,s,l){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=s(e),void 0!==l&&f.hasValue){var n=f.value;if(l(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=s(e);return void 0!==l&&l(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,s,l]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},w}();var k=s(b.exports);const C=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{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."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:M}=e,{useSyncExternalStoreWithSelector:N}=k,P=e=>e;function O(e,n=P,t){const r=N(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return M(r),r}const j=(e,n)=>{const t=(e=>e?C(e):C)(e),r=(e,r=n)=>O(t,e,r);return Object.assign(r,t),r};var I=e.createContext(null),A=I.Provider,z=function(){return z=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},z.apply(this,arguments)};function T(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function B(e,n,t){if(2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var D,R,V,H,Y,X,F,Z,U,W,G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,se,le,de,fe,he,ve,pe,ge,ye,me,xe,be,we,_e,Ee,Se,ke,Ce,Me,Ne,Pe,Oe,je,Ie,Ae,ze,Te,Le,Be,De,Re,Ve,He,Ye,Xe,Fe,Ze,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,sn,ln,dn,fn,hn,vn,pn,gn,yn,mn,xn,bn,wn,_n,En,Sn,kn,Cn,Mn,Nn,Pn,On,jn,In,An,zn,Tn,Ln,Bn,Dn,Rn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hn(){return H?V:(H=1,V=function(e,n){return e===n||e!=e&&n!=n})}function Yn(){if(X)return Y;X=1;var e=Hn();return Y=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Y}function Xn(){if(J)return Q;J=1;var e=R?D:(R=1,D=function(){this.__data__=[],this.size=0}),n=function(){if(Z)return F;Z=1;var e=Yn(),n=Array.prototype.splice;return F=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(W)return U;W=1;var e=Yn();return U=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(q)return G;q=1;var e=Yn();return G=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(K)return $;K=1;var e=Yn();return $=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Q=i}function Fn(){if(se)return ce;se=1;var e="object"==typeof Rn&&Rn&&Rn.Object===Object&&Rn;return ce=e}function Zn(){if(de)return le;de=1;var e=Fn(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return le=t}function Un(){if(he)return fe;he=1;var e=Zn().Symbol;return fe=e}function Wn(){if(xe)return me;xe=1;var e=Un(),n=function(){if(pe)return ve;pe=1;var e=Un(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return ve=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(ye)return ge;ye=1;var e=Object.prototype.toString;return ge=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return me=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function Gn(){return we?be:(we=1,be=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function qn(){if(Ee)return _e;Ee=1;var e=Wn(),n=Gn();return _e=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function $n(){if(Pe)return Ne;Pe=1;var e=Function.prototype.toString;return Ne=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function Kn(){if(Te)return ze;Te=1;var e=function(){if(je)return Oe;je=1;var e=qn(),n=function(){if(Me)return Ce;Me=1;var e,n=function(){if(ke)return Se;ke=1;var e=Zn()["__core-js_shared__"];return Se=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Ce=function(e){return!!t&&t in e}}(),t=Gn(),r=$n(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,s=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Oe=function(i){return!(!t(i)||n(i))&&(e(i)?s:o).test(r(i))}}(),n=Ae?Ie:(Ae=1,Ie=function(e,n){return null==e?void 0:e[n]});return ze=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function Qn(){if(Be)return Le;Be=1;var e=Kn()(Zn(),"Map");return Le=e}function Jn(){if(Re)return De;Re=1;var e=Kn()(Object,"create");return De=e}function et(){if(rn)return tn;rn=1;var e=nn?en:(nn=1,en=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return tn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},tn}function nt(){if(vn)return hn;vn=1;var e=function(){if(Je)return Qe;Je=1;var e=function(){if(Ke)return $e;Ke=1;var e=function(){if(He)return Ve;He=1;var e=Jn();return Ve=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Xe?Ye:(Xe=1,Ye=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(Ze)return Fe;Ze=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Fe=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(We)return Ue;We=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Ue=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(qe)return Ge;qe=1;var e=Jn();return Ge=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,$e=i}(),n=Xn(),t=Qn();return Qe=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(an)return on;an=1;var e=et();return on=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(cn)return un;cn=1;var e=et();return un=function(n){return e(this,n).get(n)}}(),r=function(){if(ln)return sn;ln=1;var e=et();return sn=function(n){return e(this,n).has(n)}}(),o=function(){if(fn)return dn;fn=1;var e=et();return dn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},dn}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,hn=i}function tt(){if(mn)return yn;mn=1;var e=Xn(),n=function(){if(ne)return ee;ne=1;var e=Xn();return ee=function(){this.__data__=new e,this.size=0}}(),t=re?te:(re=1,te=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=ie?oe:(ie=1,oe=function(e){return this.__data__.get(e)}),o=ue?ae:(ue=1,ae=function(e){return this.__data__.has(e)}),i=function(){if(gn)return pn;gn=1;var e=Xn(),n=Qn(),t=nt();return pn=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,yn=a}function rt(){return bn||(bn=1,xn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),xn}function ot(){if(_n)return wn;_n=1;var e=Kn(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return wn=n}function it(){if(Sn)return En;Sn=1;var e=ot();return En=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function at(){if(Cn)return kn;Cn=1;var e=it(),n=Hn(),t=Object.prototype.hasOwnProperty;return kn=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function ut(){if(Nn)return Mn;Nn=1;var e=at(),n=it();return Mn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var s=r[u],l=i?i(o[s],t[s],s,o,t):void 0;void 0===l&&(l=t[s]),a?n(o,s,l):e(o,s,l)}return o}}function ct(){return In?jn:(In=1,jn=function(e){return null!=e&&"object"==typeof e})}function st(){if(Ln)return Tn;Ln=1;var e=function(){if(zn)return An;zn=1;var e=Wn(),n=ct();return An=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=ct(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return Tn=i}function lt(){if(Dn)return Bn;Dn=1;var e=Array.isArray;return Bn=e}var dt,ft,ht,vt,pt,gt,yt,mt,xt,bt,wt,_t={exports:{}};function Et(){return ht||(ht=1,function(e,n){var t=Zn(),r=ft?dt:(ft=1,dt=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(_t,_t.exports)),_t.exports}function St(){if(pt)return vt;pt=1;var e=/^(?:0|[1-9]\d*)$/;return vt=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function kt(){return yt?gt:(yt=1,gt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Ct(){return wt?bt:(wt=1,bt=function(e){return function(n){return e(n)}})}_t.exports;var Mt,Nt,Pt,Ot,jt,It,At,zt,Tt,Lt,Bt,Dt,Rt,Vt,Ht,Yt,Xt,Ft,Zt,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er={exports:{}};function nr(){return Mt||(Mt=1,e=er,n=er.exports,t=Fn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),er.exports;var e,n,t,r,o,i,a}function tr(){if(Pt)return Nt;Pt=1;var e=function(){if(xt)return mt;xt=1;var e=Wn(),n=kt(),t=ct(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,mt=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Ct(),t=nr(),r=t&&t.isTypedArray,o=r?n(r):e;return Nt=o}function rr(){if(jt)return Ot;jt=1;var e=On?Pn:(On=1,Pn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=st(),t=lt(),r=Et(),o=St(),i=tr(),a=Object.prototype.hasOwnProperty;return Ot=function(u,c){var s=t(u),l=!s&&n(u),d=!s&&!l&&r(u),f=!s&&!l&&!d&&i(u),h=s||l||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},Ot}function or(){if(At)return It;At=1;var e=Object.prototype;return It=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function ir(){return Tt||(Tt=1,zt=function(e,n){return function(t){return e(n(t))}}),zt}function ar(){if(Rt)return Dt;Rt=1;var e=or(),n=function(){if(Bt)return Lt;Bt=1;var e=ir()(Object.keys,Object);return Lt=e}(),t=Object.prototype.hasOwnProperty;return Dt=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function ur(){if(Ht)return Vt;Ht=1;var e=qn(),n=kt();return Vt=function(t){return null!=t&&n(t.length)&&!e(t)}}function cr(){if(Xt)return Yt;Xt=1;var e=rr(),n=ar(),t=ur();return Yt=function(r){return t(r)?e(r):n(r)}}function sr(){if(Kt)return $t;Kt=1;var e=rr(),n=function(){if(qt)return Gt;qt=1;var e=Gn(),n=or(),t=Wt?Ut:(Wt=1,Ut=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return Gt=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=ur();return $t=function(r){return t(r)?e(r,!0):n(r)}}er.exports;var lr,dr,fr,hr,vr,pr,gr,yr,mr,xr,br,wr,_r,Er,Sr,kr,Cr,Mr,Nr,Pr,Or,jr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Vr,Hr,Yr,Xr,Fr,Zr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,so,lo,fo,ho,vo,po,go,yo,mo,xo,bo,wo,_o,Eo,So,ko,Co,Mo,No,Po,Oo,jo,Io,Ao,zo,To,Lo,Bo,Do,Ro,Vo,Ho,Yo,Xo,Fo,Zo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,si,li,di,fi,hi,vi,pi,gi,yi,mi,xi,bi,wi,_i,Ei,Si,ki,Ci,Mi,Ni,Pi,Oi,ji,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Vi,Hi,Yi,Xi,Fi,Zi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,sa,la,da,fa,ha,va,pa,ga,ya,ma,xa,ba,wa,_a,Ea,Sa,ka,Ca,Ma,Na,Pa,Oa,ja,Ia,Aa,za,Ta,La,Ba,Da,Ra,Va,Ha,Ya,Xa,Fa,Za,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,su,lu,du,fu,hu,vu,pu,gu,yu,mu,xu,bu,wu,_u,Eu,Su,ku,Cu,Mu,Nu,Pu,Ou,ju,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Vu,Hu,Yu,Xu,Fu,Zu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,sc,lc,dc,fc,hc,vc,pc,gc,yc,mc,xc,bc,wc={exports:{}};function _c(){return lr||(lr=1,function(e,n){var t=Zn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}}(wc,wc.exports)),wc.exports}function Ec(){return fr||(fr=1,dr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),dr}function Sc(){return vr||(vr=1,hr=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i}),hr}function kc(){return gr?pr:(gr=1,pr=function(){return[]})}function Cc(){if(mr)return yr;mr=1;var e=Sc(),n=kc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return yr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Mc(){return _r||(_r=1,wr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),wr}function Nc(){if(Sr)return Er;Sr=1;var e=ir()(Object.getPrototypeOf,Object);return Er=e}function Pc(){if(Cr)return kr;Cr=1;var e=Mc(),n=Nc(),t=Cc(),r=kc(),o=Object.getOwnPropertySymbols;return kr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Oc(){if(Or)return Pr;Or=1;var e=Mc(),n=lt();return Pr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function jc(){if(Ir)return jr;Ir=1;var e=Oc(),n=Cc(),t=cr();return jr=function(r){return e(r,t,n)}}function Ic(){if(Vr)return Rr;Vr=1;var e=Kn()(Zn(),"Set");return Rr=e}function Ac(){if(Fr)return Xr;Fr=1;var e=function(){if(Lr)return Tr;Lr=1;var e=Kn()(Zn(),"DataView");return Tr=e}(),n=Qn(),t=function(){if(Dr)return Br;Dr=1;var e=Kn()(Zn(),"Promise");return Br=e}(),r=Ic(),o=function(){if(Yr)return Hr;Yr=1;var e=Kn()(Zn(),"WeakMap");return Hr=e}(),i=Wn(),a=$n(),u="[object Map]",c="[object Promise]",s="[object Set]",l="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=s||o&&y(new o)!=l)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return s;case g:return l}return n}),Xr=y}function zc(){if(Gr)return Wr;Gr=1;var e=Zn().Uint8Array;return Wr=e}function Tc(){if($r)return qr;$r=1;var e=zc();return qr=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Lc(){if(oo)return ro;oo=1;var e=Tc();return ro=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Bc(){if(co)return uo;co=1;var e=Gn(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return uo=t}function Dc(){if(lo)return so;lo=1;var e=Bc(),n=Nc(),t=or();return so=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function Rc(){if(wo)return bo;wo=1;var e=tt(),n=rt(),t=at(),r=function(){if(Zt)return Ft;Zt=1;var e=ut(),n=cr();return Ft=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(Jt)return Qt;Jt=1;var e=ut(),n=sr();return Qt=function(t,r){return t&&e(r,n(r),t)}}(),i=_c(),a=Ec(),u=function(){if(br)return xr;br=1;var e=ut(),n=Cc();return xr=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Nr)return Mr;Nr=1;var e=ut(),n=Pc();return Mr=function(t,r){return e(t,n(t),r)}}(),s=jc(),l=function(){if(zr)return Ar;zr=1;var e=Oc(),n=Pc(),t=sr();return Ar=function(r){return e(r,t,n)}}(),d=Ac(),f=function(){if(Ur)return Zr;Ur=1;var e=Object.prototype.hasOwnProperty;return Zr=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r},Zr}(),h=function(){if(ao)return io;ao=1;var e=Tc(),n=function(){if(Qr)return Kr;Qr=1;var e=Tc();return Kr=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(eo)return Jr;eo=1;var e=/\w*$/;return Jr=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(to)return no;to=1;var e=Un(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return no=function(e){return t?Object(t.call(e)):{}}}(),o=Lc();return io=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=Dc(),p=lt(),g=Et(),y=function(){if(po)return vo;po=1;var e=function(){if(ho)return fo;ho=1;var e=Ac(),n=ct();return fo=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isMap,o=r?n(r):e;return vo=o}(),m=Gn(),x=function(){if(xo)return mo;xo=1;var e=function(){if(yo)return go;yo=1;var e=Ac(),n=ct();return go=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isSet,o=r?n(r):e;return mo=o}(),b=cr(),w=sr(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,bo=function C(M,N,P,O,j,I){var A,z=1&N,T=2&N,L=4&N;if(P&&(A=j?P(M,O,j,I):P(M)),void 0!==A)return A;if(!m(M))return M;var B=p(M);if(B){if(A=f(M),!z)return a(M,A)}else{var D=d(M),R=D==E||"[object GeneratorFunction]"==D;if(g(M))return i(M,z);if(D==S||D==_||R&&!j){if(A=T||R?{}:v(M),!z)return T?c(M,o(A,M)):u(M,r(A,M))}else{if(!k[D])return j?M:{};A=h(M,D,z)}}I||(I=new e);var V=I.get(M);if(V)return V;I.set(M,A),x(M)?M.forEach((function(e){A.add(C(e,N,P,e,M,I))})):y(M)&&M.forEach((function(e,n){A.set(n,C(e,N,P,n,M,I))}));var H=B?void 0:(L?T?l:s:T?w:b)(M);return n(H||M,(function(e,n){H&&(e=M[n=e]),t(A,n,C(e,N,P,n,M,I))})),A},bo}function Vc(){if(Eo)return _o;Eo=1;var e=Rc();return _o=function(n){return e(n,4)}}function Hc(){return ko?So:(ko=1,So=function(e){return function(){return e}})}function Yc(){if(Po)return No;Po=1;var e=(Mo?Co:(Mo=1,Co=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return No=e}function Xc(){if(jo)return Oo;jo=1;var e=Yc(),n=cr();return Oo=function(t,r){return t&&e(t,r,n)}}function Fc(){if(To)return zo;To=1;var e=Xc(),n=function(){if(Ao)return Io;Ao=1;var e=ur();return Io=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}(),t=n(e);return zo=t}function Zc(){return Bo?Lo:(Bo=1,Lo=function(e){return e})}function Uc(){if(Ro)return Do;Ro=1;var e=Zc();return Do=function(n){return"function"==typeof n?n:e}}function Wc(){if(Ho)return Vo;Ho=1;var e=rt(),n=Fc(),t=Uc(),r=lt();return Vo=function(o,i){return(r(o)?e:n)(o,t(i))}}function Gc(){return Xo?Yo:(Xo=1,Yo=Wc())}function qc(){if(Ko)return $o;Ko=1;var e=nt(),n=Wo?Uo:(Wo=1,Uo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=qo?Go:(qo=1,Go=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,$o=r}function $c(){return ni?ei:(ni=1,ei=function(e,n){return e.has(n)})}function Kc(){if(ri)return ti;ri=1;var e=qc(),n=(Jo||(Jo=1,Qo=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),Qo),t=$c();return ti=function(r,o,i,a,u,c){var s=1&i,l=r.length,d=o.length;if(l!=d&&!(s&&d>l))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<l;){var y=r[v],m=o[v];if(a)var x=s?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==x){if(x)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},ti}function Qc(){return ui||(ui=1,ai=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),ai}function Jc(){if(hi)return fi;hi=1;var e=tt(),n=Kc(),t=function(){if(si)return ci;si=1;var e=Un(),n=zc(),t=Hn(),r=Kc(),o=(ii||(ii=1,oi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),oi),i=Qc(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return ci=function(e,a,c,s,l,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&s;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;s|=2,f.set(e,a);var g=r(h(e),h(a),s,l,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(di)return li;di=1;var e=jc(),n=Object.prototype.hasOwnProperty;return li=function(t,r,o,i,a,u){var c=1&o,s=e(t),l=s.length;if(l!=e(r).length&&!c)return!1;for(var d=l;d--;){var f=s[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<l;){var y=t[f=s[d]],m=r[f];if(i)var x=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===x?y===m||a(y,m,o,i,u):x)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,w=r.constructor;b==w||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Ac(),i=lt(),a=Et(),u=tr(),c="[object Arguments]",s="[object Array]",l="[object Object]",d=Object.prototype.hasOwnProperty;return fi=function(f,h,v,p,g,y){var m=i(f),x=i(h),b=m?s:o(f),w=x?s:o(h),_=(b=b==c?l:b)==l,E=(w=w==c?l:w)==l,S=b==w;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),C=E&&d.call(h,"__wrapped__");if(k||C){var M=k?f.value():f,N=C?h.value():h;return y||(y=new e),g(M,N,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function es(){if(pi)return vi;pi=1;var e=Jc(),n=ct();return vi=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},vi}function ns(){if(xi)return mi;xi=1;var e=Gn();return mi=function(n){return n==n&&!e(n)}}function ts(){return Ei?_i:(Ei=1,_i=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function rs(){if(Mi)return Ci;Mi=1;var e=Wn(),n=ct();return Ci=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function os(){if(Pi)return Ni;Pi=1;var e=lt(),n=rs(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Ni=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function is(){return Bi||(Bi=1,Li=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o}),Li}function as(){if(Hi)return Vi;Hi=1;var e=function(){if(Ri)return Di;Ri=1;var e=Un(),n=is(),t=lt(),r=rs(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Di=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Di}();return Vi=function(n){return null==n?"":e(n)}}function us(){if(Xi)return Yi;Xi=1;var e=lt(),n=os(),t=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ai)return Ii;Ai=1;var e=function(){if(ji)return Oi;ji=1;var e=nt();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,Oi=n}();return Ii=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return zi=r}(),r=as();return Yi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function cs(){if(Zi)return Fi;Zi=1;var e=rs();return Fi=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function ss(){if(Wi)return Ui;Wi=1;var e=us(),n=cs();return Ui=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function ls(){if(Ji)return Qi;Ji=1;var e=us(),n=st(),t=lt(),r=St(),o=kt(),i=cs();return Qi=function(a,u,c){for(var s=-1,l=(u=e(u,a)).length,d=!1;++s<l;){var f=i(u[s]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++s!=l?d:!!(l=null==a?0:a.length)&&o(l)&&r(f,l)&&(t(a)||n(a))}}function ds(){if(na)return ea;na=1;var e=Ki?$i:(Ki=1,$i=function(e,n){return null!=e&&n in Object(e)}),n=ls();return ea=function(t,r){return null!=t&&n(t,r,e)}}function fs(){return ia?oa:(ia=1,oa=function(e){return function(n){return null==n?void 0:n[e]}})}function hs(){if(da)return la;da=1;var e=function(){if(ki)return Si;ki=1;var e=function(){if(yi)return gi;yi=1;var e=tt(),n=es();return gi=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var s=o[a];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<u;){var l=(s=o[a])[0],d=t[l],f=s[1];if(c&&s[2]){if(void 0===d&&!(l in t))return!1}else{var h=new e;if(i)var v=i(d,f,l,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(wi)return bi;wi=1;var e=ns(),n=cr();return bi=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=ts();return Si=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(ra)return ta;ra=1;var e=es(),n=function(){if(qi)return Gi;qi=1;var e=ss();return Gi=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=ds(),r=os(),o=ns(),i=ts(),a=cs();return ta=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=Zc(),r=lt(),o=function(){if(sa)return ca;sa=1;var e=fs(),n=function(){if(ua)return aa;ua=1;var e=ss();return aa=function(n){return function(t){return e(t,n)}}}(),t=os(),r=cs();return ca=function(o){return t(o)?e(r(o)):n(o)}}();return la=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function vs(){if(ha)return fa;ha=1;var e=Sc(),n=function(){if(Zo)return Fo;Zo=1;var e=Fc();return Fo=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=hs(),r=lt();return fa=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function ps(){if(ya)return ga;ya=1;var e=function(){if(pa)return va;pa=1;var e=Object.prototype.hasOwnProperty;return va=function(n,t){return null!=n&&e.call(n,t)}}(),n=ls();return ga=function(t,r){return null!=t&&n(t,r,e)}}function gs(){if(xa)return ma;xa=1;var e=ar(),n=Ac(),t=st(),r=lt(),o=ur(),i=Et(),a=or(),u=tr(),c=Object.prototype.hasOwnProperty;return ma=function(s){if(null==s)return!0;if(o(s)&&(r(s)||"string"==typeof s||"function"==typeof s.splice||i(s)||u(s)||t(s)))return!s.length;var l=n(s);if("[object Map]"==l||"[object Set]"==l)return!s.size;if(a(s))return!e(s).length;for(var d in s)if(c.call(s,d))return!1;return!0}}function ys(){return wa?ba:(wa=1,ba=function(e){return void 0===e})}function ms(){if(Ea)return _a;Ea=1;var e=Fc(),n=ur();return _a=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function xs(){if(ka)return Sa;ka=1;var e=is(),n=hs(),t=ms(),r=lt();return Sa=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function bs(){if(ja)return Oa;ja=1;var e=(Ma||(Ma=1,Ca=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),Ca),n=Fc(),t=hs(),r=Pa?Na:(Pa=1,Na=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=lt();return Oa=function(i,a,u){var c=o(i)?e:r,s=arguments.length<3;return c(i,t(a,4),u,s,n)},Oa}function ws(){if(Xa)return Ya;Xa=1;var e=ar(),n=Ac(),t=ur(),r=function(){if(Aa)return Ia;Aa=1;var e=Wn(),n=lt(),t=ct();return Ia=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ha)return Va;Ha=1;var e=function(){if(Ta)return za;Ta=1;var e=fs()("length");return za=e}(),n=function(){if(Ba)return La;Ba=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return La=function(n){return e.test(n)}}(),t=function(){if(Ra)return Da;Ra=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",s=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",l="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+l+s,"g");return Da=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return Va=function(r){return n(r)?t(r):e(r)}}();return Ya=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function _s(){if(Za)return Fa;Za=1;var e=rt(),n=Bc(),t=Xc(),r=hs(),o=Nc(),i=lt(),a=Et(),u=qn(),c=Gn(),s=tr();return Fa=function(l,d,f){var h=i(l),v=h||a(l)||s(l);if(d=r(d,4),null==f){var p=l&&l.constructor;f=v?h?new p:[]:c(l)&&u(p)?n(o(l)):{}}return(v?e:t)(l,(function(e,n,t){return d(f,e,n,t)})),f}}function Es(){if(qa)return Ga;qa=1;var e=Mc(),n=function(){if(Wa)return Ua;Wa=1;var e=Un(),n=st(),t=lt(),r=e?e.isConcatSpreadable:void 0;return Ua=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return Ga=function t(r,o,i,a,u){var c=-1,s=r.length;for(i||(i=n),u||(u=[]);++c<s;){var l=r[c];o>0&&i(l)?o>1?t(l,o-1,i,a,u):e(u,l):a||(u[u.length]=l)}return u},Ga}function Ss(){if(Ja)return Qa;Ja=1;var e=Ka?$a:(Ka=1,$a=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return Qa=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var s=Array(r+1);++a<r;)s[a]=i[a];return s[r]=o(c),e(t,this,s)}},Qa}function ks(){if(iu)return ou;iu=1;var e=function(){if(nu)return eu;nu=1;var e=Hc(),n=ot(),t=Zc();return eu=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(ru)return tu;ru=1;var e=Date.now;return tu=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},tu}(),t=n(e);return ou=t}function Cs(){if(uu)return au;uu=1;var e=Zc(),n=Ss(),t=ks();return au=function(r,o){return t(n(r,o,e),r+"")},au}function Ms(){return su||(su=1,cu=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1}),cu}function Ns(){if(ku)return Su;ku=1;var e=qc(),n=function(){if(yu)return gu;yu=1;var e=function(){if(pu)return vu;pu=1;var e=Ms(),n=du?lu:(du=1,lu=function(e){return e!=e}),t=(hu||(hu=1,fu=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),fu);return vu=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},vu}();return gu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},gu}(),t=(xu||(xu=1,mu=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),mu),r=$c(),o=function(){if(Eu)return _u;Eu=1;var e=Ic(),n=wu?bu:(wu=1,bu=function(){}),t=Qc(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return _u=r}(),i=Qc();return Su=function(a,u,c){var s=-1,l=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,l=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,l=r,v=new e}else v=u?[]:h;e:for(;++s<d;){var g=a[s],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else l(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},Su}function Ps(){if(Mu)return Cu;Mu=1;var e=ur(),n=ct();return Cu=function(t){return n(t)&&e(t)}}function Os(){if(Pu)return Nu;Pu=1;var e=Es(),n=Cs(),t=Ns(),r=Ps(),o=n((function(n){return t(e(n,1,r,!0))}));return Nu=o}function js(){if(Au)return Iu;Au=1;var e=function(){if(ju)return Ou;ju=1;var e=is();return Ou=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=cr();return Iu=function(t){return null==t?[]:e(t,n(t))}}function Is(){if(Tu)return zu;var e;Tu=1;try{e={clone:Vc(),constant:Hc(),each:Gc(),filter:vs(),has:ps(),isArray:lt(),isEmpty:gs(),isFunction:qn(),isUndefined:ys(),keys:cr(),map:xs(),reduce:bs(),size:ws(),transform:_s(),union:Os(),values:js()}}catch(e){}return e||(e=window._),zu=e}function As(){if(Bu)return Lu;Bu=1;var e=Is();Lu=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,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[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var s=u;u=c,c=s}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var s=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,s))return a&&(this._edgeLabels[s]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=a?o:this._defaultEdgeLabelFn(n,t,r);var l=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},Lu}function zs(){if(Xu)return Yu;Xu=1;var e=Is(),n=As();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return Yu={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function Ts(){if(Zu)return Fu;Zu=1;var e=Is();return Fu=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},Fu}function Ls(){if(Wu)return Uu;Wu=1;var e=Is();function n(){this._arr=[],this._keyIndices={}}return Uu=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},Uu}function Bs(){if(qu)return Gu;qu=1;var e=Is(),n=Ls();Gu=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,s=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),s=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);s<t.distance&&(t.distance=s,t.predecessor=i,c.decrease(n,s))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(s);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return Gu}function Ds(){if(Ku)return $u;Ku=1;var e=Bs(),n=Is();return $u=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function Rs(){if(Ju)return Qu;Ju=1;var e=Is();return Qu=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var s,l=[];do{s=r.pop(),o[s].onStack=!1,l.push(s)}while(u!==s);i.push(l)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},Qu}function Vs(){if(nc)return ec;nc=1;var e=Is(),n=Rs();return ec=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Hs(){if(rc)return tc;rc=1;var e=Is();tc=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return tc}function Ys(){if(ic)return oc;ic=1;var e=Is();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return oc=n,n.CycleException=t,t.prototype=new Error,oc}function Xs(){if(uc)return ac;uc=1;var e=Ys();return ac=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Fs(){if(sc)return cc;sc=1;var e=Is();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return cc=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},cc}function Zs(){if(dc)return lc;dc=1;var e=Fs();return lc=function(n,t){return e(n,t,"post")}}function Us(){if(hc)return fc;hc=1;var e=Fs();return fc=function(n,t){return e(n,t,"pre")}}function Ws(){if(pc)return vc;pc=1;var e=Is(),n=As(),t=Ls();return vc=function(r,o){var i,a=new n,u={},c=new t;function s(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var l=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(i).forEach(s)}return a},vc}wc.exports;try{bc=function(){if(xc)return mc;xc=1;var e=Hu?Vu:(Hu=1,Vu={Graph:As(),version:Ru?Du:(Ru=1,Du="2.1.8")});return mc={Graph:e.Graph,json:zs(),alg:yc?gc:(yc=1,gc={components:Ts(),dijkstra:Bs(),dijkstraAll:Ds(),findCycles:Vs(),floydWarshall:Hs(),isAcyclic:Xs(),postorder:Zs(),preorder:Us(),prim:Ws(),tarjan:Rs(),topsort:Ys()}),version:e.version}}()}catch(z){}bc||(bc=window.graphlib);var Gs,qs,$s,Ks,Qs,Js,el,nl,tl,rl,ol,il,al,ul,cl,sl,ll,dl,fl,hl,vl,pl,gl,yl,ml,xl,bl,wl,_l,El,Sl,kl,Cl,Ml,Nl,Pl,Ol,jl,Il,Al,zl,Tl,Ll,Bl,Dl,Rl,Vl,Hl,Yl,Xl,Fl,Zl,Ul,Wl,Gl,ql,$l,Kl,Ql,Jl,ed,nd,td,rd,od,id,ad,ud,cd,sd,ld,dd,fd,hd,vd,pd,gd,yd,md,xd,bd,wd,_d,Ed,Sd,kd,Cd,Md,Nd,Pd,Od,jd,Id,Ad=bc;function zd(){if(Ks)return $s;Ks=1;var e=Hn(),n=ur(),t=St(),r=Gn();return $s=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function Td(){if(sl)return cl;sl=1;var e=function(){if(ul)return al;ul=1;var e=function(){if(il)return ol;il=1;var e=function(){if(rl)return tl;rl=1;var e=/\s/;return tl=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return ol=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=Gn(),t=rs(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return al=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var s=o.test(u);return s||i.test(u)?a(u.slice(2),s?2:8):r.test(u)?NaN:+u}}(),n=1/0;return cl=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function Ld(){if(yl)return gl;yl=1;var e=Es();return gl=function(n){return null!=n&&n.length?e(n,1):[]}}function Bd(){if(kl)return Sl;kl=1;var e=rs();return Sl=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,s=a}return s},Sl}function Dd(){if(jl)return Ol;jl=1;var e=it(),n=Hn();return Ol=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function Rd(){return Tl?zl:(Tl=1,zl=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function Vd(){return Wl?Ul:(Wl=1,Ul=function(e,n){return e<n})}function Hd(){if(Ed)return _d;Ed=1;var e=is(),n=ss(),t=hs(),r=ms(),o=(yd||(yd=1,gd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),gd),i=Ct(),a=function(){if(wd)return bd;wd=1;var e=function(){if(xd)return md;xd=1;var e=rs();return md=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,s=t==t,l=e(t);if(!c&&!l&&!a&&n>t||a&&u&&s&&!c&&!l||o&&u&&s||!r&&s||!i)return 1;if(!o&&!a&&!l&&n<t||l&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!s)return-1}return 0}}();return bd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var s=e(i[o],a[o]);if(s)return o>=c?s:s*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=Zc(),c=lt();return _d=function(s,l,d){l=l.length?e(l,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;l=e(l,i(t));var h=r(s,(function(n,t,r){return{criteria:e(l,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Id={cloneDeep:function(){if(qs)return Gs;qs=1;var e=Rc();return Gs=function(n){return e(n,5)}}(),constant:Hc(),defaults:function(){if(Js)return Qs;Js=1;var e=Cs(),n=Hn(),t=zd(),r=sr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,s=c>2?a[2]:void 0;for(s&&t(a[0],a[1],s)&&(c=1);++u<c;)for(var l=a[u],d=r(l),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=l[v])}return e}));return Qs=a}(),each:Gc(),filter:vs(),find:function(){if(pl)return vl;pl=1;var e=function(){if(nl)return el;nl=1;var e=hs(),n=ur(),t=cr();return el=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var s=r(o,i,a);return s>-1?u[c?o[s]:s]:void 0}}}(),n=e(function(){if(hl)return fl;hl=1;var e=Ms(),n=hs(),t=function(){if(dl)return ll;dl=1;var e=Td();return ll=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return fl=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)},fl}());return vl=n}(),flatten:Ld(),forEach:Wc(),forIn:function(){if(xl)return ml;xl=1;var e=Yc(),n=Uc(),t=sr();return ml=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:ps(),isUndefined:ys(),last:(wl||(wl=1,bl=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),bl),map:xs(),mapValues:function(){if(El)return _l;El=1;var e=it(),n=Xc(),t=hs();return _l=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Pl)return Nl;Pl=1;var e=Bd(),n=Ml?Cl:(Ml=1,Cl=function(e,n){return e>n}),t=Zc();return Nl=function(r){return r&&r.length?e(r,t,n):void 0},Nl}(),merge:function(){if(Zl)return Fl;Zl=1;var e=function(){if(Hl)return Vl;Hl=1;var e=tt(),n=Dd(),t=Yc(),r=function(){if(Rl)return Dl;Rl=1;var e=Dd(),n=_c(),t=Lc(),r=Ec(),o=Dc(),i=st(),a=lt(),u=Ps(),c=Et(),s=qn(),l=Gn(),d=function(){if(Al)return Il;Al=1;var e=Wn(),n=Nc(),t=ct(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Il=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=tr(),h=Rd(),v=function(){if(Bl)return Ll;Bl=1;var e=ut(),n=sr();return Ll=function(t){return e(t,n(t))}}();return Dl=function(p,g,y,m,x,b,w){var _=h(p,y),E=h(g,y),S=w.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,w):void 0,C=void 0===k;if(C){var M=a(E),N=!M&&c(E),P=!M&&!N&&f(E);k=E,M||N||P?a(_)?k=_:u(_)?k=r(_):N?(C=!1,k=n(E,!0)):P?(C=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):l(_)&&!s(_)||(k=o(E))):C=!1}C&&(w.set(E,k),x(k,E,m,b,w),w.delete(E)),e(p,y,k)}}}(),o=Gn(),i=sr(),a=Rd();return Vl=function u(c,s,l,d,f){c!==s&&t(s,(function(t,i){if(f||(f=new e),o(t))r(c,s,i,l,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,s,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},Vl}(),n=function(){if(Xl)return Yl;Xl=1;var e=Cs(),n=zd();return Yl=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return Fl=n}(),min:function(){if(ql)return Gl;ql=1;var e=Bd(),n=Vd(),t=Zc();return Gl=function(r){return r&&r.length?e(r,t,n):void 0},Gl}(),minBy:function(){if(Kl)return $l;Kl=1;var e=Bd(),n=hs(),t=Vd();return $l=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},$l}(),now:function(){if(Jl)return Ql;Jl=1;var e=Zn();return Ql=function(){return e.Date.now()}}(),pick:function(){if(sd)return cd;sd=1;var e=function(){if(id)return od;id=1;var e=function(){if(rd)return td;rd=1;var e=ss(),n=function(){if(nd)return ed;nd=1;var e=at(),n=us(),t=St(),r=Gn(),o=cs();return ed=function(i,a,u,c){if(!r(i))return i;for(var s=-1,l=(a=n(a,i)).length,d=l-1,f=i;null!=f&&++s<l;){var h=o(a[s]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(s!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[s+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=us();return td=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var s=o[a],l=e(r,s);i(l,s)&&n(c,t(s,r),l)}return c}}(),n=ds();return od=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(ud)return ad;ud=1;var e=Ld(),n=Ss(),t=ks();return ad=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return cd=t}(),range:function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=function(){if(dd)return ld;dd=1;var e=Math.ceil,n=Math.max;return ld=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},ld}(),n=zd(),t=Td();return fd=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}},fd}()();return vd=e}(),reduce:bs(),sortBy:function(){if(kd)return Sd;kd=1;var e=Es(),n=Hd(),t=Cs(),r=zd(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return Sd=o}(),uniqueId:function(){if(Md)return Cd;Md=1;var e=as(),n=0;return Cd=function(t){var r=++n;return e(t)+r},Cd}(),values:js(),zipObject:function(){if(jd)return Od;jd=1;var e=at(),n=(Pd||(Pd=1,Nd=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a}),Nd);return Od=function(t,r){return n(t||[],r||[],e)},Od}()}}catch(z){}Id||(Id=window._);var Yd=Id,Xd=Fd;function Fd(){var e={};e._next=e._prev=e,this._sentinel=e}function Zd(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ud(e,n){if("_next"!==e&&"_prev"!==e)return n}Fd.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return Zd(n),n},Fd.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&Zd(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Fd.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,Ud)),t=t._prev;return"["+e.join(", ")+"]"};var Wd=Yd,Gd=Ad.Graph,qd=Xd,$d=Wd.constant(1);function Kd(e,n,t,r,o){var i=o?[]:void 0;return Wd.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,Qd(n,t,u)})),Wd.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,Qd(n,t,a)})),e.removeNode(r.v),i}function Qd(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var Jd=Yd,ef=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new Gd,r=0,o=0;Wd.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),Wd.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=Wd.range(o+r+3).map((function(){return new qd})),a=r+1;return Wd.forEach(t.nodes(),(function(e){Qd(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||$d),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)Kd(e,n,t,r);for(;r=i.dequeue();)Kd(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(Kd(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Wd.flatten(Wd.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},nf={run:function(e){var n="greedy"===e.graph().acyclicer?ef(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return Jd.forEach(e.nodes(),(function o(i){Jd.has(r,i)||(r[i]=!0,t[i]=!0,Jd.forEach(e.outEdges(i),(function(e){Jd.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);Jd.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,Jd.uniqueId("rev"))}))},undo:function(e){Jd.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},tf=Yd,rf=Ad.Graph,of={addDummyNode:af,simplify:function(e){var n=(new rf).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),tf.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new rf({multigraph:e.isMultigraph()}).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),tf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=tf.map(tf.range(uf(e)+1),(function(){return[]}));return tf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;tf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank})));tf.forEach(e.nodes(),(function(t){var r=e.node(t);tf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];tf.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;tf.forEach(t,(function(n,t){tf.isUndefined(n)&&t%o!=0?--r:r&&tf.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),af(e,"border",o,n)},maxRank:uf,partition:function(e,n){var t={lhs:[],rhs:[]};return tf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=tf.now();try{return n()}finally{console.log(e+" time: "+(tf.now()-t)+"ms")}},notime:function(e,n){return n()}};function af(e,n,t,r){var o;do{o=tf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function uf(e){return tf.max(tf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!tf.isUndefined(t))return t})))}var cf=Yd,sf=of,lf={run:function(e){e.graph().dummyChains=[],cf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,l=e.edge(n),d=l.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:n,rank:a},t=sf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),e.setEdge(i,t,{weight:l.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:l.weight},s)}}(e,n)}))},undo:function(e){cf.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},df=Yd,ff=function(e){var n={};df.forEach(e.sources(),(function t(r){var o=e.node(r);if(df.has(n,r))return o.rank;n[r]=!0;var i=df.min(df.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},hf=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},vf=Yd,pf=Ad.Graph,gf=hf,yf=function(e){var n,t,r=new pf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});mf(r,e)<i;)n=xf(r,e),t=r.hasNode(n.v)?gf(e,n):-gf(e,n),bf(r,e,t);return r};function mf(e,n){return vf.forEach(e.nodes(),(function t(r){vf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||gf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function xf(e,n){return vf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return gf(n,t)}))}function bf(e,n,t){vf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var wf=Yd,_f=yf,Ef=hf,Sf=ff,kf=Ad.alg.preorder,Cf=Ad.alg.postorder,Mf=of.simplify,Nf=Pf;function Pf(e){e=Mf(e),Sf(e);var n,t=_f(e);for(If(t),Of(t,e);n=zf(t);)Lf(t,e,n,Tf(t,e,n))}function Of(e,n){var t=Cf(e,e.nodes());t=t.slice(0,t.length-1),wf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=jf(e,n,t)}(e,n,t)}))}function jf(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,wf.forEach(n.nodeEdges(t),(function(i){var u,c,s=i.v===t,l=s?i.w:i.v;if(l!==r){var d=s===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=l,e.hasEdge(u,c)){var h=e.edge(t,l).cutvalue;a+=d?-h:h}}})),a}function If(e,n){arguments.length<2&&(n=e.nodes()[0]),Af(e,{},1,n)}function Af(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,wf.forEach(e.neighbors(r),(function(o){wf.has(n,o)||(t=Af(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function zf(e){return wf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Tf(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=wf.filter(n.edges(),(function(n){return c===Bf(e,e.node(n.v),u)&&c!==Bf(e,e.node(n.w),u)}));return wf.minBy(s,(function(e){return Ef(n,e)}))}function Lf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),If(e),Of(e,n),function(e,n){var t=wf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=kf(e,t);r=r.slice(1),wf.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function Bf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Pf.initLowLimValues=If,Pf.initCutValues=Of,Pf.calcCutValue=jf,Pf.leaveEdge=zf,Pf.enterEdge=Tf,Pf.exchangeEdges=Lf;var Df=ff,Rf=yf,Vf=Nf,Hf=Df;var Yf=Yd,Xf=Yd,Ff=of,Zf={run:function(e){var n=Ff.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Xf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Xf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Xf.max(Xf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Xf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Xf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Xf.forEach(e.children(),(function(a){Uf(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,Xf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function Uf(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Ff.addBorderNode(e,"_bt"),s=Ff.addBorderNode(e,"_bb"),l=e.node(a);e.setParent(c,a),l.borderTop=c,e.setParent(s,a),l.borderBottom=s,Xf.forEach(u,(function(u){Uf(e,n,t,r,o,i,u);var l=e.node(u),d=l.borderTop?l.borderTop:u,f=l.borderBottom?l.borderBottom:u,h=l.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,s,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var Wf=Yd,Gf=of;function qf(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Gf.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var $f=Yd,Kf={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||Qf(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){$f.forEach(e.nodes(),(function(n){eh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,eh),$f.has(t,"y")&&eh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){$f.forEach(e.nodes(),(function(n){nh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,nh),$f.has(t,"x")&&nh(t)}))}(e),Qf(e))}};function Qf(e){$f.forEach(e.nodes(),(function(n){Jf(e.node(n))})),$f.forEach(e.edges(),(function(n){Jf(e.edge(n))}))}function Jf(e){var n=e.width;e.width=e.height,e.height=n}function eh(e){e.y=-e.y}function nh(e){var n=e.x;e.x=e.y,e.y=n}var th=Yd,rh=Yd;function oh(e,n,t){for(var r=rh.zipObject(t,rh.map(t,(function(e,n){return n}))),o=rh.flatten(rh.map(n,(function(n){return rh.sortBy(rh.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=rh.map(new Array(a),(function(){return 0})),c=0;return rh.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var ih=Yd,ah=Yd,uh=Yd,ch=of;function sh(e,n,t){for(var r;n.length&&(r=uh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var lh=Yd,dh=Yd,fh=Ad.Graph,hh=Yd,vh=Yd,ph=function(e){var n={},t=th.filter(e.nodes(),(function(n){return!e.children(n).length})),r=th.max(th.map(t,(function(n){return e.node(n).rank}))),o=th.map(th.range(r+1),(function(){return[]}));var i=th.sortBy(t,(function(n){return e.node(n).rank}));return th.forEach(i,(function t(r){if(!th.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),th.forEach(e.successors(r),t)}})),o},gh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=oh(e,n[r-1],n[r]);return t},yh=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=lh.filter(i,(function(e){return e!==u&&e!==c})));var l=function(e,n){return ih.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ih.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);lh.forEach(l,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);s[t.v]=i,lh.has(i,"barycenter")&&(a=t,u=i,lh.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return ah.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};ah.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),ah.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];ah.isUndefined(n)||ah.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(ah.isUndefined(n.barycenter)||ah.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),ah.forEach(o.in.reverse(),t(o)),ah.forEach(o.out,r(o))}return ah.map(ah.filter(n,(function(e){return!e.merged})),(function(e){return ah.pick(e,["vs","i","barycenter","weight"])}))}(ah.filter(t,(function(e){return!e.indegree})))}(l,r);!function(e,n){lh.forEach(e,(function(e){e.vs=lh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var f=function(e,n){var t,r=ch.partition(e,(function(e){return uh.has(e,"barycenter")})),o=r.lhs,i=uh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,s=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),s=sh(a,i,s),uh.forEach(o,(function(e){s+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,s=sh(a,i,s)}));var l={vs:uh.flatten(a,!0)};return c&&(l.barycenter=u/c,l.weight=c),l}(d,o);if(u&&(f.vs=lh.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);lh.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},mh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=dh.uniqueId("_root")););return n}(e),o=new fh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return dh.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),dh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=dh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),dh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},xh=Ad.Graph,bh=of;function wh(e,n,t){return vh.map(n,(function(n){return mh(e,n,t)}))}function _h(e,n){var t=new xh;vh.forEach(e,(function(e){var r=e.graph().root,o=yh(e,r,t,n);vh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};hh.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function Eh(e,n){vh.forEach(n,(function(n){vh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var Sh=Yd,kh=Ad.Graph,Ch=of;function Mh(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Nh(e,n,t){if(n>t){var r=n;n=t,t=r}return Sh.has(e[n],t)}var Ph=Yd,Oh=of,jh=function(e){var n,t=Ch.buildLayerMatrix(e),r=Sh.merge(function(e,n){var t={};return Sh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=Sh.last(r);return Sh.forEach(r,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return Sh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),l=s?e.node(s).order:a;(s||n===u)&&(Sh.forEach(r.slice(i,c+1),(function(n){Sh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||l<a)||i.dummy&&e.node(n).dummy||Mh(t,r,n)}))})),i=c+1,o=l)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;Sh.forEach(Sh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&Sh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Mh(t,n,u)}))}))}return Sh.reduce(n,(function(n,t){var o,i=-1,a=0;return Sh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};Sh.forEach(["u","d"],(function(i){n="u"===i?t:Sh.values(t).reverse(),Sh.forEach(["l","r"],(function(t){"r"===t&&(n=Sh.map(n,(function(e){return Sh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return Sh.forEach(n,(function(e){Sh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Sh.forEach(n,(function(e){var n=-1;Sh.forEach(e,(function(e){var u=r(e);if(u.length){u=Sh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),l=Math.ceil(c);s<=l;++s){var d=u[s];i[e]===e&&n<a[d]&&!Nh(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new kh,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),s=0;if(s+=u.width/2,Sh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=t?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,Sh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=t?a:-a),a=0,s}}(i.nodesep,i.edgesep,r);return Sh.forEach(n,(function(n){var r;Sh.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),Sh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=Sh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return Sh.minBy(Sh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Sh.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=Sh.values(n),r=Sh.min(t),o=Sh.max(t);Sh.forEach(["u","d"],(function(t){Sh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var s=Sh.values(c);(a="l"===i?r-Sh.min(s):o-Sh.max(s))&&(e[u]=Sh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return Sh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=Sh.sortBy(Sh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Ih=Yd,Ah=nf,zh=lf,Th=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){Vf(e)}(e);break;case"tight-tree":!function(e){Df(e),Rf(e)}(e);break;case"longest-path":Hf(e)}},Lh=of.normalizeRanks,Bh=function(e){var n=function(e){var n={},t=0;return Yf.forEach(e.children(),(function r(o){var i=t;Yf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Yf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],l=!0;t!==o.w;){if(r=e.node(t),l){for(;(s=a[c])!==u&&e.node(s).maxRank<r.rank;)c++;s===u&&(l=!1)}if(!l){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=r.rank;)c++;s=a[c]}e.setParent(t,s),t=e.successors(t)[0]}}))},Dh=of.removeEmptyRanks,Rh=Zf,Vh=function(e){Wf.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&Wf.forEach(r,n),Wf.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)qf(e,"borderLeft","_bl",t,o,i),qf(e,"borderRight","_br",t,o,i)}}))},Hh=Kf,Yh=function(e){var n=bh.maxRank(e),t=wh(e,vh.range(1,n+1),"inEdges"),r=wh(e,vh.range(n-1,-1,-1),"outEdges"),o=ph(e);Eh(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){_h(u%2?t:r,u%4>=2),o=bh.buildLayerMatrix(e);var s=gh(e,o);s<a&&(c=0,i=vh.cloneDeep(o),a=s)}Eh(e,i)},Xh=function(e){(function(e){var n=Oh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Ph.forEach(n,(function(n){var o=Ph.max(Ph.map(n,(function(n){return e.node(n).height})));Ph.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Oh.asNonCompoundGraph(e)),Ph.forEach(jh(e),(function(n,t){e.node(t).x=n}))},Fh=of,Zh=Ad.Graph,Uh=["nodesep","edgesep","ranksep","marginx","marginy"],Wh={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gh=["acyclicer","ranker","rankdir","align"],qh=["width","height"],$h={width:0,height:0},Kh=["minlen","weight","width","height","labeloffset"],Qh={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Jh=["labelpos"];function ev(e,n){return Ih.mapValues(Ih.pick(e,n),Number)}function nv(e){var n={};return Ih.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var tv=Yd,rv=of,ov=Ad.Graph,iv={debugOrdering:function(e){var n=rv.buildLayerMatrix(e),t=new ov({compound:!0,multigraph:!0}).setGraph({});return tv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),tv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),tv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),tv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},av=Vn({graphlib:Ad,layout:function(e,n){var t=n&&n.debugTiming?Fh.time:Fh.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new Zh({multigraph:!0,compound:!0}),t=nv(e.graph());return n.setGraph(Ih.merge({},Wh,ev(t,Uh),Ih.pick(t,Gh))),Ih.forEach(e.nodes(),(function(t){var r=nv(e.node(t));n.setNode(t,Ih.defaults(ev(r,qh),$h)),n.setParent(t,e.parent(t))})),Ih.forEach(e.edges(),(function(t){var r=nv(e.edge(t));n.setEdge(t,Ih.merge({},Qh,ev(r,Kh),Ih.pick(r,Jh)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Ih.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Ih.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){Ah.run(e)})),n(" nestingGraph.run",(function(){Rh.run(e)})),n(" rank",(function(){Th(Fh.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};Fh.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Dh(e)})),n(" nestingGraph.cleanup",(function(){Rh.cleanup(e)})),n(" normalizeRanks",(function(){Lh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Ih.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Ih.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){zh.run(e)})),n(" parentDummyChains",(function(){Bh(e)})),n(" addBorderSegments",(function(){Vh(e)})),n(" order",(function(){Yh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=Fh.buildLayerMatrix(e);Ih.forEach(n,(function(n){var t=0;Ih.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Ih.forEach(o.selfEdges,(function(n){Fh.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){Hh.adjust(e)})),n(" position",(function(){Xh(e)})),n(" positionSelfEdges",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Ih.last(t.borderLeft)),a=e.node(Ih.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Ih.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){zh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);if(Ih.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){Hh.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Ih.forEach(e.nodes(),(function(n){c(e.node(n))})),Ih.forEach(e.edges(),(function(n){var t=e.edge(n);Ih.has(t,"x")&&c(t)})),n-=a,r-=u,Ih.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Ih.forEach(e.edges(),(function(t){var o=e.edge(t);Ih.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Ih.has(o,"x")&&(o.x-=n),Ih.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(Fh.intersectRect(i,t)),o.points.push(Fh.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Ah.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Ih.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Ih.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Ih.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:iv,util:{time:of.time,notime:of.notime},version:"0.8.5"}),uv={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},error002:function(){return"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:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(e){return void 0===e&&(e="react"),"It seems that you haven't loaded the styles. Please import '@aloudata/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},cv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sv=["Enter"," ","Escape"],lv=function(e,n){void 0===n&&(n=[0,0]);var t=Mv(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},dv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=wv(t,n.nodeOrigin);return mv(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return bv(t)},fv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=wv(e,n.nodeOrigin);t=mv(t,r)}})),bv(t)};function hv(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?lv(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&Cv(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],b=f+p*m[1];h=[[x,b],[x+g-v,b+y-p]]}}else null==u||u("005",uv.error005());var w=Cv(h)?pv(t,h):t;return{position:{x:w.x-d,y:w.y-f},positionAbsolute:w}}var vv=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},pv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:vv(e.x,n[0][0],n[1][0]),y:vv(e.y,n[0][1],n[1][1])}},gv=function(e,n,t){return e<n?vv(Math.abs(e-n),1,50)/50:e>t?-vv(Math.abs(e-t),1,50)/50:0},yv=function(e,n){return[20*gv(e.x,35,n.width-35),20*gv(e.y,35,n.height-35)]},mv=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},xv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},bv=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},wv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=lv(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},_v=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Ev=function(e,n,t,r){var o=e.x,i=e.y,a=L(n,3),u=a[0],c=a[1],s=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var l={x:(o-u)/s,y:(i-c)/s};return t?_v(l,r):l},Sv=function(e,n){var t=e.x,r=e.y,o=L(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},kv=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function Cv(e){return void 0!==e&&"parent"!==e}function Mv(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var Nv={x:0,y:0};var Pv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},Ov=function(e,n){return!!Pv(e)&&e.indexOf(n)>-1},jv=function(e,n){if(!Pv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},Iv={}.toString,Av=function(e,n){return Iv.call(e)==="[object "+n+"]"},zv=function(e){return Av(e,"Function")},Tv=function(e){return null==e},Lv=function(e){return Array.isArray?Array.isArray(e):Av(e,"Array")},Bv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function Dv(e,n){if(e)if(Lv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(Bv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var Rv=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return Dv(e,(function(t,r){zv(e)&&"prototype"===r||n.push(r)})),n};function Vv(e,n){var t=Rv(n),r=t.length;if(Tv(e))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(n[i]!==e[i]||!(i in e))return!1}return!0}var Hv=function(e){return"object"==typeof e&&null!==e},Yv=function(e){if(!Hv(e)||!Av(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n},Xv=function(e,n){if(void 0===n&&(n=[]),Lv(e))for(var t=0;t<e.length;t+=1)Xv(e[t],n);else n.push(e);return n},Fv=function(e){if(Lv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},Zv=function(e){if(Lv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},Uv=Array.prototype,Wv=Uv.splice,Gv=Uv.indexOf,qv=Array.prototype.splice,$v=function(e,n){if(!Pv(e))return[];for(var t=e?n.length:0,r=t-1;t--;){var o=void 0,i=n[t];t!==r&&i===o||(o=i,qv.call(e,i,1))}return e},Kv=function(e,n,t){if(!Lv(e)&&!Yv(e))return e;var r=t;return Dv(e,(function(e,t){r=n(r,e,t)})),r},Qv=function(e){return Av(e,"String")};function Jv(e,n){void 0===n&&(n=new Map);var t=[];if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++){var i=e[r];n.has(i)||(t.push(i),n.set(i,!0))}return t}var ep=Object.prototype.hasOwnProperty;function np(e,n){if(!n||!Lv(e))return{};for(var t,r={},o=zv(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),ep.call(r,t)?r[t].push(a):r[t]=[a]}return r}function tp(e,n){if(!n)return{0:e};if(!zv(n)){var t=Lv(n)?n:n.replace(/\s+/g,"").split("*");n=function(e){for(var n="_",r=0,o=t.length;r<o;r++)n+=e[t[r]]&&e[t[r]].toString();return n}}return np(e,n)}var rp={},op=function(e){return Av(e,"Number")},ip=Number.isInteger?Number.isInteger:function(e){return op(e)&&e%1==0},ap=180/Math.PI,up=parseInt,cp=Math.PI/180,sp=function(e,n){return e.hasOwnProperty(n)},lp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return Dv(e,(function(t,r){zv(e)&&"prototype"===r||n.push(t)})),n},dp=function(e){return Tv(e)?"":e.toString()},fp={}.toString,hp=function(e){return fp.call(e).replace(/^\[object /,"").replace(/]$/,"")},vp=Object.prototype,pp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||vp)};function gp(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function yp(e,n,t,r){return n&&gp(e,n),t&&gp(e,t),r&&gp(e,r),e}var mp=function(e){if("object"!=typeof e||null===e)return e;var n;if(Lv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=mp(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=mp(e[o]):n[o]=e[o];return n},xp=function(e,n){if(!zv(e))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function bp(e,n,t,r){for(var o in t=t||0,r=r||5,n)if(n.hasOwnProperty(o)){var i=n[o];null!==i&&Yv(i)?(Yv(e[o])||(e[o]={}),t<r?bp(e[o],i,t+1,r):e[o]=n[o]):Lv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var wp,_p=Object.prototype.hasOwnProperty,Ep=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(Qv(e)||Qv(n))return!1;if(Pv(e)||Pv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=Ep(e[r],n[r]));r++);return t}if(Hv(e)||Hv(n)){var o=Object.keys(e),i=Object.keys(n);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=Ep(e[o[r]],n[o[r]]));r++);return t}return!1},Sp=function(e){return e},kp=Object.prototype.hasOwnProperty,Cp={},Mp=xp((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return wp||(wp=document.createElement("canvas").getContext("2d")),wp.font=[i,a,o,t+"px",r].join(" "),wp.measureText(Qv(e)?e:"").width}),(function(e,n){return void 0===n&&(n={}),function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([e],lp(n)).join("")})),Np=function(){function e(){this.map={}}return e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,n){var t=this.map[e];return void 0===t?n:t},e.prototype.set=function(e,n){this.map[e]=n},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length},e}(),Pp=Object.freeze({__proto__:null,Cache:Np,assign:yp,augment:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=e[0],r=1;r<e.length;r++){var o=e[r];zv(o)&&(o=o.prototype),yp(t.prototype,o)}},clamp:function(e,n,t){return e<n?n:e>t?t:e},clearAnimationFrame:function(e){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(e)},clone:mp,contains:Ov,debounce:function(e,n,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||e.apply(o,i)}),n),a&&e.apply(o,i)}},deepMix:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r+=1)bp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),jv(e,(function(e){return!Ov(n,e)}))},each:Dv,endsWith:function(e,n){return!(!Lv(e)&&!Qv(e))&&e[e.length-1]===n},every:function(e,n){for(var t=0;t<e.length;t++)if(!n(e[t],t))return!1;return!0},extend:function(e,n,t,r){zv(n)||(t=n,n=e,e=function(){});var o=Object.create?function(e,n){return Object.create(e,{constructor:{value:n}})}:function(e,n){function t(){}t.prototype=e;var r=new t;return r.constructor=n,r},i=o(n.prototype,e);return e.prototype=yp(i,e.prototype),e.superclass=o(n.prototype,n),yp(i,t),yp(e,r),e},filter:jv,find:function(e,n){if(!Lv(e))return null;var t;if(zv(n)&&(t=n),Yv(n)&&(t=function(e){return Vv(e,n)}),t)for(var r=0;r<e.length;r+=1)if(t(e[r]))return e[r];return null},findIndex:function(e,n,t){void 0===t&&(t=0);for(var r=t;r<e.length;r++)if(n(e[r],r))return r;return-1},firstValue:function(e,n){for(var t=null,r=0;r<e.length;r++){var o=e[r][n];if(!Tv(o)){t=Lv(o)?o[0]:o;break}}return t},fixedBase:function(e,n){var t=n.toString(),r=t.indexOf(".");if(-1===r)return Math.round(e);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(e.toFixed(o))},flatten:function(e){if(!Lv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:Xv,forIn:Dv,get:function(e,n,t){for(var r=0,o=Qv(n)?n.split("."):n;e&&r<o.length;)e=e[o[r++]];return void 0===e||r<o.length?t:e},getEllipsisText:function(e,n,t,r){void 0===r&&(r="...");var o,i,a=Mp(r,t),u=Qv(e)?e:dp(e),c=n,s=[];if(Mp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=Mp(o,t))+a>c&&i>c);)if(s.push(o),c-=i,!(u=u.substr(16)))return s.join("");for(;o=u.substr(0,1),!((i=Mp(o,t))+a>c);)if(s.push(o),c-=i,!(u=u.substr(1)))return s.join("");return""+s.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(Lv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=Fv(n);return{min:Zv(n),max:o}},getType:hp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=tp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:np,groupToMap:tp,has:sp,hasKey:sp,hasValue:function(e,n){return Ov(lp(e),n)},head:function(e){if(Pv(e))return e[0]},identity:function(e){return e},includes:Ov,indexOf:function(e,n){if(!Pv(e))return-1;var t=Array.prototype.indexOf;if(t)return t.call(e,n);for(var r=-1,o=0;o<e.length;o++)if(e[o]===n){r=o;break}return r},isArguments:function(e){return Av(e,"Arguments")},isArray:Lv,isArrayLike:Pv,isBoolean:function(e){return Av(e,"Boolean")},isDate:function(e){return Av(e,"Date")},isDecimal:function(e){return op(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(Tv(e))return!0;if(Pv(e))return!e.length;var n=hp(e);if("Map"===n||"Set"===n)return!e.size;if(pp(e))return!Object.keys(e).length;for(var t in e)if(_p.call(e,t))return!1;return!0},isEqual:Ep,isEqualWith:function(e,n,t){return zv(t)?!!t(e,n):Ep(e,n)},isError:function(e){return Av(e,"Error")},isEven:function(e){return op(e)&&e%2==0},isFinite:function(e){return op(e)&&isFinite(e)},isFunction:zv,isInteger:ip,isMatch:Vv,isNegative:function(e){return op(e)&&e<0},isNil:Tv,isNull:function(e){return null===e},isNumber:op,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:Bv,isObjectLike:Hv,isOdd:function(e){return op(e)&&e%2!=0},isPlainObject:Yv,isPositive:function(e){return op(e)&&e>0},isPrototype:pp,isRegExp:function(e){return Av(e,"RegExp")},isString:Qv,isType:Av,isUndefined:function(e){return void 0===e},keys:Rv,last:function(e){if(Pv(e))return e[e.length-1]},lowerCase:function(e){return dp(e).toLowerCase()},lowerFirst:function(e){var n=dp(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!Pv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];t.push(n(o,r))}return t},mapValues:function(e,n){void 0===n&&(n=Sp);var t={};return Bv(e)&&!Tv(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:Fv,maxBy:function(e,n){if(Lv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=zv(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:Mp,memoize:xp,min:Zv,minBy:function(e,n){if(Lv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=zv(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:yp,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=rp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,rp[e]=n}return n},omit:function(e,n){return Kv(e,(function(e,t,r){return n.includes(r)||(e[r]=t),e}),{})},parseRadius:function(e){var n=0,t=0,r=0,o=0;return Lv(e)?1===e.length?n=t=r=o=e[0]:2===e.length?(n=r=e[0],t=o=e[1]):3===e.length?(n=e[0],t=o=e[1],r=e[2]):(n=e[0],t=e[1],r=e[2],o=e[3]):n=t=r=o=e,{r1:n,r2:t,r3:r,r4:o}},pick:function(e,n){if(null===e||!Yv(e))return{};var t={};return Dv(n,(function(n){kp.call(e,n)&&(t[n]=e[n])})),t},pull:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r++)for(var o=n[r],i=-1;(i=Gv.call(e,o))>-1;)Wv.call(e,i,1);return e},pullAt:$v,reduce:Kv,remove:function(e,n){var t=[];if(!Pv(e))return t;for(var r=-1,o=[],i=e.length;++r<i;){var a=e[r];n(a,r,e)&&(t.push(a),o.push(r))}return $v(e,o),t},requestAnimationFrame:function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)})(e)},set:function(e,n,t){var r=e,o=Qv(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(Bv(r[e])||(r[e]=op(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return Tv(e)?0:Pv(e)?e.length:Object.keys(e).length},some:function(e,n){for(var t=0;t<e.length;t++)if(n(e[t],t))return!0;return!1},sortBy:function(e,n){var t;if(zv(n))t=function(e,t){return n(e)-n(t)};else{var r=[];Qv(n)?r.push(n):Lv(n)&&(r=n),t=function(e,n){for(var t=0;t<r.length;t+=1){var o=r[t];if(e[o]>n[o])return 1;if(e[o]<n[o])return-1}return 0}}return e.sort(t),e},startsWith:function(e,n){return!(!Lv(e)&&!Qv(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},s=function(){var s=Date.now();u||!1!==t.leading||(u=s);var l=n-(s-u);return o=this,i=arguments,l<=0||l>n?(r&&(clearTimeout(r),r=null),u=s,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,l)),a};return s.cancel=function(){clearTimeout(r),u=0,r=o=i=null},s},toArray:function(e){return Pv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return ap*e},toInteger:up,toRadian:function(e){return cp*e},toString:dp,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Jv([].concat.apply([],e))},uniq:Jv,uniqueId:function(e){return Cp[e=e||"g"]?Cp[e]+=1:Cp[e]=1,e+Cp[e]},upperCase:function(e){return dp(e).toUpperCase()},upperFirst:function(e){var n=dp(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:lp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!Tv(i)){Lv(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),Op={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(Pp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},jp=Op,Ip={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||18},getVGap:function(e){return e.vgap||18},getChildren:function(e){return e.children},getHeight:function(e){return e.height||36},getWidth:function(e){var n=e.label||" ";return e.width||18*n.split("").length}};function Ap(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof Ap)return e;t.data=e;var r=n.getHGap(e),o=n.getVGap(e);return t.preH=n.getPreH(e),t.preV=n.getPreV(e),t.width=n.getWidth(e),t.height=n.getHeight(e),t.width+=t.preH,t.height+=t.preV,t.id=n.getId(e),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}jp.assign(Ap.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(e,n){var t=this;t.hgap+=e,t.vgap+=n,t.width+=2*e,t.height+=2*n},eachNode:function(e){for(var n,t=[this];n=t.shift();)e(n),t=n.children.concat(t)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var n,t=[this];n=t.shift();)e(n),t=t.concat(n.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(n){e.left=Math.min(e.left,n.x),e.top=Math.min(e.top,n.y),e.width=Math.max(e.width,n.x+n.width),e.height=Math.max(e.height,n.y+n.height)})),e},translate:function(e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.eachNode((function(t){t.x+=e,t.y+=n,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.x=e.x-2*(e.x-n.left)-e.width})),e.translate(n.width,0)},bottom2top:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.y=e.y-2*(e.y-n.top)-e.height})),e.translate(0,n.height)}});var zp=function(e,n,t){void 0===n&&(n={});var r,o=new Ap(e,n=jp.assign({},Ip,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var s=new Ap(a[c],n);r.children[c]=s,i.push(s),s.parent=r,s.depth=r.depth+1}}return o},Tp=zp,Lp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=Tp(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),Bp=Lp;function Dp(e,n,t,r){void 0===r&&(r=[]);var o=this;o.w=e||0,o.h=n||0,o.y=t||0,o.x=0,o.c=r||[],o.cs=r.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function Rp(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){Rp(e,n,t)}))}function Vp(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(Vp(e,n),t)})),t}function Hp(e,n){Rp(e,-Vp(e,n),n)}function Yp(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){Yp(e,n.children[r],t)}))}function Xp(e,n,t){void 0===t&&(t=0),n?(e.x=t,t+=e.width):(e.y=t,t+=e.height),e.children.forEach((function(e){Xp(e,n,t)}))}Dp.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(Dp.fromNode(e,n))})),n?new Dp(e.height,e.width,e.x,t):new Dp(e.width,e.height,e.y,t)};var Fp=zp,Zp=function(e,n){for(var t=Fp(e.data,n,!0),r=Fp(e.data,n,!0),o=e.children.length,i=Math.round(o/2),a=n.getSide||function(e,n){return n<i?"right":"left"},u=0;u<o;u++){var c=e.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(e){e.isRoot()||(e.side="left")})),r.eachNode((function(e){e.isRoot()||(e.side="right")})),{left:t,right:r}},Up=Zp,Wp=["LR","RL","TB","BT","H","V"],Gp=["LR","RL","H"],qp=Wp[0],$p=function(e,n,t){var r=n.direction||qp;if(n.isHorizontal=function(e){return Gp.indexOf(e)>-1}(r),r&&-1===Wp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Wp[0])t(e,n);else if(r===Wp[1])t(e,n),e.right2left();else if(r===Wp[2])t(e,n);else if(r===Wp[3])t(e,n),e.bottom2top();else if(r===Wp[4]||r===Wp[5]){var o=Up(e,n),i=o.left,a=o.right;t(i,n),t(a,n),n.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),e.x=i.x,e.y=a.y;var u=e.getBoundingBox();n.isHorizontal?u.top<0&&e.translate(0,-u.top):u.left<0&&e.translate(-u.left,0)}var c=n.fixedRoot;return void 0===c&&(c=!0),c&&e.translate(-(e.x+e.width/2+e.hgap),-(e.y+e.height/2+e.vgap)),e};function Kp(e,n){return Kp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Kp(e,n)}var Qp=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,s=e.c[n],l=s.mod;null!==r&&null!==s;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(l+s.prelim);d>0&&(l+=d,i(e,n,t.index,d));var f=c(r),h=c(s);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(s=a(s))&&(l+=s.mod)}!r&&s?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,s,l):r&&!s&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function s(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}Xp(e,t);var l=Dp.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=s(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=s(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(l),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(l,0),Yp(l,e,t),Hp(e,t),e},Jp=$p,eg=Op,ng=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Kp(n,t),r.prototype.execute=function(){return Jp(this.rootNode,this.options,Qp)},r}(Bp),tg={},rg=Op;function og(e,n){void 0===n&&(n=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=n}var ig={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function ag(e,n,t){t?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,r){ag(e,n.children[r],t)}))}function ug(e,n){return ug=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},ug(e,n)}var cg=function(e,n){void 0===n&&(n={}),n=rg.assign({},ig,n);var t,r=0,o=function e(n){if(!n)return null;n.width=0,n.depth&&n.depth>r&&(r=n.depth);var t=n.children,o=t.length,i=new og(n.height,[]);return t.forEach((function(n,t){var r=e(n);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=n,i.isLeaf=n.isLeaf(),i}(e);return function e(n){if(n.isLeaf||0===n.children.length)n.drawingDepth=r;else{var t=n.children.map((function(n){return e(n)})),o=Math.min.apply(null,t);n.drawingDepth=o-1}return n.drawingDepth}(o),function e(r){r.x=r.drawingDepth*n.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+n.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=n.subTreeSep)),t=r):(r.children.forEach((function(n){e(n)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),ag(o,e,n.isHorizontal),e},sg=$p,lg=Op,dg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,ug(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,sg(e.rootNode,e.options,cg)},r}(Bp),fg={},hg=Op;function vg(e,n){return vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},vg(e,n)}var pg=Bp,gg=function(e,n,t,r){var o=null;e.eachNode((function(e){!function(e,n,t,r,o){var i="function"==typeof t?t(e):t*e.depth;if(!r)try{if(e.id===e.parent.children[0].id)return e.x+=i,void(e.y=n?n.y:0)}catch(e){}if(e.x+=i,n){if(e.y=n.y+hg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+hg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},yg=Zp,mg=Op,xg=["LR","RL","H"],bg=xg[0],wg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,vg(n,t),r.prototype.execute=function(){var e=this.options,n=this.rootNode;e.isHorizontal=!0;var t=e.indent,r=void 0===t?20:t,o=e.dropCap,i=void 0===o||o,a=e.direction,u=void 0===a?bg:a,c=e.align;if(u&&-1===xg.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===xg[0])gg(n,r,i,c);else if(u===xg[1])gg(n,r,i,c),n.right2left();else if(u===xg[2]){var s=yg(n,e),l=s.left,d=s.right;gg(l,r,i,c),l.right2left(),gg(d,r,i,c);var f=l.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(pg),_g={},Eg=Op;function Sg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=Sg(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function kg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){kg(e)}));var r=n[0],o=n[t-1],i=o.y-r.y+o.height,a=0;if(n.forEach((function(e){a+=e.totalHeight})),i>e.height)e.y=r.y+i/2-e.height/2;else if(1!==n.length||e.height>a){var u=e.y+(e.height-i)/2-r.y;n.forEach((function(e){e.translate(0,u)}))}else e.y=(r.y+r.height/2+o.y+o.height/2)/2-e.height/2}}var Cg={getSubTreeSep:function(){return 0}};function Mg(e,n){return Mg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Mg(e,n)}var Ng=function(e,n){void 0===n&&(n={}),n=Eg.assign({},Cg,n),e.parent={x:0,width:0,height:0,y:0},e.BFTraverse((function(e){e.x=e.parent.x+e.parent.width})),e.parent=null,Sg(e,n),e.startY=0,e.y=e.totalHeight/2-e.height/2,e.eachNode((function(e){var n=e.children,t=n.length;if(t){var r=n[0];if(r.startY=e.startY+e._subTreeSep,1===t)r.y=e.y+e.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var o=1;o<t;o++){var i=n[o];i.startY=n[o-1].startY+n[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),kg(e)},Pg=$p,Og=Op,jg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Mg(n,t),r.prototype.execute=function(){return Pg(this.rootNode,this.options,Ng)},r}(Bp),Ig={};Vn({compactBox:function(e,n){return n=eg.assign({},tg,n),new ng(e,n).execute()},dendrogram:function(e,n){return n=lg.assign({},fg,n),new dg(e,n).execute()},indented:function(e,n){return n=mg.assign({},_g,n),new wg(e,n).execute()},mindmap:function(e,n){return n=Og.assign({},Ig,n),new jg(e,n).execute()}});var Ag={value:()=>{}};function zg(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Tg(r)}function Tg(e){this._=e}function Lg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Bg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Ag,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}Tg.prototype=zg.prototype={constructor:Tg,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=Bg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Bg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Lg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new Tg(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var Dg="http://www.w3.org/1999/xhtml",Rg={svg:"http://www.w3.org/2000/svg",xhtml:Dg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vg(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Rg.hasOwnProperty(n)?{space:Rg[n],local:e}:e}function Hg(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Dg&&n.documentElement.namespaceURI===Dg?n.createElement(e):n.createElementNS(t,e)}}function Yg(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xg(e){var n=Vg(e);return(n.local?Yg:Hg)(n)}function Fg(){}function Zg(e){return null==e?Fg:function(){return this.querySelector(e)}}function Ug(){return[]}function Wg(e){return null==e?Ug:function(){return this.querySelectorAll(e)}}function Gg(e){return function(){return this.matches(e)}}function qg(e){return function(n){return n.matches(e)}}var $g=Array.prototype.find;function Kg(){return this.firstElementChild}var Qg=Array.prototype.filter;function Jg(){return Array.from(this.children)}function ey(e){return new Array(e.length)}function ny(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function ty(e,n,t,r,o,i){for(var a,u=0,c=n.length,s=i.length;u<s;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new ny(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function ry(e,n,t,r,o,i,a){var u,c,s,l=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=s=a.call(c,c.__data__,u,n)+"",l.has(s)?o[u]=c:l.set(s,c));for(u=0;u<f;++u)s=a.call(e,i[u],u,i)+"",(c=l.get(s))?(r[u]=c,c.__data__=i[u],l.delete(s)):t[u]=new ny(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&l.get(h[u])===c&&(o[u]=c)}function oy(e){return e.__data__}function iy(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function ay(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function uy(e){return function(){this.removeAttribute(e)}}function cy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sy(e,n){return function(){this.setAttribute(e,n)}}function ly(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function dy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function fy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function hy(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vy(e){return function(){this.style.removeProperty(e)}}function py(e,n,t){return function(){this.style.setProperty(e,n,t)}}function gy(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function yy(e,n){return e.style.getPropertyValue(n)||hy(e).getComputedStyle(e,null).getPropertyValue(n)}function my(e){return function(){delete this[e]}}function xy(e,n){return function(){this[e]=n}}function by(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function wy(e){return e.trim().split(/^|\s+/)}function _y(e){return e.classList||new Ey(e)}function Ey(e){this._node=e,this._names=wy(e.getAttribute("class")||"")}function Sy(e,n){for(var t=_y(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function ky(e,n){for(var t=_y(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Cy(e){return function(){Sy(this,e)}}function My(e){return function(){ky(this,e)}}function Ny(e,n){return function(){(n.apply(this,arguments)?Sy:ky)(this,e)}}function Py(){this.textContent=""}function Oy(e){return function(){this.textContent=e}}function jy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Iy(){this.innerHTML=""}function Ay(e){return function(){this.innerHTML=e}}function zy(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Ty(){this.nextSibling&&this.parentNode.appendChild(this)}function Ly(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function By(){return null}function Dy(){var e=this.parentNode;e&&e.removeChild(this)}function Ry(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Vy(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Hy(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function Yy(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Xy(e,n,t){var r=hy(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function Fy(e,n){return function(){return Xy(this,e,n)}}function Zy(e,n){return function(){return Xy(this,e,n.apply(this,arguments))}}ny.prototype={constructor:ny,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Ey.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Uy=[null];function Wy(e,n){this._groups=e,this._parents=n}function Gy(){return new Wy([[document.documentElement]],Uy)}function qy(e){return"string"==typeof e?new Wy([[document.querySelector(e)]],[document.documentElement]):new Wy([[e]],Uy)}function $y(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Wy.prototype=Gy.prototype={constructor:Wy,select:function(e){"function"!=typeof e&&(e=Zg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,s=r[o]=new Array(c),l=0;l<c;++l)(i=u[l])&&(a=e.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),s[l]=a);return new Wy(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(n=e.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(e):Wg(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(e.call(a,a.__data__,s,u)),o.push(a));return new Wy(r,o)},selectChild:function(e){return this.select(null==e?Kg:function(e){return function(){return $g.call(this.children,e)}}("function"==typeof e?e:qg(e)))},selectChildren:function(e){return this.selectAll(null==e?Jg:function(e){return function(){return Qg.call(this.children,e)}}("function"==typeof e?e:qg(e)))},filter:function(e){"function"!=typeof e&&(e=Gg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Wy(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,oy);var t,r=n?ry:ty,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),s=new Array(a),l=0;l<a;++l){var d=o[l],f=i[l],h=f.length,v=iy(e.call(d,d&&d.__data__,l,o)),p=v.length,g=c[l]=new Array(p),y=u[l]=new Array(p);r(d,f,g,y,s[l]=new Array(h),v,n);for(var m,x,b=0,w=0;b<p;++b)if(m=g[b]){for(b>=w&&(w=b+1);!(x=y[w])&&++w<p;);m._next=x||null}}return(u=new Wy(u,o))._enter=c,u._exit=s,u},enter:function(){return new Wy(this._enter||this._groups.map(ey),this._parents)},exit:function(){return new Wy(this._exit||this._groups.map(ey),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var s,l=t[c],d=r[c],f=l.length,h=u[c]=new Array(f),v=0;v<f;++v)(s=l[v]||d[v])&&(h[v]=s);for(;c<o;++c)u[c]=t[c];return new Wy(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=ay);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,s=o[i]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new Wy(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Vg(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?cy:uy:"function"==typeof n?t.local?fy:dy:t.local?ly:sy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?vy:"function"==typeof n?gy:py)(e,n,null==t?"":t)):yy(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?my:"function"==typeof n?by:xy)(e,n)):this.node()[e]},classed:function(e,n){var t=wy(e+"");if(arguments.length<2){for(var r=_y(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Ny:n?Cy:My)(t,n))},text:function(e){return arguments.length?this.each(null==e?Py:("function"==typeof e?jy:Oy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Iy:("function"==typeof e?zy:Ay)(e)):this.node().innerHTML},raise:function(){return this.each(Ty)},lower:function(){return this.each(Ly)},append:function(e){var n="function"==typeof e?e:Xg(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Xg(e),r=null==n?By:"function"==typeof n?n:Zg(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Dy)},clone:function(e){return this.select(e?Vy:Ry)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?Yy:Hy,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?Zy:Fy)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Ky={passive:!1},Qy={capture:!0,passive:!1};function Jy(e){e.stopImmediatePropagation()}function em(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var n=e.document.documentElement,t=qy(e).on("dragstart.drag",em,Qy);"onselectstart"in n?t.on("selectstart.drag",em,Qy):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function tm(e,n){var t=e.document.documentElement,r=qy(e).on("dragstart.drag",null);n&&(r.on("click.drag",em,Qy),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var rm=e=>()=>e;function om(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:s,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:l}})}function im(e){return!e.ctrlKey&&!e.button}function am(){return this.parentNode}function um(e,n){return null==n?{x:e.x,y:e.y}:n}function cm(){return navigator.maxTouchPoints||"ontouchstart"in this}function sm(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=lm(e),c=u.x,s=u.y,l=Ev({x:c,y:s},a),d=i?_v(l,r):l,f=d.x,h=d.y;return z({xSnapped:f,ySnapped:h},l)}om.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};exports.ConnectionMode=void 0,exports.PanOnScrollMode=void 0,exports.SelectionMode=void 0,exports.ConnectionLineType=void 0,exports.MarkerType=void 0,exports.Position=void 0;var lm=function(e,n){var t,r,o,i,a=function(e){return"clientX"in e}(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}};function dm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function fm(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function hm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-fm(t-o,a),r];case exports.Position.Right:return[t+fm(o-t,a),r];case exports.Position.Top:return[t,r-fm(r-i,a)];case exports.Position.Bottom:return[t,r+fm(i-r,a)]}}function vm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.curvature,l=void 0===s?.25:s,d=L(hm({pos:o,x1:n,y1:t,x2:i,y2:a,c:l}),2),f=d[0],h=d[1],v=L(hm({pos:c,x1:i,y1:a,x2:n,y2:t,c:l}),2),p=v[0],g=v[1],y=L(dm({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],x=y[1],b=y[2],w=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,x,b,w]}function pm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(exports.ConnectionMode||(exports.ConnectionMode={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(exports.PanOnScrollMode||(exports.PanOnScrollMode={})),function(e){e.Partial="partial",e.Full="full"}(exports.SelectionMode||(exports.SelectionMode={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(exports.ConnectionLineType||(exports.ConnectionLineType={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(exports.MarkerType||(exports.MarkerType={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(exports.Position||(exports.Position={}));var gm,ym=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var mm=((gm={})[exports.Position.Left]={x:-1,y:0},gm[exports.Position.Right]={x:1,y:0},gm[exports.Position.Top]={x:0,y:-1},gm[exports.Position.Bottom]={x:0,y:1},gm),xm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function bm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.borderRadius,l=void 0===s?5:s,d=e.centerX,f=e.centerY,h=e.offset,v=L(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?exports.Position.Bottom:a,c=e.target,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.center,f=e.offset,h=mm[u],v=mm[l],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",x=y[m],b=[],w={x:0,y:0},_={x:0,y:0},E=L(pm({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],C=E[2],M=E[3];if(h[m]*v[m]==-1){r=null!==(n=d.x)&&void 0!==n?n:S,o=null!==(t=d.y)&&void 0!==t?t:k;var N=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===x?"x"===m?N:P:"x"===m?P:N}else{var O=[{x:p.x,y:g.y}],j=[{x:g.x,y:p.y}];if(b="x"===m?h.x===x?j:O:h.y===x?O:j,u===l){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===x?w[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==l){var z="x"===m?"y":"x",T=h[m]===v[z],D=p[z]>g[z],R=p[z]<g[z];(1===h[m]&&(!T&&D||T&&R)||1!==h[m]&&(!T&&R||T&&D))&&(b="x"===m?O:j)}var V={x:p.x+w.x,y:p.y+w.y},H={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(V.x-b[0].x),Math.abs(H.x-b[0].x))>=Math.max(Math.abs(V.y-b[0].y),Math.abs(H.y-b[0].y))?(r=(V.x+H.x)/2,o=b[0].y):(r=b[0].x,o=(V.y+H.y)/2)}return[B(B([i,{x:p.x+w.x,y:p.y+w.y}],L(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,C,M]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],x=v[4],b=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(xm(e,n)/2,xm(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(p[t-1],n,p[t+1],l):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[b,g,y,m,x]}function wm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||wm(t,n))}function _m(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function Em(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var s=T(a),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(z(z({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[z(z({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Sm(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,s=!1,l={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function x(e,n){var r,i,u=e.x,s=e.y,l=t(),d=l.nodeLookup,f=l.nodeExtent,h=l.snapGrid,v=l.snapToGrid,p=l.nodeOrigin,g=l.onNodeDrag,y=l.onSelectionDrag,x=l.onError,b=l.updateNodePositions;a={x:u,y:s};var w=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=fv(c,{nodeOrigin:p});_=xv(E)}try{for(var S=T(c),k=S.next();!k.done;k=S.next()){var C=L(k.value,2),M=C[0],N=C[1],P={x:u-N.distance.x,y:s-N.distance.y};v&&(P=_v(P,h));var O=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!N.extent){var j=N.internals.positionAbsolute,I=j.x-_.x+f[0][0],A=j.x+N.measured.width-_.x2+f[1][0];O=[[I,j.y-_.y+f[0][1]],[A,j.y+N.measured.height-_.y2+f[1][1]]]}var z=hv({nodeId:M,nextPosition:P,nodeLookup:d,nodeExtent:O,nodeOrigin:p,onError:x}),B=z.position,D=z.positionAbsolute;w=w||N.position.x!==B.x||N.position.y!==B.y,N.position=B,N.internals.positionAbsolute=D}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(w&&(b(c,!0),n&&(o||g||!m&&y))){var R=L(Em({nodeId:m,dragItems:c,nodeLookup:d}),2),V=R[0],H=R[1];null==o||o(n,c,V,H),null==g||g(n,V,H),m||null==y||y(n,H)}}function b(){var e,n;if(d){var r=L(yv(l,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),s=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/s[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/s[2],f({x:o,y:i})&&x(a,null)}u=requestAnimationFrame(b)}}function w(e){var o,i=t(),u=i.nodeLookup,s=i.multiSelectionActive,l=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,x=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||s||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==n||n(m));var w=sm(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=w,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var s=T(e),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!wm(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c}(u,l,w,m),c.size>0&&(r||g||!m&&x)){var _=L(Em({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==x||x(e.sourceEvent,S)}}h=qy(g);var _=function(){var e,n,t,r,o=im,i=am,a=um,u=cm,c={},s=zg("start","drag","end"),l=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Ky).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=x(this,i.call(this,a,u),a,u,"mouse");c&&(qy(a.view).on("mousemove.drag",v,Qy).on("mouseup.drag",p,Qy),nm(a.view),Jy(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(em(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){qy(e.view).on("mousemove.drag mouseup.drag",null),tm(e.view,t),em(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=x(this,u,e,n,a[t].identifier,a[t]))&&(Jy(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(em(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(Jy(e),t("end",e,o[n]))}function x(e,n,t,r,o,i){var u,d,h,v=s.copy(),p=$y(i||t,n);if(null!=(h=a.call(e,new om("beforestart",{sourceEvent:t,target:f,identifier:o,active:l,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,s){var g,y=p;switch(i){case"start":c[o]=t,g=l++;break;case"end":delete c[o],--l;case"drag":p=$y(s||a,n),g=l}v.call(i,e,new om(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:rm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:rm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:rm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:rm(!!e),f):u},f.on=function(){var e=s.on.apply(s,arguments);return e===s?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&w(e);var s=sm(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=s,d=(null==r?void 0:r.getBoundingClientRect())||null,l=lm(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=sm(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!s&&i&&f&&(s=!0,b()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(l=lm(e.sourceEvent,d),x(g,e.sourceEvent))})).on("end",(function(e){if(f&&(s=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,l=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&l){var d=L(Em({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==l||l(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!_m(n,".".concat(v),g))&&(!p||_m(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function km(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function Cm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Mm=function(){return!0},Nm=null;function Pm(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,s=n.flowId,l=n.isValidConnection,d=void 0===l?Mm:l,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(s,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=lm(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,x={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Cm(void 0,m),w=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!w)return x;var k={source:f?w:o,sourceHandle:f?_:i,target:f?o:w,targetHandle:f?i:_};x.connection=k,E&&S&&(r===exports.ConnectionMode.Strict?f&&"source"===b||!f&&"target"===b:w!==o||_!==i)&&(x.endHandle={nodeId:w,handleId:_,type:b},x.isValid=d(k))}return x}var Om={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,s=n.domNode,l=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,x=n.isValidConnection,b=void 0===x?Mm:x,w=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),C=0,M=lm(e),N=M.x,P=M.y,O=null==k?void 0:k.elementFromPoint(N,P),j=Cm(u,O),I=null==s?void 0:s.getBoundingClientRect();if(I&&j){var A=lm(e,I),z=!1,D=null,R=!1,V=null,H=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=T(r),s=c.next();!s.done;s=c.next()){var l=L(s.value,2)[1];if(l.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=km(l,l.internals.handleBounds,"source",d),h=km(l,l.internals.handleBounds,"target",d);u.push.apply(u,B(B([],L(f),!1),L(h),!1))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:l,nodeId:a,handleId:i,handleType:j});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Nm={nodeId:a,handleId:i,type:j},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:j}),k.addEventListener("mousemove",X),k.addEventListener("mouseup",F),k.addEventListener("touchmove",X),k.addEventListener("touchend",F)}function Y(){if(f&&I){var e=L(yv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),C=requestAnimationFrame(Y)}}function X(e){S()||F(e);var n=E();A=lm(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=T(t),c=u.next();!c.done;c=u.next()){var s=c.value,l=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));l<=n&&(l<a?i=[s]:l===a&&i.push(s),a=l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(Ev(A,n,!1,[1,1]),o,H),z||(Y(),z=!0);var u,s,l,f=Pm(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});V=f.handleDomNode,D=f.connection,R=f.isValid,_({connectionStartHandle:Nm,connectionPosition:t&&R?Sv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,s=R,l=null,s?l="valid":u&&!s&&(l="invalid"),l),connectionEndHandle:f.endHandle})}function F(e){(t||V)&&D&&R&&(null==y||y(D)),null==m||m(e),u&&(null==w||w(e)),p(),cancelAnimationFrame(C),z=!1,R=!1,D=null,V=null,Nm=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",F),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",F)}},isValid:Pm};function jm(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Im(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Am(){}var zm=.7,Tm=1/zm,Lm="\\s*([+-]?\\d+)\\s*",Bm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rm=/^#([0-9a-f]{3,8})$/,Vm=new RegExp(`^rgb\\(${Lm},${Lm},${Lm}\\)$`),Hm=new RegExp(`^rgb\\(${Dm},${Dm},${Dm}\\)$`),Ym=new RegExp(`^rgba\\(${Lm},${Lm},${Lm},${Bm}\\)$`),Xm=new RegExp(`^rgba\\(${Dm},${Dm},${Dm},${Bm}\\)$`),Fm=new RegExp(`^hsl\\(${Bm},${Dm},${Dm}\\)$`),Zm=new RegExp(`^hsla\\(${Bm},${Dm},${Dm},${Bm}\\)$`),Um={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Wm(){return this.rgb().formatHex()}function Gm(){return this.rgb().formatRgb()}function qm(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=Rm.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?$m(n):3===t?new Jm(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Km(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Km(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Vm.exec(e))?new Jm(n[1],n[2],n[3],1):(n=Hm.exec(e))?new Jm(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ym.exec(e))?Km(n[1],n[2],n[3],n[4]):(n=Xm.exec(e))?Km(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Fm.exec(e))?ix(n[1],n[2]/100,n[3]/100,1):(n=Zm.exec(e))?ix(n[1],n[2]/100,n[3]/100,n[4]):Um.hasOwnProperty(e)?$m(Um[e]):"transparent"===e?new Jm(NaN,NaN,NaN,0):null}function $m(e){return new Jm(e>>16&255,e>>8&255,255&e,1)}function Km(e,n,t,r){return r<=0&&(e=n=t=NaN),new Jm(e,n,t,r)}function Qm(e,n,t,r){return 1===arguments.length?((o=e)instanceof Am||(o=qm(o)),o?new Jm((o=o.rgb()).r,o.g,o.b,o.opacity):new Jm):new Jm(e,n,t,null==r?1:r);var o}function Jm(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function ex(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}`}function nx(){const e=tx(this.opacity);return`${1===e?"rgb(":"rgba("}${rx(this.r)}, ${rx(this.g)}, ${rx(this.b)}${1===e?")":`, ${e})`}`}function tx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rx(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ox(e){return((e=rx(e))<16?"0":"")+e.toString(16)}function ix(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new ux(e,n,t,r)}function ax(e){if(e instanceof ux)return new ux(e.h,e.s,e.l,e.opacity);if(e instanceof Am||(e=qm(e)),!e)return new ux;if(e instanceof ux)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new ux(a,u,c,e.opacity)}function ux(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function cx(e){return(e=(e||0)%360)<0?e+360:e}function sx(e){return Math.max(0,Math.min(1,e||0))}function lx(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}jm(Am,qm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wm,formatHex:Wm,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ax(this).formatHsl()},formatRgb:Gm,toString:Gm}),jm(Jm,Qm,Im(Am,{brighter(e){return e=null==e?Tm:Math.pow(Tm,e),new Jm(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?zm:Math.pow(zm,e),new Jm(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Jm(rx(this.r),rx(this.g),rx(this.b),tx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ex,formatHex:ex,formatHex8:function(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}${ox(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:nx,toString:nx})),jm(ux,(function(e,n,t,r){return 1===arguments.length?ax(e):new ux(e,n,t,null==r?1:r)}),Im(Am,{brighter(e){return e=null==e?Tm:Math.pow(Tm,e),new ux(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?zm:Math.pow(zm,e),new ux(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new Jm(lx(e>=240?e-240:e+120,o,r),lx(e,o,r),lx(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ux(cx(this.h),sx(this.s),sx(this.l),tx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=tx(this.opacity);return`${1===e?"hsl(":"hsla("}${cx(this.h)}, ${100*sx(this.s)}%, ${100*sx(this.l)}%${1===e?")":`, ${e})`}`}}));var dx=e=>()=>e;function fx(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):dx(isNaN(e)?n:e)}var hx=function e(n){var t=function(e){return 1==(e=+e)?fx:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):dx(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=Qm(e)).r,(n=Qm(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=fx(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function vx(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var px=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gx=new RegExp(px.source,"g");function yx(e,n){var t,r,o,i=px.lastIndex=gx.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=px.exec(e))&&(r=gx.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:vx(t,r)})),i=gx.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var mx,xx=180/Math.PI,bx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wx(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*xx,skewX:Math.atan(c)*xx,scaleX:a,scaleY:u}}function _x(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:vx(e,o)},{i:c-2,x:vx(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:vx(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:vx(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:vx(e,t)},{i:u-2,x:vx(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var Ex=_x((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?bx:wx(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Sx=_x((function(e){return null==e?bx:(mx||(mx=document.createElementNS("http://www.w3.org/2000/svg","g")),mx.setAttribute("transform",e),(e=mx.transform.baseVal.consolidate())?wx((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):bx)}),", ",")",")");function kx(e){return((e=Math.exp(e))+1/e)/2}var Cx,Mx,Nx=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],s=e[2],l=o[0],d=o[1],f=o[2],h=l-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/s)/n,i=function(e){return[u+e*h,c+e*v,s*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-s*s+r*p)/(2*s*t*g),m=(f*f-s*s-r*p)/(2*f*t*g),x=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-x)/n,i=function(e){var r,o=e*a,i=kx(x),l=s/(t*g)*(i*(r=n*o+x,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[u+l*h,c+l*v,s*i/kx(n*o+x)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),Px=0,Ox=0,jx=0,Ix=1e3,Ax=0,zx=0,Tx=0,Lx="object"==typeof performance&&performance.now?performance:Date,Bx="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Dx(){return zx||(Bx(Rx),zx=Lx.now()+Tx)}function Rx(){zx=0}function Vx(){this._call=this._time=this._next=null}function Hx(e,n,t){var r=new Vx;return r.restart(e,n,t),r}function Yx(){zx=(Ax=Lx.now())+Tx,Px=Ox=0;try{!function(){Dx(),++Px;for(var e,n=Cx;n;)(e=zx-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Px}()}finally{Px=0,function(){for(var e,n,t=Cx,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Cx=n);Mx=e,Fx(r)}(),zx=0}}function Xx(){var e=Lx.now(),n=e-Ax;n>Ix&&(Tx-=n,Ax=e)}function Fx(e){Px||(Ox&&(Ox=clearTimeout(Ox)),e-zx>24?(e<1/0&&(Ox=setTimeout(Yx,e-Lx.now()-Tx)),jx&&(jx=clearInterval(jx))):(jx||(Ax=Lx.now(),jx=setInterval(Xx,Ix)),Px=1,Bx(Yx)))}function Zx(e,n,t){var r=new Vx;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}Vx.prototype=Hx.prototype={constructor:Vx,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?Dx():+t)+(null==n?0:+n),this._next||Mx===this||(Mx?Mx._next=this:Cx=this,Mx=this),this._call=e,this._time=t,Fx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Fx())}};var Ux=zg("start","end","cancel","interrupt"),Wx=[],Gx=0,qx=2,$x=3,Kx=5,Qx=6;function Jx(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var s,l,d,f;if(1!==t.state)return u();for(s in o)if((f=o[s]).name===t.name){if(f.state===$x)return Zx(i);4===f.state?(f.state=Qx,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[s]):+s<n&&(f.state=Qx,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[s])}if(Zx((function(){t.state===$x&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=qx,t.on.call("start",e,e.__data__,t.index,t.group),t.state===qx){for(t.state=$x,r=new Array(d=t.tween.length),s=0,l=-1;s<d;++s)(f=t.tween[s].value.call(e,e.__data__,t.index,t.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=Kx,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Kx&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=Qx,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=Hx((function(e){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=e&&i(e-t.delay)}),0,t.time)}(e,t,{name:n,index:r,group:o,on:Ux,tween:Wx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Gx})}function eb(e,n){var t=tb(e,n);if(t.state>Gx)throw new Error("too late; already scheduled");return t}function nb(e,n){var t=tb(e,n);if(t.state>$x)throw new Error("too late; already running");return t}function tb(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function rb(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>qx&&t.state<Kx,t.state=Qx,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function ob(e,n){var t,r;return function(){var o=nb(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function ib(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=nb(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,s=o.length;c<s;++c)if(o[c].name===n){o[c]=u;break}c===s&&o.push(u)}i.tween=o}}function ab(e,n,t){var r=e._id;return e.each((function(){var e=nb(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return tb(e,r).value[n]}}function ub(e,n){var t;return("number"==typeof n?vx:n instanceof qm?hx:(t=qm(n))?(n=t,hx):yx)(e,n)}function cb(e){return function(){this.removeAttribute(e)}}function sb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function db(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function fb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function hb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function vb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function pb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function gb(e,n){return function(){eb(this,e).delay=+n.apply(this,arguments)}}function yb(e,n){return n=+n,function(){eb(this,e).delay=n}}function mb(e,n){return function(){nb(this,e).duration=+n.apply(this,arguments)}}function xb(e,n){return n=+n,function(){nb(this,e).duration=n}}var bb=Gy.prototype.constructor;function wb(e){return function(){this.style.removeProperty(e)}}var _b=0;function Eb(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Sb(){return++_b}var kb=Gy.prototype;Eb.prototype={constructor:Eb,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Zg(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],l=s.length,d=i[a]=new Array(l),f=0;f<l;++f)(u=s[f])&&(c=e.call(u,u.__data__,f,s))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Jx(d[f],n,t,f,d,tb(u,t)));return new Eb(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Wg(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,s=r[u],l=s.length,d=0;d<l;++d)if(c=s[d]){for(var f,h=e.call(c,c.__data__,d,s),v=tb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Jx(f,n,t,p,h,v);i.push(h),a.push(c)}return new Eb(i,a,n,t)},selectChild:kb.selectChild,selectChildren:kb.selectChildren,filter:function(e){"function"!=typeof e&&(e=Gg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Eb(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,s=n[u],l=t[u],d=s.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=s[h]||l[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Eb(a,this._parents,this._name,this._id)},selection:function(){return new bb(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=Sb(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=tb(a,n);Jx(a,e,t,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Eb(r,this._parents,e,t)},call:kb.call,nodes:kb.nodes,node:kb.node,size:kb.size,empty:kb.empty,each:kb.each,on:function(e,n){var t=this._id;return arguments.length<2?tb(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?eb:nb;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Vg(e),r="transform"===t?Sx:ub;return this.attrTween(e,"function"==typeof n?(t.local?hb:fb)(t,r,ab(this,"attr."+e,n)):null==n?(t.local?sb:cb)(t):(t.local?db:lb)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Vg(e);return this.tween(t,(r.local?vb:pb)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Ex:ub;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=yy(this,e),a=(this.style.removeProperty(e),yy(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,wb(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=yy(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=yy(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,ab(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=nb(this,e),s=c.on,l=null==c.value[a]?i||(i=wb(n)):void 0;s===t&&o===l||(r=(t=s).copy()).on(u,o=l),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=yy(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(ab(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=tb(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?ob:ib)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?gb:yb)(n,e)):tb(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?mb:xb)(n,e)):tb(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){nb(this,e).ease=n}}(n,e)):tb(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;nb(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=nb(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:kb[Symbol.iterator]};var Cb={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Mb(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Gy.prototype.interrupt=function(e){return this.each((function(){rb(this,e)}))},Gy.prototype.transition=function(e){var n,t;e instanceof Eb?(n=e._id,e=e._name):(n=Sb(),(t=Cb).time=Dx(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)(a=u[s])&&Jx(a,e,n,s,u,t||Mb(a,n));return new Eb(r,this._parents,e,n)};var Nb=e=>()=>e;function Pb(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ob(e,n,t){this.k=e,this.x=n,this.y=t}Ob.prototype={constructor:Ob,scale:function(e){return 1===e?this:new Ob(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new Ob(this.k,this.x+this.k*e,this.y+this.k*n)},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 jb=new Ob(1,0,0);function Ib(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jb;return e.__zoom}function Ab(e){e.stopImmediatePropagation()}function zb(e){e.preventDefault(),e.stopImmediatePropagation()}function Tb(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Lb(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Bb(){return this.__zoom||jb}function Db(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Rb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vb(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}Ib.prototype=Ob.prototype;var Hb,Yb=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Xb=function(e){return{x:e.x,y:e.y,zoom:e.k}},Fb=function(e){var n=e.x,t=e.y,r=e.zoom;return jb.translate(n,t).scale(r)},Zb=function(e,n){return e.target.closest(".".concat(n))},Ub=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Wb=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Gb=function(e){var n=e.ctrlKey&&kv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function qb(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,s=e.onTransformChange,l=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=Tb,o=Lb,i=Vb,a=Db,u=Rb,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Nx,f=zg("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",Bb).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(u).on("touchstart.zoom",M).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new Ob(n,e.x,e.y)}function x(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new Ob(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),l=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=s/n[2];e=new Ob(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),l=$y(e);if(t.wheel)t.mouse[0][0]===l[0]&&t.mouse[0][1]===l[1]||(t.mouse[1]=o.invert(t.mouse[0]=l)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[l,o.invert(l)],rb(this),t.start()}zb(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(x(m(o,u),t.mouse[0],t.mouse[1]),t.extent,s))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=qy(e.view).on("mousemove.zoom",(function(e){if(zb(e),!a.moved){var n=e.clientX-l,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=$y(e,o),a.mouse[1]),a.extent,s))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),tm(e.view,a.moved),zb(e),a.event(e).end()}),!0),c=$y(e,o),l=e.clientX,d=e.clientY;nm(e.view),Ab(e),a.mouse=[c,this.__zoom.invert(c)],rb(this),a.start()}}function C(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=$y(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(x(m(t,c),a,u),o.apply(this,n),s);zb(e),l>0?qy(this).transition().duration(l).call(w,d,a,e):qy(this).call(y.transform,d,a,e)}}function M(t,...o){if(r.apply(this,arguments)){var i,a,u,c,s=t.touches,l=s.length,d=_(this,o,t.changedTouches.length===l).event(t);for(Ab(t),a=0;a<l;++a)c=[c=$y(u=s[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),rb(this),d.start())}}function N(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,l=c.length;for(zb(e),t=0;t<l;++t)o=$y(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(x(r,o,a),u.extent,s))}}function P(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(Ab(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=$y(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var s=qy(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",Bb),e!==o?w(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(x(m(r,c),a,u),e,s)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),s)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(jb.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,s)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=qy(this.that).datum();f.call(e,this.that,new Pb(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Nb(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:Nb(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Nb(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:Nb([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(l=+e,y):l},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=qy(n).call(h);x({x:i.x,y:i.y,zoom:vv(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(Wb(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function x(e,n,t){var r=Fb(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Gb),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,x=e.panOnScrollSpeed,b=e.preventScrolling,w=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var C=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||Zb(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,s=e.onPanZoom,l=e.onPanZoomEnd;return function(e){if(Zb(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=$y(e),h=Gb(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===exports.PanOnScrollMode.Vertical?0:e.deltaX*p,y=i===exports.PanOnScrollMode.Horizontal?0:e.deltaY*p;!kv()&&e.shiftKey&&i!==exports.PanOnScrollMode.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Xb(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==s||s(e,m),n.panScrollTimeout=setTimeout((function(){null==l||l(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:x,zoomOnPinch:w,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",C,{passive:!1}),!o){var M=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=Xb(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:u});h.on("start",M);var N=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!Ub(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,Xb(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:s});h.on("zoom",N);var P=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&Ub(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Yb(n.prevViewport,e.transform))){var s=Xb(e.transform);n.prevViewport=s,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,s)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:l});h.on("end",P)}var O=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,s=e.noPanClassName,l=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(Zb(e,"".concat(l,"-flow__node"))||Zb(e,"".concat(l,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(Zb(e,c)&&"wheel"===e.type)return!1;if(Zb(e,s)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:w,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(O),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Fb(e);return y(t,n),t},setViewportConstrained:x,getViewport:function(){var e=v?Ib(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(Wb(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Wb(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=Fb(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}!function(e){e.Line="line",e.Handle="handle"}(Hb||(Hb={}));z(z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var $b=uv.error001();function Kb(n,t){var r=e.useContext(I);if(null===r)throw new Error($b);return O(r,n,t)}function Qb(){var n=e.useContext(I);if(null===n)throw new Error($b);return e.useMemo((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function Jb(e,n){var r,o,i;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var s=a(e),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=d.parentId;if(f){if(!e.has(f))throw new Error("Parent node ".concat(f," not found"));var h=e.get(f),v=ew(d,e,t(t({},d.position),{z:(cw(d.zIndex)?d.zIndex:0)+(d.selected?c:0)}),null!==(i=null==h?void 0:h.origin)&&void 0!==i?i:n.nodeOrigin),p=v.x,g=v.y,y=v.z,m=d.internals.positionAbsolute,x=p!==m.x||g!==m.y;(x||y!==d.internals.z)&&(d.internals=t(t({},d.internals),{positionAbsolute:x?{x:p,y:g}:m,z:y}))}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function ew(e,n,t,r){var o,i,a,u,c,s;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var l=n.get(e.parentId),d=nw(l,r).position;return ew(l,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=l.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=l.internals.z)&&void 0!==c?c:0:null!==(s=t.z)&&void 0!==s?s:0},l.origin||r)}var nw=function(e,n){void 0===n&&(n=[0,0]);var t=uw(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function tw(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=a(t),u=i.next();!u.done;u=i.next()){var c=u.value,s=c.source,l=c.target,d=c.sourceHandle,f=void 0===d?null:d,h=c.targetHandle,v=void 0===h?null:h,p="".concat(s,"-source-").concat(f),g="".concat(l,"-target-").concat(v),y=e.get(p)||new Map,m=e.get(g)||new Map,x={edgeId:c.id,source:s,target:l,sourceHandle:f,targetHandle:v};n.set(c.id,c),e.set(p,y.set("".concat(l,"-").concat(v),x)),e.set(g,m.set("".concat(s,"-").concat(f),x))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function rw(e,n,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(n);n.clear(),r.clear();var a=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var u,c,s=i.get(e.id);if(o.checkEquality&&e===(null==s?void 0:s.internals.userNode)||(s=t(t(t({},o.defaults),e),{measured:{width:null===(u=e.measured)||void 0===u?void 0:u.width,height:null===(c=e.measured)||void 0===c?void 0:c.height},internals:{positionAbsolute:e.position,handleBounds:null==s?void 0:s.internals.handleBounds,z:(cw(e.zIndex)?e.zIndex:0)+(e.selected?a:0),userNode:e}})),n.set(e.id,s),e.parentId){var l=r.get(e.parentId);l?l.push(s):r.set(e.parentId,[s])}})),r.size>0&&Jb(n,o)}function ow(e,n,t,r){var o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){var v=h.value,p=n.get(v.parentId);if(p){var g=null!==(c=null===(u=d.get(v.parentId))||void 0===u?void 0:u.expandedRect)&&void 0!==c?c:dw(p,null!==(s=p.origin)&&void 0!==s?s:r),y=pw(g,v.rect);d.set(v.parentId,{expandedRect:y,parent:p})}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}return d.size>0&&d.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=nw(i,i.origin).position,u=uw(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var iw=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},aw=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:iw(e.x,n[0][0],n[1][0]),y:iw(e.y,n[0][1],n[1][1])}};function uw(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var cw=function(e){return!isNaN(e)&&isFinite(e)},sw=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},lw=function(e,n,t,r){var o=e.x,i=e.y,a=u(n,3),c=a[0],s=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var d={x:(o-c)/l,y:(i-s)/l};return t?sw(d,r):d},dw=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=nw(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},fw=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},hw=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},vw=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},pw=function(e,n){return vw(fw(hw(e),hw(n)))};function gw(n){return e.forwardRef(n)}var yw=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},mw=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=iw(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}};function xw(e){return void 0!==e&&"parent"!==e}var bw=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},ww=function(e){return _w(e)},_w=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Ew=function(e){return cw(e.width)&&cw(e.height)&&cw(e.x)&&cw(e.y)},Sw=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},kw=["INPUT","SELECT","TEXTAREA"];function Cw(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return kw.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Mw=function(e){return"clientX"in e},Nw=function(e,n){var t,r,o,i,a=Mw(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},Pw=function(e,n,r,o){void 0===o&&(o=[0,0]);var i=n.querySelectorAll(e);if(!i||!i.length)return null;var a=Array.from(i),u=n.getBoundingClientRect(),c=u.width*o[0],s=u.height*o[1];return a.map((function(e){var n=e.getBoundingClientRect();return t({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-u.left-c)/r,y:(n.top-u.top-s)/r},Sw(e))}))},Ow="undefined"!=typeof document?document:null;function jw(n,t){void 0===n&&(n=null),void 0===t&&(t={target:Ow,actInsideInputWithModifier:!0});var r=u(e.useState(!1),2),o=r[0],i=r[1],a=e.useRef(!1),s=e.useRef(new Set([])),l=u(e.useMemo((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=e.reduce((function(e,n){return e.concat.apply(e,c([],u(n),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),d=l[0],f=l[1];return e.useEffect((function(){var e=(null==t?void 0:t.target)||Ow;if(null!==n){var r=function(e){if(a.current=e.ctrlKey||e.metaKey||e.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Cw(e))return!1;var n=Aw(e.code,f);s.current.add(e[n]),Iw(d,s.current,!1)&&(e.preventDefault(),i(!0))},o=function(e){if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Cw(e))return!1;var n=Aw(e.code,f);Iw(d,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},u=function(){s.current.clear(),i(!1)};return null==e||e.addEventListener("keydown",r),null==e||e.addEventListener("keyup",o),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),function(){null==e||e.removeEventListener("keydown",r),null==e||e.removeEventListener("keyup",o),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}}),[n,i]),o}function Iw(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function Aw(e,n){return n.includes(e)?"code":"key"}function zw(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var Tw={position:"absolute",width:"100%",height:"100%",top:0,left:0};var Lw=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function Bw(n){var t=n.onPaneContextMenu,r=n.zoomOnScroll,o=void 0===r||r,i=n.zoomOnPinch,a=void 0===i||i,u=n.panOnScroll,c=void 0!==u&&u,s=n.panOnScrollSpeed,l=void 0===s?.5:s,d=n.panOnScrollMode,f=void 0===d?exports.PanOnScrollMode.Free:d,h=n.zoomOnDoubleClick,p=void 0===h||h,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,x=n.translateExtent,b=n.minZoom,w=n.maxZoom,_=n.zoomActivationKeyCode,E=n.preventScrolling,S=void 0===E||E,k=n.children,C=n.noWheelClassName,M=n.noPanClassName,N=n.onViewportChange,P=n.isControlledViewport,O=Qb(),j=e.useRef(null),I=Kb(Lw,zw),A=I.userSelectionActive,z=I.lib,T=jw(_),L=e.useRef();return function(n){var t=Qb();e.useEffect((function(){var e=function(){var e,r;if(!n.current)return!1;var o=Sw(n.current);0!==o.height&&0!==o.width||null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"004",uv.error004()),t.setState({width:o.width||500,height:o.height||500})};if(n.current){e(),window.addEventListener("resize",e);var r=new ResizeObserver((function(){return e()}));return r.observe(n.current),function(){window.removeEventListener("resize",e),r&&n.current&&r.unobserve(n.current)}}}),[])}(j),e.useEffect((function(){if(j.current){L.current=qb({domNode:j.current,minZoom:b,maxZoom:w,translateExtent:x,viewport:m,onTransformChange:function(e){null==N||N({x:e[0],y:e[1],zoom:e[2]}),P||O.setState({transform:e})},onDraggingChange:function(e){return O.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=O.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=O.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=O.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var e=L.current.getViewport(),n=e.x,t=e.y,r=e.zoom;return O.setState({panZoom:L.current,transform:[n,t,r],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=L.current)||void 0===e||e.destroy()}}}),[]),e.useEffect((function(){var e;null===(e=L.current)||void 0===e||e.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:a,panOnScroll:c,panOnScrollSpeed:l,panOnScrollMode:f,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:T,preventScrolling:S,noPanClassName:M,userSelectionActive:A,noWheelClassName:C,lib:z})}),[t,o,a,c,l,f,p,y,T,S,M,A,C,z]),v.jsx("div",{className:"ink-flow__renderer",ref:j,style:Tw,children:k})}var Dw={actInsideInputWithModifier:!1};function Rw(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function Vw(e,n){var r,o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)d.set(_.id,[_]);else{var v=d.get(_.id);v?v.push(_):d.set(_.id,[_])}else l.push(_.item)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var p=a(n),g=p.next();!g.done;g=p.next()){var y=g.value,m=d.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var x=t({},y);try{for(var b=(c=void 0,a(m)),w=b.next();!w.done;w=b.next()){var _;Rw(_=w.value,x)}}catch(e){c={error:e}}finally{try{w&&!w.done&&(s=b.return)&&s.call(b)}finally{if(c)throw c.error}}l.push(x)}else l.push(t({},m[0].item))}else l.push(y)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(i)throw i.error}}return l}function Hw(e,n){return Vw(e,n)}function Yw(e,n){return Vw(e,n)}function Xw(e,n){return{id:e,type:"select",selected:n}}function Fw(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=u(s.value,2),d=l[0],f=l[1],h=n.has(d);void 0===f.selected&&!h||f.selected===h||(t&&(f.selected=h),i.push(Xw(f.id,h)))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return i}function Zw(e){var n,t,r,o,i,c,s=e.items,l=void 0===s?[]:s,d=e.lookup,f=[],h=new Map(l.map((function(e){return[e.id,e]})));try{for(var v=a(l),p=v.next();!p.done;p=v.next()){var g=p.value,y=d.get(g.id),m=null!==(c=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&f.push({id:g.id,item:g,type:"replace"}),void 0===m&&f.push({item:g,type:"add"})}}catch(e){n={error:e}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(n)throw n.error}}try{for(var x=a(d),b=x.next();!b.done;b=x.next()){var w=u(b.value,1)[0];void 0===h.get(w)&&f.push({id:w,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}return f}function Uw(e){return{id:e.id,type:"remove"}}var Ww=function(e,n){void 0===n&&(n=[0,0]);var t=uw(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},Gw=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=nw(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return fw(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vw(t)},qw=function(e,n,r,o,i,c){var s,l,d,f,h,v,p,g,y=u(void 0===r?[0,0,1]:r,3),m=y[0],x=y[1],b=y[2];void 0===o&&(o=!1),void 0===i&&(i=!1),void 0===c&&(c=[0,0]);var w=t(t({},lw(n,[m,x,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=a(e),S=E.next();!S.done;S=E.next()){var k=u(S.value,2)[1],C=k.measured,M=k.selectable,N=void 0===M||M,P=k.hidden,O=void 0!==P&&P,j=null!==(h=null!==(f=null!==(d=C.width)&&void 0!==d?d:k.width)&&void 0!==f?f:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=C.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(i&&!N||O)){var A=yw(w,dw(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}return _},$w=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function Kw(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,s=e.minZoom,l=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=Gw(h,{nodeOrigin:f}),g=mw(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:s,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:l,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(g,{duration:null==n?void 0:n.duration}),!0}return!1}function Qw(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Ww(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&xw(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],b=f+p*m[1];h=[[x,b],[x+g-v,b+y-p]]}}else null==u||u("005",uv.error005());var w=xw(h)?aw(t,h):t;return{position:{x:w.x-d,y:w.y-f},positionAbsolute:w}}function Jw(e){return o(this,arguments,void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x,b,w,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,C=e.nodes,M=e.edges,N=e.onBeforeDelete;return i(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(o=a(C),u=o.next();!u.done;u=o.next())c=u.value,r(c)}catch(e){m={error:e}}finally{try{u&&!u.done&&(x=o.return)&&x.call(o)}finally{if(m)throw m.error}}s=new Set(k.map((function(e){return e.id}))),l=M.filter((function(e){return!1!==e.deletable})),d=$w(t,l),f=d,h=function(e){s.has(e.id)&&!f.find((function(n){return n.id===e.id}))&&f.push(e)};try{for(v=a(l),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(e){b={error:e}}finally{try{p&&!p.done&&(w=v.return)&&w.call(v)}finally{if(b)throw b.error}}return N?[4,N({nodes:t,edges:f})]:[2,{edges:f,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:f,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var e_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function n_(){var e=Kb(e_,zw),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?v.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var t_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},r_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function o_(n){var t=n.isSelecting;n.selectionMode;var r=n.panOnDrag,o=n.onSelectionStart,i=n.onSelectionEnd,c=n.onPaneClick,s=n.onPaneContextMenu,l=n.onPaneScroll,d=n.onPaneMouseEnter,f=n.onPaneMouseMove,h=n.onPaneMouseLeave,p=n.children,g=e.useRef(null),y=Qb(),m=e.useRef(0),b=e.useRef(0),w=e.useRef(),_=e.useRef(new Map),E=Kb(r_,zw),S=E.userSelectionActive,k=E.elementsSelectable,C=E.dragging,M=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,b.current=0},N=function(e){null==c||c(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=l?function(e){return l(e)}:void 0,O=k&&(t||S);return v.jsxs("div",{className:x(["ink-flow__pane",{draggable:r,dragging:C,selection:t}]),onClick:O?void 0:t_(N,g),onContextMenu:t_((function(e){Array.isArray(r)&&(null==r?void 0:r.includes(2))?e.preventDefault():null==s||s(e)}),g),onWheel:t_(P,g),onMouseEnter:O?void 0:d,onMouseDown:O?function(e){var n,r,i,c,s=y.getState(),l=s.resetSelectedElements,d=s.domNode,f=s.edgeLookup;if(w.current=null==d?void 0:d.getBoundingClientRect(),k&&t&&0===e.button&&e.target===g.current&&w.current){_.current=new Map;try{for(var h=a(f),v=h.next();!v.done;v=h.next()){var p=u(v.value,2),m=p[0],x=p[1];_.current.set(x.source,(null===(i=_.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),_.current.set(x.target,(null===(c=_.current.get(x.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var b=Nw(e.nativeEvent,w.current),E=b.x,S=b.y;l(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(e)}}:void 0,onMouseMove:O?function(e){var n,r,o,i,u=y.getState(),c=u.userSelectionRect,s=u.edgeLookup,l=u.transform,d=u.nodeOrigin,f=u.nodeLookup,h=u.triggerNodeChanges,v=u.triggerEdgeChanges;if(t&&w.current&&c){var p=Nw(e.nativeEvent,w.current),g=p.x,x=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:x<S?x:S,width:Math.abs(g-E),height:Math.abs(x-S)},C=qw(f,k,l,!1,!0,d),M=new Set,N=new Set;try{for(var P=a(C),O=P.next();!O.done;O=P.next()){var j=O.value;N.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,a(I)),z=A.next();!z.done;z=A.next()){var T=z.value;M.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}if(m.current!==N.size)m.current=N.size,h(Fw(f,N,!0));if(b.current!==M.size)b.current=M.size,v(Fw(s,M));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:f,onMouseUp:O?function(e){if(0===e.button){var n=y.getState().userSelectionRect;!S&&n&&e.target===g.current&&(null==N||N(e)),y.setState({nodesSelectionActive:m.current>0}),M(),null==i||i(e)}}:void 0,onMouseLeave:O?function(e){S&&(y.setState({nodesSelectionActive:m.current>0}),null==i||i(e)),M()}:h,ref:g,style:Tw,children:[p,v.jsx(n_,{})]})}var i_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function a_(n){var t=n.children,r=n.onPaneClick,o=n.onPaneMouseEnter,i=n.onPaneMouseMove,a=n.onPaneMouseLeave,u=n.onPaneContextMenu,c=n.onPaneScroll,s=n.deleteKeyCode,l=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,h=n.onSelectionStart,p=n.onSelectionEnd,g=n.multiSelectionKeyCode,y=n.panActivationKeyCode,m=n.zoomActivationKeyCode,x=n.elementsSelectable,b=n.zoomOnScroll,w=n.zoomOnPinch,_=n.panOnScroll,E=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,C=n.panOnDrag,M=n.defaultViewport,N=n.translateExtent,P=n.minZoom,O=n.maxZoom,j=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,L=Kb(i_);L.nodesSelectionActive;var B=L.userSelectionActive,D=jw(l),R=jw(y),V=R||C,H=R||_,Y=D||B||d&&!0!==V;return function(n){var t=n.deleteKeyCode,r=n.multiSelectionKeyCode,o=Qb(),i=jw(t,Dw),a=jw(r);e.useEffect((function(){if(i){var e=o.getState();e.edges,e.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),e.useEffect((function(){o.setState({multiSelectionActive:a})}),[a])}({deleteKeyCode:s,multiSelectionKeyCode:g}),v.jsx(Bw,{onPaneContextMenu:u,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:H,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:M,translateExtent:N,minZoom:P,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:v.jsx(o_,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:t})})}a_.displayName="FlowRenderer";var u_=e.memo(a_);var c_="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function s_(n){var t=u(e.useState(!1),2),r=t[0],o=t[1],i=u(e.useState((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return o(!0)}))})),1),a=i[0];return c_((function(){if(r){var e=a.get();e.length&&(n(e),a.reset()),o(!1)}else a.reset()}),[r]),a}var l_=e.createContext(null);function d_(n){var t=n.children,r=Qb(),o=e.useCallback((function(e){var n,t,o=r.getState(),i=o.nodes,u=void 0===i?[]:i,c=o.setNodes,s=o.hasDefaultNodes,l=o.onNodesChange,d=o.nodeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Zw({items:f,lookup:d}))}),[]),i=s_(o),u=e.useCallback((function(e){var n,t,o=r.getState(),i=o.edges,u=void 0===i?[]:i,c=o.setEdges,s=o.hasDefaultEdges,l=o.onEdgesChange,d=o.edgeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Zw({items:f,lookup:d}))}),[]),c=s_(u),s=e.useMemo((function(){return{nodeQueue:i,edgeQueue:c}}),[]);return v.jsx(l_.Provider,{value:s,children:t})}var f_=function(){var n=Qb();return e.useMemo((function(){return{zoomIn:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==e?void 0:e.duration})},zoomOut:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==e?void 0:e.duration})},zoomTo:function(e,t){var r;return null===(r=n.getState().panZoom)||void 0===r?void 0:r.scaleTo(e,{duration:null==t?void 0:t.duration})},getZoom:function(){return n.getState().transform[2]},setViewport:function(e,t){var r,o,i,a=n.getState(),c=u(a.transform,3),s=c[0],l=c[1],d=c[2],f=a.panZoom;null==f||f.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:d},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=u(n.getState().transform,3);return{x:e[0],y:e[1],zoom:e[2]}},fitView:function(e){var t=n.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,s=t.panZoom;return!!s&&Kw({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:s},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,s=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],l=i/2-e*s,d=a/2-t*s;null==u||u.setViewport({x:l,y:d,zoom:s},{duration:null==r?void 0:r.duration})},fitBounds:function(e,t){var r,o=n.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,s=o.panZoom,l=mw(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==s||s.setViewport(l,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(e,t){void 0===t&&(t={snapToGrid:!0});var r=n.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return e;var u=a.getBoundingClientRect(),c=u.x,s=u.y,l={x:e.x-c,y:e.y-s};return lw(l,o,t.snapToGrid,i)},flowToScreenPosition:function(e){var t=n.getState(),r=t.transform,o=t.domNode;if(!o)return e;var i=o.getBoundingClientRect(),a=i.x,c=i.y,s=function(e,n){var t=e.x,r=e.y,o=u(n,3),i=o[0],a=o[1],c=o[2];return{x:t*c+i,y:r*c+a}}(e,r);return{x:s.x+a,y:s.y+c}}}}),[])},h_=function(e){return!!e.panZoom};function v_(){var n=this,r=f_(),a=Qb(),s=function(){var n=e.useContext(l_);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),l=Kb(h_);console.log("yk store",a.getState());var d=e.useMemo((function(){var e=function(e){return a.getState().nodeLookup.get(e)},r=function(e){s.nodeQueue.push(e)},l=function(e){var n,r,o,i,u=a.getState(),c=u.nodeLookup,s=u.nodeOrigin,l=ww(e)?e:c.get(e.id),d=l.parentId?function(e,n,r,o){var i,a;void 0===o&&(o=[0,0]);for(var u=n,c=t({},e);u;){var s=r.get(n);if(u=null==s?void 0:s.parentId,s){var l=s.origin||o,d=(null!==(i=s.measured.width)&&void 0!==i?i:0)*l[0],f=(null!==(a=s.measured.height)&&void 0!==a?a:0)*l[1];c.x+=s.position.x-d,c.y+=s.position.y-f}}return c}(l.position,l.parentId,c,s):l.position,f={id:l.id,position:d,width:null!==(r=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==r?r:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height,data:l.data};return dw(f)},d=function(e,n,o){void 0===o&&(o={replace:!1}),r((function(r){return r.map((function(r){if(r.id===e){var i="function"==typeof n?n(r):n;return o.replace&&ww(i)?i:t(t({},r),i)}return r}))}))};return{getNodes:function(){return a.getState().nodes.map((function(e){return t({},e)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var e=a.getState().edges;return(void 0===e?[]:e).map((function(e){return t({},e)}))},getEdge:function(e){return a.getState().edgeLookup.get(e)},setNodes:r,setEdges:function(e){s.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];s.nodeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];s.edgeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},toObject:function(){var e=a.getState(),n=e.nodes,r=void 0===n?[]:n,o=e.edges,i=void 0===o?[]:o,c=u(e.transform,3),s=c[0],l=c[1],d=c[2];return{nodes:r.map((function(e){return t({},e)})),edges:i.map((function(e){return t({},e)})),viewport:{x:s,y:l,zoom:d}}},deleteElements:function(e){return o(n,[e],void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x=e.nodes,b=void 0===x?[]:x,w=e.edges,_=void 0===w?[]:w;return i(this,(function(e){switch(e.label){case 0:return n=a.getState(),t=n.nodes,r=n.edges,o=n.onNodesDelete,u=n.onEdgesDelete,c=n.triggerNodeChanges,s=n.triggerEdgeChanges,l=n.onDelete,d=n.onBeforeDelete,[4,Jw({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:d})];case 1:return f=e.sent(),h=f.nodes,v=f.edges,p=v.length>0,g=h.length>0,p&&(y=v.map(Uw),null==u||u(v),s(y)),g&&(m=h.map(Uw),null==o||o(h),c(m)),(g||p)&&(null==l||l({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var r=Ew(e),o=r?e:l(e),i=void 0!==t;return o?(t||a.getState().nodes).filter((function(t){var u=a.getState().nodeLookup.get(t.id);if(u&&!r&&(t.id===e.id||!u.internals.positionAbsolute))return!1;var c=dw(i?t:u),s=yw(c,o);return n&&s>0||s>=o.width*o.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var r=Ew(e)?e:l(e);if(!r)return!1;var o=yw(r,n);return t&&o>0||o>=r.width*r.height},updateNode:d,updateNodeData:function(e,n,r){void 0===r&&(r={replace:!1}),d(e,(function(e){var o="function"==typeof n?n(e):n;return r.replace?t(t({},e),{data:o}):t(t({},e),{data:t(t({},e.data),o)})}),r)},checkAllNodeBeMeasured:function(){return a.getState().nodes.every((function(e){return e.measured}))}}}),[]);return e.useMemo((function(){return t(t(t({},d),r),{viewportInitialized:l})}),[l])}var p_=function(e){return e.updateNodeInternals};var g_=function(e){return function(n){return e?qw(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var y_=e.createContext(null),m_=y_.Provider;y_.Consumer;var x_="ink-flow__node-desc",b_="ink-flow__edge-desc";function w_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function __(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function E_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-__(t-o,a),r];case exports.Position.Right:return[t+__(o-t,a),r];case exports.Position.Top:return[t,r-__(r-i,a)];case exports.Position.Bottom:return[t,r+__(i-r,a)]}}function S_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var k_,C_=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var M_=((k_={})[exports.Position.Left]={x:-1,y:0},k_[exports.Position.Right]={x:1,y:0},k_[exports.Position.Top]={x:0,y:-1},k_[exports.Position.Bottom]={x:0,y:1},k_),N_=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},P_=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function O_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.borderRadius,f=void 0===d?5:d,h=e.centerX,v=e.centerY,p=e.offset,g=u(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,s=void 0===a?exports.Position.Bottom:a,l=e.target,d=e.targetPosition,f=void 0===d?exports.Position.Top:d,h=e.center,v=e.offset,p=M_[s],g=M_[f],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:l.x+g.x*v,y:l.y+g.y*v},x=N_({source:y,sourcePosition:s,target:m}),b=0!==x.x?"x":"y",w=x[b],_=[],E={x:0,y:0},S={x:0,y:0},k=u(S_({sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}),4),C=k[0],M=k[1],N=k[2],P=k[3];if(p[b]*g[b]==-1){r=null!==(n=h.x)&&void 0!==n?n:C,o=null!==(t=h.y)&&void 0!==t?t:M;var O=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[b]===w?"x"===b?O:j:"x"===b?j:O}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===b?p.x===w?A:I:p.y===w?I:A,s===f){var z=Math.abs(i[b]-l[b]);if(z<=v){var T=Math.min(v-1,v-z);p[b]===w?E[b]=(y[b]>i[b]?-1:1)*T:S[b]=(m[b]>l[b]?-1:1)*T}}if(s!==f){var L="x"===b?"y":"x",B=p[b]===g[L],D=y[L]>m[L],R=y[L]<m[L];(1===p[b]&&(!B&&D||B&&R)||1!==p[b]&&(!B&&R||B&&D))&&(_="x"===b?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[c(c([i,{x:y.x+E.x,y:y.y+E.y}],u(_),!1),[{x:m.x+S.x,y:m.y+S.y},l],!1),r,o,N,P]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:l,center:{x:h,y:v},offset:void 0===p?20:p}),5),y=g[0],m=g[1],x=g[2],b=g[3],w=g[4],_=y.reduce((function(e,n,t){var r="";return r=t>0&&t<y.length-1?function(e,n,t,r){var o=Math.min(P_(e,n)/2,P_(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(y[t-1],n,y[t+1],f):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,x,b,w]}var j_=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var I_=e.memo(gw((function(n,o){var i,a,u=n.type,c=void 0===u?"source":u,s=n.position,l=void 0===s?exports.Position.Top:s,d=n.isValidConnection,f=n.isConnectable,h=void 0===f||f,p=n.isConnectableStart,g=void 0===p||p,y=n.isConnectableEnd,m=void 0===y||y,b=n.id,w=n.onConnect,_=n.children,E=n.className,S=n.onMouseDown,k=n.onTouchStart,C=r(n,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),M=b||null,N="target"===c,P=Qb(),O=e.useContext(y_),j=Kb(j_,zw),I=j.connectOnClick,A=j.noPanClassName,z=j.rfId,T=Kb(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,s=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:s,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===exports.ConnectionMode.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:s&&"valid"===c}}}(O,M,c),zw),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;O||null===(a=(i=P.getState()).onError)||void 0===a||a.call(i,"010",uv.error010());var Y=function(e){var n=P.getState(),r=n.defaultEdgeOptions,o=n.onConnect,i=n.hasDefaultEdges,a=t(t({},r),e);if(i){var u=P.getState(),c=u.edges;(0,u.setEdges)(function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(r="id"in(o=e)&&"source"in o&&"target"in o?t({},e):t(t({},e),{id:C_(e)}),n)?n:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,n.concat(r)):n;var r,o}(a,c))}null==o||o(a),null==w||w(a)},X=function(e){if(O){var n=Mw(e.nativeEvent);if(g&&(n&&0===e.button||!n)){var t=P.getState();Om.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:N,handleId:M,nodeId:O,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:d||t.isValidConnection,getTransform:function(){return P.getState().transform},getConnectionStartHandle:function(){return P.getState().connectionStartHandle}})}n?null==S||S(e):null==k||k(e)}};return v.jsx("div",t({"data-handleid":M,"data-nodeid":O,"data-handlepos":l,"data-id":"".concat(z,"-").concat(O,"-").concat(M,"-").concat(c),className:x(["ink-flow__handle","ink-flow__handle-".concat(l),"nodrag",A,E,{source:!N,target:N,connectable:h,connectablestart:g,connectableend:m,clickconnecting:D,connectingfrom:L,connectingto:B,valid:H,connectionindicator:h&&(!V||R)&&(V?m:g)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=P.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,a=n.isValidConnection,u=n.lib,s=n.rfId;if(O&&(o||g)){if(!o)return null==t||t(e.nativeEvent,{nodeId:O,handleId:M,handleType:c}),void P.setState({connectionClickStartHandle:{nodeId:O,type:c,handleId:M}});var l=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=d||a,h=Om.isValid(e.nativeEvent,{handle:{nodeId:O,id:M,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:l,lib:u}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),P.setState({connectionClickStartHandle:null})}}:void 0,ref:o},C,{children:_}))})));var A_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},z_={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return v.jsxs(v.Fragment,{children:[null==n?void 0:n.label,v.jsx(I_,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r,i=e.sourcePosition,a=void 0===i?exports.Position.Bottom:i;return v.jsxs(v.Fragment,{children:[v.jsx(I_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,v.jsx(I_,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r;return v.jsxs(v.Fragment,{children:[v.jsx(I_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function T_(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,s=a.multiSelectionActive,l=a.nodeLookup,d=a.onError,f=l.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&s)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",uv.error012(n))}var L_=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function B_(n){var r,o=n.id,i=n.onClick,c=n.onMouseEnter,s=n.onMouseMove,l=n.onMouseLeave,d=n.onContextMenu,f=n.onDoubleClick,h=n.nodesDraggable,p=n.elementsSelectable,g=n.nodesConnectable,y=n.nodesFocusable,m=n.resizeObserver,b=n.noDragClassName,w=n.noPanClassName,_=n.disableKeyboardA11y,E=n.rfId,S=n.nodeTypes,k=n.nodeExtent,C=n.nodeOrigin,M=n.onError,N=Kb((function(e){var n=e.nodeLookup.get(o),t=e.parentLookup.has(o);return{node:n,internals:n.internals,isParent:t}}),zw),P=N.node,O=N.internals,j=N.isParent,I=P.type||"default",A=(null==S?void 0:S[I])||z_[I];void 0===A&&(null==M||M("003",uv.error003(I)),I="default",A=z_.default);var z=!!(P.draggable||h&&void 0===P.draggable),T=!!(P.selectable||p&&void 0===P.selectable),L=!!(P.connectable||g&&void 0===P.connectable),B=!!(P.focusable||y&&void 0===P.focusable),D=Qb(),R=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(P),V=function(n){var t=n.node,r=n.nodeType,o=n.hasDimensions,i=n.resizeObserver,a=Qb(),u=e.useRef(null),c=e.useRef(null),s=e.useRef(t.sourcePosition),l=e.useRef(t.targetPosition),d=e.useRef(r),f=o&&!!t.internals.handleBounds&&!t.hidden;return e.useEffect((function(){!u.current||f&&c.current===u.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(u.current),c.current=u.current)}),[f]),e.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),e.useEffect((function(){if(u.current){var e=d.current!==r,n=s.current!==t.sourcePosition,o=l.current!==t.targetPosition;(e||n||o)&&(d.current=r,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),u}({node:P,nodeType:I,hasDimensions:R,resizeObserver:m}),H=function(n){var t=n.nodeRef,r=n.disabled,o=void 0!==r&&r,i=n.noDragClassName,a=n.handleSelector,c=n.nodeId,s=n.isSelectable,l=Qb(),d=u(e.useState(!1),2),f=d[0],h=d[1],v=e.useRef();return e.useEffect((function(){v.current=Sm({getStoreItems:function(){return l.getState()},onNodeMouseDown:function(e){T_({id:e,store:l,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),e.useEffect((function(){var e,n;if(o)null===(e=v.current)||void 0===e||e.destroy();else if(t.current)return null===(n=v.current)||void 0===n||n.update({noDragClassName:i,handleSelector:a,domNode:t.current,isSelectable:s,nodeId:c}),function(){var e;null===(e=v.current)||void 0===e||e.destroy()}}),[i,a,o,s,t,c]),f}({nodeRef:V,disabled:P.hidden||!z,noDragClassName:b,handleSelector:P.dragHandle,nodeId:o,isSelectable:T}),Y=function(){var n=Qb(),t=e.useCallback((function(e){var t,r,o=n.getState(),i=o.nodeExtent,c=o.snapToGrid,s=o.snapGrid,l=o.nodesDraggable,d=o.onError,f=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=L_(l),y=c?s[0]:5,m=c?s[1]:5,x=e.direction.x*y*e.factor,b=e.direction.y*m*e.factor;try{for(var w=a(h),_=w.next();!_.done;_=w.next()){var E=u(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+b};c&&(S=sw(S,s));var k=Qw({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:i,nodeOrigin:v,onError:d}),C=k.position,M=k.positionAbsolute;E.position=C,E.internals.positionAbsolute=M,p.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}f(p)}),[]);return t}();if(P.hidden)return null;var X=uw(P),F=function(e){var n,t,r,o,i,a,u,c,s,l;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(s=e.height)&&void 0!==s?s:null===(l=e.style)||void 0===l?void 0:l.height}}(P),Z=k?aw(O.positionAbsolute,k):O.positionAbsolute,U=bw(t(t(t({},Z),X),{origin:P.origin||C})),W=T||z||i||c||s||l,G=c?function(e){return c(e,t({},O.userNode))}:void 0,q=s?function(e){return s(e,t({},O.userNode))}:void 0,$=l?function(e){return l(e,t({},O.userNode))}:void 0,K=d?function(e){return d(e,t({},O.userNode))}:void 0,Q=f?function(e){return f(e,t({},O.userNode))}:void 0;return v.jsx("div",{className:x(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[w]=z,r),P.className,{selected:P.selected,selectable:T,parent:j,draggable:z,dragging:H}]),ref:V,style:t(t({zIndex:O.z,transform:"translate(".concat(U.x,"px,").concat(U.y,"px)"),pointerEvents:W?"all":"none",visibility:R?"visible":"hidden"},P.style),F),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:G,onMouseMove:q,onMouseLeave:$,onContextMenu:K,onClick:function(e){var n=D.getState(),r=n.selectNodesOnDrag,a=n.nodeDragThreshold;T&&(!r||!z||a>0)&&T_({id:o,store:D,nodeRef:V}),i&&i(e,t({},O.userNode))},onDoubleClick:Q,onKeyDown:B?function(e){if(!Cw(e.nativeEvent)&&!_)if(sv.includes(e.key)&&T){var n="Escape"===e.key;T_({id:o,store:D,unselect:n,nodeRef:V})}else z&&P.selected&&Object.prototype.hasOwnProperty.call(A_,e.key)&&(D.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~Z.x,", y: ").concat(~~Z.y)}),Y({direction:A_[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:B?0:void 0,role:B?"button":void 0,"aria-describedby":_?void 0:"".concat(x_,"-").concat(E),"aria-label":P.ariaLabel,children:v.jsx(m_,{value:o,children:v.jsx(A,t({id:o,data:P.data,type:I,positionAbsoluteX:Z.x,positionAbsoluteY:Z.y,selected:P.selected,isConnectable:L,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:H,dragHandle:P.dragHandle,zIndex:O.z},X))})})}var D_=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function R_(n){var t,r=Kb(D_,zw),o=r.nodesDraggable,i=r.nodesConnectable,a=r.nodesFocusable,c=r.elementsSelectable,s=r.onError,l=(t=!1,Kb(e.useCallback(g_(t),[t]),zw)),d=function(){var n=Kb(p_),t=u(e.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),n(t)}))})),1),r=t[0];return e.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return v.jsx("div",{className:"ink-flow__nodes",style:Tw,children:l.map((function(e){return v.jsx(B_,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:d,nodesDraggable:o,nodesConnectable:i,nodesFocusable:a,elementsSelectable:c,onError:s},e)}))})}R_.displayName="NodeRenderer";var V_,H_=e.memo(R_),Y_=((V_={})[exports.MarkerType.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},V_[exports.MarkerType.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},V_);function X_(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var F_=function(n){var t=n.id,r=n.type,o=n.color,i=n.width,a=void 0===i?12.5:i,u=n.height,c=void 0===u?12.5:u,s=n.markerUnits,l=void 0===s?"strokeWidth":s,d=n.strokeWidth,f=n.orient,h=void 0===f?"auto-start-reverse":f,p=function(n){var t=Qb(),r=e.useMemo((function(){var e,r;return Object.prototype.hasOwnProperty.call(Y_,n)?Y_[n]:(null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"009",uv.error009(n)),null)}),[n]);return r}(r);return p?v.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:l,orient:h,refX:"0",refY:"0",children:v.jsx(p,{color:o,strokeWidth:d})}):null},Z_=function(n){var r=n.defaultColor,o=n.rfId,i=Kb((function(e){return e.edges})),a=Kb((function(e){return e.defaultEdgeOptions})),u=e.useMemo((function(){var e=function(e,n){var r=n.id,o=n.defaultColor,i=n.defaultMarkerStart,a=n.defaultMarkerEnd,u=new Set;return e.reduce((function(e,n){return[n.markerStart||i,n.markerEnd||a].forEach((function(n){if(n&&"object"==typeof n){var i=X_(n,r);u.has(i)||(e.push(t({id:i,color:n.color||o},n)),u.add(i))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==a?void 0:a.markerStart,defaultMarkerEnd:null==a?void 0:a.markerEnd});return e}),[i,a,o,r]);return u.length?v.jsx("svg",{className:"ink-flow__marker",children:v.jsx("defs",{children:u.map((function(e){return v.jsx(F_,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};Z_.displayName="MarkerDefinitions";var U_=e.memo(Z_);function W_(n){var o=n.x,i=n.y,a=n.label,c=n.labelStyle,s=void 0===c?{}:c,l=n.labelShowBg,d=void 0===l||l,f=n.labelBgStyle,h=void 0===f?{}:f,p=n.labelBgPadding,g=void 0===p?[2,4]:p,y=n.labelBgBorderRadius,m=void 0===y?2:y,b=n.children,w=n.className,_=r(n,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=u(e.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],C=x(["ink-flow__edge-textwrapper",w]),M=e.useCallback((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==a&&a?v.jsxs("g",t({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:C,visibility:S.width?"visible":"hidden"},_,{children:[d&&v.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),v.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:M,style:s,children:a}),b]})):null}W_.displayName="EdgeText";var G_=e.memo(W_);function q_(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,s=e.labelBgPadding,l=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,p=e.className,g=e.interactionWidth,y=void 0===g?20:g;return v.jsxs(v.Fragment,{children:[v.jsx("path",{id:n,style:d,d:t,fill:"none",className:x(["ink-flow__edge-path",p]),markerEnd:f,markerStart:h}),y&&v.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&cw(r)&&cw(o)?v.jsx(G_,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function $_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===exports.Position.Left||n===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function K_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=u($_({pos:o,x1:n,y1:t,x2:i,y2:a}),2),d=l[0],f=l[1],h=u($_({pos:s,x1:i,y1:a,x2:n,y2:t}),2),v=h[0],p=h[1],g=u(w_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],x=g[2],b=g[3];return["M".concat(n,",").concat(t," C").concat(d,",").concat(f," ").concat(v,",").concat(p," ").concat(i,",").concat(a),y,m,x,b]}function Q_(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,b=e.markerEnd,w=e.markerStart,_=e.interactionWidth,E=u(K_({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d}),3),S=E[0],k=E[1],C=E[2],M=n.isInternal?void 0:t;return v.jsx(q_,{id:M,path:S,labelX:k,labelY:C,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:b,markerStart:w,interactionWidth:_})}))}var J_=Q_({isInternal:!1}),eE=Q_({isInternal:!0});function nE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=e.targetPosition,x=void 0===m?exports.Position.Top:m,b=e.markerEnd,w=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(O_({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:a,targetPosition:x,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(q_,{id:N,path:k,labelX:C,labelY:M,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:b,markerStart:w,interactionWidth:E})}))}J_.displayName="SimpleBezierEdge",eE.displayName="SimpleBezierEdgeInternal";var tE=nE({isInternal:!1}),rE=nE({isInternal:!0});function oE(n){return e.memo((function(o){var i,a=o.id,u=r(o,["id"]),c=n.isInternal?void 0:a;return v.jsx(tE,t({},u,{id:c,pathOptions:e.useMemo((function(){var e;return{borderRadius:0,offset:null===(e=u.pathOptions)||void 0===e?void 0:e.offset}}),[null===(i=u.pathOptions)||void 0===i?void 0:i.offset])}))}))}tE.displayName="SmoothStepEdge",rE.displayName="SmoothStepEdgeInternal";var iE=oE({isInternal:!1}),aE=oE({isInternal:!0});function uE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.markerEnd,y=e.markerStart,m=e.interactionWidth,x=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=u(S_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],c=i[1],s=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,c,s,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),b=x[0],w=x[1],_=x[2],E=n.isInternal?void 0:t;return v.jsx(q_,{id:E,path:b,labelX:w,labelY:_,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:m})}))}iE.displayName="StepEdge",aE.displayName="StepEdgeInternal";var cE=uE({isInternal:!1}),sE=uE({isInternal:!0});function lE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,b=e.markerEnd,w=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=e.curvature,d=void 0===l?.25:l,f=u(E_({pos:o,x1:n,y1:t,x2:i,y2:a,c:d}),2),h=f[0],v=f[1],p=u(E_({pos:s,x1:i,y1:a,x2:n,y2:t,c:d}),2),g=p[0],y=p[1],m=u(w_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),x=m[0],b=m[1],w=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(a),x,b,w,_]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d,curvature:null==_?void 0:_.curvature}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(q_,{id:N,path:k,labelX:C,labelY:M,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:b,markerStart:w,interactionWidth:E})}))}cE.displayName="StraightEdge",sE.displayName="StraightEdgeInternal";var dE=lE({isInternal:!1}),fE=lE({isInternal:!0});dE.displayName="BezierEdge",fE.displayName="BezierEdgeInternal";var hE={default:fE,straight:sE,step:aE,smoothstep:rE,simplebezier:eE},vE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},pE=function(e,n,t){return t===exports.Position.Left?e-n:t===exports.Position.Right?e+n:e},gE=function(e,n,t){return t===exports.Position.Top?e-n:t===exports.Position.Bottom?e+n:e},yE="ink-flow__edgeupdater";function mE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,s=e.type;return v.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:x([yE,"".concat(yE,"-").concat(s)]),cx:pE(t,i,n),cy:gE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function xE(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,s=e.targetY,l=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,p=e.onEdgeUpdateEnd,g=e.setUpdating,y=e.setUpdateHover,m=Qb(),x=function(e,n){if(0===e.button){var t=m.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,s=t.connectionMode,l=t.connectionRadius,d=t.lib,v=t.onConnectStart,y=t.onConnectEnd,x=t.cancelConnection,b=t.nodeLookup,w=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,C=n?"target":"source",M=n;g(!0),null==h||h(e,r,C);Om.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:s,connectionRadius:l,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:M,edgeUpdaterType:C,lib:d,flowId:w,cancelConnection:x,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:v,onConnectEnd:y,onEdgeUpdateEnd:function(e){g(!1),null==p||p(e,r,C)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},b=function(){return y(!0)},w=function(){return y(!1)};return v.jsxs(v.Fragment,{children:[("source"===n||!0===n)&&v.jsx(mE,{position:l,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return x(e,!0)},onMouseEnter:b,onMouseOut:w,type:"source"}),("target"===n||!0===n)&&v.jsx(mE,{position:d,centerX:c,centerY:s,radius:t,onMouseDown:function(e){return x(e,!1)},onMouseEnter:b,onMouseOut:w,type:"target"})]})}function bE(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function wE(e){var n,t,r,o;if(!e)return null;var i=[],u=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=s.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&u.push(l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return{source:i,target:u}}function _E(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:uw(n),c=u.width,s=u.height;switch(e){case exports.Position.Top:return[i+c/2,a];case exports.Position.Right:return[i+c,a+s/2];case exports.Position.Bottom:return[i+c/2,a+s];case exports.Position.Left:return[i,a+s/2]}}function EE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function SE(n){var r=n.id,o=n.edgesFocusable,i=n.edgesUpdatable,a=n.elementsSelectable,c=n.onClick,s=n.onDoubleClick,l=n.onContextMenu,d=n.onMouseEnter,f=n.onMouseMove,h=n.onMouseLeave,p=n.edgeUpdaterRadius,g=n.onEdgeUpdate,y=n.onEdgeUpdateStart,m=n.onEdgeUpdateEnd,b=n.rfId,w=n.edgeTypes,_=n.noPanClassName,E=n.onError,S=n.disableKeyboardA11y,k=Kb((function(e){return e.edgeLookup.get(r)})),C=Kb((function(e){return e.defaultEdgeOptions})),M=(k=C?t(t({},C),k):k).type||"default",N=(null==w?void 0:w[M])||hE[M];void 0===N&&(null==E||E("011",uv.error011(M)),M="default",N=hE.default);var P=!!(k.focusable||o&&void 0===k.focusable),O=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||a&&void 0===k.selectable),I=e.useRef(null),A=u(e.useState(!1),2),z=A[0],T=A[1],L=u(e.useState(!1),2),B=L[0],D=L[1],R=Qb(),V=Kb(e.useCallback((function(e){var n=e.nodeLookup.get(k.source),o=e.nodeLookup.get(k.target);if(!n||!o)return t({zIndex:k.zIndex},vE);var i=function(e){var n,t,r,o,i,a=e.sourceNode,c=e.targetNode;if(!bE(a)||!bE(c))return null;var s=a.internals.handleBounds||wE(a.handles),l=c.internals.handleBounds||wE(c.handles),d=EE(null!==(n=null==s?void 0:s.source)&&void 0!==n?n:[],e.sourceHandle),f=EE(e.connectionMode===exports.ConnectionMode.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),h=(null==d?void 0:d.position)||exports.Position.Bottom,v=(null==f?void 0:f.position)||exports.Position.Top;if(!d||!f)return null===(i=e.onError)||void 0===i||i.call(e,"008",uv.error008(d?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var p=u(_E(h,a,d),2),g=p[0],y=p[1],m=u(_E(v,c,f),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:n,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:e.connectionMode,onError:E}),a=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,s=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?s:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return t({zIndex:a},i||vE)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),zw),H=V.zIndex,Y=V.sourceX,X=V.sourceY,F=V.targetX,Z=V.targetY,U=V.sourcePosition,W=V.targetPosition,G=e.useMemo((function(){return k.markerStart?"url('#".concat(X_(k.markerStart,b),"')"):void 0}),[k.markerStart,b]),q=e.useMemo((function(){return k.markerEnd?"url('#".concat(X_(k.markerEnd,b),"')"):void 0}),[k.markerEnd,b]);if(k.hidden||null===Y||null===X||null===F||null===Z)return null;var $=s?function(e){s(e,t({},k))}:void 0,K=l?function(e){l(e,t({},k))}:void 0,Q=d?function(e){d(e,t({},k))}:void 0,J=f?function(e){f(e,t({},k))}:void 0,ee=h?function(e){h(e,t({},k))}:void 0;return v.jsx("svg",{style:{zIndex:H},children:v.jsxs("g",{className:x(["ink-flow__edge","ink-flow__edge-".concat(M),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:z,selectable:j}]),onClick:function(e){var n,t=R.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,a=t.multiSelectionActive;j&&(R.setState({nodesSelectionActive:!1}),k.selected&&a?(i({nodes:[],edges:[k]}),null===(n=I.current)||void 0===n||n.blur()):o([r])),c&&c(e,k)},onDoubleClick:$,onContextMenu:K,onMouseEnter:Q,onMouseMove:J,onMouseLeave:ee,onKeyDown:P?function(e){var n;if(!S&&sv.includes(e.key)&&j){var t=R.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===e.key?(null===(n=I.current)||void 0===n||n.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":P?"".concat(b_,"-").concat(b):void 0,ref:I,children:[!B&&v.jsx(N,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Y,sourceY:X,targetX:F,targetY:Z,sourcePosition:U,targetPosition:W,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:G,markerEnd:q,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),O&&v.jsx(xE,{edge:k,isUpdatable:O,edgeUpdaterRadius:p,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:m,sourceX:Y,sourceY:X,targetX:F,targetY:Z,sourcePosition:U,targetPosition:W,setUpdateHover:T,setUpdating:D,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var kE=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function CE(n){var t=n.defaultMarkerColor,r=n.rfId,o=n.noPanClassName,i=n.onEdgeUpdate,a=n.onEdgeContextMenu,u=n.onEdgeMouseEnter,c=n.onEdgeMouseMove,s=n.onEdgeMouseLeave,l=n.onEdgeClick,d=n.edgeTypes,f=Kb(kE,zw),h=f.edgesFocusable,p=f.edgesUpdatable,g=f.elementsSelectable,y=f.onError,m=function(n){var t=Kb(e.useCallback((function(e){return e.edges.map((function(e){return e.id}))}),[n]),zw);return t}(!1);return v.jsxs("div",{className:"ink-flow__edges",children:[v.jsx(U_,{defaultColor:t,rfId:r}),m.map((function(e){return v.jsx(SE,{id:e,edgesFocusable:h,edgesUpdatable:p,elementsSelectable:g,noPanClassName:o,onEdgeUpdate:i,onContextMenu:a,onMouseEnter:u,onMouseMove:c,onMouseLeave:s,onClick:l,rfId:r,onError:y,edgeTypes:d},e)}))]})}CE.displayName="EdgeRenderer";var ME,NE=e.memo(CE),PE=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function OE(e){var n=e.children,t=Kb(PE);return v.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var jE=((ME={})[exports.Position.Left]=exports.Position.Right,ME[exports.Position.Right]=exports.Position.Left,ME[exports.Position.Top]=exports.Position.Bottom,ME[exports.Position.Bottom]=exports.Position.Top,ME),IE=function(n){var r,o,i=n.nodeId,a=n.handleType,c=n.style,s=n.type,l=void 0===s?exports.ConnectionLineType.Bezier:s,d=n.CustomComponent,f=n.connectionStatus,h=Kb(e.useCallback((function(e){var n;return{fromNode:e.nodeLookup.get(i),handleId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.handleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}}),[i]),zw),p=h.fromNode,g=h.handleId,y=h.toX,m=h.toY,x=h.connectionMode,b=null==p?void 0:p.internals.handleBounds,w=null==b?void 0:b[a];if(x===exports.ConnectionMode.Loose&&(w=w||(null==b?void 0:b["source"===a?"target":"source"])),!p||!w)return null;var _=g?w.find((function(e){return e.id===g})):w[0],E=_?_.x+_.width/2:(null!==(r=p.measured.width)&&void 0!==r?r:0)/2,S=_?_.y+_.height/2:null!==(o=p.measured.height)&&void 0!==o?o:0,k=p.internals.positionAbsolute.x+E,C=p.internals.positionAbsolute.y+S,M=null==_?void 0:_.position,N=M?jE[M]:null;if(!M||!N)return null;if(d)return v.jsx(d,{connectionLineType:l,connectionLineStyle:c,fromNode:p,fromHandle:_,fromX:k,fromY:C,toX:y,toY:m,fromPosition:M,toPosition:N,connectionStatus:f});var P="",O={sourceX:k,sourceY:C,sourcePosition:M,targetX:y,targetY:m,targetPosition:N};return P=l===exports.ConnectionLineType.Bezier?u(vm(O),1)[0]:l===exports.ConnectionLineType.Step?u(bm(t(t({},O),{borderRadius:0})),1)[0]:l===exports.ConnectionLineType.SmoothStep?u(bm(O),1)[0]:l===exports.ConnectionLineType.SimpleBezier?u(K_(O),1)[0]:"M".concat(k,",").concat(C," ").concat(y,",").concat(m),v.jsx("path",{d:P,fill:"none",className:"react-flow__connection-path",style:c})};IE.displayName="ConnectionLine";var AE=function(e){var n,t;return{nodeId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.nodeId,handleType:null===(t=e.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height}};function zE(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=Kb(AE,zw),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,s=i.width,l=i.height,d=i.connectionStatus;return!!(a&&u&&s&&c)?v.jsx("svg",{style:n,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:x(["react-flow__connection",d]),children:v.jsx(IE,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function TE(e){var n=e.onNodeClick,t=e.onNodeDoubleClick,r=e.onNodeMouseEnter,o=e.onNodeMouseMove,i=e.onNodeMouseLeave,a=e.onNodeContextMenu,u=e.onEdgeClick,c=e.onEdgeDoubleClick,s=e.onEdgeMouseEnter,l=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,p=e.minZoom,g=e.maxZoom,y=e.noPanClassName,m=e.noDragClassName,x=e.nodeOrigin,b=e.viewport,w=e.disableKeyboardA11y,_=e.translateExtent,E=e.defaultViewport,S=e.nodeTypes,k=e.edgeTypes,C=e.elementsSelectable,M=e.defaultMarkerColor,N=e.connectionLineType,P=e.connectionLineStyle,O=e.connectionLineComponent,j=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return v.jsx(u_,{minZoom:p,maxZoom:g,noPanClassName:y,noDragClassName:m,isControlledViewport:!!b,disableKeyboardA11y:w,translateExtent:_,defaultViewport:E,elementsSelectable:C,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:v.jsxs(OE,{children:[v.jsx(NE,{rfId:h,edgeTypes:k,noPanClassName:y,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:M}),v.jsx(zE,{style:P,type:N,component:O,containerStyle:j}),v.jsx("div",{className:"ink-flow__edgelabel-renderer"}),v.jsx(H_,{rfId:h,nodeTypes:S,nodeOrigin:x,noDragClassName:m,noPanClassName:y,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),v.jsx("div",{className:"ink-flow__viewport-portal"})]})})}TE.displayName="GraphView";var LE=e.memo(TE),BE=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=new Map,s=new Map,l=new Map,d=new Map,f=null!==(n=null!=u?u:i)&&void 0!==n?n:[],h=null!==(t=null!=a?a:o)&&void 0!==t?t:[];tw(l,d,f),rw(h,c,s,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:s,edges:f,edgeLookup:d,connectionLookup:l,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:cv,nodeExtent:cv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},DE=function(e){var n,r,o=e.nodes,i=e.edges,s=e.defaultNodes,l=e.defaultEdges,d=e.width,f=e.height,h=e.fitView;return n=function(e,n){return t(t({},BE({nodes:o,edges:i,width:d,height:f,fitView:h,defaultNodes:s,defaultEdges:l})),{setNodes:function(t){var r=n();rw(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();tw(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(r){var o=n(),i=o.triggerNodeChanges,a=o.fitView,s=o.nodeLookup,l=o.parentLookup,d=o.fitViewOnInit,f=o.fitViewDone,h=o.fitViewOnInitOptions,v=o.domNode,p=o.nodeOrigin,g=o.debug,y=function(e,n,r,o,i){var a=null==o?void 0:o.querySelector(".xyflow__viewport"),s=!1;if(!a)return{changes:[],updatedInternals:s};var l=[],d=window.getComputedStyle(a),f=new window.DOMMatrixReadOnly(d.transform).m22,h=[];if(e.forEach((function(e){var r=n.get(e.id);if(null==r?void 0:r.hidden)n.set(r.id,t(t({},r),{internals:t(t({},r.internals),{handleBounds:void 0})})),s=!0;else if(r){var o=Sw(e.nodeElement),a=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(a||!r.internals.handleBounds||e.force)){var u=t(t({},r),{measured:o,internals:t(t({},r.internals),{handleBounds:{source:Pw(".source",e.nodeElement,f,r.origin||i),target:Pw(".target",e.nodeElement,f,r.origin||i)}})});n.set(r.id,u),s=!0,a&&(l.push({id:u.id,type:"dimensions",dimensions:o}),u.expandParent&&u.parentId&&h.push({id:u.id,parentId:u.parentId,rect:dw(u,u.origin||i)}))}}})),h.length>0){var v=ow(h,n,r,i);l.push.apply(l,c([],u(v),!1))}return{changes:l,updatedInternals:s}}(r,s,l,v,p),m=y.changes;if(y.updatedInternals){Jb(s,{nodeOrigin:p});var x=f;!f&&d&&(x=a(t(t({},h),{nodes:null==h?void 0:h.nodes}))),e({fitViewDone:x}),(null==m?void 0:m.length)>0&&(g&&console.log("Ink Flow: trigger node changes",m),null==i||i(m))}},updateNodePositions:function(e,r){var o,i;void 0===r&&(r=!1);var s=[],l=[];try{for(var d=a(e),f=d.next();!f.done;f=d.next()){var h=u(f.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(s.push({id:v,parentId:p.parentId,rect:t(t({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),l.push(g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}if(s.length>0){var y=n(),m=ow(s,y.nodeLookup,y.parentLookup);l.push.apply(l,c([],u(m),!1))}n().triggerNodeChanges(l)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(Yw(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(Hw(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,s=t.triggerEdgeChanges;r?a(e.map((function(e){return Xw(e,!0)}))):(a(Fw(i,new Set(c([],u(e),!1)),!0)),s(Fw(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,s=t.triggerEdgeChanges;r?s(e.map((function(e){return Xw(e,!0)}))):(s(Fw(o,new Set(c([],u(e),!1)))),a(Fw(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,s=i.triggerEdgeChanges,l=o||a,d=(r||u).map((function(e){return e.selected=!1,Xw(e.id,!1)})),f=l.map((function(e){return Xw(e.id,!1)}));c(d),s(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?c(c([],u(e),!1),[Xw(n.id,!1)],!1):e}),[]),s=t.reduce((function(e,n){return n.selected?c(c([],u(e),!1),[Xw(n.id,!1)],!1):e}),[]);o(a),i(s)},setNodeExtent:function(r){var o,i,c=n().nodeLookup;try{for(var s=a(c),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=aw(d.position,r);c.set(d.id,t(t({},d),{internals:t(t({},d.internals),{positionAbsolute:f})}))}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}e({nodeExtent:r})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(e){var t=n(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,s=t.nodeLookup;return!!r&&Kw({nodeLookup:s,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=n().connectionPosition,a=t(t({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});e(a)},reset:function(){return e(t({},BE()))}})},r=Object.is,n?j(n,r):j};function RE(n){var t=n.initialNodes,r=n.initialEdges,o=n.defaultNodes,i=n.defaultEdges,a=n.initialWidth,c=n.initialHeight,s=n.fitView,l=n.children,d=u(e.useState((function(){return DE({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:a,height:c,fitView:s})})),1)[0];return v.jsx(A,{value:d,children:v.jsx(d_,{children:l})})}function VE(n){var t=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,s=n.fitView;return e.useContext(I)?v.jsx(v.Fragment,{children:t}):v.jsx(RE,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:s,children:t})}var HE={x:0,y:0,zoom:1},YE=c(c([],u(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),XE=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},FE={translateExtent:cv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ZE(n){var t=Kb(XE,zw),r=t.setNodes,o=t.setEdges,i=t.setMinZoom,u=t.setMaxZoom,c=t.setTranslateExtent,s=t.setNodeExtent,l=t.reset,d=t.setDefaultNodesAndEdges,f=Qb();e.useEffect((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=FE,l()}}),[]);var h=e.useRef(FE);return e.useEffect((function(){var e,t,l;try{for(var d=a(YE),v=d.next();!v.done;v=d.next()){var p=v.value,g=n[p];g!==h.current[p]&&(void 0!==n[p]&&("nodes"===p?r(g):"edges"===p?o(g):"minZoom"===p?i(g):"maxZoom"===p?u(g):"translateExtent"===p?c(g):"nodeExtent"===p?s(g):"fitView"===p?f.setState({fitViewOnInit:g}):"fitViewOptions"===p?f.setState({fitViewOnInitOptions:g}):f.setState(((l={})[p]=g,l))))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}h.current=n}),YE.map((function(e){return n[e]}))),null}var UE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var WE=gw((function(e,n){var o=e.nodes,i=e.edges,a=e.translateExtent,u=void 0===a?cv:a,c=e.defaultViewport,s=void 0===c?HE:c,l=e.minZoom,d=void 0===l?.5:l,f=e.maxZoom,h=void 0===f?2:f,p=e.defaultMarkerColor,g=void 0===p?"#b1b1b7":p,y=e.nodeOrigin,m=e.noDragClassName,b=e.noPanClassName,w=e.disableKeyboardA11y,_=e.nodeTypes,E=e.edgeTypes;e.connectionMode;var S=e.connectionLineType,k=void 0===S?exports.ConnectionLineType.Bezier:S,C=e.connectionLineStyle,M=e.connectionLineComponent,N=e.connectionLineContainerStyle,P=e.onNodeClick,O=e.onNodeDoubleClick,j=e.onNodeMouseEnter,I=e.onNodeMouseMove,A=e.onNodeMouseLeave,z=e.onNodeContextMenu,T=e.onEdgeClick,L=e.onEdgeMouseEnter,B=e.onEdgeMouseMove,D=e.onEdgeMouseLeave,R=e.onEdgeContextMenu,V=e.onEdgeDoubleClick,H=e.onNodesChange,Y=e.onEdgesChange,X=e.fitView,F=e.fitViewOptions,Z=e.nodeExtent,U=e.nodesDraggable,W=e.children,G=e.id,q=e.width,$=e.height,K=e.onPaneClick,Q=e.onPaneContextMenu,J=e.onPaneMouseEnter,ee=e.onPaneMouseMove,ne=e.onPaneMouseLeave,te=e.onPaneScroll,re=e.elementsSelectable,oe=void 0===re||re,ie=r(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable"]),ae=G||"1";return v.jsx("div",t({},ie,{ref:n,style:t({},UE),className:x(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:v.jsxs(VE,{nodes:o,edges:i,width:q,height:$,fitView:X,children:[v.jsx(LE,{onNodeClick:P,onNodeMouseEnter:j,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:O,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:V,rfId:ae,nodeTypes:_,edgeTypes:E,minZoom:d,maxZoom:h,nodeOrigin:y,noDragClassName:m,noPanClassName:b,disableKeyboardA11y:w,translateExtent:u,defaultMarkerColor:g,connectionLineType:k,connectionLineStyle:C,connectionLineComponent:M,connectionLineContainerStyle:N,defaultViewport:s,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),v.jsx(ZE,{nodes:o,edges:i,rfId:ae,onNodesChange:H,onEdgesChange:Y,fitView:X,fitViewOptions:F,nodeExtent:Z,nodesDraggable:U,elementsSelectable:oe}),W]})}))}));function GE(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function qE(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function $E(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function KE(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("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 QE(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("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"})})}function JE(e){var n=e.children,o=e.className,i=r(e,["children","className"]);return v.jsx("button",t({type:"button",className:x(["ink-flow__controls-button",o])},i,{children:n}))}var eS=function(e){return e.userSelectionActive?"none":"all"};function nS(e){var n=e.position,o=void 0===n?"top-left":n,i=e.children,a=e.className,s=e.style,l=r(e,["position","children","className","style"]),d=Kb(eS),f="".concat(o).split("-");return v.jsx("div",t({className:x(c(["ink-flow__panel",a],u(f),!1)),style:t(t({},s),{pointerEvents:d})},l,{children:i}))}var tS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function rS(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,s=e.onZoomIn,l=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,p=e.children,g=e.position,y=void 0===g?"bottom-left":g,m=e.orientation,b=void 0===m?"vertical":m,w=e["aria-label"],_=void 0===w?"Ink Flow controls":w,E=Qb(),S=Kb(tS,zw),k=S.isInteractive,C=S.minZoomReached,M=S.maxZoomReached,N=v_(),P=N.zoomIn,O=N.zoomOut,j=N.fitView,I="horizontal"===b?"horizontal":"vertical";return v.jsxs(nS,{className:x(["ink-flow__controls",I,h]),position:y,style:n,"data-testid":"rf__controls","aria-label":_,children:[i&&v.jsx(JE,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==d||d()},"aria-label":"fit view",children:v.jsx($E,{})}),r&&v.jsxs("div",{className:"ink-flow__controls-zoom",children:[v.jsx(JE,{onClick:function(){P(),null==s||s()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:M,children:v.jsx(GE,{})}),v.jsx(JE,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:C,children:v.jsx(qE,{})})]}),u&&v.jsx(JE,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==f||f(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?v.jsx(QE,{}):v.jsx(KE,{})}),p]})}rS.displayName="Controls";var oS,iS,aS=e.memo(rS);function uS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return v.jsx("path",{strokeWidth:t,d:"M".concat(n[0]/2," 0 V").concat(n[1]," M0 ").concat(n[1]/2," H").concat(n[0]),className:x(["react-flow__background-pattern",r,o])})}function cS(e){var n=e.radius,t=e.className;return v.jsx("circle",{cx:n,cy:n,r:n,className:x(["react-flow__background-pattern","dots",t])})}exports.BackgroundVariant=void 0,(oS=exports.BackgroundVariant||(exports.BackgroundVariant={})).Lines="lines",oS.Dots="dots",oS.Cross="cross";var sS=((iS={})[exports.BackgroundVariant.Dots]=1,iS[exports.BackgroundVariant.Lines]=1,iS[exports.BackgroundVariant.Cross]=6,iS),lS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function dS(n){var r=n.id,o=n.variant,i=void 0===o?exports.BackgroundVariant.Dots:o,a=n.gap,u=void 0===a?20:a,c=n.size,s=n.lineWidth,l=void 0===s?1:s,d=n.offset,f=void 0===d?2:d,h=n.color,p=n.bgColor,g=n.style,y=n.className,m=n.patternClassName,b=e.useRef(null),w=Kb(lS,zw),_=w.transform,E=w.patternId,S=c||sS[i],k=i===exports.BackgroundVariant.Dots,C=i===exports.BackgroundVariant.Cross,M=Array.isArray(u)?u:[u,u],N=[M[0]*_[2]||1,M[1]*_[2]||1],P=S*_[2],O=C?[P,P]:N,j=k?[P/f,P/f]:[O[0]/f,O[1]/f],I="".concat(E).concat(r||"");return v.jsxs("svg",{className:x(["ink-flow__background",y]),style:t(t(t({},g),Tw),{"--xy-background-color-props":p,"--xy-background-pattern-color-props":h}),ref:b,"data-testid":"rf__background",children:[v.jsx("pattern",{id:I,x:_[0]%N[0],y:_[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(j[0],",-").concat(j[1],")"),children:k?v.jsx(cS,{radius:P/f,className:m}):v.jsx(uS,{dimensions:O,lineWidth:l,variant:i,className:m})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}dS.displayName="Background";var fS=e.memo(dS),hS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};exports.Background=fS,exports.BaseEdge=q_,exports.ControlButton=JE,exports.Controls=aS,exports.EdgeLabelRenderer=function(e){var t=e.children,r=Kb(hS);return r?n.createPortal(t,r):null},exports.Handle=I_,exports.InkFlowProvider=RE,exports.SmoothStepEdge=tE,exports.StepEdge=iE,exports.addEdge=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?z({},e):z(z({},e),{id:ym(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},exports.dagreLayout=function(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new av.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(z({rankdir:r},t));var i=e.map((function(e){return z({},e)}));i.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),av.layout(o),i.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":default:t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}}));var a=function(e){var n=e.centerNodeId,t=e.containerHeight,r=void 0===t?0:t,o=e.containerWidth,i=void 0===o?0:o,a=e.centerByBBox,u=e.nodes;if(!n&&!a||!r||!i)return Nv;if(null==n?void 0:n.trim()){var c=null==u?void 0:u.find((function(e){return e.id===(null==n?void 0:n.trim())}));if(c){var s=function(e){if(!e)return Nv;var n=Mv(e),t=n.width,r=n.height;return{y:e.position.y+r/2,x:e.position.x+t/2}}(c);return{x:i/2-s.x,y:r/2-s.y}}}return a?(s=function(e){if(!(null==e?void 0:e.length))return Nv;var n=dv(e),t=n.x,r=n.y;return{x:t+n.width/2,y:r+n.height/2}}(u),{x:i/2-s.x,y:r/2-s.y}):Nv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height}),u=a.x,c=void 0===u?0:u,s=a.y,l=void 0===s?0:s;return i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+l}})),{nodes:i,edges:n}},exports.default=WE,exports.getBezierEdgeCenter=dm,exports.getBezierPath=vm,exports.getConnectedEdges=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))},exports.getEdgeCenter=pm,exports.getIncomers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},exports.getNodesBounds=dv,exports.getOutgoers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},exports.getSmoothStepPath=bm,exports.getStraightPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=L(pm({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],s=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,s]},exports.getViewportForBounds=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=vv(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}},exports.updateEdge=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=z(z({},i),{id:r.shouldReplaceId?ym(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)},exports.useEdgesState=function(n){var t=u(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Hw(e,n)}))}),[]);return[r,o,i]},exports.useInkFlow=v_,exports.useNodesState=function(n){var t=u(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Yw(e,n)}))}),[]);return[r,o,i]},exports.useStore=Kb,exports.useStoreApi=Qb;
|
|
16
|
+
*/b.exports=function(){if(m)return w;m=1;var n=e,t=S(),r="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},o=t.useSyncExternalStore,i=n.useRef,a=n.useEffect,u=n.useMemo,c=n.useDebugValue;return w.useSyncExternalStoreWithSelector=function(e,n,t,s,l){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=u((function(){function e(e){if(!a){if(a=!0,o=e,e=s(e),void 0!==l&&f.hasValue){var n=f.value;if(l(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=s(e);return void 0!==l&&l(n,t)?n:(o=e,i=t)}var o,i,a=!1,u=void 0===t?null:t;return[function(){return e(n())},null===u?void 0:function(){return e(u())}]}),[n,t,s,l]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},w}();var k=s(b.exports);const C=e=>{let n;const t=new Set,r=(e,r)=>{const o="function"==typeof e?e(n):e;if(!Object.is(o,n)){const e=n;n=(null!=r?r:"object"!=typeof o||null===o)?o:Object.assign({},n,o),t.forEach((t=>t(n,e)))}},o=()=>n,i={setState:r,getState:o,getInitialState:()=>a,subscribe:e=>(t.add(e),()=>t.delete(e)),destroy:()=>{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."),t.clear()}},a=n=e(r,o,i);return i},{useDebugValue:M}=e,{useSyncExternalStoreWithSelector:N}=k,P=e=>e;function O(e,n=P,t){const r=N(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return M(r),r}const j=(e,n)=>{const t=(e=>e?C(e):C)(e),r=(e,r=n)=>O(t,e,r);return Object.assign(r,t),r};var I=e.createContext(null),A=I.Provider,z=function(){return z=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},z.apply(this,arguments)};function T(e){var n="function"==typeof Symbol&&Symbol.iterator,t=n&&e[n],r=0;if(t)return t.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(n?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(e,n){var t="function"==typeof Symbol&&e[Symbol.iterator];if(!t)return e;var r,o,i=t.call(e),a=[];try{for(;(void 0===n||n-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(t=i.return)&&t.call(i)}finally{if(o)throw o.error}}return a}function B(e,n,t){if(2===arguments.length)for(var r,o=0,i=n.length;o<i;o++)!r&&o in n||(r||(r=Array.prototype.slice.call(n,0,o)),r[o]=n[o]);return e.concat(r||Array.prototype.slice.call(n))}"function"==typeof SuppressedError&&SuppressedError;var D,R,V,H,Y,X,Z,F,U,W,G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,se,le,de,fe,he,ve,pe,ge,ye,me,xe,be,we,_e,Ee,Se,ke,Ce,Me,Ne,Pe,Oe,je,Ie,Ae,ze,Te,Le,Be,De,Re,Ve,He,Ye,Xe,Ze,Fe,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,sn,ln,dn,fn,hn,vn,pn,gn,yn,mn,xn,bn,wn,_n,En,Sn,kn,Cn,Mn,Nn,Pn,On,jn,In,An,zn,Tn,Ln,Bn,Dn,Rn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Vn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Hn(){return H?V:(H=1,V=function(e,n){return e===n||e!=e&&n!=n})}function Yn(){if(X)return Y;X=1;var e=Hn();return Y=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Y}function Xn(){if(J)return Q;J=1;var e=R?D:(R=1,D=function(){this.__data__=[],this.size=0}),n=function(){if(F)return Z;F=1;var e=Yn(),n=Array.prototype.splice;return Z=function(t){var r=this.__data__,o=e(r,t);return!(o<0||(o==r.length-1?r.pop():n.call(r,o,1),--this.size,0))}}(),t=function(){if(W)return U;W=1;var e=Yn();return U=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(q)return G;q=1;var e=Yn();return G=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(K)return $;K=1;var e=Yn();return $=function(n,t){var r=this.__data__,o=e(r,n);return o<0?(++this.size,r.push([n,t])):r[o][1]=t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,Q=i}function Zn(){if(se)return ce;se=1;var e="object"==typeof Rn&&Rn&&Rn.Object===Object&&Rn;return ce=e}function Fn(){if(de)return le;de=1;var e=Zn(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return le=t}function Un(){if(he)return fe;he=1;var e=Fn().Symbol;return fe=e}function Wn(){if(xe)return me;xe=1;var e=Un(),n=function(){if(pe)return ve;pe=1;var e=Un(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return ve=function(e){var n=t.call(e,o),i=e[o];try{e[o]=void 0;var a=!0}catch(e){}var u=r.call(e);return a&&(n?e[o]=i:delete e[o]),u}}(),t=function(){if(ye)return ge;ye=1;var e=Object.prototype.toString;return ge=function(n){return e.call(n)}}(),r=e?e.toStringTag:void 0;return me=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":r&&r in Object(e)?n(e):t(e)}}function Gn(){return we?be:(we=1,be=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function qn(){if(Ee)return _e;Ee=1;var e=Wn(),n=Gn();return _e=function(t){if(!n(t))return!1;var r=e(t);return"[object Function]"==r||"[object GeneratorFunction]"==r||"[object AsyncFunction]"==r||"[object Proxy]"==r}}function $n(){if(Pe)return Ne;Pe=1;var e=Function.prototype.toString;return Ne=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function Kn(){if(Te)return ze;Te=1;var e=function(){if(je)return Oe;je=1;var e=qn(),n=function(){if(Me)return Ce;Me=1;var e,n=function(){if(ke)return Se;ke=1;var e=Fn()["__core-js_shared__"];return Se=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Ce=function(e){return!!t&&t in e}}(),t=Gn(),r=$n(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,s=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return Oe=function(i){return!(!t(i)||n(i))&&(e(i)?s:o).test(r(i))}}(),n=Ae?Ie:(Ae=1,Ie=function(e,n){return null==e?void 0:e[n]});return ze=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function Qn(){if(Be)return Le;Be=1;var e=Kn()(Fn(),"Map");return Le=e}function Jn(){if(Re)return De;Re=1;var e=Kn()(Object,"create");return De=e}function et(){if(rn)return tn;rn=1;var e=nn?en:(nn=1,en=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return tn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},tn}function nt(){if(vn)return hn;vn=1;var e=function(){if(Je)return Qe;Je=1;var e=function(){if(Ke)return $e;Ke=1;var e=function(){if(He)return Ve;He=1;var e=Jn();return Ve=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Xe?Ye:(Xe=1,Ye=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(Fe)return Ze;Fe=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Ze=function(t){var r=this.__data__;if(e){var o=r[t];return"__lodash_hash_undefined__"===o?void 0:o}return n.call(r,t)?r[t]:void 0}}(),r=function(){if(We)return Ue;We=1;var e=Jn(),n=Object.prototype.hasOwnProperty;return Ue=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(qe)return Ge;qe=1;var e=Jn();return Ge=function(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=e&&void 0===t?"__lodash_hash_undefined__":t,this}}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,$e=i}(),n=Xn(),t=Qn();return Qe=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(an)return on;an=1;var e=et();return on=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(cn)return un;cn=1;var e=et();return un=function(n){return e(this,n).get(n)}}(),r=function(){if(ln)return sn;ln=1;var e=et();return sn=function(n){return e(this,n).has(n)}}(),o=function(){if(fn)return dn;fn=1;var e=et();return dn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},dn}();function i(e){var n=-1,t=null==e?0:e.length;for(this.clear();++n<t;){var r=e[n];this.set(r[0],r[1])}}return i.prototype.clear=e,i.prototype.delete=n,i.prototype.get=t,i.prototype.has=r,i.prototype.set=o,hn=i}function tt(){if(mn)return yn;mn=1;var e=Xn(),n=function(){if(ne)return ee;ne=1;var e=Xn();return ee=function(){this.__data__=new e,this.size=0}}(),t=re?te:(re=1,te=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=ie?oe:(ie=1,oe=function(e){return this.__data__.get(e)}),o=ue?ae:(ue=1,ae=function(e){return this.__data__.has(e)}),i=function(){if(gn)return pn;gn=1;var e=Xn(),n=Qn(),t=nt();return pn=function(r,o){var i=this.__data__;if(i instanceof e){var a=i.__data__;if(!n||a.length<199)return a.push([r,o]),this.size=++i.size,this;i=this.__data__=new t(a)}return i.set(r,o),this.size=i.size,this}}();function a(n){var t=this.__data__=new e(n);this.size=t.size}return a.prototype.clear=n,a.prototype.delete=t,a.prototype.get=r,a.prototype.has=o,a.prototype.set=i,yn=a}function rt(){return bn||(bn=1,xn=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),xn}function ot(){if(_n)return wn;_n=1;var e=Kn(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return wn=n}function it(){if(Sn)return En;Sn=1;var e=ot();return En=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function at(){if(Cn)return kn;Cn=1;var e=it(),n=Hn(),t=Object.prototype.hasOwnProperty;return kn=function(r,o,i){var a=r[o];t.call(r,o)&&n(a,i)&&(void 0!==i||o in r)||e(r,o,i)}}function ut(){if(Nn)return Mn;Nn=1;var e=at(),n=it();return Mn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var s=r[u],l=i?i(o[s],t[s],s,o,t):void 0;void 0===l&&(l=t[s]),a?n(o,s,l):e(o,s,l)}return o}}function ct(){return In?jn:(In=1,jn=function(e){return null!=e&&"object"==typeof e})}function st(){if(Ln)return Tn;Ln=1;var e=function(){if(zn)return An;zn=1;var e=Wn(),n=ct();return An=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=ct(),t=Object.prototype,r=t.hasOwnProperty,o=t.propertyIsEnumerable,i=e(function(){return arguments}())?e:function(e){return n(e)&&r.call(e,"callee")&&!o.call(e,"callee")};return Tn=i}function lt(){if(Dn)return Bn;Dn=1;var e=Array.isArray;return Bn=e}var dt,ft,ht,vt,pt,gt,yt,mt,xt,bt,wt,_t={exports:{}};function Et(){return ht||(ht=1,function(e,n){var t=Fn(),r=ft?dt:(ft=1,dt=function(){return!1}),o=n&&!n.nodeType&&n,i=o&&e&&!e.nodeType&&e,a=i&&i.exports===o?t.Buffer:void 0,u=(a?a.isBuffer:void 0)||r;e.exports=u}(_t,_t.exports)),_t.exports}function St(){if(pt)return vt;pt=1;var e=/^(?:0|[1-9]\d*)$/;return vt=function(n,t){var r=typeof n;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&e.test(n))&&n>-1&&n%1==0&&n<t}}function kt(){return yt?gt:(yt=1,gt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Ct(){return wt?bt:(wt=1,bt=function(e){return function(n){return e(n)}})}_t.exports;var Mt,Nt,Pt,Ot,jt,It,At,zt,Tt,Lt,Bt,Dt,Rt,Vt,Ht,Yt,Xt,Zt,Ft,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er={exports:{}};function nr(){return Mt||(Mt=1,e=er,n=er.exports,t=Zn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r&&t.process,a=function(){try{return o&&o.require&&o.require("util").types||i&&i.binding&&i.binding("util")}catch(e){}}(),e.exports=a),er.exports;var e,n,t,r,o,i,a}function tr(){if(Pt)return Nt;Pt=1;var e=function(){if(xt)return mt;xt=1;var e=Wn(),n=kt(),t=ct(),r={};return r["[object Float32Array]"]=r["[object Float64Array]"]=r["[object Int8Array]"]=r["[object Int16Array]"]=r["[object Int32Array]"]=r["[object Uint8Array]"]=r["[object Uint8ClampedArray]"]=r["[object Uint16Array]"]=r["[object Uint32Array]"]=!0,r["[object Arguments]"]=r["[object Array]"]=r["[object ArrayBuffer]"]=r["[object Boolean]"]=r["[object DataView]"]=r["[object Date]"]=r["[object Error]"]=r["[object Function]"]=r["[object Map]"]=r["[object Number]"]=r["[object Object]"]=r["[object RegExp]"]=r["[object Set]"]=r["[object String]"]=r["[object WeakMap]"]=!1,mt=function(o){return t(o)&&n(o.length)&&!!r[e(o)]}}(),n=Ct(),t=nr(),r=t&&t.isTypedArray,o=r?n(r):e;return Nt=o}function rr(){if(jt)return Ot;jt=1;var e=On?Pn:(On=1,Pn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=st(),t=lt(),r=Et(),o=St(),i=tr(),a=Object.prototype.hasOwnProperty;return Ot=function(u,c){var s=t(u),l=!s&&n(u),d=!s&&!l&&r(u),f=!s&&!l&&!d&&i(u),h=s||l||d||f,v=h?e(u.length,String):[],p=v.length;for(var g in u)!c&&!a.call(u,g)||h&&("length"==g||d&&("offset"==g||"parent"==g)||f&&("buffer"==g||"byteLength"==g||"byteOffset"==g)||o(g,p))||v.push(g);return v},Ot}function or(){if(At)return It;At=1;var e=Object.prototype;return It=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function ir(){return Tt||(Tt=1,zt=function(e,n){return function(t){return e(n(t))}}),zt}function ar(){if(Rt)return Dt;Rt=1;var e=or(),n=function(){if(Bt)return Lt;Bt=1;var e=ir()(Object.keys,Object);return Lt=e}(),t=Object.prototype.hasOwnProperty;return Dt=function(r){if(!e(r))return n(r);var o=[];for(var i in Object(r))t.call(r,i)&&"constructor"!=i&&o.push(i);return o}}function ur(){if(Ht)return Vt;Ht=1;var e=qn(),n=kt();return Vt=function(t){return null!=t&&n(t.length)&&!e(t)}}function cr(){if(Xt)return Yt;Xt=1;var e=rr(),n=ar(),t=ur();return Yt=function(r){return t(r)?e(r):n(r)}}function sr(){if(Kt)return $t;Kt=1;var e=rr(),n=function(){if(qt)return Gt;qt=1;var e=Gn(),n=or(),t=Wt?Ut:(Wt=1,Ut=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return Gt=function(o){if(!e(o))return t(o);var i=n(o),a=[];for(var u in o)("constructor"!=u||!i&&r.call(o,u))&&a.push(u);return a}}(),t=ur();return $t=function(r){return t(r)?e(r,!0):n(r)}}er.exports;var lr,dr,fr,hr,vr,pr,gr,yr,mr,xr,br,wr,_r,Er,Sr,kr,Cr,Mr,Nr,Pr,Or,jr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Vr,Hr,Yr,Xr,Zr,Fr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,so,lo,fo,ho,vo,po,go,yo,mo,xo,bo,wo,_o,Eo,So,ko,Co,Mo,No,Po,Oo,jo,Io,Ao,zo,To,Lo,Bo,Do,Ro,Vo,Ho,Yo,Xo,Zo,Fo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,si,li,di,fi,hi,vi,pi,gi,yi,mi,xi,bi,wi,_i,Ei,Si,ki,Ci,Mi,Ni,Pi,Oi,ji,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Vi,Hi,Yi,Xi,Zi,Fi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,sa,la,da,fa,ha,va,pa,ga,ya,ma,xa,ba,wa,_a,Ea,Sa,ka,Ca,Ma,Na,Pa,Oa,ja,Ia,Aa,za,Ta,La,Ba,Da,Ra,Va,Ha,Ya,Xa,Za,Fa,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,su,lu,du,fu,hu,vu,pu,gu,yu,mu,xu,bu,wu,_u,Eu,Su,ku,Cu,Mu,Nu,Pu,Ou,ju,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Vu,Hu,Yu,Xu,Zu,Fu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,sc,lc,dc,fc,hc,vc,pc,gc,yc,mc,xc,bc,wc={exports:{}};function _c(){return lr||(lr=1,function(e,n){var t=Fn(),r=n&&!n.nodeType&&n,o=r&&e&&!e.nodeType&&e,i=o&&o.exports===r?t.Buffer:void 0,a=i?i.allocUnsafe:void 0;e.exports=function(e,n){if(n)return e.slice();var t=e.length,r=a?a(t):new e.constructor(t);return e.copy(r),r}}(wc,wc.exports)),wc.exports}function Ec(){return fr||(fr=1,dr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),dr}function Sc(){return vr||(vr=1,hr=function(e,n){for(var t=-1,r=null==e?0:e.length,o=0,i=[];++t<r;){var a=e[t];n(a,t,e)&&(i[o++]=a)}return i}),hr}function kc(){return gr?pr:(gr=1,pr=function(){return[]})}function Cc(){if(mr)return yr;mr=1;var e=Sc(),n=kc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return yr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Mc(){return _r||(_r=1,wr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),wr}function Nc(){if(Sr)return Er;Sr=1;var e=ir()(Object.getPrototypeOf,Object);return Er=e}function Pc(){if(Cr)return kr;Cr=1;var e=Mc(),n=Nc(),t=Cc(),r=kc(),o=Object.getOwnPropertySymbols;return kr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Oc(){if(Or)return Pr;Or=1;var e=Mc(),n=lt();return Pr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function jc(){if(Ir)return jr;Ir=1;var e=Oc(),n=Cc(),t=cr();return jr=function(r){return e(r,t,n)}}function Ic(){if(Vr)return Rr;Vr=1;var e=Kn()(Fn(),"Set");return Rr=e}function Ac(){if(Zr)return Xr;Zr=1;var e=function(){if(Lr)return Tr;Lr=1;var e=Kn()(Fn(),"DataView");return Tr=e}(),n=Qn(),t=function(){if(Dr)return Br;Dr=1;var e=Kn()(Fn(),"Promise");return Br=e}(),r=Ic(),o=function(){if(Yr)return Hr;Yr=1;var e=Kn()(Fn(),"WeakMap");return Hr=e}(),i=Wn(),a=$n(),u="[object Map]",c="[object Promise]",s="[object Set]",l="[object WeakMap]",d="[object DataView]",f=a(e),h=a(n),v=a(t),p=a(r),g=a(o),y=i;return(e&&y(new e(new ArrayBuffer(1)))!=d||n&&y(new n)!=u||t&&y(t.resolve())!=c||r&&y(new r)!=s||o&&y(new o)!=l)&&(y=function(e){var n=i(e),t="[object Object]"==n?e.constructor:void 0,r=t?a(t):"";if(r)switch(r){case f:return d;case h:return u;case v:return c;case p:return s;case g:return l}return n}),Xr=y}function zc(){if(Gr)return Wr;Gr=1;var e=Fn().Uint8Array;return Wr=e}function Tc(){if($r)return qr;$r=1;var e=zc();return qr=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Lc(){if(oo)return ro;oo=1;var e=Tc();return ro=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Bc(){if(co)return uo;co=1;var e=Gn(),n=Object.create,t=function(){function t(){}return function(r){if(!e(r))return{};if(n)return n(r);t.prototype=r;var o=new t;return t.prototype=void 0,o}}();return uo=t}function Dc(){if(lo)return so;lo=1;var e=Bc(),n=Nc(),t=or();return so=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function Rc(){if(wo)return bo;wo=1;var e=tt(),n=rt(),t=at(),r=function(){if(Ft)return Zt;Ft=1;var e=ut(),n=cr();return Zt=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(Jt)return Qt;Jt=1;var e=ut(),n=sr();return Qt=function(t,r){return t&&e(r,n(r),t)}}(),i=_c(),a=Ec(),u=function(){if(br)return xr;br=1;var e=ut(),n=Cc();return xr=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Nr)return Mr;Nr=1;var e=ut(),n=Pc();return Mr=function(t,r){return e(t,n(t),r)}}(),s=jc(),l=function(){if(zr)return Ar;zr=1;var e=Oc(),n=Pc(),t=sr();return Ar=function(r){return e(r,t,n)}}(),d=Ac(),f=function(){if(Ur)return Fr;Ur=1;var e=Object.prototype.hasOwnProperty;return Fr=function(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&e.call(n,"index")&&(r.index=n.index,r.input=n.input),r},Fr}(),h=function(){if(ao)return io;ao=1;var e=Tc(),n=function(){if(Qr)return Kr;Qr=1;var e=Tc();return Kr=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(eo)return Jr;eo=1;var e=/\w*$/;return Jr=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(to)return no;to=1;var e=Un(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return no=function(e){return t?Object(t.call(e)):{}}}(),o=Lc();return io=function(i,a,u){var c=i.constructor;switch(a){case"[object ArrayBuffer]":return e(i);case"[object Boolean]":case"[object Date]":return new c(+i);case"[object DataView]":return n(i,u);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return o(i,u);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(i);case"[object RegExp]":return t(i);case"[object Symbol]":return r(i)}}}(),v=Dc(),p=lt(),g=Et(),y=function(){if(po)return vo;po=1;var e=function(){if(ho)return fo;ho=1;var e=Ac(),n=ct();return fo=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isMap,o=r?n(r):e;return vo=o}(),m=Gn(),x=function(){if(xo)return mo;xo=1;var e=function(){if(yo)return go;yo=1;var e=Ac(),n=ct();return go=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Ct(),t=nr(),r=t&&t.isSet,o=r?n(r):e;return mo=o}(),b=cr(),w=sr(),_="[object Arguments]",E="[object Function]",S="[object Object]",k={};return k[_]=k["[object Array]"]=k["[object ArrayBuffer]"]=k["[object DataView]"]=k["[object Boolean]"]=k["[object Date]"]=k["[object Float32Array]"]=k["[object Float64Array]"]=k["[object Int8Array]"]=k["[object Int16Array]"]=k["[object Int32Array]"]=k["[object Map]"]=k["[object Number]"]=k[S]=k["[object RegExp]"]=k["[object Set]"]=k["[object String]"]=k["[object Symbol]"]=k["[object Uint8Array]"]=k["[object Uint8ClampedArray]"]=k["[object Uint16Array]"]=k["[object Uint32Array]"]=!0,k["[object Error]"]=k[E]=k["[object WeakMap]"]=!1,bo=function C(M,N,P,O,j,I){var A,z=1&N,T=2&N,L=4&N;if(P&&(A=j?P(M,O,j,I):P(M)),void 0!==A)return A;if(!m(M))return M;var B=p(M);if(B){if(A=f(M),!z)return a(M,A)}else{var D=d(M),R=D==E||"[object GeneratorFunction]"==D;if(g(M))return i(M,z);if(D==S||D==_||R&&!j){if(A=T||R?{}:v(M),!z)return T?c(M,o(A,M)):u(M,r(A,M))}else{if(!k[D])return j?M:{};A=h(M,D,z)}}I||(I=new e);var V=I.get(M);if(V)return V;I.set(M,A),x(M)?M.forEach((function(e){A.add(C(e,N,P,e,M,I))})):y(M)&&M.forEach((function(e,n){A.set(n,C(e,N,P,n,M,I))}));var H=B?void 0:(L?T?l:s:T?w:b)(M);return n(H||M,(function(e,n){H&&(e=M[n=e]),t(A,n,C(e,N,P,n,M,I))})),A},bo}function Vc(){if(Eo)return _o;Eo=1;var e=Rc();return _o=function(n){return e(n,4)}}function Hc(){return ko?So:(ko=1,So=function(e){return function(){return e}})}function Yc(){if(Po)return No;Po=1;var e=(Mo?Co:(Mo=1,Co=function(e){return function(n,t,r){for(var o=-1,i=Object(n),a=r(n),u=a.length;u--;){var c=a[e?u:++o];if(!1===t(i[c],c,i))break}return n}}))();return No=e}function Xc(){if(jo)return Oo;jo=1;var e=Yc(),n=cr();return Oo=function(t,r){return t&&e(t,r,n)}}function Zc(){if(To)return zo;To=1;var e=Xc(),n=function(){if(Ao)return Io;Ao=1;var e=ur();return Io=function(n,t){return function(r,o){if(null==r)return r;if(!e(r))return n(r,o);for(var i=r.length,a=t?i:-1,u=Object(r);(t?a--:++a<i)&&!1!==o(u[a],a,u););return r}}}(),t=n(e);return zo=t}function Fc(){return Bo?Lo:(Bo=1,Lo=function(e){return e})}function Uc(){if(Ro)return Do;Ro=1;var e=Fc();return Do=function(n){return"function"==typeof n?n:e}}function Wc(){if(Ho)return Vo;Ho=1;var e=rt(),n=Zc(),t=Uc(),r=lt();return Vo=function(o,i){return(r(o)?e:n)(o,t(i))}}function Gc(){return Xo?Yo:(Xo=1,Yo=Wc())}function qc(){if(Ko)return $o;Ko=1;var e=nt(),n=Wo?Uo:(Wo=1,Uo=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=qo?Go:(qo=1,Go=function(e){return this.__data__.has(e)});function r(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new e;++t<r;)this.add(n[t])}return r.prototype.add=r.prototype.push=n,r.prototype.has=t,$o=r}function $c(){return ni?ei:(ni=1,ei=function(e,n){return e.has(n)})}function Kc(){if(ri)return ti;ri=1;var e=qc(),n=(Jo||(Jo=1,Qo=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r;)if(n(e[t],t,e))return!0;return!1}),Qo),t=$c();return ti=function(r,o,i,a,u,c){var s=1&i,l=r.length,d=o.length;if(l!=d&&!(s&&d>l))return!1;var f=c.get(r),h=c.get(o);if(f&&h)return f==o&&h==r;var v=-1,p=!0,g=2&i?new e:void 0;for(c.set(r,o),c.set(o,r);++v<l;){var y=r[v],m=o[v];if(a)var x=s?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==x){if(x)continue;p=!1;break}if(g){if(!n(o,(function(e,n){if(!t(g,n)&&(y===e||u(y,e,i,a,c)))return g.push(n)}))){p=!1;break}}else if(y!==m&&!u(y,m,i,a,c)){p=!1;break}}return c.delete(r),c.delete(o),p},ti}function Qc(){return ui||(ui=1,ai=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),ai}function Jc(){if(hi)return fi;hi=1;var e=tt(),n=Kc(),t=function(){if(si)return ci;si=1;var e=Un(),n=zc(),t=Hn(),r=Kc(),o=(ii||(ii=1,oi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),oi),i=Qc(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return ci=function(e,a,c,s,l,d,f){switch(c){case"[object DataView]":if(e.byteLength!=a.byteLength||e.byteOffset!=a.byteOffset)return!1;e=e.buffer,a=a.buffer;case"[object ArrayBuffer]":return!(e.byteLength!=a.byteLength||!d(new n(e),new n(a)));case"[object Boolean]":case"[object Date]":case"[object Number]":return t(+e,+a);case"[object Error]":return e.name==a.name&&e.message==a.message;case"[object RegExp]":case"[object String]":return e==a+"";case"[object Map]":var h=o;case"[object Set]":var v=1&s;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;s|=2,f.set(e,a);var g=r(h(e),h(a),s,l,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(di)return li;di=1;var e=jc(),n=Object.prototype.hasOwnProperty;return li=function(t,r,o,i,a,u){var c=1&o,s=e(t),l=s.length;if(l!=e(r).length&&!c)return!1;for(var d=l;d--;){var f=s[d];if(!(c?f in r:n.call(r,f)))return!1}var h=u.get(t),v=u.get(r);if(h&&v)return h==r&&v==t;var p=!0;u.set(t,r),u.set(r,t);for(var g=c;++d<l;){var y=t[f=s[d]],m=r[f];if(i)var x=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===x?y===m||a(y,m,o,i,u):x)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,w=r.constructor;b==w||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof w&&w instanceof w||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Ac(),i=lt(),a=Et(),u=tr(),c="[object Arguments]",s="[object Array]",l="[object Object]",d=Object.prototype.hasOwnProperty;return fi=function(f,h,v,p,g,y){var m=i(f),x=i(h),b=m?s:o(f),w=x?s:o(h),_=(b=b==c?l:b)==l,E=(w=w==c?l:w)==l,S=b==w;if(S&&a(f)){if(!a(h))return!1;m=!0,_=!1}if(S&&!_)return y||(y=new e),m||u(f)?n(f,h,v,p,g,y):t(f,h,b,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),C=E&&d.call(h,"__wrapped__");if(k||C){var M=k?f.value():f,N=C?h.value():h;return y||(y=new e),g(M,N,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function es(){if(pi)return vi;pi=1;var e=Jc(),n=ct();return vi=function t(r,o,i,a,u){return r===o||(null==r||null==o||!n(r)&&!n(o)?r!=r&&o!=o:e(r,o,i,a,t,u))},vi}function ns(){if(xi)return mi;xi=1;var e=Gn();return mi=function(n){return n==n&&!e(n)}}function ts(){return Ei?_i:(Ei=1,_i=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function rs(){if(Mi)return Ci;Mi=1;var e=Wn(),n=ct();return Ci=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function os(){if(Pi)return Ni;Pi=1;var e=lt(),n=rs(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Ni=function(o,i){if(e(o))return!1;var a=typeof o;return!("number"!=a&&"symbol"!=a&&"boolean"!=a&&null!=o&&!n(o))||r.test(o)||!t.test(o)||null!=i&&o in Object(i)}}function is(){return Bi||(Bi=1,Li=function(e,n){for(var t=-1,r=null==e?0:e.length,o=Array(r);++t<r;)o[t]=n(e[t],t,e);return o}),Li}function as(){if(Hi)return Vi;Hi=1;var e=function(){if(Ri)return Di;Ri=1;var e=Un(),n=is(),t=lt(),r=rs(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Di=function e(o){if("string"==typeof o)return o;if(t(o))return n(o,e)+"";if(r(o))return i?i.call(o):"";var a=o+"";return"0"==a&&1/o==-1/0?"-0":a},Di}();return Vi=function(n){return null==n?"":e(n)}}function us(){if(Xi)return Yi;Xi=1;var e=lt(),n=os(),t=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ai)return Ii;Ai=1;var e=function(){if(ji)return Oi;ji=1;var e=nt();function n(t,r){if("function"!=typeof t||null!=r&&"function"!=typeof r)throw new TypeError("Expected a function");var o=function(){var e=arguments,n=r?r.apply(this,e):e[0],i=o.cache;if(i.has(n))return i.get(n);var a=t.apply(this,e);return o.cache=i.set(n,a)||i,a};return o.cache=new(n.Cache||e),o}return n.Cache=e,Oi=n}();return Ii=function(n){var t=e(n,(function(e){return 500===r.size&&r.clear(),e})),r=t.cache;return t}}(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,t=/\\(\\)?/g,r=e((function(e){var r=[];return 46===e.charCodeAt(0)&&r.push(""),e.replace(n,(function(e,n,o,i){r.push(o?i.replace(t,"$1"):n||e)})),r}));return zi=r}(),r=as();return Yi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function cs(){if(Fi)return Zi;Fi=1;var e=rs();return Zi=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function ss(){if(Wi)return Ui;Wi=1;var e=us(),n=cs();return Ui=function(t,r){for(var o=0,i=(r=e(r,t)).length;null!=t&&o<i;)t=t[n(r[o++])];return o&&o==i?t:void 0}}function ls(){if(Ji)return Qi;Ji=1;var e=us(),n=st(),t=lt(),r=St(),o=kt(),i=cs();return Qi=function(a,u,c){for(var s=-1,l=(u=e(u,a)).length,d=!1;++s<l;){var f=i(u[s]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++s!=l?d:!!(l=null==a?0:a.length)&&o(l)&&r(f,l)&&(t(a)||n(a))}}function ds(){if(na)return ea;na=1;var e=Ki?$i:(Ki=1,$i=function(e,n){return null!=e&&n in Object(e)}),n=ls();return ea=function(t,r){return null!=t&&n(t,r,e)}}function fs(){return ia?oa:(ia=1,oa=function(e){return function(n){return null==n?void 0:n[e]}})}function hs(){if(da)return la;da=1;var e=function(){if(ki)return Si;ki=1;var e=function(){if(yi)return gi;yi=1;var e=tt(),n=es();return gi=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var s=o[a];if(c&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++a<u;){var l=(s=o[a])[0],d=t[l],f=s[1];if(c&&s[2]){if(void 0===d&&!(l in t))return!1}else{var h=new e;if(i)var v=i(d,f,l,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(wi)return bi;wi=1;var e=ns(),n=cr();return bi=function(t){for(var r=n(t),o=r.length;o--;){var i=r[o],a=t[i];r[o]=[i,a,e(a)]}return r}}(),t=ts();return Si=function(r){var o=n(r);return 1==o.length&&o[0][2]?t(o[0][0],o[0][1]):function(n){return n===r||e(n,r,o)}}}(),n=function(){if(ra)return ta;ra=1;var e=es(),n=function(){if(qi)return Gi;qi=1;var e=ss();return Gi=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=ds(),r=os(),o=ns(),i=ts(),a=cs();return ta=function(u,c){return r(u)&&o(c)?i(a(u),c):function(r){var o=n(r,u);return void 0===o&&o===c?t(r,u):e(c,o,3)}}}(),t=Fc(),r=lt(),o=function(){if(sa)return ca;sa=1;var e=fs(),n=function(){if(ua)return aa;ua=1;var e=ss();return aa=function(n){return function(t){return e(t,n)}}}(),t=os(),r=cs();return ca=function(o){return t(o)?e(r(o)):n(o)}}();return la=function(i){return"function"==typeof i?i:null==i?t:"object"==typeof i?r(i)?n(i[0],i[1]):e(i):o(i)}}function vs(){if(ha)return fa;ha=1;var e=Sc(),n=function(){if(Fo)return Zo;Fo=1;var e=Zc();return Zo=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=hs(),r=lt();return fa=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function ps(){if(ya)return ga;ya=1;var e=function(){if(pa)return va;pa=1;var e=Object.prototype.hasOwnProperty;return va=function(n,t){return null!=n&&e.call(n,t)}}(),n=ls();return ga=function(t,r){return null!=t&&n(t,r,e)}}function gs(){if(xa)return ma;xa=1;var e=ar(),n=Ac(),t=st(),r=lt(),o=ur(),i=Et(),a=or(),u=tr(),c=Object.prototype.hasOwnProperty;return ma=function(s){if(null==s)return!0;if(o(s)&&(r(s)||"string"==typeof s||"function"==typeof s.splice||i(s)||u(s)||t(s)))return!s.length;var l=n(s);if("[object Map]"==l||"[object Set]"==l)return!s.size;if(a(s))return!e(s).length;for(var d in s)if(c.call(s,d))return!1;return!0}}function ys(){return wa?ba:(wa=1,ba=function(e){return void 0===e})}function ms(){if(Ea)return _a;Ea=1;var e=Zc(),n=ur();return _a=function(t,r){var o=-1,i=n(t)?Array(t.length):[];return e(t,(function(e,n,t){i[++o]=r(e,n,t)})),i}}function xs(){if(ka)return Sa;ka=1;var e=is(),n=hs(),t=ms(),r=lt();return Sa=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function bs(){if(ja)return Oa;ja=1;var e=(Ma||(Ma=1,Ca=function(e,n,t,r){var o=-1,i=null==e?0:e.length;for(r&&i&&(t=e[++o]);++o<i;)t=n(t,e[o],o,e);return t}),Ca),n=Zc(),t=hs(),r=Pa?Na:(Pa=1,Na=function(e,n,t,r,o){return o(e,(function(e,o,i){t=r?(r=!1,e):n(t,e,o,i)})),t}),o=lt();return Oa=function(i,a,u){var c=o(i)?e:r,s=arguments.length<3;return c(i,t(a,4),u,s,n)},Oa}function ws(){if(Xa)return Ya;Xa=1;var e=ar(),n=Ac(),t=ur(),r=function(){if(Aa)return Ia;Aa=1;var e=Wn(),n=lt(),t=ct();return Ia=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ha)return Va;Ha=1;var e=function(){if(Ta)return za;Ta=1;var e=fs()("length");return za=e}(),n=function(){if(Ba)return La;Ba=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return La=function(n){return e.test(n)}}(),t=function(){if(Ra)return Da;Ra=1;var e="\\ud800-\\udfff",n="["+e+"]",t="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",r="\\ud83c[\\udffb-\\udfff]",o="[^"+e+"]",i="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",u="(?:"+t+"|"+r+")?",c="[\\ufe0e\\ufe0f]?",s=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",l="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+l+s,"g");return Da=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return Va=function(r){return n(r)?t(r):e(r)}}();return Ya=function(i){if(null==i)return 0;if(t(i))return r(i)?o(i):i.length;var a=n(i);return"[object Map]"==a||"[object Set]"==a?i.size:e(i).length}}function _s(){if(Fa)return Za;Fa=1;var e=rt(),n=Bc(),t=Xc(),r=hs(),o=Nc(),i=lt(),a=Et(),u=qn(),c=Gn(),s=tr();return Za=function(l,d,f){var h=i(l),v=h||a(l)||s(l);if(d=r(d,4),null==f){var p=l&&l.constructor;f=v?h?new p:[]:c(l)&&u(p)?n(o(l)):{}}return(v?e:t)(l,(function(e,n,t){return d(f,e,n,t)})),f}}function Es(){if(qa)return Ga;qa=1;var e=Mc(),n=function(){if(Wa)return Ua;Wa=1;var e=Un(),n=st(),t=lt(),r=e?e.isConcatSpreadable:void 0;return Ua=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return Ga=function t(r,o,i,a,u){var c=-1,s=r.length;for(i||(i=n),u||(u=[]);++c<s;){var l=r[c];o>0&&i(l)?o>1?t(l,o-1,i,a,u):e(u,l):a||(u[u.length]=l)}return u},Ga}function Ss(){if(Ja)return Qa;Ja=1;var e=Ka?$a:(Ka=1,$a=function(e,n,t){switch(t.length){case 0:return e.call(n);case 1:return e.call(n,t[0]);case 2:return e.call(n,t[0],t[1]);case 3:return e.call(n,t[0],t[1],t[2])}return e.apply(n,t)}),n=Math.max;return Qa=function(t,r,o){return r=n(void 0===r?t.length-1:r,0),function(){for(var i=arguments,a=-1,u=n(i.length-r,0),c=Array(u);++a<u;)c[a]=i[r+a];a=-1;for(var s=Array(r+1);++a<r;)s[a]=i[a];return s[r]=o(c),e(t,this,s)}},Qa}function ks(){if(iu)return ou;iu=1;var e=function(){if(nu)return eu;nu=1;var e=Hc(),n=ot(),t=Fc();return eu=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(ru)return tu;ru=1;var e=Date.now;return tu=function(n){var t=0,r=0;return function(){var o=e(),i=16-(o-r);if(r=o,i>0){if(++t>=800)return arguments[0]}else t=0;return n.apply(void 0,arguments)}},tu}(),t=n(e);return ou=t}function Cs(){if(uu)return au;uu=1;var e=Fc(),n=Ss(),t=ks();return au=function(r,o){return t(n(r,o,e),r+"")},au}function Ms(){return su||(su=1,cu=function(e,n,t,r){for(var o=e.length,i=t+(r?1:-1);r?i--:++i<o;)if(n(e[i],i,e))return i;return-1}),cu}function Ns(){if(ku)return Su;ku=1;var e=qc(),n=function(){if(yu)return gu;yu=1;var e=function(){if(pu)return vu;pu=1;var e=Ms(),n=du?lu:(du=1,lu=function(e){return e!=e}),t=(hu||(hu=1,fu=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),fu);return vu=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},vu}();return gu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},gu}(),t=(xu||(xu=1,mu=function(e,n,t){for(var r=-1,o=null==e?0:e.length;++r<o;)if(t(n,e[r]))return!0;return!1}),mu),r=$c(),o=function(){if(Eu)return _u;Eu=1;var e=Ic(),n=wu?bu:(wu=1,bu=function(){}),t=Qc(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return _u=r}(),i=Qc();return Su=function(a,u,c){var s=-1,l=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,l=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,l=r,v=new e}else v=u?[]:h;e:for(;++s<d;){var g=a[s],y=u?u(g):g;if(g=c||0!==g?g:0,f&&y==y){for(var m=v.length;m--;)if(v[m]===y)continue e;u&&v.push(y),h.push(g)}else l(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},Su}function Ps(){if(Mu)return Cu;Mu=1;var e=ur(),n=ct();return Cu=function(t){return n(t)&&e(t)}}function Os(){if(Pu)return Nu;Pu=1;var e=Es(),n=Cs(),t=Ns(),r=Ps(),o=n((function(n){return t(e(n,1,r,!0))}));return Nu=o}function js(){if(Au)return Iu;Au=1;var e=function(){if(ju)return Ou;ju=1;var e=is();return Ou=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=cr();return Iu=function(t){return null==t?[]:e(t,n(t))}}function Is(){if(Tu)return zu;var e;Tu=1;try{e={clone:Vc(),constant:Hc(),each:Gc(),filter:vs(),has:ps(),isArray:lt(),isEmpty:gs(),isFunction:qn(),isUndefined:ys(),keys:cr(),map:xs(),reduce:bs(),size:ws(),transform:_s(),union:Os(),values:js()}}catch(e){}return e||(e=window._),zu=e}function As(){if(Bu)return Lu;Bu=1;var e=Is();Lu=o;var n="\0",t="\0",r="";function o(n){this._isDirected=!e.has(n,"directed")||n.directed,this._isMultigraph=!!e.has(n,"multigraph")&&n.multigraph,this._isCompound=!!e.has(n,"compound")&&n.compound,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[t]={}),this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={}}function i(e,n){e[n]?e[n]++:e[n]=1}function a(e,n){--e[n]||delete e[n]}function u(t,o,i,a){var u=""+o,c=""+i;if(!t&&u>c){var s=u;u=c,c=s}return u+r+c+r+(e.isUndefined(a)?n:a)}function c(e,n){return u(e,n.v,n.w,n.name)}return o.prototype._nodeCount=0,o.prototype._edgeCount=0,o.prototype.isDirected=function(){return this._isDirected},o.prototype.isMultigraph=function(){return this._isMultigraph},o.prototype.isCompound=function(){return this._isCompound},o.prototype.setGraph=function(e){return this._label=e,this},o.prototype.graph=function(){return this._label},o.prototype.setDefaultNodeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultNodeLabelFn=n,this},o.prototype.nodeCount=function(){return this._nodeCount},o.prototype.nodes=function(){return e.keys(this._nodes)},o.prototype.sources=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._in[t])}))},o.prototype.sinks=function(){var n=this;return e.filter(this.nodes(),(function(t){return e.isEmpty(n._out[t])}))},o.prototype.setNodes=function(n,t){var r=arguments,o=this;return e.each(n,(function(e){r.length>1?o.setNode(e,t):o.setNode(e)})),this},o.prototype.setNode=function(n,r){return e.has(this._nodes,n)?(arguments.length>1&&(this._nodes[n]=r),this):(this._nodes[n]=arguments.length>1?r:this._defaultNodeLabelFn(n),this._isCompound&&(this._parent[n]=t,this._children[n]={},this._children[t][n]=!0),this._in[n]={},this._preds[n]={},this._out[n]={},this._sucs[n]={},++this._nodeCount,this)},o.prototype.node=function(e){return this._nodes[e]},o.prototype.hasNode=function(n){return e.has(this._nodes,n)},o.prototype.removeNode=function(n){var t=this;if(e.has(this._nodes,n)){var r=function(e){t.removeEdge(t._edgeObjs[e])};delete this._nodes[n],this._isCompound&&(this._removeFromParentsChildList(n),delete this._parent[n],e.each(this.children(n),(function(e){t.setParent(e)})),delete this._children[n]),e.each(e.keys(this._in[n]),r),delete this._in[n],delete this._preds[n],e.each(e.keys(this._out[n]),r),delete this._out[n],delete this._sucs[n],--this._nodeCount}return this},o.prototype.setParent=function(n,r){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e.isUndefined(r))r=t;else{for(var o=r+="";!e.isUndefined(o);o=this.parent(o))if(o===n)throw new Error("Setting "+r+" as parent of "+n+" would create a cycle");this.setNode(r)}return this.setNode(n),this._removeFromParentsChildList(n),this._parent[n]=r,this._children[r][n]=!0,this},o.prototype._removeFromParentsChildList=function(e){delete this._children[this._parent[e]][e]},o.prototype.parent=function(e){if(this._isCompound){var n=this._parent[e];if(n!==t)return n}},o.prototype.children=function(n){if(e.isUndefined(n)&&(n=t),this._isCompound){var r=this._children[n];if(r)return e.keys(r)}else{if(n===t)return this.nodes();if(this.hasNode(n))return[]}},o.prototype.predecessors=function(n){var t=this._preds[n];if(t)return e.keys(t)},o.prototype.successors=function(n){var t=this._sucs[n];if(t)return e.keys(t)},o.prototype.neighbors=function(n){var t=this.predecessors(n);if(t)return e.union(t,this.successors(n))},o.prototype.isLeaf=function(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length},o.prototype.filterNodes=function(n){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var r=this;e.each(this._nodes,(function(e,r){n(r)&&t.setNode(r,e)})),e.each(this._edgeObjs,(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,r.edge(e))}));var o={};function i(e){var n=r.parent(e);return void 0===n||t.hasNode(n)?(o[e]=n,n):n in o?o[n]:i(n)}return this._isCompound&&e.each(t.nodes(),(function(e){t.setParent(e,i(e))})),t},o.prototype.setDefaultEdgeLabel=function(n){return e.isFunction(n)||(n=e.constant(n)),this._defaultEdgeLabelFn=n,this},o.prototype.edgeCount=function(){return this._edgeCount},o.prototype.edges=function(){return e.values(this._edgeObjs)},o.prototype.setPath=function(n,t){var r=this,o=arguments;return e.reduce(n,(function(e,n){return o.length>1?r.setEdge(e,n,t):r.setEdge(e,n),n})),this},o.prototype.setEdge=function(){var n,t,r,o,a=!1,c=arguments[0];"object"==typeof c&&null!==c&&"v"in c?(n=c.v,t=c.w,r=c.name,2===arguments.length&&(o=arguments[1],a=!0)):(n=c,t=arguments[1],r=arguments[3],arguments.length>2&&(o=arguments[2],a=!0)),n=""+n,t=""+t,e.isUndefined(r)||(r=""+r);var s=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,s))return a&&(this._edgeLabels[s]=o),this;if(!e.isUndefined(r)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(n),this.setNode(t),this._edgeLabels[s]=a?o:this._defaultEdgeLabelFn(n,t,r);var l=function(e,n,t,r){var o=""+n,i=""+t;if(!e&&o>i){var a=o;o=i,i=a}var u={v:o,w:i};return r&&(u.name=r),u}(this._isDirected,n,t,r);return n=l.v,t=l.w,Object.freeze(l),this._edgeObjs[s]=l,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][s]=l,this._out[n][s]=l,this._edgeCount++,this},o.prototype.edge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t);return this._edgeLabels[r]},o.prototype.hasEdge=function(n,t,r){var o=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,n,t,r);return e.has(this._edgeLabels,o)},o.prototype.removeEdge=function(e,n,t){var r=1===arguments.length?c(this._isDirected,arguments[0]):u(this._isDirected,e,n,t),o=this._edgeObjs[r];return o&&(e=o.v,n=o.w,delete this._edgeLabels[r],delete this._edgeObjs[r],a(this._preds[n],e),a(this._sucs[e],n),delete this._in[n][r],delete this._out[e][r],this._edgeCount--),this},o.prototype.inEdges=function(n,t){var r=this._in[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.v===t})):o}},o.prototype.outEdges=function(n,t){var r=this._out[n];if(r){var o=e.values(r);return t?e.filter(o,(function(e){return e.w===t})):o}},o.prototype.nodeEdges=function(e,n){var t=this.inEdges(e,n);if(t)return t.concat(this.outEdges(e,n))},Lu}function zs(){if(Xu)return Yu;Xu=1;var e=Is(),n=As();function t(n){return e.map(n.nodes(),(function(t){var r=n.node(t),o=n.parent(t),i={v:t};return e.isUndefined(r)||(i.value=r),e.isUndefined(o)||(i.parent=o),i}))}function r(n){return e.map(n.edges(),(function(t){var r=n.edge(t),o={v:t.v,w:t.w};return e.isUndefined(t.name)||(o.name=t.name),e.isUndefined(r)||(o.value=r),o}))}return Yu={write:function(n){var o={options:{directed:n.isDirected(),multigraph:n.isMultigraph(),compound:n.isCompound()},nodes:t(n),edges:r(n)};return e.isUndefined(n.graph())||(o.value=e.clone(n.graph())),o},read:function(t){var r=new n(t.options).setGraph(t.value);return e.each(t.nodes,(function(e){r.setNode(e.v,e.value),e.parent&&r.setParent(e.v,e.parent)})),e.each(t.edges,(function(e){r.setEdge({v:e.v,w:e.w,name:e.name},e.value)})),r}}}function Ts(){if(Fu)return Zu;Fu=1;var e=Is();return Zu=function(n){var t,r={},o=[];function i(o){e.has(r,o)||(r[o]=!0,t.push(o),e.each(n.successors(o),i),e.each(n.predecessors(o),i))}return e.each(n.nodes(),(function(e){t=[],i(e),t.length&&o.push(t)})),o},Zu}function Ls(){if(Wu)return Uu;Wu=1;var e=Is();function n(){this._arr=[],this._keyIndices={}}return Uu=n,n.prototype.size=function(){return this._arr.length},n.prototype.keys=function(){return this._arr.map((function(e){return e.key}))},n.prototype.has=function(n){return e.has(this._keyIndices,n)},n.prototype.priority=function(e){var n=this._keyIndices[e];if(void 0!==n)return this._arr[n].priority},n.prototype.min=function(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key},n.prototype.add=function(n,t){var r=this._keyIndices;if(n=String(n),!e.has(r,n)){var o=this._arr,i=o.length;return r[n]=i,o.push({key:n,priority:t}),this._decrease(i),!0}return!1},n.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key},n.prototype.decrease=function(e,n){var t=this._keyIndices[e];if(n>this._arr[t].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[t].priority+" New: "+n);this._arr[t].priority=n,this._decrease(t)},n.prototype._heapify=function(e){var n=this._arr,t=2*e,r=t+1,o=e;t<n.length&&(o=n[t].priority<n[o].priority?t:o,r<n.length&&(o=n[r].priority<n[o].priority?r:o),o!==e&&(this._swap(e,o),this._heapify(o)))},n.prototype._decrease=function(e){for(var n,t=this._arr,r=t[e].priority;0!==e&&!(t[n=e>>1].priority<r);)this._swap(e,n),e=n},n.prototype._swap=function(e,n){var t=this._arr,r=this._keyIndices,o=t[e],i=t[n];t[e]=i,t[n]=o,r[i.key]=e,r[o.key]=n},Uu}function Bs(){if(qu)return Gu;qu=1;var e=Is(),n=Ls();Gu=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,s=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),s=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);s<t.distance&&(t.distance=s,t.predecessor=i,c.decrease(n,s))};for(e.nodes().forEach((function(e){var n=e===t?0:Number.POSITIVE_INFINITY;u[e]={distance:n},c.add(e,n)}));c.size()>0&&(i=c.removeMin(),(a=u[i]).distance!==Number.POSITIVE_INFINITY);)o(i).forEach(s);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return Gu}function Ds(){if(Ku)return $u;Ku=1;var e=Bs(),n=Is();return $u=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function Rs(){if(Ju)return Qu;Ju=1;var e=Is();return Qu=function(n){var t=0,r=[],o={},i=[];function a(u){var c=o[u]={onStack:!0,lowlink:t,index:t++};if(r.push(u),n.successors(u).forEach((function(n){e.has(o,n)?o[n].onStack&&(c.lowlink=Math.min(c.lowlink,o[n].index)):(a(n),c.lowlink=Math.min(c.lowlink,o[n].lowlink))})),c.lowlink===c.index){var s,l=[];do{s=r.pop(),o[s].onStack=!1,l.push(s)}while(u!==s);i.push(l)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},Qu}function Vs(){if(nc)return ec;nc=1;var e=Is(),n=Rs();return ec=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Hs(){if(rc)return tc;rc=1;var e=Is();tc=function(e,t,r){return function(e,n,t){var r={},o=e.nodes();return o.forEach((function(e){r[e]={},r[e][e]={distance:0},o.forEach((function(n){e!==n&&(r[e][n]={distance:Number.POSITIVE_INFINITY})})),t(e).forEach((function(t){var o=t.v===e?t.w:t.v,i=n(t);r[e][o]={distance:i,predecessor:e}}))})),o.forEach((function(e){var n=r[e];o.forEach((function(t){var i=r[t];o.forEach((function(t){var r=i[e],o=n[t],a=i[t],u=r.distance+o.distance;u<a.distance&&(a.distance=u,a.predecessor=o.predecessor)}))}))})),r}(e,t||n,r||function(n){return e.outEdges(n)})};var n=e.constant(1);return tc}function Ys(){if(ic)return oc;ic=1;var e=Is();function n(n){var r={},o={},i=[];if(e.each(n.sinks(),(function a(u){if(e.has(o,u))throw new t;e.has(r,u)||(o[u]=!0,r[u]=!0,e.each(n.predecessors(u),a),delete o[u],i.push(u))})),e.size(r)!==n.nodeCount())throw new t;return i}function t(){}return oc=n,n.CycleException=t,t.prototype=new Error,oc}function Xs(){if(uc)return ac;uc=1;var e=Ys();return ac=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function Zs(){if(sc)return cc;sc=1;var e=Is();function n(t,r,o,i,a,u){e.has(i,r)||(i[r]=!0,o||u.push(r),e.each(a(r),(function(e){n(t,e,o,i,a,u)})),o&&u.push(r))}return cc=function(t,r,o){e.isArray(r)||(r=[r]);var i=(t.isDirected()?t.successors:t.neighbors).bind(t),a=[],u={};return e.each(r,(function(e){if(!t.hasNode(e))throw new Error("Graph does not have node: "+e);n(t,e,"post"===o,u,i,a)})),a},cc}function Fs(){if(dc)return lc;dc=1;var e=Zs();return lc=function(n,t){return e(n,t,"post")}}function Us(){if(hc)return fc;hc=1;var e=Zs();return fc=function(n,t){return e(n,t,"pre")}}function Ws(){if(pc)return vc;pc=1;var e=Is(),n=As(),t=Ls();return vc=function(r,o){var i,a=new n,u={},c=new t;function s(e){var n=e.v===i?e.w:e.v,t=c.priority(n);if(void 0!==t){var r=o(e);r<t&&(u[n]=i,c.decrease(n,r))}}if(0===r.nodeCount())return a;e.each(r.nodes(),(function(e){c.add(e,Number.POSITIVE_INFINITY),a.setNode(e)})),c.decrease(r.nodes()[0],0);for(var l=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(l)throw new Error("Input graph is not connected: "+r);l=!0}r.nodeEdges(i).forEach(s)}return a},vc}wc.exports;try{bc=function(){if(xc)return mc;xc=1;var e=Hu?Vu:(Hu=1,Vu={Graph:As(),version:Ru?Du:(Ru=1,Du="2.1.8")});return mc={Graph:e.Graph,json:zs(),alg:yc?gc:(yc=1,gc={components:Ts(),dijkstra:Bs(),dijkstraAll:Ds(),findCycles:Vs(),floydWarshall:Hs(),isAcyclic:Xs(),postorder:Fs(),preorder:Us(),prim:Ws(),tarjan:Rs(),topsort:Ys()}),version:e.version}}()}catch(z){}bc||(bc=window.graphlib);var Gs,qs,$s,Ks,Qs,Js,el,nl,tl,rl,ol,il,al,ul,cl,sl,ll,dl,fl,hl,vl,pl,gl,yl,ml,xl,bl,wl,_l,El,Sl,kl,Cl,Ml,Nl,Pl,Ol,jl,Il,Al,zl,Tl,Ll,Bl,Dl,Rl,Vl,Hl,Yl,Xl,Zl,Fl,Ul,Wl,Gl,ql,$l,Kl,Ql,Jl,ed,nd,td,rd,od,id,ad,ud,cd,sd,ld,dd,fd,hd,vd,pd,gd,yd,md,xd,bd,wd,_d,Ed,Sd,kd,Cd,Md,Nd,Pd,Od,jd,Id,Ad=bc;function zd(){if(Ks)return $s;Ks=1;var e=Hn(),n=ur(),t=St(),r=Gn();return $s=function(o,i,a){if(!r(a))return!1;var u=typeof i;return!!("number"==u?n(a)&&t(i,a.length):"string"==u&&i in a)&&e(a[i],o)}}function Td(){if(sl)return cl;sl=1;var e=function(){if(ul)return al;ul=1;var e=function(){if(il)return ol;il=1;var e=function(){if(rl)return tl;rl=1;var e=/\s/;return tl=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return ol=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=Gn(),t=rs(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return al=function(u){if("number"==typeof u)return u;if(t(u))return NaN;if(n(u)){var c="function"==typeof u.valueOf?u.valueOf():u;u=n(c)?c+"":c}if("string"!=typeof u)return 0===u?u:+u;u=e(u);var s=o.test(u);return s||i.test(u)?a(u.slice(2),s?2:8):r.test(u)?NaN:+u}}(),n=1/0;return cl=function(t){return t?(t=e(t))===n||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}}function Ld(){if(yl)return gl;yl=1;var e=Es();return gl=function(n){return null!=n&&n.length?e(n,1):[]}}function Bd(){if(kl)return Sl;kl=1;var e=rs();return Sl=function(n,t,r){for(var o=-1,i=n.length;++o<i;){var a=n[o],u=t(a);if(null!=u&&(void 0===c?u==u&&!e(u):r(u,c)))var c=u,s=a}return s},Sl}function Dd(){if(jl)return Ol;jl=1;var e=it(),n=Hn();return Ol=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function Rd(){return Tl?zl:(Tl=1,zl=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function Vd(){return Wl?Ul:(Wl=1,Ul=function(e,n){return e<n})}function Hd(){if(Ed)return _d;Ed=1;var e=is(),n=ss(),t=hs(),r=ms(),o=(yd||(yd=1,gd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),gd),i=Ct(),a=function(){if(wd)return bd;wd=1;var e=function(){if(xd)return md;xd=1;var e=rs();return md=function(n,t){if(n!==t){var r=void 0!==n,o=null===n,i=n==n,a=e(n),u=void 0!==t,c=null===t,s=t==t,l=e(t);if(!c&&!l&&!a&&n>t||a&&u&&s&&!c&&!l||o&&u&&s||!r&&s||!i)return 1;if(!o&&!a&&!l&&n<t||l&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!s)return-1}return 0}}();return bd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var s=e(i[o],a[o]);if(s)return o>=c?s:s*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=Fc(),c=lt();return _d=function(s,l,d){l=l.length?e(l,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;l=e(l,i(t));var h=r(s,(function(n,t,r){return{criteria:e(l,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Id={cloneDeep:function(){if(qs)return Gs;qs=1;var e=Rc();return Gs=function(n){return e(n,5)}}(),constant:Hc(),defaults:function(){if(Js)return Qs;Js=1;var e=Cs(),n=Hn(),t=zd(),r=sr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,s=c>2?a[2]:void 0;for(s&&t(a[0],a[1],s)&&(c=1);++u<c;)for(var l=a[u],d=r(l),f=-1,h=d.length;++f<h;){var v=d[f],p=e[v];(void 0===p||n(p,o[v])&&!i.call(e,v))&&(e[v]=l[v])}return e}));return Qs=a}(),each:Gc(),filter:vs(),find:function(){if(pl)return vl;pl=1;var e=function(){if(nl)return el;nl=1;var e=hs(),n=ur(),t=cr();return el=function(r){return function(o,i,a){var u=Object(o);if(!n(o)){var c=e(i,3);o=t(o),i=function(e){return c(u[e],e,u)}}var s=r(o,i,a);return s>-1?u[c?o[s]:s]:void 0}}}(),n=e(function(){if(hl)return fl;hl=1;var e=Ms(),n=hs(),t=function(){if(dl)return ll;dl=1;var e=Td();return ll=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return fl=function(o,i,a){var u=null==o?0:o.length;if(!u)return-1;var c=null==a?0:t(a);return c<0&&(c=r(u+c,0)),e(o,n(i,3),c)},fl}());return vl=n}(),flatten:Ld(),forEach:Wc(),forIn:function(){if(xl)return ml;xl=1;var e=Yc(),n=Uc(),t=sr();return ml=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:ps(),isUndefined:ys(),last:(wl||(wl=1,bl=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),bl),map:xs(),mapValues:function(){if(El)return _l;El=1;var e=it(),n=Xc(),t=hs();return _l=function(r,o){var i={};return o=t(o,3),n(r,(function(n,t,r){e(i,t,o(n,t,r))})),i}}(),max:function(){if(Pl)return Nl;Pl=1;var e=Bd(),n=Ml?Cl:(Ml=1,Cl=function(e,n){return e>n}),t=Fc();return Nl=function(r){return r&&r.length?e(r,t,n):void 0},Nl}(),merge:function(){if(Fl)return Zl;Fl=1;var e=function(){if(Hl)return Vl;Hl=1;var e=tt(),n=Dd(),t=Yc(),r=function(){if(Rl)return Dl;Rl=1;var e=Dd(),n=_c(),t=Lc(),r=Ec(),o=Dc(),i=st(),a=lt(),u=Ps(),c=Et(),s=qn(),l=Gn(),d=function(){if(Al)return Il;Al=1;var e=Wn(),n=Nc(),t=ct(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Il=function(r){if(!t(r)||"[object Object]"!=e(r))return!1;var o=n(r);if(null===o)return!0;var c=a.call(o,"constructor")&&o.constructor;return"function"==typeof c&&c instanceof c&&i.call(c)==u}}(),f=tr(),h=Rd(),v=function(){if(Bl)return Ll;Bl=1;var e=ut(),n=sr();return Ll=function(t){return e(t,n(t))}}();return Dl=function(p,g,y,m,x,b,w){var _=h(p,y),E=h(g,y),S=w.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,w):void 0,C=void 0===k;if(C){var M=a(E),N=!M&&c(E),P=!M&&!N&&f(E);k=E,M||N||P?a(_)?k=_:u(_)?k=r(_):N?(C=!1,k=n(E,!0)):P?(C=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):l(_)&&!s(_)||(k=o(E))):C=!1}C&&(w.set(E,k),x(k,E,m,b,w),w.delete(E)),e(p,y,k)}}}(),o=Gn(),i=sr(),a=Rd();return Vl=function u(c,s,l,d,f){c!==s&&t(s,(function(t,i){if(f||(f=new e),o(t))r(c,s,i,l,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,s,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},Vl}(),n=function(){if(Xl)return Yl;Xl=1;var e=Cs(),n=zd();return Yl=function(t){return e((function(e,r){var o=-1,i=r.length,a=i>1?r[i-1]:void 0,u=i>2?r[2]:void 0;for(a=t.length>3&&"function"==typeof a?(i--,a):void 0,u&&n(r[0],r[1],u)&&(a=i<3?void 0:a,i=1),e=Object(e);++o<i;){var c=r[o];c&&t(e,c,o,a)}return e}))}}()((function(n,t,r){e(n,t,r)}));return Zl=n}(),min:function(){if(ql)return Gl;ql=1;var e=Bd(),n=Vd(),t=Fc();return Gl=function(r){return r&&r.length?e(r,t,n):void 0},Gl}(),minBy:function(){if(Kl)return $l;Kl=1;var e=Bd(),n=hs(),t=Vd();return $l=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},$l}(),now:function(){if(Jl)return Ql;Jl=1;var e=Fn();return Ql=function(){return e.Date.now()}}(),pick:function(){if(sd)return cd;sd=1;var e=function(){if(id)return od;id=1;var e=function(){if(rd)return td;rd=1;var e=ss(),n=function(){if(nd)return ed;nd=1;var e=at(),n=us(),t=St(),r=Gn(),o=cs();return ed=function(i,a,u,c){if(!r(i))return i;for(var s=-1,l=(a=n(a,i)).length,d=l-1,f=i;null!=f&&++s<l;){var h=o(a[s]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(s!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[s+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=us();return td=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var s=o[a],l=e(r,s);i(l,s)&&n(c,t(s,r),l)}return c}}(),n=ds();return od=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(ud)return ad;ud=1;var e=Ld(),n=Ss(),t=ks();return ad=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return cd=t}(),range:function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=function(){if(dd)return ld;dd=1;var e=Math.ceil,n=Math.max;return ld=function(t,r,o,i){for(var a=-1,u=n(e((r-t)/(o||1)),0),c=Array(u);u--;)c[i?u:++a]=t,t+=o;return c},ld}(),n=zd(),t=Td();return fd=function(r){return function(o,i,a){return a&&"number"!=typeof a&&n(o,i,a)&&(i=a=void 0),o=t(o),void 0===i?(i=o,o=0):i=t(i),a=void 0===a?o<i?1:-1:t(a),e(o,i,a,r)}},fd}()();return vd=e}(),reduce:bs(),sortBy:function(){if(kd)return Sd;kd=1;var e=Es(),n=Hd(),t=Cs(),r=zd(),o=t((function(t,o){if(null==t)return[];var i=o.length;return i>1&&r(t,o[0],o[1])?o=[]:i>2&&r(o[0],o[1],o[2])&&(o=[o[0]]),n(t,e(o,1),[])}));return Sd=o}(),uniqueId:function(){if(Md)return Cd;Md=1;var e=as(),n=0;return Cd=function(t){var r=++n;return e(t)+r},Cd}(),values:js(),zipObject:function(){if(jd)return Od;jd=1;var e=at(),n=(Pd||(Pd=1,Nd=function(e,n,t){for(var r=-1,o=e.length,i=n.length,a={};++r<o;){var u=r<i?n[r]:void 0;t(a,e[r],u)}return a}),Nd);return Od=function(t,r){return n(t||[],r||[],e)},Od}()}}catch(z){}Id||(Id=window._);var Yd=Id,Xd=Zd;function Zd(){var e={};e._next=e._prev=e,this._sentinel=e}function Fd(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function Ud(e,n){if("_next"!==e&&"_prev"!==e)return n}Zd.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return Fd(n),n},Zd.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&Fd(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},Zd.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,Ud)),t=t._prev;return"["+e.join(", ")+"]"};var Wd=Yd,Gd=Ad.Graph,qd=Xd,$d=Wd.constant(1);function Kd(e,n,t,r,o){var i=o?[]:void 0;return Wd.forEach(e.inEdges(r.v),(function(r){var a=e.edge(r),u=e.node(r.v);o&&i.push({v:r.v,w:r.w}),u.out-=a,Qd(n,t,u)})),Wd.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,Qd(n,t,a)})),e.removeNode(r.v),i}function Qd(e,n,t){t.out?t.in?e[t.out-t.in+n].enqueue(t):e[e.length-1].enqueue(t):e[0].enqueue(t)}var Jd=Yd,ef=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new Gd,r=0,o=0;Wd.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),Wd.forEach(e.edges(),(function(e){var i=t.edge(e.v,e.w)||0,a=n(e),u=i+a;t.setEdge(e.v,e.w,u),o=Math.max(o,t.node(e.v).out+=a),r=Math.max(r,t.node(e.w).in+=a)}));var i=Wd.range(o+r+3).map((function(){return new qd})),a=r+1;return Wd.forEach(t.nodes(),(function(e){Qd(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||$d),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)Kd(e,n,t,r);for(;r=i.dequeue();)Kd(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(Kd(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return Wd.flatten(Wd.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},nf={run:function(e){var n="greedy"===e.graph().acyclicer?ef(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return Jd.forEach(e.nodes(),(function o(i){Jd.has(r,i)||(r[i]=!0,t[i]=!0,Jd.forEach(e.outEdges(i),(function(e){Jd.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);Jd.forEach(n,(function(n){var t=e.edge(n);e.removeEdge(n),t.forwardName=n.name,t.reversed=!0,e.setEdge(n.w,n.v,t,Jd.uniqueId("rev"))}))},undo:function(e){Jd.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.reversed){e.removeEdge(n);var r=t.forwardName;delete t.reversed,delete t.forwardName,e.setEdge(n.w,n.v,t,r)}}))}},tf=Yd,rf=Ad.Graph,of={addDummyNode:af,simplify:function(e){var n=(new rf).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),tf.forEach(e.edges(),(function(t){var r=n.edge(t.v,t.w)||{weight:0,minlen:1},o=e.edge(t);n.setEdge(t.v,t.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})})),n},asNonCompoundGraph:function(e){var n=new rf({multigraph:e.isMultigraph()}).setGraph(e.graph());return tf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),tf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=tf.map(e.nodes(),(function(n){var t={};return tf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return tf.zipObject(e.nodes(),n)},intersectRect:function(e,n){var t,r,o=e.x,i=e.y,a=n.x-o,u=n.y-i,c=e.width/2,s=e.height/2;if(!a&&!u)throw new Error("Not possible to find intersection inside of the rectangle");return Math.abs(u)*c>Math.abs(a)*s?(u<0&&(s=-s),t=s*a/u,r=s):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=tf.map(tf.range(uf(e)+1),(function(){return[]}));return tf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;tf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank})));tf.forEach(e.nodes(),(function(t){var r=e.node(t);tf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=tf.min(tf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];tf.forEach(e.nodes(),(function(r){var o=e.node(r).rank-n;t[o]||(t[o]=[]),t[o].push(r)}));var r=0,o=e.graph().nodeRankFactor;tf.forEach(t,(function(n,t){tf.isUndefined(n)&&t%o!=0?--r:r&&tf.forEach(n,(function(n){e.node(n).rank+=r}))}))},addBorderNode:function(e,n,t,r){var o={width:0,height:0};return arguments.length>=4&&(o.rank=t,o.order=r),af(e,"border",o,n)},maxRank:uf,partition:function(e,n){var t={lhs:[],rhs:[]};return tf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=tf.now();try{return n()}finally{console.log(e+" time: "+(tf.now()-t)+"ms")}},notime:function(e,n){return n()}};function af(e,n,t,r){var o;do{o=tf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function uf(e){return tf.max(tf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!tf.isUndefined(t))return t})))}var cf=Yd,sf=of,lf={run:function(e){e.graph().dummyChains=[],cf.forEach(e.edges(),(function(n){!function(e,n){var t,r,o,i=n.v,a=e.node(i).rank,u=n.w,c=e.node(u).rank,s=n.name,l=e.edge(n),d=l.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)l.points=[],r={width:0,height:0,edgeLabel:l,edgeObj:n,rank:a},t=sf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=l.width,r.height=l.height,r.dummy="edge-label",r.labelpos=l.labelpos),e.setEdge(i,t,{weight:l.weight},s),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:l.weight},s)}}(e,n)}))},undo:function(e){cf.forEach(e.graph().dummyChains,(function(n){var t,r=e.node(n),o=r.edgeLabel;for(e.setEdge(r.edgeObj,o);r.dummy;)t=e.successors(n)[0],e.removeNode(n),o.points.push({x:r.x,y:r.y}),"edge-label"===r.dummy&&(o.x=r.x,o.y=r.y,o.width=r.width,o.height=r.height),n=t,r=e.node(n)}))}},df=Yd,ff=function(e){var n={};df.forEach(e.sources(),(function t(r){var o=e.node(r);if(df.has(n,r))return o.rank;n[r]=!0;var i=df.min(df.map(e.outEdges(r),(function(n){return t(n.w)-e.edge(n).minlen})));return i!==Number.POSITIVE_INFINITY&&null!=i||(i=0),o.rank=i}))},hf=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},vf=Yd,pf=Ad.Graph,gf=hf,yf=function(e){var n,t,r=new pf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});mf(r,e)<i;)n=xf(r,e),t=r.hasNode(n.v)?gf(e,n):-gf(e,n),bf(r,e,t);return r};function mf(e,n){return vf.forEach(e.nodes(),(function t(r){vf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||gf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function xf(e,n){return vf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return gf(n,t)}))}function bf(e,n,t){vf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var wf=Yd,_f=yf,Ef=hf,Sf=ff,kf=Ad.alg.preorder,Cf=Ad.alg.postorder,Mf=of.simplify,Nf=Pf;function Pf(e){e=Mf(e),Sf(e);var n,t=_f(e);for(If(t),Of(t,e);n=zf(t);)Lf(t,e,n,Tf(t,e,n))}function Of(e,n){var t=Cf(e,e.nodes());t=t.slice(0,t.length-1),wf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=jf(e,n,t)}(e,n,t)}))}function jf(e,n,t){var r=e.node(t).parent,o=!0,i=n.edge(t,r),a=0;return i||(o=!1,i=n.edge(r,t)),a=i.weight,wf.forEach(n.nodeEdges(t),(function(i){var u,c,s=i.v===t,l=s?i.w:i.v;if(l!==r){var d=s===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=l,e.hasEdge(u,c)){var h=e.edge(t,l).cutvalue;a+=d?-h:h}}})),a}function If(e,n){arguments.length<2&&(n=e.nodes()[0]),Af(e,{},1,n)}function Af(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,wf.forEach(e.neighbors(r),(function(o){wf.has(n,o)||(t=Af(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function zf(e){return wf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Tf(e,n,t){var r=t.v,o=t.w;n.hasEdge(r,o)||(r=t.w,o=t.v);var i=e.node(r),a=e.node(o),u=i,c=!1;i.lim>a.lim&&(u=a,c=!0);var s=wf.filter(n.edges(),(function(n){return c===Bf(e,e.node(n.v),u)&&c!==Bf(e,e.node(n.w),u)}));return wf.minBy(s,(function(e){return Ef(n,e)}))}function Lf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),If(e),Of(e,n),function(e,n){var t=wf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=kf(e,t);r=r.slice(1),wf.forEach(r,(function(t){var r=e.node(t).parent,o=n.edge(t,r),i=!1;o||(o=n.edge(r,t),i=!0),n.node(t).rank=n.node(r).rank+(i?o.minlen:-o.minlen)}))}(e,n)}function Bf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Pf.initLowLimValues=If,Pf.initCutValues=Of,Pf.calcCutValue=jf,Pf.leaveEdge=zf,Pf.enterEdge=Tf,Pf.exchangeEdges=Lf;var Df=ff,Rf=yf,Vf=Nf,Hf=Df;var Yf=Yd,Xf=Yd,Zf=of,Ff={run:function(e){var n=Zf.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Xf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Xf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Xf.max(Xf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Xf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Xf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Xf.forEach(e.children(),(function(a){Uf(e,n,o,i,r,t,a)})),e.graph().nodeRankFactor=o},cleanup:function(e){var n=e.graph();e.removeNode(n.nestingRoot),delete n.nestingRoot,Xf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function Uf(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=Zf.addBorderNode(e,"_bt"),s=Zf.addBorderNode(e,"_bb"),l=e.node(a);e.setParent(c,a),l.borderTop=c,e.setParent(s,a),l.borderBottom=s,Xf.forEach(u,(function(u){Uf(e,n,t,r,o,i,u);var l=e.node(u),d=l.borderTop?l.borderTop:u,f=l.borderBottom?l.borderBottom:u,h=l.borderTop?r:2*r,v=d!==f?1:o-i[a]+1;e.setEdge(c,d,{weight:h,minlen:v,nestingEdge:!0}),e.setEdge(f,s,{weight:h,minlen:v,nestingEdge:!0})})),e.parent(a)||e.setEdge(n,c,{weight:0,minlen:o+i[a]})}else a!==n&&e.setEdge(n,a,{weight:0,minlen:t})}var Wf=Yd,Gf=of;function qf(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=Gf.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var $f=Yd,Kf={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||Qf(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){$f.forEach(e.nodes(),(function(n){eh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,eh),$f.has(t,"y")&&eh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){$f.forEach(e.nodes(),(function(n){nh(e.node(n))})),$f.forEach(e.edges(),(function(n){var t=e.edge(n);$f.forEach(t.points,nh),$f.has(t,"x")&&nh(t)}))}(e),Qf(e))}};function Qf(e){$f.forEach(e.nodes(),(function(n){Jf(e.node(n))})),$f.forEach(e.edges(),(function(n){Jf(e.edge(n))}))}function Jf(e){var n=e.width;e.width=e.height,e.height=n}function eh(e){e.y=-e.y}function nh(e){var n=e.x;e.x=e.y,e.y=n}var th=Yd,rh=Yd;function oh(e,n,t){for(var r=rh.zipObject(t,rh.map(t,(function(e,n){return n}))),o=rh.flatten(rh.map(n,(function(n){return rh.sortBy(rh.map(e.outEdges(n),(function(n){return{pos:r[n.w],weight:e.edge(n).weight}})),"pos")})),!0),i=1;i<t.length;)i<<=1;var a=2*i-1;i-=1;var u=rh.map(new Array(a),(function(){return 0})),c=0;return rh.forEach(o.forEach((function(e){var n=e.pos+i;u[n]+=e.weight;for(var t=0;n>0;)n%2&&(t+=u[n+1]),u[n=n-1>>1]+=e.weight;c+=e.weight*t}))),c}var ih=Yd,ah=Yd,uh=Yd,ch=of;function sh(e,n,t){for(var r;n.length&&(r=uh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var lh=Yd,dh=Yd,fh=Ad.Graph,hh=Yd,vh=Yd,ph=function(e){var n={},t=th.filter(e.nodes(),(function(n){return!e.children(n).length})),r=th.max(th.map(t,(function(n){return e.node(n).rank}))),o=th.map(th.range(r+1),(function(){return[]}));var i=th.sortBy(t,(function(n){return e.node(n).rank}));return th.forEach(i,(function t(r){if(!th.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),th.forEach(e.successors(r),t)}})),o},gh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=oh(e,n[r-1],n[r]);return t},yh=function e(n,t,r,o){var i=n.children(t),a=n.node(t),u=a?a.borderLeft:void 0,c=a?a.borderRight:void 0,s={};u&&(i=lh.filter(i,(function(e){return e!==u&&e!==c})));var l=function(e,n){return ih.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ih.reduce(t,(function(n,t){var r=e.edge(t),o=e.node(t.v);return{sum:n.sum+r.weight*o.order,weight:n.weight+r.weight}}),{sum:0,weight:0});return{v:n,barycenter:r.sum/r.weight,weight:r.weight}}return{v:n}}))}(n,i);lh.forEach(l,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);s[t.v]=i,lh.has(i,"barycenter")&&(a=t,u=i,lh.isUndefined(a.barycenter)?(a.barycenter=u.barycenter,a.weight=u.weight):(a.barycenter=(a.barycenter*a.weight+u.barycenter*u.weight)/(a.weight+u.weight),a.weight+=u.weight))}var a,u}));var d=function(e,n){var t={};return ah.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};ah.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),ah.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];ah.isUndefined(n)||ah.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(ah.isUndefined(n.barycenter)||ah.isUndefined(e.barycenter)||n.barycenter>=e.barycenter)&&function(e,n){var t=0,r=0;e.weight&&(t+=e.barycenter*e.weight,r+=e.weight),n.weight&&(t+=n.barycenter*n.weight,r+=n.weight),e.vs=n.vs.concat(e.vs),e.barycenter=t/r,e.weight=r,e.i=Math.min(n.i,e.i),n.merged=!0}(e,n)}}function r(n){return function(t){t.in.push(n),0==--t.indegree&&e.push(t)}}for(;e.length;){var o=e.pop();n.push(o),ah.forEach(o.in.reverse(),t(o)),ah.forEach(o.out,r(o))}return ah.map(ah.filter(n,(function(e){return!e.merged})),(function(e){return ah.pick(e,["vs","i","barycenter","weight"])}))}(ah.filter(t,(function(e){return!e.indegree})))}(l,r);!function(e,n){lh.forEach(e,(function(e){e.vs=lh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,s);var f=function(e,n){var t,r=ch.partition(e,(function(e){return uh.has(e,"barycenter")})),o=r.lhs,i=uh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,s=0;o.sort((t=!!n,function(e,n){return e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i})),s=sh(a,i,s),uh.forEach(o,(function(e){s+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,s=sh(a,i,s)}));var l={vs:uh.flatten(a,!0)};return c&&(l.barycenter=u/c,l.weight=c),l}(d,o);if(u&&(f.vs=lh.flatten([u,f.vs,c],!0),n.predecessors(u).length)){var h=n.node(n.predecessors(u)[0]),v=n.node(n.predecessors(c)[0]);lh.has(f,"barycenter")||(f.barycenter=0,f.weight=0),f.barycenter=(f.barycenter*f.weight+h.order+v.order)/(f.weight+2),f.weight+=2}return f},mh=function(e,n,t){var r=function(e){for(var n;e.hasNode(n=dh.uniqueId("_root")););return n}(e),o=new fh({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return dh.forEach(e.nodes(),(function(i){var a=e.node(i),u=e.parent(i);(a.rank===n||a.minRank<=n&&n<=a.maxRank)&&(o.setNode(i),o.setParent(i,u||r),dh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=dh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),dh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},xh=Ad.Graph,bh=of;function wh(e,n,t){return vh.map(n,(function(n){return mh(e,n,t)}))}function _h(e,n){var t=new xh;vh.forEach(e,(function(e){var r=e.graph().root,o=yh(e,r,t,n);vh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};hh.forEach(t,(function(t){for(var i,a,u=e.parent(t);u;){if((i=e.parent(u))?(a=o[i],o[i]=u):(a=r,r=u),a&&a!==u)return void n.setEdge(a,u);u=i}}))}(e,t,o.vs)}))}function Eh(e,n){vh.forEach(n,(function(n){vh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var Sh=Yd,kh=Ad.Graph,Ch=of;function Mh(e,n,t){if(n>t){var r=n;n=t,t=r}var o=e[n];o||(e[n]=o={}),o[t]=!0}function Nh(e,n,t){if(n>t){var r=n;n=t,t=r}return Sh.has(e[n],t)}var Ph=Yd,Oh=of,jh=function(e){var n,t=Ch.buildLayerMatrix(e),r=Sh.merge(function(e,n){var t={};return Sh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=Sh.last(r);return Sh.forEach(r,(function(n,c){var s=function(e,n){if(e.node(n).dummy)return Sh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),l=s?e.node(s).order:a;(s||n===u)&&(Sh.forEach(r.slice(i,c+1),(function(n){Sh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||l<a)||i.dummy&&e.node(n).dummy||Mh(t,r,n)}))})),i=c+1,o=l)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;Sh.forEach(Sh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&Sh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Mh(t,n,u)}))}))}return Sh.reduce(n,(function(n,t){var o,i=-1,a=0;return Sh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var s=e.predecessors(u);s.length&&(o=e.node(s[0]).order,r(t,a,c,i,o),a=c,i=o)}r(t,a,t.length,o,n.length)})),t})),t}(e,t)),o={};Sh.forEach(["u","d"],(function(i){n="u"===i?t:Sh.values(t).reverse(),Sh.forEach(["l","r"],(function(t){"r"===t&&(n=Sh.map(n,(function(e){return Sh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return Sh.forEach(n,(function(e){Sh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),Sh.forEach(n,(function(e){var n=-1;Sh.forEach(e,(function(e){var u=r(e);if(u.length){u=Sh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,s=Math.floor(c),l=Math.ceil(c);s<=l;++s){var d=u[s];i[e]===e&&n<a[d]&&!Nh(t,e,d)&&(i[d]=e,i[e]=o[e]=o[d],n=a[d])}}}))})),{root:o,align:i}}(0,n,r,a),c=function(e,n,t,r,o){var i={},a=function(e,n,t,r){var o=new kh,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),s=0;if(s+=u.width/2,Sh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(s+=t?a:-a),a=0,s+=(u.dummy?n:e)/2,s+=(c.dummy?n:e)/2,s+=c.width/2,Sh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(s+=t?a:-a),a=0,s}}(i.nodesep,i.edgesep,r);return Sh.forEach(n,(function(n){var r;Sh.forEach(n,(function(n){var i=t[n];if(o.setNode(i),r){var u=t[r],c=o.edge(u,i);o.setEdge(u,i,Math.max(a(e,n,r),c||0))}r=n}))})),o}(e,n,t,o),u=o?"borderLeft":"borderRight";function c(e,n){for(var t=a.nodes(),r=t.pop(),o={};r;)o[r]?e(r):(o[r]=!0,t.push(r),t=t.concat(n(r))),r=t.pop()}return c((function(e){i[e]=a.inEdges(e).reduce((function(e,n){return Math.max(e,i[n.v]+a.edge(n))}),0)}),a.predecessors.bind(a)),c((function(n){var t=a.outEdges(n).reduce((function(e,n){return Math.min(e,i[n.w]-a.edge(n))}),Number.POSITIVE_INFINITY),r=e.node(n);t!==Number.POSITIVE_INFINITY&&r.borderType!==u&&(i[n]=Math.max(i[n],t))}),a.successors.bind(a)),Sh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=Sh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return Sh.minBy(Sh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return Sh.forIn(n,(function(n,o){var i=function(e,n){return e.node(n).width}(e,o)/2;t=Math.max(n+i,t),r=Math.min(n-i,r)})),t-r}))}(e,o);return function(e,n){var t=Sh.values(n),r=Sh.min(t),o=Sh.max(t);Sh.forEach(["u","d"],(function(t){Sh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var s=Sh.values(c);(a="l"===i?r-Sh.min(s):o-Sh.max(s))&&(e[u]=Sh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return Sh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=Sh.sortBy(Sh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Ih=Yd,Ah=nf,zh=lf,Th=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){Vf(e)}(e);break;case"tight-tree":!function(e){Df(e),Rf(e)}(e);break;case"longest-path":Hf(e)}},Lh=of.normalizeRanks,Bh=function(e){var n=function(e){var n={},t=0;return Yf.forEach(e.children(),(function r(o){var i=t;Yf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Yf.forEach(e.graph().dummyChains,(function(t){for(var r=e.node(t),o=r.edgeObj,i=function(e,n,t,r){var o,i,a=[],u=[],c=Math.min(n[t].low,n[r].low),s=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||s>n[o].lim));for(i=o,o=r;(o=e.parent(o))!==i;)u.push(o);return{path:a.concat(u.reverse()),lca:i}}(e,n,o.v,o.w),a=i.path,u=i.lca,c=0,s=a[c],l=!0;t!==o.w;){if(r=e.node(t),l){for(;(s=a[c])!==u&&e.node(s).maxRank<r.rank;)c++;s===u&&(l=!1)}if(!l){for(;c<a.length-1&&e.node(s=a[c+1]).minRank<=r.rank;)c++;s=a[c]}e.setParent(t,s),t=e.successors(t)[0]}}))},Dh=of.removeEmptyRanks,Rh=Ff,Vh=function(e){Wf.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&Wf.forEach(r,n),Wf.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)qf(e,"borderLeft","_bl",t,o,i),qf(e,"borderRight","_br",t,o,i)}}))},Hh=Kf,Yh=function(e){var n=bh.maxRank(e),t=wh(e,vh.range(1,n+1),"inEdges"),r=wh(e,vh.range(n-1,-1,-1),"outEdges"),o=ph(e);Eh(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){_h(u%2?t:r,u%4>=2),o=bh.buildLayerMatrix(e);var s=gh(e,o);s<a&&(c=0,i=vh.cloneDeep(o),a=s)}Eh(e,i)},Xh=function(e){(function(e){var n=Oh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Ph.forEach(n,(function(n){var o=Ph.max(Ph.map(n,(function(n){return e.node(n).height})));Ph.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Oh.asNonCompoundGraph(e)),Ph.forEach(jh(e),(function(n,t){e.node(t).x=n}))},Zh=of,Fh=Ad.Graph,Uh=["nodesep","edgesep","ranksep","marginx","marginy"],Wh={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Gh=["acyclicer","ranker","rankdir","align"],qh=["width","height"],$h={width:0,height:0},Kh=["minlen","weight","width","height","labeloffset"],Qh={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Jh=["labelpos"];function ev(e,n){return Ih.mapValues(Ih.pick(e,n),Number)}function nv(e){var n={};return Ih.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var tv=Yd,rv=of,ov=Ad.Graph,iv={debugOrdering:function(e){var n=rv.buildLayerMatrix(e),t=new ov({compound:!0,multigraph:!0}).setGraph({});return tv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),tv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),tv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),tv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},av=Vn({graphlib:Ad,layout:function(e,n){var t=n&&n.debugTiming?Zh.time:Zh.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new Fh({multigraph:!0,compound:!0}),t=nv(e.graph());return n.setGraph(Ih.merge({},Wh,ev(t,Uh),Ih.pick(t,Gh))),Ih.forEach(e.nodes(),(function(t){var r=nv(e.node(t));n.setNode(t,Ih.defaults(ev(r,qh),$h)),n.setParent(t,e.parent(t))})),Ih.forEach(e.edges(),(function(t){var r=nv(e.edge(t));n.setEdge(t,Ih.merge({},Qh,ev(r,Kh),Ih.pick(r,Jh)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Ih.forEach(e.edges(),(function(t){var r=e.edge(t);r.minlen*=2,"c"!==r.labelpos.toLowerCase()&&("TB"===n.rankdir||"BT"===n.rankdir?r.width+=r.labeloffset:r.height+=r.labeloffset)}))}(e)})),n(" removeSelfEdges",(function(){!function(e){Ih.forEach(e.edges(),(function(n){if(n.v===n.w){var t=e.node(n.v);t.selfEdges||(t.selfEdges=[]),t.selfEdges.push({e:n,label:e.edge(n)}),e.removeEdge(n)}}))}(e)})),n(" acyclic",(function(){Ah.run(e)})),n(" nestingGraph.run",(function(){Rh.run(e)})),n(" rank",(function(){Th(Zh.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);if(t.width&&t.height){var r=e.node(n.v),o={rank:(e.node(n.w).rank-r.rank)/2+r.rank,e:n};Zh.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Dh(e)})),n(" nestingGraph.cleanup",(function(){Rh.cleanup(e)})),n(" normalizeRanks",(function(){Lh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Ih.forEach(e.nodes(),(function(t){var r=e.node(t);r.borderTop&&(r.minRank=e.node(r.borderTop).rank,r.maxRank=e.node(r.borderBottom).rank,n=Ih.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){var t=e.node(n);"edge-proxy"===t.dummy&&(e.edge(t.e).labelRank=t.rank,e.removeNode(n))}))}(e)})),n(" normalize.run",(function(){zh.run(e)})),n(" parentDummyChains",(function(){Bh(e)})),n(" addBorderSegments",(function(){Vh(e)})),n(" order",(function(){Yh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=Zh.buildLayerMatrix(e);Ih.forEach(n,(function(n){var t=0;Ih.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Ih.forEach(o.selfEdges,(function(n){Zh.addDummyNode(e,"selfedge",{width:n.label.width,height:n.label.height,rank:o.rank,order:r+ ++t,e:n.e,label:n.label},"_se")})),delete o.selfEdges}))}))}(e)})),n(" adjustCoordinateSystem",(function(){Hh.adjust(e)})),n(" position",(function(){Xh(e)})),n(" positionSelfEdges",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){var t=e.node(n);if("selfedge"===t.dummy){var r=e.node(t.e.v),o=r.x+r.width/2,i=r.y,a=t.x-o,u=r.height/2;e.setEdge(t.e,t.label),e.removeNode(n),t.label.points=[{x:o+2*a/3,y:i-u},{x:o+5*a/6,y:i-u},{x:o+a,y:i},{x:o+5*a/6,y:i+u},{x:o+2*a/3,y:i+u}],t.label.x=t.x,t.label.y=t.y}}))}(e)})),n(" removeBorderNodes",(function(){!function(e){Ih.forEach(e.nodes(),(function(n){if(e.children(n).length){var t=e.node(n),r=e.node(t.borderTop),o=e.node(t.borderBottom),i=e.node(Ih.last(t.borderLeft)),a=e.node(Ih.last(t.borderRight));t.width=Math.abs(a.x-i.x),t.height=Math.abs(o.y-r.y),t.x=i.x+t.width/2,t.y=r.y+t.height/2}})),Ih.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){zh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);if(Ih.has(t,"x"))switch("l"!==t.labelpos&&"r"!==t.labelpos||(t.width-=t.labeloffset),t.labelpos){case"l":t.x-=t.width/2+t.labeloffset;break;case"r":t.x+=t.width/2+t.labeloffset}}))}(e)})),n(" undoCoordinateSystem",(function(){Hh.undo(e)})),n(" translateGraph",(function(){!function(e){var n=Number.POSITIVE_INFINITY,t=0,r=Number.POSITIVE_INFINITY,o=0,i=e.graph(),a=i.marginx||0,u=i.marginy||0;function c(e){var i=e.x,a=e.y,u=e.width,c=e.height;n=Math.min(n,i-u/2),t=Math.max(t,i+u/2),r=Math.min(r,a-c/2),o=Math.max(o,a+c/2)}Ih.forEach(e.nodes(),(function(n){c(e.node(n))})),Ih.forEach(e.edges(),(function(n){var t=e.edge(n);Ih.has(t,"x")&&c(t)})),n-=a,r-=u,Ih.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Ih.forEach(e.edges(),(function(t){var o=e.edge(t);Ih.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Ih.has(o,"x")&&(o.x-=n),Ih.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t,r,o=e.edge(n),i=e.node(n.v),a=e.node(n.w);o.points?(t=o.points[0],r=o.points[o.points.length-1]):(o.points=[],t=a,r=i),o.points.unshift(Zh.intersectRect(i,t)),o.points.push(Zh.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Ih.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Ah.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Ih.forEach(e.nodes(),(function(t){var r=e.node(t),o=n.node(t);r&&(r.x=o.x,r.y=o.y,n.children(t).length&&(r.width=o.width,r.height=o.height))})),Ih.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Ih.has(o,"x")&&(r.x=o.x,r.y=o.y)})),e.graph().width=n.graph().width,e.graph().height=n.graph().height}(e,n)}))}))},debug:iv,util:{time:of.time,notime:of.notime},version:"0.8.5"}),uv={error001:function(){return"[Ink Flow]: Seems like you have not used zustand provider as an ancestor."},error002:function(){return"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:function(e){return'Node type "'.concat(e,'" not found. Using fallback type "default".')},error004:function(){return"The Ink Flow parent container needs a width and a height to render the graph."},error005:function(){return"Only child nodes can use a parent extent."},error006:function(){return"Can't create edge. An edge needs a source and a target."},error007:function(e){return"The old edge with id=".concat(e," does not exist.")},error009:function(e){return'Marker type "'.concat(e,"\" doesn't exist.")},error008:function(e,n){var t=n.id,r=n.sourceHandle,o=n.targetHandle;return"Couldn't create edge for ".concat(e,' handle id: "').concat(r?o:r,'", edge id: ').concat(t,".")},error010:function(){return"Handle: No node id found. Make sure to only use a Handle inside a custom Node."},error011:function(e){return'Edge type "'.concat(e,'" not found. Using fallback type "default".')},error012:function(e){return'Node with id "'.concat(e,'" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.')},error013:function(e){return void 0===e&&(e="react"),"It seems that you haven't loaded the styles. Please import '@aloudata/".concat(e,"/dist/style.css' or base.css to make sure everything is working properly.")}},cv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],sv=["Enter"," ","Escape"],lv=function(e,n){void 0===n&&(n=[0,0]);var t=Mv(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},dv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=wv(t,n.nodeOrigin);return mv(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return bv(t)},fv=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.size)return{x:0,y:0,width:0,height:0};var t={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach((function(e){if(null==n.filter||n.filter(e)){var r=wv(e,n.nodeOrigin);t=mv(t,r)}})),bv(t)};function hv(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?lv(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&Cv(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],b=f+p*m[1];h=[[x,b],[x+g-v,b+y-p]]}}else null==u||u("005",uv.error005());var w=Cv(h)?pv(t,h):t;return{position:{x:w.x-d,y:w.y-f},positionAbsolute:w}}var vv=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},pv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:vv(e.x,n[0][0],n[1][0]),y:vv(e.y,n[0][1],n[1][1])}},gv=function(e,n,t){return e<n?vv(Math.abs(e-n),1,50)/50:e>t?-vv(Math.abs(e-t),1,50)/50:0},yv=function(e,n){return[20*gv(e.x,35,n.width-35),20*gv(e.y,35,n.height-35)]},mv=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},xv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},bv=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},wv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=lv(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}},_v=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},Ev=function(e,n,t,r){var o=e.x,i=e.y,a=L(n,3),u=a[0],c=a[1],s=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var l={x:(o-u)/s,y:(i-c)/s};return t?_v(l,r):l},Sv=function(e,n){var t=e.x,r=e.y,o=L(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},kv=function(){var e;return"undefined"!=typeof navigator&&(null===(e=null===navigator||void 0===navigator?void 0:navigator.userAgent)||void 0===e?void 0:e.indexOf("Mac"))>=0};function Cv(e){return void 0!==e&&"parent"!==e}function Mv(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var Nv={x:0,y:0};var Pv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},Ov=function(e,n){return!!Pv(e)&&e.indexOf(n)>-1},jv=function(e,n){if(!Pv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},Iv={}.toString,Av=function(e,n){return Iv.call(e)==="[object "+n+"]"},zv=function(e){return Av(e,"Function")},Tv=function(e){return null==e},Lv=function(e){return Array.isArray?Array.isArray(e):Av(e,"Array")},Bv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function Dv(e,n){if(e)if(Lv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(Bv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var Rv=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return Dv(e,(function(t,r){zv(e)&&"prototype"===r||n.push(r)})),n};function Vv(e,n){var t=Rv(n),r=t.length;if(Tv(e))return!r;for(var o=0;o<r;o+=1){var i=t[o];if(n[i]!==e[i]||!(i in e))return!1}return!0}var Hv=function(e){return"object"==typeof e&&null!==e},Yv=function(e){if(!Hv(e)||!Av(e,"Object"))return!1;if(null===Object.getPrototypeOf(e))return!0;for(var n=e;null!==Object.getPrototypeOf(n);)n=Object.getPrototypeOf(n);return Object.getPrototypeOf(e)===n},Xv=function(e,n){if(void 0===n&&(n=[]),Lv(e))for(var t=0;t<e.length;t+=1)Xv(e[t],n);else n.push(e);return n},Zv=function(e){if(Lv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},Fv=function(e){if(Lv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},Uv=Array.prototype,Wv=Uv.splice,Gv=Uv.indexOf,qv=Array.prototype.splice,$v=function(e,n){if(!Pv(e))return[];for(var t=e?n.length:0,r=t-1;t--;){var o=void 0,i=n[t];t!==r&&i===o||(o=i,qv.call(e,i,1))}return e},Kv=function(e,n,t){if(!Lv(e)&&!Yv(e))return e;var r=t;return Dv(e,(function(e,t){r=n(r,e,t)})),r},Qv=function(e){return Av(e,"String")};function Jv(e,n){void 0===n&&(n=new Map);var t=[];if(Array.isArray(e))for(var r=0,o=e.length;r<o;r++){var i=e[r];n.has(i)||(t.push(i),n.set(i,!0))}return t}var ep=Object.prototype.hasOwnProperty;function np(e,n){if(!n||!Lv(e))return{};for(var t,r={},o=zv(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),ep.call(r,t)?r[t].push(a):r[t]=[a]}return r}function tp(e,n){if(!n)return{0:e};if(!zv(n)){var t=Lv(n)?n:n.replace(/\s+/g,"").split("*");n=function(e){for(var n="_",r=0,o=t.length;r<o;r++)n+=e[t[r]]&&e[t[r]].toString();return n}}return np(e,n)}var rp={},op=function(e){return Av(e,"Number")},ip=Number.isInteger?Number.isInteger:function(e){return op(e)&&e%1==0},ap=180/Math.PI,up=parseInt,cp=Math.PI/180,sp=function(e,n){return e.hasOwnProperty(n)},lp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return Dv(e,(function(t,r){zv(e)&&"prototype"===r||n.push(t)})),n},dp=function(e){return Tv(e)?"":e.toString()},fp={}.toString,hp=function(e){return fp.call(e).replace(/^\[object /,"").replace(/]$/,"")},vp=Object.prototype,pp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||vp)};function gp(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function yp(e,n,t,r){return n&&gp(e,n),t&&gp(e,t),r&&gp(e,r),e}var mp=function(e){if("object"!=typeof e||null===e)return e;var n;if(Lv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=mp(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=mp(e[o]):n[o]=e[o];return n},xp=function(e,n){if(!zv(e))throw new TypeError("Expected a function");var t=function(){for(var r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var i=n?n.apply(this,r):r[0],a=t.cache;if(a.has(i))return a.get(i);var u=e.apply(this,r);return a.set(i,u),u};return t.cache=new Map,t};function bp(e,n,t,r){for(var o in t=t||0,r=r||5,n)if(n.hasOwnProperty(o)){var i=n[o];null!==i&&Yv(i)?(Yv(e[o])||(e[o]={}),t<r?bp(e[o],i,t+1,r):e[o]=n[o]):Lv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var wp,_p=Object.prototype.hasOwnProperty,Ep=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(Qv(e)||Qv(n))return!1;if(Pv(e)||Pv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=Ep(e[r],n[r]));r++);return t}if(Hv(e)||Hv(n)){var o=Object.keys(e),i=Object.keys(n);if(o.length!==i.length)return!1;for(t=!0,r=0;r<o.length&&(t=Ep(e[o[r]],n[o[r]]));r++);return t}return!1},Sp=function(e){return e},kp=Object.prototype.hasOwnProperty,Cp={},Mp=xp((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return wp||(wp=document.createElement("canvas").getContext("2d")),wp.font=[i,a,o,t+"px",r].join(" "),wp.measureText(Qv(e)?e:"").width}),(function(e,n){return void 0===n&&(n={}),function(){for(var e=0,n=0,t=arguments.length;n<t;n++)e+=arguments[n].length;var r=Array(e),o=0;for(n=0;n<t;n++)for(var i=arguments[n],a=0,u=i.length;a<u;a++,o++)r[o]=i[a];return r}([e],lp(n)).join("")})),Np=function(){function e(){this.map={}}return e.prototype.has=function(e){return void 0!==this.map[e]},e.prototype.get=function(e,n){var t=this.map[e];return void 0===t?n:t},e.prototype.set=function(e,n){this.map[e]=n},e.prototype.clear=function(){this.map={}},e.prototype.delete=function(e){delete this.map[e]},e.prototype.size=function(){return Object.keys(this.map).length},e}(),Pp=Object.freeze({__proto__:null,Cache:Np,assign:yp,augment:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];for(var t=e[0],r=1;r<e.length;r++){var o=e[r];zv(o)&&(o=o.prototype),yp(t.prototype,o)}},clamp:function(e,n,t){return e<n?n:e>t?t:e},clearAnimationFrame:function(e){(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame||clearTimeout)(e)},clone:mp,contains:Ov,debounce:function(e,n,t){var r;return function(){var o=this,i=arguments,a=t&&!r;clearTimeout(r),r=setTimeout((function(){r=null,t||e.apply(o,i)}),n),a&&e.apply(o,i)}},deepMix:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r+=1)bp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),jv(e,(function(e){return!Ov(n,e)}))},each:Dv,endsWith:function(e,n){return!(!Lv(e)&&!Qv(e))&&e[e.length-1]===n},every:function(e,n){for(var t=0;t<e.length;t++)if(!n(e[t],t))return!1;return!0},extend:function(e,n,t,r){zv(n)||(t=n,n=e,e=function(){});var o=Object.create?function(e,n){return Object.create(e,{constructor:{value:n}})}:function(e,n){function t(){}t.prototype=e;var r=new t;return r.constructor=n,r},i=o(n.prototype,e);return e.prototype=yp(i,e.prototype),e.superclass=o(n.prototype,n),yp(i,t),yp(e,r),e},filter:jv,find:function(e,n){if(!Lv(e))return null;var t;if(zv(n)&&(t=n),Yv(n)&&(t=function(e){return Vv(e,n)}),t)for(var r=0;r<e.length;r+=1)if(t(e[r]))return e[r];return null},findIndex:function(e,n,t){void 0===t&&(t=0);for(var r=t;r<e.length;r++)if(n(e[r],r))return r;return-1},firstValue:function(e,n){for(var t=null,r=0;r<e.length;r++){var o=e[r][n];if(!Tv(o)){t=Lv(o)?o[0]:o;break}}return t},fixedBase:function(e,n){var t=n.toString(),r=t.indexOf(".");if(-1===r)return Math.round(e);var o=t.substr(r+1).length;return o>20&&(o=20),parseFloat(e.toFixed(o))},flatten:function(e){if(!Lv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:Xv,forIn:Dv,get:function(e,n,t){for(var r=0,o=Qv(n)?n.split("."):n;e&&r<o.length;)e=e[o[r++]];return void 0===e||r<o.length?t:e},getEllipsisText:function(e,n,t,r){void 0===r&&(r="...");var o,i,a=Mp(r,t),u=Qv(e)?e:dp(e),c=n,s=[];if(Mp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=Mp(o,t))+a>c&&i>c);)if(s.push(o),c-=i,!(u=u.substr(16)))return s.join("");for(;o=u.substr(0,1),!((i=Mp(o,t))+a>c);)if(s.push(o),c-=i,!(u=u.substr(1)))return s.join("");return""+s.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(Lv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=Zv(n);return{min:Fv(n),max:o}},getType:hp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=tp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:np,groupToMap:tp,has:sp,hasKey:sp,hasValue:function(e,n){return Ov(lp(e),n)},head:function(e){if(Pv(e))return e[0]},identity:function(e){return e},includes:Ov,indexOf:function(e,n){if(!Pv(e))return-1;var t=Array.prototype.indexOf;if(t)return t.call(e,n);for(var r=-1,o=0;o<e.length;o++)if(e[o]===n){r=o;break}return r},isArguments:function(e){return Av(e,"Arguments")},isArray:Lv,isArrayLike:Pv,isBoolean:function(e){return Av(e,"Boolean")},isDate:function(e){return Av(e,"Date")},isDecimal:function(e){return op(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if(Tv(e))return!0;if(Pv(e))return!e.length;var n=hp(e);if("Map"===n||"Set"===n)return!e.size;if(pp(e))return!Object.keys(e).length;for(var t in e)if(_p.call(e,t))return!1;return!0},isEqual:Ep,isEqualWith:function(e,n,t){return zv(t)?!!t(e,n):Ep(e,n)},isError:function(e){return Av(e,"Error")},isEven:function(e){return op(e)&&e%2==0},isFinite:function(e){return op(e)&&isFinite(e)},isFunction:zv,isInteger:ip,isMatch:Vv,isNegative:function(e){return op(e)&&e<0},isNil:Tv,isNull:function(e){return null===e},isNumber:op,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:Bv,isObjectLike:Hv,isOdd:function(e){return op(e)&&e%2!=0},isPlainObject:Yv,isPositive:function(e){return op(e)&&e>0},isPrototype:pp,isRegExp:function(e){return Av(e,"RegExp")},isString:Qv,isType:Av,isUndefined:function(e){return void 0===e},keys:Rv,last:function(e){if(Pv(e))return e[e.length-1]},lowerCase:function(e){return dp(e).toLowerCase()},lowerFirst:function(e){var n=dp(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!Pv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];t.push(n(o,r))}return t},mapValues:function(e,n){void 0===n&&(n=Sp);var t={};return Bv(e)&&!Tv(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:Zv,maxBy:function(e,n){if(Lv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=zv(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:Mp,memoize:xp,min:Fv,minBy:function(e,n){if(Lv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=zv(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:yp,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=rp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,rp[e]=n}return n},omit:function(e,n){return Kv(e,(function(e,t,r){return n.includes(r)||(e[r]=t),e}),{})},parseRadius:function(e){var n=0,t=0,r=0,o=0;return Lv(e)?1===e.length?n=t=r=o=e[0]:2===e.length?(n=r=e[0],t=o=e[1]):3===e.length?(n=e[0],t=o=e[1],r=e[2]):(n=e[0],t=e[1],r=e[2],o=e[3]):n=t=r=o=e,{r1:n,r2:t,r3:r,r4:o}},pick:function(e,n){if(null===e||!Yv(e))return{};var t={};return Dv(n,(function(n){kp.call(e,n)&&(t[n]=e[n])})),t},pull:function(e){for(var n=[],t=1;t<arguments.length;t++)n[t-1]=arguments[t];for(var r=0;r<n.length;r++)for(var o=n[r],i=-1;(i=Gv.call(e,o))>-1;)Wv.call(e,i,1);return e},pullAt:$v,reduce:Kv,remove:function(e,n){var t=[];if(!Pv(e))return t;for(var r=-1,o=[],i=e.length;++r<i;){var a=e[r];n(a,r,e)&&(t.push(a),o.push(r))}return $v(e,o),t},requestAnimationFrame:function(e){return(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame||function(e){return setTimeout(e,16)})(e)},set:function(e,n,t){var r=e,o=Qv(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(Bv(r[e])||(r[e]=op(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return Tv(e)?0:Pv(e)?e.length:Object.keys(e).length},some:function(e,n){for(var t=0;t<e.length;t++)if(n(e[t],t))return!0;return!1},sortBy:function(e,n){var t;if(zv(n))t=function(e,t){return n(e)-n(t)};else{var r=[];Qv(n)?r.push(n):Lv(n)&&(r=n),t=function(e,n){for(var t=0;t<r.length;t+=1){var o=r[t];if(e[o]>n[o])return 1;if(e[o]<n[o])return-1}return 0}}return e.sort(t),e},startsWith:function(e,n){return!(!Lv(e)&&!Qv(e))&&e[0]===n},substitute:function(e,n){return e&&n?e.replace(/\\?\{([^{}]+)\}/g,(function(e,t){return"\\"===e.charAt(0)?e.slice(1):void 0===n[t]?"":n[t]})):e},throttle:function(e,n,t){var r,o,i,a,u=0;t||(t={});var c=function(){u=!1===t.leading?0:Date.now(),r=null,a=e.apply(o,i),r||(o=i=null)},s=function(){var s=Date.now();u||!1!==t.leading||(u=s);var l=n-(s-u);return o=this,i=arguments,l<=0||l>n?(r&&(clearTimeout(r),r=null),u=s,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,l)),a};return s.cancel=function(){clearTimeout(r),u=0,r=o=i=null},s},toArray:function(e){return Pv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return ap*e},toInteger:up,toRadian:function(e){return cp*e},toString:dp,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return Jv([].concat.apply([],e))},uniq:Jv,uniqueId:function(e){return Cp[e=e||"g"]?Cp[e]+=1:Cp[e]=1,e+Cp[e]},upperCase:function(e){return dp(e).toUpperCase()},upperFirst:function(e){var n=dp(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:lp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!Tv(i)){Lv(i)||(i=[i]);for(var a=0;a<i.length;a++){var u=i[a];r[u]||(t.push(u),r[u]=!0)}}}return t},wrapBehavior:function(e,n){if(e["_wrap_"+n])return e["_wrap_"+n];var t=function(t){e[n](t)};return e["_wrap_"+n]=t,t}}),Op={assign:function(e){if(e.__esModule)return e;var n=e.default;if("function"==typeof n){var t=function e(){return this instanceof e?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};t.prototype=n.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(e).forEach((function(n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})})),t}(Pp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},jp=Op,Ip={getId:function(e){return e.id||e.name},getPreH:function(e){return e.preH||0},getPreV:function(e){return e.preV||0},getHGap:function(e){return e.hgap||18},getVGap:function(e){return e.vgap||18},getChildren:function(e){return e.children},getHeight:function(e){return e.height||36},getWidth:function(e){var n=e.label||" ";return e.width||18*n.split("").length}};function Ap(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof Ap)return e;t.data=e;var r=n.getHGap(e),o=n.getVGap(e);return t.preH=n.getPreH(e),t.preV=n.getPreV(e),t.width=n.getWidth(e),t.height=n.getHeight(e),t.width+=t.preH,t.height+=t.preV,t.id=n.getId(e),t.x=t.y=0,t.depth=0,t.children||(t.children=[]),t.addGap(r,o),t}jp.assign(Ap.prototype,{isRoot:function(){return 0===this.depth},isLeaf:function(){return 0===this.children.length},addGap:function(e,n){var t=this;t.hgap+=e,t.vgap+=n,t.width+=2*e,t.height+=2*n},eachNode:function(e){for(var n,t=[this];n=t.shift();)e(n),t=n.children.concat(t)},DFTraverse:function(e){this.eachNode(e)},BFTraverse:function(e){for(var n,t=[this];n=t.shift();)e(n),t=t.concat(n.children)},getBoundingBox:function(){var e={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode((function(n){e.left=Math.min(e.left,n.x),e.top=Math.min(e.top,n.y),e.width=Math.max(e.width,n.x+n.width),e.height=Math.max(e.height,n.y+n.height)})),e},translate:function(e,n){void 0===e&&(e=0),void 0===n&&(n=0),this.eachNode((function(t){t.x+=e,t.y+=n,t.x+=t.preH,t.y+=t.preV}))},right2left:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.x=e.x-2*(e.x-n.left)-e.width})),e.translate(n.width,0)},bottom2top:function(){var e=this,n=e.getBoundingBox();e.eachNode((function(e){e.y=e.y-2*(e.y-n.top)-e.height})),e.translate(0,n.height)}});var zp=function(e,n,t){void 0===n&&(n={});var r,o=new Ap(e,n=jp.assign({},Ip,n)),i=[o];if(!t&&!e.collapsed)for(;r=i.shift();)if(!r.data.collapsed){var a=n.getChildren(r.data),u=a?a.length:0;if(r.children=new Array(u),a&&u)for(var c=0;c<u;c++){var s=new Ap(a[c],n);r.children[c]=s,i.push(s),s.parent=r,s.depth=r.depth+1}}return o},Tp=zp,Lp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=Tp(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),Bp=Lp;function Dp(e,n,t,r){void 0===r&&(r=[]);var o=this;o.w=e||0,o.h=n||0,o.y=t||0,o.x=0,o.c=r||[],o.cs=r.length,o.prelim=0,o.mod=0,o.shift=0,o.change=0,o.tl=null,o.tr=null,o.el=null,o.er=null,o.msel=0,o.mser=0}function Rp(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){Rp(e,n,t)}))}function Vp(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(Vp(e,n),t)})),t}function Hp(e,n){Rp(e,-Vp(e,n),n)}function Yp(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){Yp(e,n.children[r],t)}))}function Xp(e,n,t){void 0===t&&(t=0),n?(e.x=t,t+=e.width):(e.y=t,t+=e.height),e.children.forEach((function(e){Xp(e,n,t)}))}Dp.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(Dp.fromNode(e,n))})),n?new Dp(e.height,e.width,e.x,t):new Dp(e.width,e.height,e.y,t)};var Zp=zp,Fp=function(e,n){for(var t=Zp(e.data,n,!0),r=Zp(e.data,n,!0),o=e.children.length,i=Math.round(o/2),a=n.getSide||function(e,n){return n<i?"right":"left"},u=0;u<o;u++){var c=e.children[u];"right"===a(c,u)?r.children.push(c):t.children.push(c)}return t.eachNode((function(e){e.isRoot()||(e.side="left")})),r.eachNode((function(e){e.isRoot()||(e.side="right")})),{left:t,right:r}},Up=Fp,Wp=["LR","RL","TB","BT","H","V"],Gp=["LR","RL","H"],qp=Wp[0],$p=function(e,n,t){var r=n.direction||qp;if(n.isHorizontal=function(e){return Gp.indexOf(e)>-1}(r),r&&-1===Wp.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===Wp[0])t(e,n);else if(r===Wp[1])t(e,n),e.right2left();else if(r===Wp[2])t(e,n);else if(r===Wp[3])t(e,n),e.bottom2top();else if(r===Wp[4]||r===Wp[5]){var o=Up(e,n),i=o.left,a=o.right;t(i,n),t(a,n),n.isHorizontal?i.right2left():i.bottom2top(),a.translate(i.x-a.x,i.y-a.y),e.x=i.x,e.y=a.y;var u=e.getBoundingBox();n.isHorizontal?u.top<0&&e.translate(0,-u.top):u.left<0&&e.translate(-u.left,0)}var c=n.fixedRoot;return void 0===c&&(c=!0),c&&e.translate(-(e.x+e.width/2+e.hgap),-(e.y+e.height/2+e.vgap)),e};function Kp(e,n){return Kp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Kp(e,n)}var Qp=function(e,n){void 0===n&&(n={});var t=n.isHorizontal;function r(e){0===e.cs?(e.el=e,e.er=e,e.msel=e.mser=0):(e.el=e.c[0].el,e.msel=e.c[0].msel,e.er=e.c[e.cs-1].er,e.mser=e.c[e.cs-1].mser)}function o(e,n,t){for(var r=e.c[n-1],o=r.mod,s=e.c[n],l=s.mod;null!==r&&null!==s;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(l+s.prelim);d>0&&(l+=d,i(e,n,t.index,d));var f=c(r),h=c(s);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(s=a(s))&&(l+=s.mod)}!r&&s?function(e,n,t,r){var o=e.c[0].el;o.tl=t;var i=r-t.mod-e.c[0].msel;o.mod+=i,o.prelim-=i,e.c[0].el=e.c[n].el,e.c[0].msel=e.c[n].msel}(e,n,s,l):r&&!s&&function(e,n,t,r){var o=e.c[n].er;o.tr=t;var i=r-t.mod-e.c[n].mser;o.mod+=i,o.prelim-=i,e.c[n].er=e.c[n-1].er,e.c[n].mser=e.c[n-1].mser}(e,n,r,o)}function i(e,n,t,r){e.c[n].mod+=r,e.c[n].msel+=r,e.c[n].mser+=r,function(e,n,t,r){if(t!==n-1){var o=n-t;e.c[t+1].shift+=r/o,e.c[n].shift-=r/o,e.c[n].change-=r-r/o}}(e,n,t,r)}function a(e){return 0===e.cs?e.tl:e.c[0]}function u(e){return 0===e.cs?e.tr:e.c[e.cs-1]}function c(e){return e.y+e.h}function s(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}Xp(e,t);var l=Dp.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=s(c(n.c[0].el),0,null),i=1;i<n.cs;++i){e(n.c[i]);var a=c(n.c[i].er);o(n,i,t),t=s(a,i,t)}!function(e){e.prelim=(e.c[0].prelim+e.c[0].mod+e.c[e.cs-1].mod+e.c[e.cs-1].prelim+e.c[e.cs-1].w)/2-e.w/2}(n),r(n)}else r(n)}(l),function e(n,t){t+=n.mod,n.x=n.prelim+t,function(e){for(var n=0,t=0,r=0;r<e.cs;r++)t+=(n+=e.c[r].shift)+e.c[r].change,e.c[r].mod+=t}(n);for(var r=0;r<n.cs;r++)e(n.c[r],t)}(l,0),Yp(l,e,t),Hp(e,t),e},Jp=$p,eg=Op,ng=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Kp(n,t),r.prototype.execute=function(){return Jp(this.rootNode,this.options,Qp)},r}(Bp),tg={},rg=Op;function og(e,n){void 0===n&&(n=[]);var t=this;t.x=t.y=0,t.leftChild=t.rightChild=null,t.height=0,t.children=n}var ig={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function ag(e,n,t){t?(n.x=e.x,n.y=e.y):(n.x=e.y,n.y=e.x),e.children.forEach((function(e,r){ag(e,n.children[r],t)}))}function ug(e,n){return ug=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},ug(e,n)}var cg=function(e,n){void 0===n&&(n={}),n=rg.assign({},ig,n);var t,r=0,o=function e(n){if(!n)return null;n.width=0,n.depth&&n.depth>r&&(r=n.depth);var t=n.children,o=t.length,i=new og(n.height,[]);return t.forEach((function(n,t){var r=e(n);i.children.push(r),0===t&&(i.leftChild=r),t===o-1&&(i.rightChild=r)})),i.originNode=n,i.isLeaf=n.isLeaf(),i}(e);return function e(n){if(n.isLeaf||0===n.children.length)n.drawingDepth=r;else{var t=n.children.map((function(n){return e(n)})),o=Math.min.apply(null,t);n.drawingDepth=o-1}return n.drawingDepth}(o),function e(r){r.x=r.drawingDepth*n.rankSep,r.isLeaf?(r.y=0,t&&(r.y=t.y+t.height+n.nodeSep,r.originNode.parent!==t.originNode.parent&&(r.y+=n.subTreeSep)),t=r):(r.children.forEach((function(n){e(n)})),r.y=(r.leftChild.y+r.rightChild.y)/2)}(o),ag(o,e,n.isHorizontal),e},sg=$p,lg=Op,dg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,ug(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,sg(e.rootNode,e.options,cg)},r}(Bp),fg={},hg=Op;function vg(e,n){return vg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},vg(e,n)}var pg=Bp,gg=function(e,n,t,r){var o=null;e.eachNode((function(e){!function(e,n,t,r,o){var i="function"==typeof t?t(e):t*e.depth;if(!r)try{if(e.id===e.parent.children[0].id)return e.x+=i,void(e.y=n?n.y:0)}catch(e){}if(e.x+=i,n){if(e.y=n.y+hg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+hg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},yg=Fp,mg=Op,xg=["LR","RL","H"],bg=xg[0],wg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,vg(n,t),r.prototype.execute=function(){var e=this.options,n=this.rootNode;e.isHorizontal=!0;var t=e.indent,r=void 0===t?20:t,o=e.dropCap,i=void 0===o||o,a=e.direction,u=void 0===a?bg:a,c=e.align;if(u&&-1===xg.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===xg[0])gg(n,r,i,c);else if(u===xg[1])gg(n,r,i,c),n.right2left();else if(u===xg[2]){var s=yg(n,e),l=s.left,d=s.right;gg(l,r,i,c),l.right2left(),gg(d,r,i,c);var f=l.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(pg),_g={},Eg=Op;function Sg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=Sg(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function kg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){kg(e)}));var r=n[0],o=n[t-1],i=o.y-r.y+o.height,a=0;if(n.forEach((function(e){a+=e.totalHeight})),i>e.height)e.y=r.y+i/2-e.height/2;else if(1!==n.length||e.height>a){var u=e.y+(e.height-i)/2-r.y;n.forEach((function(e){e.translate(0,u)}))}else e.y=(r.y+r.height/2+o.y+o.height/2)/2-e.height/2}}var Cg={getSubTreeSep:function(){return 0}};function Mg(e,n){return Mg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Mg(e,n)}var Ng=function(e,n){void 0===n&&(n={}),n=Eg.assign({},Cg,n),e.parent={x:0,width:0,height:0,y:0},e.BFTraverse((function(e){e.x=e.parent.x+e.parent.width})),e.parent=null,Sg(e,n),e.startY=0,e.y=e.totalHeight/2-e.height/2,e.eachNode((function(e){var n=e.children,t=n.length;if(t){var r=n[0];if(r.startY=e.startY+e._subTreeSep,1===t)r.y=e.y+e.height/2-r.height/2;else{r.y=r.startY+r.totalHeight/2-r.height/2;for(var o=1;o<t;o++){var i=n[o];i.startY=n[o-1].startY+n[o-1].totalHeight,i.y=i.startY+i.totalHeight/2-i.height/2}}}})),kg(e)},Pg=$p,Og=Op,jg=function(e){var n,t;function r(){return e.apply(this,arguments)||this}return t=e,(n=r).prototype=Object.create(t.prototype),n.prototype.constructor=n,Mg(n,t),r.prototype.execute=function(){return Pg(this.rootNode,this.options,Ng)},r}(Bp),Ig={};Vn({compactBox:function(e,n){return n=eg.assign({},tg,n),new ng(e,n).execute()},dendrogram:function(e,n){return n=lg.assign({},fg,n),new dg(e,n).execute()},indented:function(e,n){return n=mg.assign({},_g,n),new wg(e,n).execute()},mindmap:function(e,n){return n=Og.assign({},Ig,n),new jg(e,n).execute()}});var Ag={value:()=>{}};function zg(){for(var e,n=0,t=arguments.length,r={};n<t;++n){if(!(e=arguments[n]+"")||e in r||/[\s.]/.test(e))throw new Error("illegal type: "+e);r[e]=[]}return new Tg(r)}function Tg(e){this._=e}function Lg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Bg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Ag,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}Tg.prototype=zg.prototype={constructor:Tg,on:function(e,n){var t,r,o=this._,i=(r=o,(e+"").trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");if(t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),e&&!r.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))),a=-1,u=i.length;if(!(arguments.length<2)){if(null!=n&&"function"!=typeof n)throw new Error("invalid callback: "+n);for(;++a<u;)if(t=(e=i[a]).type)o[t]=Bg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Bg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Lg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new Tg(e)},call:function(e,n){if((t=arguments.length-2)>0)for(var t,r,o=new Array(t),i=0;i<t;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,t=(r=this._[e]).length;i<t;++i)r[i].value.apply(n,o)},apply:function(e,n,t){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(n,t)}};var Dg="http://www.w3.org/1999/xhtml",Rg={svg:"http://www.w3.org/2000/svg",xhtml:Dg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Vg(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),Rg.hasOwnProperty(n)?{space:Rg[n],local:e}:e}function Hg(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Dg&&n.documentElement.namespaceURI===Dg?n.createElement(e):n.createElementNS(t,e)}}function Yg(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Xg(e){var n=Vg(e);return(n.local?Yg:Hg)(n)}function Zg(){}function Fg(e){return null==e?Zg:function(){return this.querySelector(e)}}function Ug(){return[]}function Wg(e){return null==e?Ug:function(){return this.querySelectorAll(e)}}function Gg(e){return function(){return this.matches(e)}}function qg(e){return function(n){return n.matches(e)}}var $g=Array.prototype.find;function Kg(){return this.firstElementChild}var Qg=Array.prototype.filter;function Jg(){return Array.from(this.children)}function ey(e){return new Array(e.length)}function ny(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function ty(e,n,t,r,o,i){for(var a,u=0,c=n.length,s=i.length;u<s;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new ny(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function ry(e,n,t,r,o,i,a){var u,c,s,l=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=s=a.call(c,c.__data__,u,n)+"",l.has(s)?o[u]=c:l.set(s,c));for(u=0;u<f;++u)s=a.call(e,i[u],u,i)+"",(c=l.get(s))?(r[u]=c,c.__data__=i[u],l.delete(s)):t[u]=new ny(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&l.get(h[u])===c&&(o[u]=c)}function oy(e){return e.__data__}function iy(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function ay(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function uy(e){return function(){this.removeAttribute(e)}}function cy(e){return function(){this.removeAttributeNS(e.space,e.local)}}function sy(e,n){return function(){this.setAttribute(e,n)}}function ly(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function dy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function fy(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,t)}}function hy(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function vy(e){return function(){this.style.removeProperty(e)}}function py(e,n,t){return function(){this.style.setProperty(e,n,t)}}function gy(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function yy(e,n){return e.style.getPropertyValue(n)||hy(e).getComputedStyle(e,null).getPropertyValue(n)}function my(e){return function(){delete this[e]}}function xy(e,n){return function(){this[e]=n}}function by(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function wy(e){return e.trim().split(/^|\s+/)}function _y(e){return e.classList||new Ey(e)}function Ey(e){this._node=e,this._names=wy(e.getAttribute("class")||"")}function Sy(e,n){for(var t=_y(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function ky(e,n){for(var t=_y(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Cy(e){return function(){Sy(this,e)}}function My(e){return function(){ky(this,e)}}function Ny(e,n){return function(){(n.apply(this,arguments)?Sy:ky)(this,e)}}function Py(){this.textContent=""}function Oy(e){return function(){this.textContent=e}}function jy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Iy(){this.innerHTML=""}function Ay(e){return function(){this.innerHTML=e}}function zy(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function Ty(){this.nextSibling&&this.parentNode.appendChild(this)}function Ly(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function By(){return null}function Dy(){var e=this.parentNode;e&&e.removeChild(this)}function Ry(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Vy(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function Hy(e){return function(){var n=this.__on;if(n){for(var t,r=0,o=-1,i=n.length;r<i;++r)t=n[r],e.type&&t.type!==e.type||t.name!==e.name?n[++o]=t:this.removeEventListener(t.type,t.listener,t.options);++o?n.length=o:delete this.__on}}}function Yy(e,n,t){return function(){var r,o=this.__on,i=function(e){return function(n){e.call(this,n,this.__data__)}}(n);if(o)for(var a=0,u=o.length;a<u;++a)if((r=o[a]).type===e.type&&r.name===e.name)return this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=t),void(r.value=n);this.addEventListener(e.type,i,t),r={type:e.type,name:e.name,value:n,listener:i,options:t},o?o.push(r):this.__on=[r]}}function Xy(e,n,t){var r=hy(e),o=r.CustomEvent;"function"==typeof o?o=new o(n,t):(o=r.document.createEvent("Event"),t?(o.initEvent(n,t.bubbles,t.cancelable),o.detail=t.detail):o.initEvent(n,!1,!1)),e.dispatchEvent(o)}function Zy(e,n){return function(){return Xy(this,e,n)}}function Fy(e,n){return function(){return Xy(this,e,n.apply(this,arguments))}}ny.prototype={constructor:ny,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,n){return this._parent.insertBefore(e,n)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Ey.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var n=this._names.indexOf(e);n>=0&&(this._names.splice(n,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Uy=[null];function Wy(e,n){this._groups=e,this._parents=n}function Gy(){return new Wy([[document.documentElement]],Uy)}function qy(e){return"string"==typeof e?new Wy([[document.querySelector(e)]],[document.documentElement]):new Wy([[e]],Uy)}function $y(e,n){if(e=function(e){let n;for(;n=e.sourceEvent;)e=n;return e}(e),void 0===n&&(n=e.currentTarget),n){var t=n.ownerSVGElement||n;if(t.createSVGPoint){var r=t.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,[(r=r.matrixTransform(n.getScreenCTM().inverse())).x,r.y]}if(n.getBoundingClientRect){var o=n.getBoundingClientRect();return[e.clientX-o.left-n.clientLeft,e.clientY-o.top-n.clientTop]}}return[e.pageX,e.pageY]}Wy.prototype=Gy.prototype={constructor:Wy,select:function(e){"function"!=typeof e&&(e=Fg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a,u=n[o],c=u.length,s=r[o]=new Array(c),l=0;l<c;++l)(i=u[l])&&(a=e.call(i,i.__data__,l,u))&&("__data__"in i&&(a.__data__=i.__data__),s[l]=a);return new Wy(r,this._parents)},selectAll:function(e){e="function"==typeof e?function(e){return function(){return null==(n=e.apply(this,arguments))?[]:Array.isArray(n)?n:Array.from(n);var n}}(e):Wg(e);for(var n=this._groups,t=n.length,r=[],o=[],i=0;i<t;++i)for(var a,u=n[i],c=u.length,s=0;s<c;++s)(a=u[s])&&(r.push(e.call(a,a.__data__,s,u)),o.push(a));return new Wy(r,o)},selectChild:function(e){return this.select(null==e?Kg:function(e){return function(){return $g.call(this.children,e)}}("function"==typeof e?e:qg(e)))},selectChildren:function(e){return this.selectAll(null==e?Jg:function(e){return function(){return Qg.call(this.children,e)}}("function"==typeof e?e:qg(e)))},filter:function(e){"function"!=typeof e&&(e=Gg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Wy(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,oy);var t,r=n?ry:ty,o=this._parents,i=this._groups;"function"!=typeof e&&(t=e,e=function(){return t});for(var a=i.length,u=new Array(a),c=new Array(a),s=new Array(a),l=0;l<a;++l){var d=o[l],f=i[l],h=f.length,v=iy(e.call(d,d&&d.__data__,l,o)),p=v.length,g=c[l]=new Array(p),y=u[l]=new Array(p);r(d,f,g,y,s[l]=new Array(h),v,n);for(var m,x,b=0,w=0;b<p;++b)if(m=g[b]){for(b>=w&&(w=b+1);!(x=y[w])&&++w<p;);m._next=x||null}}return(u=new Wy(u,o))._enter=c,u._exit=s,u},enter:function(){return new Wy(this._enter||this._groups.map(ey),this._parents)},exit:function(){return new Wy(this._exit||this._groups.map(ey),this._parents)},join:function(e,n,t){var r=this.enter(),o=this,i=this.exit();return"function"==typeof e?(r=e(r))&&(r=r.selection()):r=r.append(e+""),null!=n&&(o=n(o))&&(o=o.selection()),null==t?i.remove():t(i),r&&o?r.merge(o).order():o},merge:function(e){for(var n=e.selection?e.selection():e,t=this._groups,r=n._groups,o=t.length,i=r.length,a=Math.min(o,i),u=new Array(o),c=0;c<a;++c)for(var s,l=t[c],d=r[c],f=l.length,h=u[c]=new Array(f),v=0;v<f;++v)(s=l[v]||d[v])&&(h[v]=s);for(;c<o;++c)u[c]=t[c];return new Wy(u,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,n=-1,t=e.length;++n<t;)for(var r,o=e[n],i=o.length-1,a=o[i];--i>=0;)(r=o[i])&&(a&&4^r.compareDocumentPosition(a)&&a.parentNode.insertBefore(r,a),a=r);return this},sort:function(e){function n(n,t){return n&&t?e(n.__data__,t.__data__):!n-!t}e||(e=ay);for(var t=this._groups,r=t.length,o=new Array(r),i=0;i<r;++i){for(var a,u=t[i],c=u.length,s=o[i]=new Array(c),l=0;l<c;++l)(a=u[l])&&(s[l]=a);s.sort(n)}return new Wy(o,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r=e[n],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null},size:function(){let e=0;for(const n of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var n=this._groups,t=0,r=n.length;t<r;++t)for(var o,i=n[t],a=0,u=i.length;a<u;++a)(o=i[a])&&e.call(o,o.__data__,a,i);return this},attr:function(e,n){var t=Vg(e);if(arguments.length<2){var r=this.node();return t.local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}return this.each((null==n?t.local?cy:uy:"function"==typeof n?t.local?fy:dy:t.local?ly:sy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?vy:"function"==typeof n?gy:py)(e,n,null==t?"":t)):yy(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?my:"function"==typeof n?by:xy)(e,n)):this.node()[e]},classed:function(e,n){var t=wy(e+"");if(arguments.length<2){for(var r=_y(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Ny:n?Cy:My)(t,n))},text:function(e){return arguments.length?this.each(null==e?Py:("function"==typeof e?jy:Oy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Iy:("function"==typeof e?zy:Ay)(e)):this.node().innerHTML},raise:function(){return this.each(Ty)},lower:function(){return this.each(Ly)},append:function(e){var n="function"==typeof e?e:Xg(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:Xg(e),r=null==n?By:"function"==typeof n?n:Fg(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Dy)},clone:function(e){return this.select(e?Vy:Ry)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,n,t){var r,o,i=function(e){return e.trim().split(/^|\s+/).map((function(e){var n="",t=e.indexOf(".");return t>=0&&(n=e.slice(t+1),e=e.slice(0,t)),{type:e,name:n}}))}(e+""),a=i.length;if(!(arguments.length<2)){for(u=n?Yy:Hy,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,s=0,l=u.length;s<l;++s)for(r=0,c=u[s];r<a;++r)if((o=i[r]).type===c.type&&o.name===c.name)return c.value},dispatch:function(e,n){return this.each(("function"==typeof n?Fy:Zy)(e,n))},[Symbol.iterator]:function*(){for(var e=this._groups,n=0,t=e.length;n<t;++n)for(var r,o=e[n],i=0,a=o.length;i<a;++i)(r=o[i])&&(yield r)}};const Ky={passive:!1},Qy={capture:!0,passive:!1};function Jy(e){e.stopImmediatePropagation()}function em(e){e.preventDefault(),e.stopImmediatePropagation()}function nm(e){var n=e.document.documentElement,t=qy(e).on("dragstart.drag",em,Qy);"onselectstart"in n?t.on("selectstart.drag",em,Qy):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function tm(e,n){var t=e.document.documentElement,r=qy(e).on("dragstart.drag",null);n&&(r.on("click.drag",em,Qy),setTimeout((function(){r.on("click.drag",null)}),0)),"onselectstart"in t?r.on("selectstart.drag",null):(t.style.MozUserSelect=t.__noselect,delete t.__noselect)}var rm=e=>()=>e;function om(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:s,dispatch:l}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},subject:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:l}})}function im(e){return!e.ctrlKey&&!e.button}function am(){return this.parentNode}function um(e,n){return null==n?{x:e.x,y:e.y}:n}function cm(){return navigator.maxTouchPoints||"ontouchstart"in this}function sm(e,n){var t=n.snapGrid,r=void 0===t?[0,0]:t,o=n.snapToGrid,i=void 0!==o&&o,a=n.transform,u=lm(e),c=u.x,s=u.y,l=Ev({x:c,y:s},a),d=i?_v(l,r):l,f=d.x,h=d.y;return z({xSnapped:f,ySnapped:h},l)}om.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};exports.ConnectionMode=void 0,exports.PanOnScrollMode=void 0,exports.SelectionMode=void 0,exports.ConnectionLineType=void 0,exports.MarkerType=void 0,exports.Position=void 0;var lm=function(e,n){var t,r,o,i,a=function(e){return"clientX"in e}(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}};function dm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function fm(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function hm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-fm(t-o,a),r];case exports.Position.Right:return[t+fm(o-t,a),r];case exports.Position.Top:return[t,r-fm(r-i,a)];case exports.Position.Bottom:return[t,r+fm(i-r,a)]}}function vm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.curvature,l=void 0===s?.25:s,d=L(hm({pos:o,x1:n,y1:t,x2:i,y2:a,c:l}),2),f=d[0],h=d[1],v=L(hm({pos:c,x1:i,y1:a,x2:n,y2:t,c:l}),2),p=v[0],g=v[1],y=L(dm({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],x=y[1],b=y[2],w=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,x,b,w]}function pm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}!function(e){e.Strict="strict",e.Loose="loose"}(exports.ConnectionMode||(exports.ConnectionMode={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(exports.PanOnScrollMode||(exports.PanOnScrollMode={})),function(e){e.Partial="partial",e.Full="full"}(exports.SelectionMode||(exports.SelectionMode={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(exports.ConnectionLineType||(exports.ConnectionLineType={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(exports.MarkerType||(exports.MarkerType={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(exports.Position||(exports.Position={}));var gm,ym=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var mm=((gm={})[exports.Position.Left]={x:-1,y:0},gm[exports.Position.Right]={x:1,y:0},gm[exports.Position.Top]={x:0,y:-1},gm[exports.Position.Bottom]={x:0,y:1},gm),xm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function bm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?exports.Position.Top:u,s=e.borderRadius,l=void 0===s?5:s,d=e.centerX,f=e.centerY,h=e.offset,v=L(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?exports.Position.Bottom:a,c=e.target,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.center,f=e.offset,h=mm[u],v=mm[l],p={x:i.x+h.x*f,y:i.y+h.y*f},g={x:c.x+v.x*f,y:c.y+v.y*f},y=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}}({source:p,sourcePosition:u,target:g}),m=0!==y.x?"x":"y",x=y[m],b=[],w={x:0,y:0},_={x:0,y:0},E=L(pm({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],C=E[2],M=E[3];if(h[m]*v[m]==-1){r=null!==(n=d.x)&&void 0!==n?n:S,o=null!==(t=d.y)&&void 0!==t?t:k;var N=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===x?"x"===m?N:P:"x"===m?P:N}else{var O=[{x:p.x,y:g.y}],j=[{x:g.x,y:p.y}];if(b="x"===m?h.x===x?j:O:h.y===x?O:j,u===l){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===x?w[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==l){var z="x"===m?"y":"x",T=h[m]===v[z],D=p[z]>g[z],R=p[z]<g[z];(1===h[m]&&(!T&&D||T&&R)||1!==h[m]&&(!T&&R||T&&D))&&(b="x"===m?O:j)}var V={x:p.x+w.x,y:p.y+w.y},H={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(V.x-b[0].x),Math.abs(H.x-b[0].x))>=Math.max(Math.abs(V.y-b[0].y),Math.abs(H.y-b[0].y))?(r=(V.x+H.x)/2,o=b[0].y):(r=b[0].x,o=(V.y+H.y)/2)}return[B(B([i,{x:p.x+w.x,y:p.y+w.y}],L(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,C,M]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:c,center:{x:d,y:f},offset:void 0===h?20:h}),5),p=v[0],g=v[1],y=v[2],m=v[3],x=v[4],b=p.reduce((function(e,n,t){var r;return r=t>0&&t<p.length-1?function(e,n,t,r){var o=Math.min(xm(e,n)/2,xm(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(p[t-1],n,p[t+1],l):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[b,g,y,m,x]}function wm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||wm(t,n))}function _m(e,n,t){var r=e;do{if(null==r?void 0:r.matches(n))return!0;if(r===t)return!1;r=r.parentElement}while(r);return!1}function Em(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var s=T(a),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1],v=null===(r=u.get(f))||void 0===r?void 0:r.internals.userNode;v&&c.push(z(z({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[z(z({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Sm(e){var n=e.onNodeMouseDown,t=e.getStoreItems,r=e.onDragStart,o=e.onDrag,i=e.onDragStop,a={x:null,y:null},u=0,c=new Map,s=!1,l={x:0,y:0},d=null,f=!1,h=null;return{update:function(e){var v=e.noDragClassName,p=e.handleSelector,g=e.domNode,y=e.isSelectable,m=e.nodeId;function x(e,n){var r,i,u=e.x,s=e.y,l=t(),d=l.nodeLookup,f=l.nodeExtent,h=l.snapGrid,v=l.snapToGrid,p=l.nodeOrigin,g=l.onNodeDrag,y=l.onSelectionDrag,x=l.onError,b=l.updateNodePositions;a={x:u,y:s};var w=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=fv(c,{nodeOrigin:p});_=xv(E)}try{for(var S=T(c),k=S.next();!k.done;k=S.next()){var C=L(k.value,2),M=C[0],N=C[1],P={x:u-N.distance.x,y:s-N.distance.y};v&&(P=_v(P,h));var O=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!N.extent){var j=N.internals.positionAbsolute,I=j.x-_.x+f[0][0],A=j.x+N.measured.width-_.x2+f[1][0];O=[[I,j.y-_.y+f[0][1]],[A,j.y+N.measured.height-_.y2+f[1][1]]]}var z=hv({nodeId:M,nextPosition:P,nodeLookup:d,nodeExtent:O,nodeOrigin:p,onError:x}),B=z.position,D=z.positionAbsolute;w=w||N.position.x!==B.x||N.position.y!==B.y,N.position=B,N.internals.positionAbsolute=D}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(w&&(b(c,!0),n&&(o||g||!m&&y))){var R=L(Em({nodeId:m,dragItems:c,nodeLookup:d}),2),V=R[0],H=R[1];null==o||o(n,c,V,H),null==g||g(n,V,H),m||null==y||y(n,H)}}function b(){var e,n;if(d){var r=L(yv(l,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),s=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/s[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/s[2],f({x:o,y:i})&&x(a,null)}u=requestAnimationFrame(b)}}function w(e){var o,i=t(),u=i.nodeLookup,s=i.multiSelectionActive,l=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,x=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||s||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==n||n(m));var w=sm(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=w,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var s=T(e),l=s.next();!l.done;l=s.next()){var d=L(l.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!wm(h,e))&&(h.draggable||n&&void 0===h.draggable)){var v=e.get(f);v&&c.set(f,{id:f,position:v.position||{x:0,y:0},distance:{x:t.x-v.internals.positionAbsolute.x,y:t.y-v.internals.positionAbsolute.y},extent:v.extent,parentId:v.parentId,origin:v.origin,expandParent:v.expandParent,internals:{positionAbsolute:v.internals.positionAbsolute||{x:0,y:0}},measured:{width:null!==(a=v.measured.width)&&void 0!==a?a:0,height:null!==(u=v.measured.height)&&void 0!==u?u:0}})}}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}return c}(u,l,w,m),c.size>0&&(r||g||!m&&x)){var _=L(Em({nodeId:m,dragItems:c,nodeLookup:u}),2),E=_[0],S=_[1];null==r||r(e.sourceEvent,c,E,S),null==g||g(e.sourceEvent,E,S),m||null==x||x(e.sourceEvent,S)}}h=qy(g);var _=function(){var e,n,t,r,o=im,i=am,a=um,u=cm,c={},s=zg("start","drag","end"),l=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,Ky).on("touchend.drag touchcancel.drag",m).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,u){if(!r&&o.call(this,a,u)){var c=x(this,i.call(this,a,u),a,u,"mouse");c&&(qy(a.view).on("mousemove.drag",v,Qy).on("mouseup.drag",p,Qy),nm(a.view),Jy(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(em(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){qy(e.view).on("mousemove.drag mouseup.drag",null),tm(e.view,t),em(e),c.mouse("end",e)}function g(e,n){if(o.call(this,e,n)){var t,r,a=e.changedTouches,u=i.call(this,e,n),c=a.length;for(t=0;t<c;++t)(r=x(this,u,e,n,a[t].identifier,a[t]))&&(Jy(e),r("start",e,a[t]))}}function y(e){var n,t,r=e.changedTouches,o=r.length;for(n=0;n<o;++n)(t=c[r[n].identifier])&&(em(e),t("drag",e,r[n]))}function m(e){var n,t,o=e.changedTouches,i=o.length;for(r&&clearTimeout(r),r=setTimeout((function(){r=null}),500),n=0;n<i;++n)(t=c[o[n].identifier])&&(Jy(e),t("end",e,o[n]))}function x(e,n,t,r,o,i){var u,d,h,v=s.copy(),p=$y(i||t,n);if(null!=(h=a.call(e,new om("beforestart",{sourceEvent:t,target:f,identifier:o,active:l,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),r)))return u=h.x-p[0]||0,d=h.y-p[1]||0,function t(i,a,s){var g,y=p;switch(i){case"start":c[o]=t,g=l++;break;case"end":delete c[o],--l;case"drag":p=$y(s||a,n),g=l}v.call(i,e,new om(i,{sourceEvent:a,subject:h,target:f,identifier:o,active:g,x:p[0]+u,y:p[1]+d,dx:p[0]-y[0],dy:p[1]-y[1],dispatch:v}),r)}}return f.filter=function(e){return arguments.length?(o="function"==typeof e?e:rm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:rm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:rm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:rm(!!e),f):u},f.on=function(){var e=s.on.apply(s,arguments);return e===s?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}().on("start",(function(e){var n=t(),r=n.domNode,o=n.nodeDragThreshold,i=n.transform,u=n.snapGrid,c=n.snapToGrid;0===o&&w(e);var s=sm(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=s,d=(null==r?void 0:r.getBoundingClientRect())||null,l=lm(e.sourceEvent,d)})).on("drag",(function(e){var n,r,o=t(),i=o.autoPanOnNodeDrag,u=o.transform,h=o.snapGrid,v=o.snapToGrid,p=o.nodeDragThreshold,g=sm(e.sourceEvent,{transform:u,snapGrid:h,snapToGrid:v});if(!s&&i&&f&&(s=!0,b()),!f){var y=g.xSnapped-(null!==(n=a.x)&&void 0!==n?n:0),m=g.ySnapped-(null!==(r=a.y)&&void 0!==r?r:0);Math.sqrt(y*y+m*m)>p&&w(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(l=lm(e.sourceEvent,d),x(g,e.sourceEvent))})).on("end",(function(e){if(f&&(s=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,l=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&l){var d=L(Em({nodeId:m,dragItems:c,nodeLookup:r}),2),h=d[0],v=d[1];null==i||i(e.sourceEvent,c,h,v),null==a||a(e.sourceEvent,h,v),m||null==l||l(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!_m(n,".".concat(v),g))&&(!p||_m(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function km(e,n,t,r){return(n[t]||[]).reduce((function(n,o){return"".concat(e.id,"-").concat(o.id,"-").concat(t)!==r&&n.push({id:o.id||null,type:t,nodeId:e.id,x:e.internals.positionAbsolute.x+o.x+o.width/2,y:e.internals.positionAbsolute.y+o.y+o.height/2}),n}),[])}function Cm(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Mm=function(){return!0},Nm=null;function Pm(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,s=n.flowId,l=n.isValidConnection,d=void 0===l?Mm:l,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(s,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=lm(e),p=v.x,g=v.y,y=u.elementFromPoint(p,g),m=(null==y?void 0:y.classList.contains("".concat(c,"-flow__handle")))?y:h,x={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=Cm(void 0,m),w=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!w)return x;var k={source:f?w:o,sourceHandle:f?_:i,target:f?o:w,targetHandle:f?i:_};x.connection=k,E&&S&&(r===exports.ConnectionMode.Strict?f&&"source"===b||!f&&"target"===b:w!==o||_!==i)&&(x.endHandle={nodeId:w,handleId:_,type:b},x.isValid=d(k))}return x}var Om={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,s=n.domNode,l=n.nodeLookup,d=n.lib,f=n.autoPanOnConnect,h=n.flowId,v=n.panBy,p=n.cancelConnection,g=n.onConnectStart,y=n.onConnect,m=n.onConnectEnd,x=n.isValidConnection,b=void 0===x?Mm:x,w=n.onEdgeUpdateEnd,_=n.updateConnection,E=n.getTransform,S=n.getConnectionStartHandle,k=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),C=0,M=lm(e),N=M.x,P=M.y,O=null==k?void 0:k.elementFromPoint(N,P),j=Cm(u,O),I=null==s?void 0:s.getBoundingClientRect();if(I&&j){var A=lm(e,I),z=!1,D=null,R=!1,V=null,H=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=T(r),s=c.next();!s.done;s=c.next()){var l=L(s.value,2)[1];if(l.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=km(l,l.internals.handleBounds,"source",d),h=km(l,l.internals.handleBounds,"target",d);u.push.apply(u,B(B([],L(f),!1),L(h),!1))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:l,nodeId:a,handleId:i,handleType:j});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Nm={nodeId:a,handleId:i,type:j},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:j}),k.addEventListener("mousemove",X),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",X),k.addEventListener("touchend",Z)}function Y(){if(f&&I){var e=L(yv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),C=requestAnimationFrame(Y)}}function X(e){S()||Z(e);var n=E();A=lm(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=T(t),c=u.next();!c.done;c=u.next()){var s=c.value,l=Math.sqrt(Math.pow(s.x-e.x,2)+Math.pow(s.y-e.y,2));l<=n&&(l<a?i=[s]:l===a&&i.push(s),a=l)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}return i.length?1===i.length?i[0]:i.find((function(e){return"target"===e.type}))||i[0]:null}(Ev(A,n,!1,[1,1]),o,H),z||(Y(),z=!0);var u,s,l,f=Pm(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});V=f.handleDomNode,D=f.connection,R=f.isValid,_({connectionStartHandle:Nm,connectionPosition:t&&R?Sv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,s=R,l=null,s?l="valid":u&&!s&&(l="invalid"),l),connectionEndHandle:f.endHandle})}function Z(e){(t||V)&&D&&R&&(null==y||y(D)),null==m||m(e),u&&(null==w||w(e)),p(),cancelAnimationFrame(C),z=!1,R=!1,D=null,V=null,Nm=null,k.removeEventListener("mousemove",X),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",X),k.removeEventListener("touchend",Z)}},isValid:Pm};function jm(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function Im(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function Am(){}var zm=.7,Tm=1/zm,Lm="\\s*([+-]?\\d+)\\s*",Bm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Dm="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rm=/^#([0-9a-f]{3,8})$/,Vm=new RegExp(`^rgb\\(${Lm},${Lm},${Lm}\\)$`),Hm=new RegExp(`^rgb\\(${Dm},${Dm},${Dm}\\)$`),Ym=new RegExp(`^rgba\\(${Lm},${Lm},${Lm},${Bm}\\)$`),Xm=new RegExp(`^rgba\\(${Dm},${Dm},${Dm},${Bm}\\)$`),Zm=new RegExp(`^hsl\\(${Bm},${Dm},${Dm}\\)$`),Fm=new RegExp(`^hsla\\(${Bm},${Dm},${Dm},${Bm}\\)$`),Um={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function Wm(){return this.rgb().formatHex()}function Gm(){return this.rgb().formatRgb()}function qm(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=Rm.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?$m(n):3===t?new Jm(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?Km(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?Km(n>>12&15|n>>8&240,n>>8&15|n>>4&240,n>>4&15|240&n,((15&n)<<4|15&n)/255):null):(n=Vm.exec(e))?new Jm(n[1],n[2],n[3],1):(n=Hm.exec(e))?new Jm(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=Ym.exec(e))?Km(n[1],n[2],n[3],n[4]):(n=Xm.exec(e))?Km(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=Zm.exec(e))?ix(n[1],n[2]/100,n[3]/100,1):(n=Fm.exec(e))?ix(n[1],n[2]/100,n[3]/100,n[4]):Um.hasOwnProperty(e)?$m(Um[e]):"transparent"===e?new Jm(NaN,NaN,NaN,0):null}function $m(e){return new Jm(e>>16&255,e>>8&255,255&e,1)}function Km(e,n,t,r){return r<=0&&(e=n=t=NaN),new Jm(e,n,t,r)}function Qm(e,n,t,r){return 1===arguments.length?((o=e)instanceof Am||(o=qm(o)),o?new Jm((o=o.rgb()).r,o.g,o.b,o.opacity):new Jm):new Jm(e,n,t,null==r?1:r);var o}function Jm(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function ex(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}`}function nx(){const e=tx(this.opacity);return`${1===e?"rgb(":"rgba("}${rx(this.r)}, ${rx(this.g)}, ${rx(this.b)}${1===e?")":`, ${e})`}`}function tx(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function rx(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ox(e){return((e=rx(e))<16?"0":"")+e.toString(16)}function ix(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new ux(e,n,t,r)}function ax(e){if(e instanceof ux)return new ux(e.h,e.s,e.l,e.opacity);if(e instanceof Am||(e=qm(e)),!e)return new ux;if(e instanceof ux)return e;var n=(e=e.rgb()).r/255,t=e.g/255,r=e.b/255,o=Math.min(n,t,r),i=Math.max(n,t,r),a=NaN,u=i-o,c=(i+o)/2;return u?(a=n===i?(t-r)/u+6*(t<r):t===i?(r-n)/u+2:(n-t)/u+4,u/=c<.5?i+o:2-i-o,a*=60):u=c>0&&c<1?0:a,new ux(a,u,c,e.opacity)}function ux(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function cx(e){return(e=(e||0)%360)<0?e+360:e}function sx(e){return Math.max(0,Math.min(1,e||0))}function lx(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}jm(Am,qm,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Wm,formatHex:Wm,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return ax(this).formatHsl()},formatRgb:Gm,toString:Gm}),jm(Jm,Qm,Im(Am,{brighter(e){return e=null==e?Tm:Math.pow(Tm,e),new Jm(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?zm:Math.pow(zm,e),new Jm(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Jm(rx(this.r),rx(this.g),rx(this.b),tx(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ex,formatHex:ex,formatHex8:function(){return`#${ox(this.r)}${ox(this.g)}${ox(this.b)}${ox(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:nx,toString:nx})),jm(ux,(function(e,n,t,r){return 1===arguments.length?ax(e):new ux(e,n,t,null==r?1:r)}),Im(Am,{brighter(e){return e=null==e?Tm:Math.pow(Tm,e),new ux(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?zm:Math.pow(zm,e),new ux(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),n=isNaN(e)||isNaN(this.s)?0:this.s,t=this.l,r=t+(t<.5?t:1-t)*n,o=2*t-r;return new Jm(lx(e>=240?e-240:e+120,o,r),lx(e,o,r),lx(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new ux(cx(this.h),sx(this.s),sx(this.l),tx(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=tx(this.opacity);return`${1===e?"hsl(":"hsla("}${cx(this.h)}, ${100*sx(this.s)}%, ${100*sx(this.l)}%${1===e?")":`, ${e})`}`}}));var dx=e=>()=>e;function fx(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):dx(isNaN(e)?n:e)}var hx=function e(n){var t=function(e){return 1==(e=+e)?fx:function(n,t){return t-n?function(e,n,t){return e=Math.pow(e,t),n=Math.pow(n,t)-e,t=1/t,function(r){return Math.pow(e+r*n,t)}}(n,t,e):dx(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=Qm(e)).r,(n=Qm(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=fx(e.opacity,n.opacity);return function(n){return e.r=r(n),e.g=o(n),e.b=i(n),e.opacity=a(n),e+""}}return r.gamma=e,r}(1);function vx(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var px=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gx=new RegExp(px.source,"g");function yx(e,n){var t,r,o,i=px.lastIndex=gx.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=px.exec(e))&&(r=gx.exec(n));)(o=r.index)>i&&(o=n.slice(i,o),u[a]?u[a]+=o:u[++a]=o),(t=t[0])===(r=r[0])?u[a]?u[a]+=r:u[++a]=r:(u[++a]=null,c.push({i:a,x:vx(t,r)})),i=gx.lastIndex;return i<n.length&&(o=n.slice(i),u[a]?u[a]+=o:u[++a]=o),u.length<2?c[0]?function(e){return function(n){return e(n)+""}}(c[0].x):function(e){return function(){return e}}(n):(n=c.length,function(e){for(var t,r=0;r<n;++r)u[(t=c[r]).i]=t.x(e);return u.join("")})}var mx,xx=180/Math.PI,bx={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function wx(e,n,t,r,o,i){var a,u,c;return(a=Math.sqrt(e*e+n*n))&&(e/=a,n/=a),(c=e*t+n*r)&&(t-=e*c,r-=n*c),(u=Math.sqrt(t*t+r*r))&&(t/=u,r/=u,c/=u),e*r<n*t&&(e=-e,n=-n,c=-c,a=-a),{translateX:o,translateY:i,rotate:Math.atan2(n,e)*xx,skewX:Math.atan(c)*xx,scaleX:a,scaleY:u}}function _x(e,n,t,r){function o(e){return e.length?e.pop()+" ":""}return function(i,a){var u=[],c=[];return i=e(i),a=e(a),function(e,r,o,i,a,u){if(e!==o||r!==i){var c=a.push("translate(",null,n,null,t);u.push({i:c-4,x:vx(e,o)},{i:c-2,x:vx(r,i)})}else(o||i)&&a.push("translate("+o+n+i+t)}(i.translateX,i.translateY,a.translateX,a.translateY,u,c),function(e,n,t,i){e!==n?(e-n>180?n+=360:n-e>180&&(e+=360),i.push({i:t.push(o(t)+"rotate(",null,r)-2,x:vx(e,n)})):n&&t.push(o(t)+"rotate("+n+r)}(i.rotate,a.rotate,u,c),function(e,n,t,i){e!==n?i.push({i:t.push(o(t)+"skewX(",null,r)-2,x:vx(e,n)}):n&&t.push(o(t)+"skewX("+n+r)}(i.skewX,a.skewX,u,c),function(e,n,t,r,i,a){if(e!==t||n!==r){var u=i.push(o(i)+"scale(",null,",",null,")");a.push({i:u-4,x:vx(e,t)},{i:u-2,x:vx(n,r)})}else 1===t&&1===r||i.push(o(i)+"scale("+t+","+r+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,u,c),i=a=null,function(e){for(var n,t=-1,r=c.length;++t<r;)u[(n=c[t]).i]=n.x(e);return u.join("")}}}var Ex=_x((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?bx:wx(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Sx=_x((function(e){return null==e?bx:(mx||(mx=document.createElementNS("http://www.w3.org/2000/svg","g")),mx.setAttribute("transform",e),(e=mx.transform.baseVal.consolidate())?wx((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):bx)}),", ",")",")");function kx(e){return((e=Math.exp(e))+1/e)/2}var Cx,Mx,Nx=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],s=e[2],l=o[0],d=o[1],f=o[2],h=l-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/s)/n,i=function(e){return[u+e*h,c+e*v,s*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-s*s+r*p)/(2*s*t*g),m=(f*f-s*s-r*p)/(2*f*t*g),x=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-x)/n,i=function(e){var r,o=e*a,i=kx(x),l=s/(t*g)*(i*(r=n*o+x,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(x));return[u+l*h,c+l*v,s*i/kx(n*o+x)]}}return i.duration=1e3*a*n/Math.SQRT2,i}return o.rho=function(n){var t=Math.max(.001,+n),r=t*t;return e(t,r,r*r)},o}(Math.SQRT2,2,4),Px=0,Ox=0,jx=0,Ix=1e3,Ax=0,zx=0,Tx=0,Lx="object"==typeof performance&&performance.now?performance:Date,Bx="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Dx(){return zx||(Bx(Rx),zx=Lx.now()+Tx)}function Rx(){zx=0}function Vx(){this._call=this._time=this._next=null}function Hx(e,n,t){var r=new Vx;return r.restart(e,n,t),r}function Yx(){zx=(Ax=Lx.now())+Tx,Px=Ox=0;try{!function(){Dx(),++Px;for(var e,n=Cx;n;)(e=zx-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Px}()}finally{Px=0,function(){for(var e,n,t=Cx,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Cx=n);Mx=e,Zx(r)}(),zx=0}}function Xx(){var e=Lx.now(),n=e-Ax;n>Ix&&(Tx-=n,Ax=e)}function Zx(e){Px||(Ox&&(Ox=clearTimeout(Ox)),e-zx>24?(e<1/0&&(Ox=setTimeout(Yx,e-Lx.now()-Tx)),jx&&(jx=clearInterval(jx))):(jx||(Ax=Lx.now(),jx=setInterval(Xx,Ix)),Px=1,Bx(Yx)))}function Fx(e,n,t){var r=new Vx;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}Vx.prototype=Hx.prototype={constructor:Vx,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?Dx():+t)+(null==n?0:+n),this._next||Mx===this||(Mx?Mx._next=this:Cx=this,Mx=this),this._call=e,this._time=t,Zx()},stop:function(){this._call&&(this._call=null,this._time=1/0,Zx())}};var Ux=zg("start","end","cancel","interrupt"),Wx=[],Gx=0,qx=2,$x=3,Kx=5,Qx=6;function Jx(e,n,t,r,o,i){var a=e.__transition;if(a){if(t in a)return}else e.__transition={};!function(e,n,t){var r,o=e.__transition;function i(c){var s,l,d,f;if(1!==t.state)return u();for(s in o)if((f=o[s]).name===t.name){if(f.state===$x)return Fx(i);4===f.state?(f.state=Qx,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[s]):+s<n&&(f.state=Qx,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[s])}if(Fx((function(){t.state===$x&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=qx,t.on.call("start",e,e.__data__,t.index,t.group),t.state===qx){for(t.state=$x,r=new Array(d=t.tween.length),s=0,l=-1;s<d;++s)(f=t.tween[s].value.call(e,e.__data__,t.index,t.group))&&(r[++l]=f);r.length=l+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=Kx,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===Kx&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=Qx,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=Hx((function(e){t.state=1,t.timer.restart(i,t.delay,t.time),t.delay<=e&&i(e-t.delay)}),0,t.time)}(e,t,{name:n,index:r,group:o,on:Ux,tween:Wx,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Gx})}function eb(e,n){var t=tb(e,n);if(t.state>Gx)throw new Error("too late; already scheduled");return t}function nb(e,n){var t=tb(e,n);if(t.state>$x)throw new Error("too late; already running");return t}function tb(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function rb(e,n){var t,r,o,i=e.__transition,a=!0;if(i){for(o in n=null==n?null:n+"",i)(t=i[o]).name===n?(r=t.state>qx&&t.state<Kx,t.state=Qx,t.timer.stop(),t.on.call(r?"interrupt":"cancel",e,e.__data__,t.index,t.group),delete i[o]):a=!1;a&&delete e.__transition}}function ob(e,n){var t,r;return function(){var o=nb(this,e),i=o.tween;if(i!==t)for(var a=0,u=(r=t=i).length;a<u;++a)if(r[a].name===n){(r=r.slice()).splice(a,1);break}o.tween=r}}function ib(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=nb(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,s=o.length;c<s;++c)if(o[c].name===n){o[c]=u;break}c===s&&o.push(u)}i.tween=o}}function ab(e,n,t){var r=e._id;return e.each((function(){var e=nb(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return tb(e,r).value[n]}}function ub(e,n){var t;return("number"==typeof n?vx:n instanceof qm?hx:(t=qm(n))?(n=t,hx):yx)(e,n)}function cb(e){return function(){this.removeAttribute(e)}}function sb(e){return function(){this.removeAttributeNS(e.space,e.local)}}function lb(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttribute(e);return a===i?null:a===r?o:o=n(r=a,t)}}function db(e,n,t){var r,o,i=t+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===r?o:o=n(r=a,t)}}function fb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttribute(e))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttribute(e)}}function hb(e,n,t){var r,o,i;return function(){var a,u,c=t(this);if(null!=c)return(a=this.getAttributeNS(e.space,e.local))===(u=c+"")?null:a===r&&u===o?i:(o=u,i=n(r=a,c));this.removeAttributeNS(e.space,e.local)}}function vb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttributeNS(e.space,e.local,n.call(this,t))}}(e,o)),t}return o._value=n,o}function pb(e,n){var t,r;function o(){var o=n.apply(this,arguments);return o!==r&&(t=(r=o)&&function(e,n){return function(t){this.setAttribute(e,n.call(this,t))}}(e,o)),t}return o._value=n,o}function gb(e,n){return function(){eb(this,e).delay=+n.apply(this,arguments)}}function yb(e,n){return n=+n,function(){eb(this,e).delay=n}}function mb(e,n){return function(){nb(this,e).duration=+n.apply(this,arguments)}}function xb(e,n){return n=+n,function(){nb(this,e).duration=n}}var bb=Gy.prototype.constructor;function wb(e){return function(){this.style.removeProperty(e)}}var _b=0;function Eb(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Sb(){return++_b}var kb=Gy.prototype;Eb.prototype={constructor:Eb,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Fg(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,s=r[a],l=s.length,d=i[a]=new Array(l),f=0;f<l;++f)(u=s[f])&&(c=e.call(u,u.__data__,f,s))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Jx(d[f],n,t,f,d,tb(u,t)));return new Eb(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=Wg(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,s=r[u],l=s.length,d=0;d<l;++d)if(c=s[d]){for(var f,h=e.call(c,c.__data__,d,s),v=tb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Jx(f,n,t,p,h,v);i.push(h),a.push(c)}return new Eb(i,a,n,t)},selectChild:kb.selectChild,selectChildren:kb.selectChildren,filter:function(e){"function"!=typeof e&&(e=Gg(e));for(var n=this._groups,t=n.length,r=new Array(t),o=0;o<t;++o)for(var i,a=n[o],u=a.length,c=r[o]=[],s=0;s<u;++s)(i=a[s])&&e.call(i,i.__data__,s,a)&&c.push(i);return new Eb(r,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var n=this._groups,t=e._groups,r=n.length,o=t.length,i=Math.min(r,o),a=new Array(r),u=0;u<i;++u)for(var c,s=n[u],l=t[u],d=s.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=s[h]||l[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Eb(a,this._parents,this._name,this._id)},selection:function(){return new bb(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=Sb(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)if(a=u[s]){var l=tb(a,n);Jx(a,e,t,s,u,{time:l.time+l.delay+l.duration,delay:0,duration:l.duration,ease:l.ease})}return new Eb(r,this._parents,e,t)},call:kb.call,nodes:kb.nodes,node:kb.node,size:kb.size,empty:kb.empty,each:kb.each,on:function(e,n){var t=this._id;return arguments.length<2?tb(this.node(),t).on.on(e):this.each(function(e,n,t){var r,o,i=function(e){return(e+"").trim().split(/^|\s+/).every((function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||"start"===e}))}(n)?eb:nb;return function(){var a=i(this,e),u=a.on;u!==r&&(o=(r=u).copy()).on(n,t),a.on=o}}(t,e,n))},attr:function(e,n){var t=Vg(e),r="transform"===t?Sx:ub;return this.attrTween(e,"function"==typeof n?(t.local?hb:fb)(t,r,ab(this,"attr."+e,n)):null==n?(t.local?sb:cb)(t):(t.local?db:lb)(t,r,n))},attrTween:function(e,n){var t="attr."+e;if(arguments.length<2)return(t=this.tween(t))&&t._value;if(null==n)return this.tween(t,null);if("function"!=typeof n)throw new Error;var r=Vg(e);return this.tween(t,(r.local?vb:pb)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Ex:ub;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=yy(this,e),a=(this.style.removeProperty(e),yy(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,wb(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=yy(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=yy(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,ab(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=nb(this,e),s=c.on,l=null==c.value[a]?i||(i=wb(n)):void 0;s===t&&o===l||(r=(t=s).copy()).on(u,o=l),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=yy(this,e);return a===i?null:a===r?o:o=n(r=a,t)}}(e,r,n),t).on("end.style."+e,null)},styleTween:function(e,n,t){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(null==n)return this.tween(r,null);if("function"!=typeof n)throw new Error;return this.tween(r,function(e,n,t){var r,o;function i(){var i=n.apply(this,arguments);return i!==o&&(r=(o=i)&&function(e,n,t){return function(r){this.style.setProperty(e,n.call(this,r),t)}}(e,i,t)),r}return i._value=n,i}(e,n,null==t?"":t))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var n=e(this);this.textContent=null==n?"":n}}(ab(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var n="text";if(arguments.length<1)return(n=this.tween(n))&&n._value;if(null==e)return this.tween(n,null);if("function"!=typeof e)throw new Error;return this.tween(n,function(e){var n,t;function r(){var r=e.apply(this,arguments);return r!==t&&(n=(t=r)&&function(e){return function(n){this.textContent=e.call(this,n)}}(r)),n}return r._value=e,r}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var n=this.parentNode;for(var t in this.__transition)if(+t!==e)return;n&&n.removeChild(this)}}(this._id))},tween:function(e,n){var t=this._id;if(e+="",arguments.length<2){for(var r,o=tb(this.node(),t).tween,i=0,a=o.length;i<a;++i)if((r=o[i]).name===e)return r.value;return null}return this.each((null==n?ob:ib)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?gb:yb)(n,e)):tb(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?mb:xb)(n,e)):tb(this.node(),n).duration},ease:function(e){var n=this._id;return arguments.length?this.each(function(e,n){if("function"!=typeof n)throw new Error;return function(){nb(this,e).ease=n}}(n,e)):tb(this.node(),n).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,n){return function(){var t=n.apply(this,arguments);if("function"!=typeof t)throw new Error;nb(this,e).ease=t}}(this._id,e))},end:function(){var e,n,t=this,r=t._id,o=t.size();return new Promise((function(i,a){var u={value:a},c={value:function(){0==--o&&i()}};t.each((function(){var t=nb(this,r),o=t.on;o!==e&&((n=(e=o).copy())._.cancel.push(u),n._.interrupt.push(u),n._.end.push(c)),t.on=n})),0===o&&i()}))},[Symbol.iterator]:kb[Symbol.iterator]};var Cb={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Mb(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}Gy.prototype.interrupt=function(e){return this.each((function(){rb(this,e)}))},Gy.prototype.transition=function(e){var n,t;e instanceof Eb?(n=e._id,e=e._name):(n=Sb(),(t=Cb).time=Dx(),e=null==e?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,s=0;s<c;++s)(a=u[s])&&Jx(a,e,n,s,u,t||Mb(a,n));return new Eb(r,this._parents,e,n)};var Nb=e=>()=>e;function Pb(e,{sourceEvent:n,target:t,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:n,enumerable:!0,configurable:!0},target:{value:t,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Ob(e,n,t){this.k=e,this.x=n,this.y=t}Ob.prototype={constructor:Ob,scale:function(e){return 1===e?this:new Ob(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new Ob(this.k,this.x+this.k*e,this.y+this.k*n)},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 jb=new Ob(1,0,0);function Ib(e){for(;!e.__zoom;)if(!(e=e.parentNode))return jb;return e.__zoom}function Ab(e){e.stopImmediatePropagation()}function zb(e){e.preventDefault(),e.stopImmediatePropagation()}function Tb(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Lb(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Bb(){return this.__zoom||jb}function Db(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Rb(){return navigator.maxTouchPoints||"ontouchstart"in this}function Vb(e,n,t){var r=e.invertX(n[0][0])-t[0][0],o=e.invertX(n[1][0])-t[1][0],i=e.invertY(n[0][1])-t[0][1],a=e.invertY(n[1][1])-t[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}Ib.prototype=Ob.prototype;var Hb,Yb=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},Xb=function(e){return{x:e.x,y:e.y,zoom:e.k}},Zb=function(e){var n=e.x,t=e.y,r=e.zoom;return jb.translate(n,t).scale(r)},Fb=function(e,n){return e.target.closest(".".concat(n))},Ub=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},Wb=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},Gb=function(e){var n=e.ctrlKey&&kv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function qb(e){var n=e.domNode,t=e.minZoom,r=e.maxZoom,o=e.translateExtent,i=e.viewport,a=e.onPanZoom,u=e.onPanZoomStart,c=e.onPanZoomEnd,s=e.onTransformChange,l=e.onDraggingChange,d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=n.getBoundingClientRect(),h=function(){var e,n,t,r=Tb,o=Lb,i=Vb,a=Db,u=Rb,c=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,d=Nx,f=zg("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",Bb).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",C).filter(u).on("touchstart.zoom",M).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",P).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,n){return(n=Math.max(c[0],Math.min(c[1],n)))===e.k?e:new Ob(n,e.x,e.y)}function x(e,n,t){var r=n[0]-t[0]*e.k,o=n[1]-t[1]*e.k;return r===e.x&&o===e.y?e:new Ob(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,n,t,r){e.on("start.zoom",(function(){_(this,arguments).event(r).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(r).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(r),u=o.apply(e,i),c=null==t?b(u):"function"==typeof t?t.apply(e,i):t,s=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),l=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(l.invert(c).concat(s/l.k),f.invert(c).concat(s/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=s/n[2];e=new Ob(t,c[0]-n[0]*t,c[1]-n[1]*t)}a.zoom(null,e)}}))}function _(e,n,t){return!t&&e.__zooming||new E(e,n)}function E(e,n){this.that=e,this.args=n,this.active=0,this.sourceEvent=null,this.extent=o.apply(e,n),this.taps=0}function S(e,...n){if(r.apply(this,arguments)){var t=_(this,n).event(e),o=this.__zoom,u=Math.max(c[0],Math.min(c[1],o.k*Math.pow(2,a.apply(this,arguments)))),l=$y(e);if(t.wheel)t.mouse[0][0]===l[0]&&t.mouse[0][1]===l[1]||(t.mouse[1]=o.invert(t.mouse[0]=l)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[l,o.invert(l)],rb(this),t.start()}zb(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(x(m(o,u),t.mouse[0],t.mouse[1]),t.extent,s))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=qy(e.view).on("mousemove.zoom",(function(e){if(zb(e),!a.moved){var n=e.clientX-l,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(x(a.that.__zoom,a.mouse[0]=$y(e,o),a.mouse[1]),a.extent,s))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),tm(e.view,a.moved),zb(e),a.event(e).end()}),!0),c=$y(e,o),l=e.clientX,d=e.clientY;nm(e.view),Ab(e),a.mouse=[c,this.__zoom.invert(c)],rb(this),a.start()}}function C(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=$y(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(x(m(t,c),a,u),o.apply(this,n),s);zb(e),l>0?qy(this).transition().duration(l).call(w,d,a,e):qy(this).call(y.transform,d,a,e)}}function M(t,...o){if(r.apply(this,arguments)){var i,a,u,c,s=t.touches,l=s.length,d=_(this,o,t.changedTouches.length===l).event(t);for(Ab(t),a=0;a<l;++a)c=[c=$y(u=s[a],this),this.__zoom.invert(c),u.identifier],d.touch0?d.touch1||d.touch0[2]===c[2]||(d.touch1=c,d.taps=0):(d.touch0=c,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(n=c[0],e=setTimeout((function(){e=null}),h)),rb(this),d.start())}}function N(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,l=c.length;for(zb(e),t=0;t<l;++t)o=$y(r=c[t],this),u.touch0&&u.touch0[2]===r.identifier?u.touch0[0]=o:u.touch1&&u.touch1[2]===r.identifier&&(u.touch1[0]=o);if(r=u.that.__zoom,u.touch1){var d=u.touch0[0],f=u.touch0[1],h=u.touch1[0],v=u.touch1[1],p=(p=h[0]-d[0])*p+(p=h[1]-d[1])*p,g=(g=v[0]-f[0])*g+(g=v[1]-f[1])*g;r=m(r,Math.sqrt(p/g)),o=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+v[0])/2,(f[1]+v[1])/2]}else{if(!u.touch0)return;o=u.touch0[0],a=u.touch0[1]}u.zoom("touch",i(x(r,o,a),u.extent,s))}}function P(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(Ab(e),t&&clearTimeout(t),t=setTimeout((function(){t=null}),h),o=0;o<c;++o)i=u[o],a.touch0&&a.touch0[2]===i.identifier?delete a.touch0:a.touch1&&a.touch1[2]===i.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(i=$y(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var s=qy(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",Bb),e!==o?w(e,n,t,r):o.interrupt().each((function(){_(this,arguments).event(r).start().zoom(null,"function"==typeof n?n.apply(this,arguments):n).end()}))},y.scaleBy=function(e,n,t,r){y.scaleTo(e,(function(){return this.__zoom.k*("function"==typeof n?n.apply(this,arguments):n)}),t,r)},y.scaleTo=function(e,n,t,r){y.transform(e,(function(){var e=o.apply(this,arguments),r=this.__zoom,a=null==t?b(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(x(m(r,c),a,u),e,s)}),t,r)},y.translateBy=function(e,n,t,r){y.transform(e,(function(){return i(this.__zoom.translate("function"==typeof n?n.apply(this,arguments):n,"function"==typeof t?t.apply(this,arguments):t),o.apply(this,arguments),s)}),null,r)},y.translateTo=function(e,n,t,r,a){y.transform(e,(function(){var e=o.apply(this,arguments),a=this.__zoom,u=null==r?b(e):"function"==typeof r?r.apply(this,arguments):r;return i(jb.translate(u[0],u[1]).scale(a.k).translate("function"==typeof n?-n.apply(this,arguments):-n,"function"==typeof t?-t.apply(this,arguments):-t),e,s)}),r,a)},E.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1==++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,n){return this.mouse&&"mouse"!==e&&(this.mouse[1]=n.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=n.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=n.invert(this.touch1[0])),this.that.__zoom=n,this.emit("zoom"),this},end:function(){return 0==--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var n=qy(this.that).datum();f.call(e,this.that,new Pb(e,{sourceEvent:this.sourceEvent,target:y,type:e,transform:this.that.__zoom,dispatch:f}),n)}},y.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Nb(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:Nb(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Nb(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:Nb([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),y):o},y.scaleExtent=function(e){return arguments.length?(c[0]=+e[0],c[1]=+e[1],y):[c[0],c[1]]},y.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],y):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(l=+e,y):l},y.interpolate=function(e){return arguments.length?(d=e,y):d},y.on=function(){var e=f.on.apply(f,arguments);return e===f?y:e},y.clickDistance=function(e){return arguments.length?(p=(e=+e)*e,y):Math.sqrt(p)},y.tapDistance=function(e){return arguments.length?(g=+e,y):g},y}().scaleExtent([t,r]).translateExtent(o),v=qy(n).call(h);x({x:i.x,y:i.y,zoom:vv(i.zoom,t,r)},[[0,0],[f.width,f.height]],o);var p=v.on("wheel.zoom"),g=v.on("dblclick.zoom");function y(e,n){v&&(null==h||h.transform(Wb(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function x(e,n,t){var r=Zb(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(Gb),{update:function(e){var n=e.noWheelClassName,t=e.noPanClassName,r=e.onPaneContextMenu,o=e.userSelectionActive,i=e.panOnScroll,f=e.panOnDrag,y=e.panOnScrollMode,x=e.panOnScrollSpeed,b=e.preventScrolling,w=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var C=!i||S||o?function(e){var n=e.noWheelClassName,t=e.preventScrolling,r=e.d3ZoomHandler;return function(e,o){if(!t&&"wheel"===e.type&&!e.ctrlKey||Fb(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:b,d3ZoomHandler:p}):function(e){var n=e.zoomPanValues,t=e.noWheelClassName,r=e.d3Selection,o=e.d3Zoom,i=e.panOnScrollMode,a=e.panOnScrollSpeed,u=e.zoomOnPinch,c=e.onPanZoomStart,s=e.onPanZoom,l=e.onPanZoomEnd;return function(e){if(Fb(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=$y(e),h=Gb(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===exports.PanOnScrollMode.Vertical?0:e.deltaX*p,y=i===exports.PanOnScrollMode.Horizontal?0:e.deltaY*p;!kv()&&e.shiftKey&&i!==exports.PanOnScrollMode.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=Xb(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==s||s(e,m),n.panScrollTimeout=setTimeout((function(){null==l||l(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:x,zoomOnPinch:w,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",C,{passive:!1}),!o){var M=function(e){var n=e.zoomPanValues,t=e.onDraggingChange,r=e.onPanZoomStart;return function(e){var o,i,a;if(!(null===(o=e.sourceEvent)||void 0===o?void 0:o.internal)){var u=Xb(e.transform);n.mouseButton=(null===(i=e.sourceEvent)||void 0===i?void 0:i.button)||0,n.isZoomingOrPanning=!0,n.prevViewport=u,"mousedown"===(null===(a=e.sourceEvent)||void 0===a?void 0:a.type)&&t(!0),r&&(null==r||r(e.sourceEvent,u))}}}({zoomPanValues:d,onDraggingChange:l,onPanZoomStart:u});h.on("start",M);var N=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.onPaneContextMenu,o=e.onTransformChange,i=e.onPanZoom;return function(e){var a,u,c;n.usedRightMouseButton=!(!r||!Ub(t,null!==(a=n.mouseButton)&&void 0!==a?a:0)),(null===(u=e.sourceEvent)||void 0===u?void 0:u.sync)||o([e.transform.x,e.transform.y,e.transform.k]),i&&!(null===(c=e.sourceEvent)||void 0===c?void 0:c.internal)&&(null==i||i(e.sourceEvent,Xb(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:s});h.on("zoom",N);var P=function(e){var n=e.zoomPanValues,t=e.panOnDrag,r=e.panOnScroll,o=e.onDraggingChange,i=e.onPanZoomEnd,a=e.onPaneContextMenu;return function(e){var u,c;if(!(null===(u=e.sourceEvent)||void 0===u?void 0:u.internal)&&(n.isZoomingOrPanning=!1,a&&Ub(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&Yb(n.prevViewport,e.transform))){var s=Xb(e.transform);n.prevViewport=s,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,s)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:l});h.on("end",P)}var O=function(e){var n=e.zoomActivationKeyPressed,t=e.zoomOnScroll,r=e.zoomOnPinch,o=e.panOnDrag,i=e.panOnScroll,a=e.zoomOnDoubleClick,u=e.userSelectionActive,c=e.noWheelClassName,s=e.noPanClassName,l=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(Fb(e,"".concat(l,"-flow__node"))||Fb(e,"".concat(l,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(Fb(e,c)&&"wheel"===e.type)return!1;if(Fb(e,s)&&("wheel"!==e.type||i&&"wheel"===e.type&&!n))return!1;if(!r&&e.ctrlKey&&"wheel"===e.type)return!1;if(!d&&!i&&!f&&"wheel"===e.type)return!1;if(!o&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(Array.isArray(o)&&!o.includes(e.button)&&"mousedown"===e.type)return!1;var h=Array.isArray(o)&&o.includes(e.button)||!e.button||e.button<=1;return(!e.ctrlKey||"wheel"===e.type)&&h}}({zoomActivationKeyPressed:S,panOnDrag:f,zoomOnScroll:_,panOnScroll:i,zoomOnDoubleClick:E,zoomOnPinch:w,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(O),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=Zb(e);return y(t,n),t},setViewportConstrained:x,getViewport:function(){var e=v?Ib(v.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,n){v&&(null==h||h.scaleTo(Wb(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(Wb(v,null==n?void 0:n.duration),e))},setScaleExtent:function(e){null==h||h.scaleExtent(e)},setTranslateExtent:function(e){null==h||h.translateExtent(e)},syncViewport:function(e){if(v){var n=Zb(e),t=v.property("__zoom");t.k===e.zoom&&t.x===e.x&&t.y===e.y||null==h||h.transform(v,n,null,{sync:!0})}}}}!function(e){e.Line="line",e.Handle="handle"}(Hb||(Hb={}));z(z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var $b=uv.error001();function Kb(n,t){var r=e.useContext(I);if(null===r)throw new Error($b);return O(r,n,t)}function Qb(){var n=e.useContext(I);if(null===n)throw new Error($b);return e.useMemo((function(){return{getState:n.getState,setState:n.setState,subscribe:n.subscribe}}),[n])}function Jb(e,n){var r,o,i;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var c=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var s=a(e),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=d.parentId;if(f){if(!e.has(f))throw new Error("Parent node ".concat(f," not found"));var h=e.get(f),v=ew(d,e,t(t({},d.position),{z:(cw(d.zIndex)?d.zIndex:0)+(d.selected?c:0)}),null!==(i=null==h?void 0:h.origin)&&void 0!==i?i:n.nodeOrigin),p=v.x,g=v.y,y=v.z,m=d.internals.positionAbsolute,x=p!==m.x||g!==m.y;(x||y!==d.internals.z)&&(d.internals=t(t({},d.internals),{positionAbsolute:x?{x:p,y:g}:m,z:y}))}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=s.return)&&o.call(s)}finally{if(r)throw r.error}}}function ew(e,n,t,r){var o,i,a,u,c,s;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var l=n.get(e.parentId),d=nw(l,r).position;return ew(l,n,{x:(null!==(o=t.x)&&void 0!==o?o:0)+d.x,y:(null!==(i=t.y)&&void 0!==i?i:0)+d.y,z:(null!==(a=l.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=l.internals.z)&&void 0!==c?c:0:null!==(s=t.z)&&void 0!==s?s:0},l.origin||r)}var nw=function(e,n){void 0===n&&(n=[0,0]);var t=uw(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}};function tw(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=a(t),u=i.next();!u.done;u=i.next()){var c=u.value,s=c.source,l=c.target,d=c.sourceHandle,f=void 0===d?null:d,h=c.targetHandle,v=void 0===h?null:h,p="".concat(s,"-source-").concat(f),g="".concat(l,"-target-").concat(v),y=e.get(p)||new Map,m=e.get(g)||new Map,x={edgeId:c.id,source:s,target:l,sourceHandle:f,targetHandle:v};n.set(c.id,c),e.set(p,y.set("".concat(l,"-").concat(v),x)),e.set(g,m.set("".concat(s,"-").concat(f),x))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function rw(e,n,r,o){void 0===o&&(o={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var i=new Map(n);n.clear(),r.clear();var a=(null==o?void 0:o.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var u,c,s=i.get(e.id);if(o.checkEquality&&e===(null==s?void 0:s.internals.userNode)||(s=t(t(t({},o.defaults),e),{measured:{width:null===(u=e.measured)||void 0===u?void 0:u.width,height:null===(c=e.measured)||void 0===c?void 0:c.height},internals:{positionAbsolute:e.position,handleBounds:null==s?void 0:s.internals.handleBounds,z:(cw(e.zIndex)?e.zIndex:0)+(e.selected?a:0),userNode:e}})),n.set(e.id,s),e.parentId){var l=r.get(e.parentId);l?l.push(s):r.set(e.parentId,[s])}})),r.size>0&&Jb(n,o)}function ow(e,n,t,r){var o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){var v=h.value,p=n.get(v.parentId);if(p){var g=null!==(c=null===(u=d.get(v.parentId))||void 0===u?void 0:u.expandedRect)&&void 0!==c?c:dw(p,null!==(s=p.origin)&&void 0!==s?s:r),y=pw(g,v.rect);d.set(v.parentId,{expandedRect:y,parent:p})}}}catch(e){o={error:e}}finally{try{h&&!h.done&&(i=f.return)&&i.call(f)}finally{if(o)throw o.error}}return d.size>0&&d.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=nw(i,i.origin).position,u=uw(i),c=o.x<a.x?Math.round(Math.abs(a.x-o.x)):0,s=o.y<a.y?Math.round(Math.abs(a.y-o.y)):0;if(c>0||s>0){l.push({id:r,type:"position",position:{x:a.x-c,y:a.y-s}});var d=t.get(r);null==d||d.forEach((function(n){e.some((function(e){return e.id===n.id}))||l.push({id:n.id,type:"position",position:{x:n.position.x+c,y:n.position.y+s}})}))}(u.width<o.width||u.height<o.height)&&l.push({id:r,type:"dimensions",setAttributes:!0,dimensions:{width:Math.max(u.width,Math.round(o.width)),height:Math.max(u.height,Math.round(o.height))}})})),l}var iw=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},aw=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:iw(e.x,n[0][0],n[1][0]),y:iw(e.y,n[0][1],n[1][1])}};function uw(e){var n,t,r,o,i,a,u,c;return{width:null!==(o=null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==o?o:0,height:null!==(c=null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:e.initialHeight)&&void 0!==c?c:0}}var cw=function(e){return!isNaN(e)&&isFinite(e)},sw=function(e,n){return void 0===n&&(n=[1,1]),{x:n[0]*Math.round(e.x/n[0]),y:n[1]*Math.round(e.y/n[1])}},lw=function(e,n,t,r){var o=e.x,i=e.y,a=u(n,3),c=a[0],s=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var d={x:(o-c)/l,y:(i-s)/l};return t?sw(d,r):d},dw=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=nw(e,n).positionAbsolute;return{x:c.x,y:c.y,width:null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0,height:null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0}},fw=function(e,n){return{x:Math.min(e.x,n.x),y:Math.min(e.y,n.y),x2:Math.max(e.x2,n.x2),y2:Math.max(e.y2,n.y2)}},hw=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},vw=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},pw=function(e,n){return vw(fw(hw(e),hw(n)))};function gw(n){return e.forwardRef(n)}var yw=function(e,n){var t=Math.max(0,Math.min(e.x+e.width,n.x+n.width)-Math.max(e.x,n.x)),r=Math.max(0,Math.min(e.y+e.height,n.y+n.height)-Math.max(e.y,n.y));return Math.ceil(t*r)},mw=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=iw(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}};function xw(e){return void 0!==e&&"parent"!==e}var bw=function(e){var n=e.x,t=e.y,r=e.width,o=e.height,i=e.origin,a=void 0===i?[0,0]:i;return!r||!o||a[0]<0||a[1]<0||a[0]>1||a[1]>1?{x:n,y:t}:{x:n-r*a[0],y:t-o*a[1]}},ww=function(e){return _w(e)},_w=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Ew=function(e){return cw(e.width)&&cw(e.height)&&cw(e.x)&&cw(e.y)},Sw=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},kw=["INPUT","SELECT","TEXTAREA"];function Cw(e){var n,t,r=(null===(t=null===(n=e.composedPath)||void 0===n?void 0:n.call(e))||void 0===t?void 0:t[0])||e.target;return kw.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Mw=function(e){return"clientX"in e},Nw=function(e,n){var t,r,o,i,a=Mw(e),u=a?e.clientX:null===(t=e.touches)||void 0===t?void 0:t[0].clientX,c=a?e.clientY:null===(r=e.touches)||void 0===r?void 0:r[0].clientY;return{x:u-(null!==(o=null==n?void 0:n.left)&&void 0!==o?o:0),y:c-(null!==(i=null==n?void 0:n.top)&&void 0!==i?i:0)}},Pw=function(e,n,r,o){void 0===o&&(o=[0,0]);var i=n.querySelectorAll(e);if(!i||!i.length)return null;var a=Array.from(i),u=n.getBoundingClientRect(),c=u.width*o[0],s=u.height*o[1];return a.map((function(e){var n=e.getBoundingClientRect();return t({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-u.left-c)/r,y:(n.top-u.top-s)/r},Sw(e))}))},Ow="undefined"!=typeof document?document:null;function jw(n,t){void 0===n&&(n=null),void 0===t&&(t={target:Ow,actInsideInputWithModifier:!0});var r=u(e.useState(!1),2),o=r[0],i=r[1],a=e.useRef(!1),s=e.useRef(new Set([])),l=u(e.useMemo((function(){if(null!==n){var e=(Array.isArray(n)?n:[n]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=e.reduce((function(e,n){return e.concat.apply(e,c([],u(n),!1))}),[]);return[e,t]}return[[],[]]}),[n]),2),d=l[0],f=l[1];return e.useEffect((function(){var e=(null==t?void 0:t.target)||Ow;if(null!==n){var r=function(e){if(a.current=e.ctrlKey||e.metaKey||e.shiftKey,(!a.current||a.current&&!t.actInsideInputWithModifier)&&Cw(e))return!1;var n=Aw(e.code,f);s.current.add(e[n]),Iw(d,s.current,!1)&&(e.preventDefault(),i(!0))},o=function(e){if((!a.current||a.current&&!t.actInsideInputWithModifier)&&Cw(e))return!1;var n=Aw(e.code,f);Iw(d,s.current,!0)?(i(!1),s.current.clear()):s.current.delete(e[n]),"Meta"===e.key&&s.current.clear(),a.current=!1},u=function(){s.current.clear(),i(!1)};return null==e||e.addEventListener("keydown",r),null==e||e.addEventListener("keyup",o),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),function(){null==e||e.removeEventListener("keydown",r),null==e||e.removeEventListener("keyup",o),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}}),[n,i]),o}function Iw(e,n,t){return e.filter((function(e){return t||e.length===n.size})).some((function(e){return e.every((function(e){return n.has(e)}))}))}function Aw(e,n){return n.includes(e)?"code":"key"}function zw(e,n){if(Object.is(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[t,r]of e)if(!Object.is(r,n.get(t)))return!1;return!0}if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const t of e)if(!n.has(t))return!1;return!0}const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;for(const r of t)if(!Object.prototype.hasOwnProperty.call(n,r)||!Object.is(e[r],n[r]))return!1;return!0}var Tw={position:"absolute",width:"100%",height:"100%",top:0,left:0};var Lw=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function Bw(n){var t=n.onPaneContextMenu,r=n.zoomOnScroll,o=void 0===r||r,i=n.zoomOnPinch,a=void 0===i||i,u=n.panOnScroll,c=void 0!==u&&u,s=n.panOnScrollSpeed,l=void 0===s?.5:s,d=n.panOnScrollMode,f=void 0===d?exports.PanOnScrollMode.Free:d,h=n.zoomOnDoubleClick,p=void 0===h||h,g=n.panOnDrag,y=void 0===g||g,m=n.defaultViewport,x=n.translateExtent,b=n.zoomActivationKeyCode,w=n.preventScrolling,_=void 0===w||w,E=n.children,S=n.noWheelClassName,k=n.noPanClassName,C=n.onViewportChange,M=n.isControlledViewport,N=Qb(),P=e.useRef(null),O=Kb(Lw,zw),j=O.userSelectionActive,I=O.lib,A=jw(b),z=e.useRef();return function(n){var t=Qb();e.useEffect((function(){var e=function(){var e,r;if(!n.current)return!1;var o=Sw(n.current);0!==o.height&&0!==o.width||null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"004",uv.error004()),t.setState({width:o.width||500,height:o.height||500})};if(n.current){e(),window.addEventListener("resize",e);var r=new ResizeObserver((function(){return e()}));return r.observe(n.current),function(){window.removeEventListener("resize",e),r&&n.current&&r.unobserve(n.current)}}}),[])}(P),e.useEffect((function(){if(P.current){var e=N.getState();z.current=qb({domNode:P.current,minZoom:e.minZoom,maxZoom:e.maxZoom,translateExtent:x,viewport:m,onTransformChange:function(e){null==C||C({x:e[0],y:e[1],zoom:e[2]}),M||N.setState({transform:e})},onDraggingChange:function(e){return N.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=N.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=N.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=N.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var n=z.current.getViewport(),t=n.x,r=n.y,o=n.zoom;return N.setState({panZoom:z.current,transform:[t,r,o],domNode:P.current.closest(".ink-flow")}),function(){var e;null===(e=z.current)||void 0===e||e.destroy()}}}),[]),e.useEffect((function(){var e;null===(e=z.current)||void 0===e||e.update({onPaneContextMenu:t,zoomOnScroll:o,zoomOnPinch:a,panOnScroll:c,panOnScrollSpeed:l,panOnScrollMode:f,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:A,preventScrolling:_,noPanClassName:k,userSelectionActive:j,noWheelClassName:S,lib:I})}),[t,o,a,c,l,f,p,y,A,_,k,j,S,I]),v.jsx("div",{className:"ink-flow__renderer",ref:P,style:Tw,children:E})}var Dw={actInsideInputWithModifier:!1};function Rw(e,n){var t;switch(e.type){case"select":n.selected=e.selected;break;case"position":void 0!==e.position&&(n.position=e.position),void 0!==e.dragging&&(n.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(null!==(t=n.measured)&&void 0!==t||(n.measured={}),n.measured.width=e.dimensions.width,n.measured.height=e.dimensions.height,e.setAttributes&&(n.width=e.dimensions.width,n.height=e.dimensions.height)),"boolean"==typeof e.resizing&&(n.resizing=e.resizing)}}function Vw(e,n){var r,o,i,u,c,s,l=[],d=new Map;try{for(var f=a(e),h=f.next();!h.done;h=f.next()){if("add"!==(_=h.value).type)if("remove"===_.type||"replace"===_.type)d.set(_.id,[_]);else{var v=d.get(_.id);v?v.push(_):d.set(_.id,[_])}else l.push(_.item)}}catch(e){r={error:e}}finally{try{h&&!h.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}try{for(var p=a(n),g=p.next();!g.done;g=p.next()){var y=g.value,m=d.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var x=t({},y);try{for(var b=(c=void 0,a(m)),w=b.next();!w.done;w=b.next()){var _;Rw(_=w.value,x)}}catch(e){c={error:e}}finally{try{w&&!w.done&&(s=b.return)&&s.call(b)}finally{if(c)throw c.error}}l.push(x)}else l.push(t({},m[0].item))}else l.push(y)}}catch(e){i={error:e}}finally{try{g&&!g.done&&(u=p.return)&&u.call(p)}finally{if(i)throw i.error}}return l}function Hw(e,n){return Vw(e,n)}function Yw(e,n){return Vw(e,n)}function Xw(e,n){return{id:e,type:"select",selected:n}}function Zw(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=u(s.value,2),d=l[0],f=l[1],h=n.has(d);void 0===f.selected&&!h||f.selected===h||(t&&(f.selected=h),i.push(Xw(f.id,h)))}}catch(e){r={error:e}}finally{try{s&&!s.done&&(o=c.return)&&o.call(c)}finally{if(r)throw r.error}}return i}function Fw(e){var n,t,r,o,i,c,s=e.items,l=void 0===s?[]:s,d=e.lookup,f=[],h=new Map(l.map((function(e){return[e.id,e]})));try{for(var v=a(l),p=v.next();!p.done;p=v.next()){var g=p.value,y=d.get(g.id),m=null!==(c=null===(i=null==y?void 0:y.internals)||void 0===i?void 0:i.userNode)&&void 0!==c?c:y;void 0!==m&&m!==g&&f.push({id:g.id,item:g,type:"replace"}),void 0===m&&f.push({item:g,type:"add"})}}catch(e){n={error:e}}finally{try{p&&!p.done&&(t=v.return)&&t.call(v)}finally{if(n)throw n.error}}try{for(var x=a(d),b=x.next();!b.done;b=x.next()){var w=u(b.value,1)[0];void 0===h.get(w)&&f.push({id:w,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=x.return)&&o.call(x)}finally{if(r)throw r.error}}return f}function Uw(e){return{id:e.id,type:"remove"}}var Ww=function(e,n){void 0===n&&(n=[0,0]);var t=uw(e),r=t.width,o=t.height,i="internals"in e?e.internals.positionAbsolute:e.position,a=e.origin||n,u=r*a[0],c=o*a[1];return{position:{x:e.position.x-u,y:e.position.y-c},positionAbsolute:{x:i.x-u,y:i.y-c}}},Gw=function(e,n){if(void 0===n&&(n={nodeOrigin:[0,0]}),0===e.length)return{x:0,y:0,width:0,height:0};var t=e.reduce((function(e,t){var r=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=nw(e,n).positionAbsolute,s=c.x,l=c.y;return{x:s,y:l,x2:s+(null!==(o=null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:e.width)&&void 0!==o?o:0),y2:l+(null!==(u=null!==(a=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==a?a:e.height)&&void 0!==u?u:0)}}(t,n.nodeOrigin);return fw(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vw(t)},qw=function(e,n,r,o,i,c){var s,l,d,f,h,v,p,g,y=u(void 0===r?[0,0,1]:r,3),m=y[0],x=y[1],b=y[2];void 0===o&&(o=!1),void 0===i&&(i=!1),void 0===c&&(c=[0,0]);var w=t(t({},lw(n,[m,x,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=a(e),S=E.next();!S.done;S=E.next()){var k=u(S.value,2)[1],C=k.measured,M=k.selectable,N=void 0===M||M,P=k.hidden,O=void 0!==P&&P,j=null!==(h=null!==(f=null!==(d=C.width)&&void 0!==d?d:k.width)&&void 0!==f?f:k.initialWidth)&&void 0!==h?h:null,I=null!==(g=null!==(p=null!==(v=C.height)&&void 0!==v?v:k.height)&&void 0!==p?p:k.initialHeight)&&void 0!==g?g:null;if(!(i&&!N||O)){var A=yw(w,dw(k,c));(null===j||null===I||o&&A>0||A>=(null!=j?j:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=E.return)&&l.call(E)}finally{if(s)throw s.error}}return _},$w=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))};function Kw(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,s=e.minZoom,l=e.maxZoom,d=e.nodeOrigin,f=void 0===d?[0,0]:d,h=[],v=(null==n?void 0:n.nodes)?new Set(n.nodes.map((function(e){return e.id}))):null;if(i.forEach((function(e){!(e.measured.width&&e.measured.height&&((null==n?void 0:n.includeHiddenNodes)||!e.hidden))||v&&!v.has(e.id)||h.push(e)})),h.length>0){var p=Gw(h,{nodeOrigin:f}),g=p.width>=a||p.height>=u;if("overflow"===(null==n?void 0:n.when)&&!g)return;var y=mw(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:s,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:l,null!==(o=null==n?void 0:n.padding)&&void 0!==o?o:.1);return c.setViewport(y,{duration:null==n?void 0:n.duration}),!0}return!1}function Qw(e){var n=e.nodeId,t=e.nextPosition,r=e.nodeLookup,o=e.nodeOrigin,i=void 0===o?[0,0]:o,a=e.nodeExtent,u=e.onError,c=r.get(n),s=c.parentId?r.get(c.parentId):void 0,l=s?Ww(s,s.origin||i).positionAbsolute:{x:0,y:0},d=l.x,f=l.y,h=function(e,n){var t,r,o,i;return n&&"parent"!==n?[n[0],[n[1][0]-(null!==(r=null===(t=e.measured)||void 0===t?void 0:t.width)&&void 0!==r?r:0),n[1][1]-(null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:0)]]:n}(c,c.extent||a);if("parent"!==c.extent||c.expandParent)s&&xw(c.extent)&&(h=[[c.extent[0][0]+d,c.extent[0][1]+f],[c.extent[1][0]+d,c.extent[1][1]+f]]);else if(s){var v=c.measured.width,p=c.measured.height,g=s.measured.width,y=s.measured.height;if(v&&p&&g&&y){var m=c.origin||i,x=d+v*m[0],b=f+p*m[1];h=[[x,b],[x+g-v,b+y-p]]}}else null==u||u("005",uv.error005());var w=xw(h)?aw(t,h):t;return{position:{x:w.x-d,y:w.y-f},positionAbsolute:w}}function Jw(e){return o(this,arguments,void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x,b,w,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,C=e.nodes,M=e.edges,N=e.onBeforeDelete;return i(this,(function(e){switch(e.label){case 0:n=new Set(E.map((function(e){return e.id}))),t=[],r=function(e){if(!1===e.deletable)return"continue";var r=n.has(e.id),o=!r&&e.parentId&&t.find((function(n){return n.id===e.parentId}));(r||o)&&t.push(e)};try{for(o=a(C),u=o.next();!u.done;u=o.next())c=u.value,r(c)}catch(e){m={error:e}}finally{try{u&&!u.done&&(x=o.return)&&x.call(o)}finally{if(m)throw m.error}}s=new Set(k.map((function(e){return e.id}))),l=M.filter((function(e){return!1!==e.deletable})),d=$w(t,l),f=d,h=function(e){s.has(e.id)&&!f.find((function(n){return n.id===e.id}))&&f.push(e)};try{for(v=a(l),p=v.next();!p.done;p=v.next())g=p.value,h(g)}catch(e){b={error:e}}finally{try{p&&!p.done&&(w=v.return)&&w.call(v)}finally{if(b)throw b.error}}return N?[4,N({nodes:t,edges:f})]:[2,{edges:f,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:f,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var e_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function n_(){var e=Kb(e_,zw),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?v.jsx("div",{className:"ink-flow__selection ink-flow__container",style:{width:t.width,height:t.height,transform:"translate(".concat(t.x,"px, ").concat(t.y,"px)")}}):null}var t_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},r_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function o_(n){var t=n.isSelecting;n.selectionMode;var r=n.panOnDrag,o=n.onSelectionStart,i=n.onSelectionEnd,c=n.onPaneClick,s=n.onPaneContextMenu,l=n.onPaneScroll,d=n.onPaneMouseEnter,f=n.onPaneMouseMove,h=n.onPaneMouseLeave,p=n.children,g=e.useRef(null),y=Qb(),m=e.useRef(0),b=e.useRef(0),w=e.useRef(),_=e.useRef(new Map),E=Kb(r_,zw),S=E.userSelectionActive,k=E.elementsSelectable,C=E.dragging,M=function(){y.setState({userSelectionActive:!1,userSelectionRect:null}),m.current=0,b.current=0},N=function(e){null==c||c(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},P=l?function(e){return l(e)}:void 0,O=k&&(t||S);return v.jsxs("div",{className:x(["ink-flow__pane",{draggable:r,dragging:C,selection:t}]),onClick:O?void 0:t_(N,g),onContextMenu:t_((function(e){Array.isArray(r)&&(null==r?void 0:r.includes(2))?e.preventDefault():null==s||s(e)}),g),onWheel:t_(P,g),onMouseEnter:O?void 0:d,onMouseDown:O?function(e){var n,r,i,c,s=y.getState(),l=s.resetSelectedElements,d=s.domNode,f=s.edgeLookup;if(w.current=null==d?void 0:d.getBoundingClientRect(),k&&t&&0===e.button&&e.target===g.current&&w.current){_.current=new Map;try{for(var h=a(f),v=h.next();!v.done;v=h.next()){var p=u(v.value,2),m=p[0],x=p[1];_.current.set(x.source,(null===(i=_.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),_.current.set(x.target,(null===(c=_.current.get(x.target))||void 0===c?void 0:c.add(m))||new Set([m]))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}var b=Nw(e.nativeEvent,w.current),E=b.x,S=b.y;l(),y.setState({userSelectionRect:{width:0,height:0,startX:E,startY:S,x:E,y:S}}),null==o||o(e)}}:void 0,onMouseMove:O?function(e){var n,r,o,i,u=y.getState(),c=u.userSelectionRect,s=u.edgeLookup,l=u.transform,d=u.nodeOrigin,f=u.nodeLookup,h=u.triggerNodeChanges,v=u.triggerEdgeChanges;if(t&&w.current&&c){var p=Nw(e.nativeEvent,w.current),g=p.x,x=p.y,E=c.startX,S=c.startY,k={startX:E,startY:S,x:g<E?g:E,y:x<S?x:S,width:Math.abs(g-E),height:Math.abs(x-S)},C=qw(f,k,l,!1,!0,d),M=new Set,N=new Set;try{for(var P=a(C),O=P.next();!O.done;O=P.next()){var j=O.value;N.add(j.id);var I=_.current.get(j.id);if(I)try{for(var A=(o=void 0,a(I)),z=A.next();!z.done;z=A.next()){var T=z.value;M.add(T)}}catch(e){o={error:e}}finally{try{z&&!z.done&&(i=A.return)&&i.call(A)}finally{if(o)throw o.error}}}}catch(e){n={error:e}}finally{try{O&&!O.done&&(r=P.return)&&r.call(P)}finally{if(n)throw n.error}}if(m.current!==N.size)m.current=N.size,h(Zw(f,N,!0));if(b.current!==M.size)b.current=M.size,v(Zw(s,M));y.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:f,onMouseUp:O?function(e){if(0===e.button){var n=y.getState().userSelectionRect;!S&&n&&e.target===g.current&&(null==N||N(e)),y.setState({nodesSelectionActive:m.current>0}),M(),null==i||i(e)}}:void 0,onMouseLeave:O?function(e){S&&(y.setState({nodesSelectionActive:m.current>0}),null==i||i(e)),M()}:h,ref:g,style:Tw,children:[p,v.jsx(n_,{})]})}var i_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function a_(n){var t=n.children,r=n.onPaneClick,o=n.onPaneMouseEnter,i=n.onPaneMouseMove,a=n.onPaneMouseLeave,u=n.onPaneContextMenu,c=n.onPaneScroll,s=n.deleteKeyCode,l=n.selectionKeyCode,d=n.selectionOnDrag,f=n.selectionMode,h=n.onSelectionStart,p=n.onSelectionEnd,g=n.multiSelectionKeyCode,y=n.panActivationKeyCode,m=n.zoomActivationKeyCode,x=n.elementsSelectable,b=n.zoomOnScroll,w=n.zoomOnPinch,_=n.panOnScroll,E=n.panOnScrollSpeed,S=n.panOnScrollMode,k=n.zoomOnDoubleClick,C=n.panOnDrag,M=n.defaultViewport,N=n.translateExtent,P=n.minZoom,O=n.maxZoom,j=n.preventScrolling;n.onSelectionContextMenu;var I=n.noWheelClassName,A=n.noPanClassName;n.disableKeyboardA11y;var z=n.onViewportChange,T=n.isControlledViewport,L=Kb(i_);L.nodesSelectionActive;var B=L.userSelectionActive,D=jw(l),R=jw(y),V=R||C,H=R||_,Y=D||B||d&&!0!==V;return function(n){var t=n.deleteKeyCode,r=n.multiSelectionKeyCode,o=Qb(),i=jw(t,Dw),a=jw(r);e.useEffect((function(){if(i){var e=o.getState();e.edges,e.nodes,o.setState({nodesSelectionActive:!1})}}),[i]),e.useEffect((function(){o.setState({multiSelectionActive:a})}),[a])}({deleteKeyCode:s,multiSelectionKeyCode:g}),v.jsx(Bw,{onPaneContextMenu:u,elementsSelectable:x,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:H,panOnScrollSpeed:E,panOnScrollMode:S,zoomOnDoubleClick:k,panOnDrag:!D&&V,defaultViewport:M,translateExtent:N,minZoom:P,maxZoom:O,zoomActivationKeyCode:m,preventScrolling:j,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:v.jsx(o_,{onSelectionStart:h,onSelectionEnd:p,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:u,onPaneScroll:c,panOnDrag:V,isSelecting:!!Y,selectionMode:f,children:t})})}a_.displayName="FlowRenderer";var u_=e.memo(a_);var c_="undefined"!=typeof window?e.useLayoutEffect:e.useEffect;function s_(n){var t=u(e.useState(!1),2),r=t[0],o=t[1],i=u(e.useState((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return o(!0)}))})),1),a=i[0];return c_((function(){if(r){var e=a.get();e.length&&(n(e),a.reset()),o(!1)}else a.reset()}),[r]),a}var l_=e.createContext(null);function d_(n){var t=n.children,r=Qb(),o=e.useCallback((function(e){var n,t,o=r.getState(),i=o.nodes,u=void 0===i?[]:i,c=o.setNodes,s=o.hasDefaultNodes,l=o.onNodesChange,d=o.nodeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Fw({items:f,lookup:d}))}),[]),i=s_(o),u=e.useCallback((function(e){var n,t,o=r.getState(),i=o.edges,u=void 0===i?[]:i,c=o.setEdges,s=o.hasDefaultEdges,l=o.onEdgesChange,d=o.edgeLookup,f=u;try{for(var h=a(e),v=h.next();!v.done;v=h.next()){var p=v.value;f="function"==typeof p?p(f):p}}catch(e){n={error:e}}finally{try{v&&!v.done&&(t=h.return)&&t.call(h)}finally{if(n)throw n.error}}s?c(f):l&&l(Fw({items:f,lookup:d}))}),[]),c=s_(u),s=e.useMemo((function(){return{nodeQueue:i,edgeQueue:c}}),[]);return v.jsx(l_.Provider,{value:s,children:t})}var f_=function(){var n=Qb();return e.useMemo((function(){return{zoomIn:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==e?void 0:e.duration})},zoomOut:function(e){var t;return null===(t=n.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==e?void 0:e.duration})},zoomTo:function(e,t){var r;return null===(r=n.getState().panZoom)||void 0===r?void 0:r.scaleTo(e,{duration:null==t?void 0:t.duration})},getZoom:function(){return n.getState().transform[2]},setViewport:function(e,t){var r,o,i,a=n.getState(),c=u(a.transform,3),s=c[0],l=c[1],d=c[2],f=a.panZoom;null==f||f.setViewport({x:null!==(r=e.x)&&void 0!==r?r:s,y:null!==(o=e.y)&&void 0!==o?o:l,zoom:null!==(i=e.zoom)&&void 0!==i?i:d},{duration:null==t?void 0:t.duration})},getViewport:function(){var e=u(n.getState().transform,3);return{x:e[0],y:e[1],zoom:e[2]}},fitView:function(e){var t=n.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,s=t.panZoom;return!!s&&Kw({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:s},e)},setCenter:function(e,t,r){var o=n.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,s=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],l=i/2-e*s,d=a/2-t*s;null==u||u.setViewport({x:l,y:d,zoom:s},{duration:null==r?void 0:r.duration})},fitBounds:function(e,t){var r,o=n.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,s=o.panZoom,l=mw(e,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==s||s.setViewport(l,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(e,t){void 0===t&&(t={snapToGrid:!0});var r=n.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return e;var u=a.getBoundingClientRect(),c=u.x,s=u.y,l={x:e.x-c,y:e.y-s};return lw(l,o,t.snapToGrid,i)},flowToScreenPosition:function(e){var t=n.getState(),r=t.transform,o=t.domNode;if(!o)return e;var i=o.getBoundingClientRect(),a=i.x,c=i.y,s=function(e,n){var t=e.x,r=e.y,o=u(n,3),i=o[0],a=o[1],c=o[2];return{x:t*c+i,y:r*c+a}}(e,r);return{x:s.x+a,y:s.y+c}}}}),[])},h_=function(e){return!!e.panZoom};function v_(){var n=this,r=f_(),a=Qb(),s=function(){var n=e.useContext(l_);if(!n)throw new Error("useBatchContext must be used within a BatchProvider");return n}(),l=Kb(h_);console.log("yk store",a.getState());var d=e.useMemo((function(){var e=function(e){return a.getState().nodeLookup.get(e)},r=function(e){s.nodeQueue.push(e)},l=function(e){var n,r,o,i,u=a.getState(),c=u.nodeLookup,s=u.nodeOrigin,l=ww(e)?e:c.get(e.id),d=l.parentId?function(e,n,r,o){var i,a;void 0===o&&(o=[0,0]);for(var u=n,c=t({},e);u;){var s=r.get(n);if(u=null==s?void 0:s.parentId,s){var l=s.origin||o,d=(null!==(i=s.measured.width)&&void 0!==i?i:0)*l[0],f=(null!==(a=s.measured.height)&&void 0!==a?a:0)*l[1];c.x+=s.position.x-d,c.y+=s.position.y-f}}return c}(l.position,l.parentId,c,s):l.position,f={id:l.id,position:d,width:null!==(r=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==r?r:l.width,height:null!==(i=null===(o=l.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:l.height,data:l.data};return dw(f)},d=function(e,n,o){void 0===o&&(o={replace:!1}),r((function(r){return r.map((function(r){if(r.id===e){var i="function"==typeof n?n(r):n;return o.replace&&ww(i)?i:t(t({},r),i)}return r}))}))};return{getNodes:function(){return a.getState().nodes.map((function(e){return t({},e)}))},getNode:function(n){var t;return null===(t=e(n))||void 0===t?void 0:t.internals.userNode},getInternalNode:e,getEdges:function(){var e=a.getState().edges;return(void 0===e?[]:e).map((function(e){return t({},e)}))},getEdge:function(e){return a.getState().edgeLookup.get(e)},setNodes:r,setEdges:function(e){s.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];s.nodeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];s.edgeQueue.push((function(e){return c(c([],u(e),!1),u(n),!1)}))},toObject:function(){var e=a.getState(),n=e.nodes,r=void 0===n?[]:n,o=e.edges,i=void 0===o?[]:o,c=u(e.transform,3),s=c[0],l=c[1],d=c[2];return{nodes:r.map((function(e){return t({},e)})),edges:i.map((function(e){return t({},e)})),viewport:{x:s,y:l,zoom:d}}},deleteElements:function(e){return o(n,[e],void 0,(function(e){var n,t,r,o,u,c,s,l,d,f,h,v,p,g,y,m,x=e.nodes,b=void 0===x?[]:x,w=e.edges,_=void 0===w?[]:w;return i(this,(function(e){switch(e.label){case 0:return n=a.getState(),t=n.nodes,r=n.edges,o=n.onNodesDelete,u=n.onEdgesDelete,c=n.triggerNodeChanges,s=n.triggerEdgeChanges,l=n.onDelete,d=n.onBeforeDelete,[4,Jw({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:d})];case 1:return f=e.sent(),h=f.nodes,v=f.edges,p=v.length>0,g=h.length>0,p&&(y=v.map(Uw),null==u||u(v),s(y)),g&&(m=h.map(Uw),null==o||o(h),c(m)),(g||p)&&(null==l||l({nodes:h,edges:v})),[2,{deletedNodes:h,deletedEdges:v}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var r=Ew(e),o=r?e:l(e),i=void 0!==t;return o?(t||a.getState().nodes).filter((function(t){var u=a.getState().nodeLookup.get(t.id);if(u&&!r&&(t.id===e.id||!u.internals.positionAbsolute))return!1;var c=dw(i?t:u),s=yw(c,o);return n&&s>0||s>=o.width*o.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var r=Ew(e)?e:l(e);if(!r)return!1;var o=yw(r,n);return t&&o>0||o>=r.width*r.height},updateNode:d,updateNodeData:function(e,n,r){void 0===r&&(r={replace:!1}),d(e,(function(e){var o="function"==typeof n?n(e):n;return r.replace?t(t({},e),{data:o}):t(t({},e),{data:t(t({},e.data),o)})}),r)},checkAllNodeBeMeasured:function(){return a.getState().nodes.every((function(e){return e.measured}))}}}),[]);return e.useMemo((function(){return t(t(t({},d),r),{viewportInitialized:l})}),[l])}var p_=function(e){return e.updateNodeInternals};var g_=function(e){return function(n){return e?qw(n.nodeLookup,{x:0,y:0,width:n.width,height:n.height},n.transform,!0).map((function(e){return e.id})):Array.from(n.nodeLookup.keys())}};var y_=e.createContext(null),m_=y_.Provider;y_.Consumer;var x_="ink-flow__node-desc",b_="ink-flow__edge-desc";function w_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=e.sourceControlX,a=e.sourceControlY,u=.125*n+.375*i+.375*e.targetControlX+.125*r,c=.125*t+.375*a+.375*e.targetControlY+.125*o;return[u,c,Math.abs(u-n),Math.abs(c-t)]}function __(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function E_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case exports.Position.Left:return[t-__(t-o,a),r];case exports.Position.Right:return[t+__(o-t,a),r];case exports.Position.Top:return[t,r-__(r-i,a)];case exports.Position.Bottom:return[t,r+__(i-r,a)]}}function S_(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=Math.abs(r-n)/2,a=r<n?r+i:r-i,u=Math.abs(o-t)/2;return[a,o<t?o+u:o-u,i,u]}var k_,C_=function(e){var n=e.source,t=e.sourceHandle,r=e.target,o=e.targetHandle;return"xy-edge__".concat(n).concat(t||"","-").concat(r).concat(o||"")};var M_=((k_={})[exports.Position.Left]={x:-1,y:0},k_[exports.Position.Right]={x:1,y:0},k_[exports.Position.Top]={x:0,y:-1},k_[exports.Position.Bottom]={x:0,y:1},k_),N_=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?exports.Position.Bottom:t,o=e.target;return r===exports.Position.Left||r===exports.Position.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1}},P_=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function O_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,s=e.targetPosition,l=void 0===s?exports.Position.Top:s,d=e.borderRadius,f=void 0===d?5:d,h=e.centerX,v=e.centerY,p=e.offset,g=u(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,s=void 0===a?exports.Position.Bottom:a,l=e.target,d=e.targetPosition,f=void 0===d?exports.Position.Top:d,h=e.center,v=e.offset,p=M_[s],g=M_[f],y={x:i.x+p.x*v,y:i.y+p.y*v},m={x:l.x+g.x*v,y:l.y+g.y*v},x=N_({source:y,sourcePosition:s,target:m}),b=0!==x.x?"x":"y",w=x[b],_=[],E={x:0,y:0},S={x:0,y:0},k=u(S_({sourceX:i.x,sourceY:i.y,targetX:l.x,targetY:l.y}),4),C=k[0],M=k[1],N=k[2],P=k[3];if(p[b]*g[b]==-1){r=null!==(n=h.x)&&void 0!==n?n:C,o=null!==(t=h.y)&&void 0!==t?t:M;var O=[{x:r,y:y.y},{x:r,y:m.y}],j=[{x:y.x,y:o},{x:m.x,y:o}];_=p[b]===w?"x"===b?O:j:"x"===b?j:O}else{var I=[{x:y.x,y:m.y}],A=[{x:m.x,y:y.y}];if(_="x"===b?p.x===w?A:I:p.y===w?I:A,s===f){var z=Math.abs(i[b]-l[b]);if(z<=v){var T=Math.min(v-1,v-z);p[b]===w?E[b]=(y[b]>i[b]?-1:1)*T:S[b]=(m[b]>l[b]?-1:1)*T}}if(s!==f){var L="x"===b?"y":"x",B=p[b]===g[L],D=y[L]>m[L],R=y[L]<m[L];(1===p[b]&&(!B&&D||B&&R)||1!==p[b]&&(!B&&R||B&&D))&&(_="x"===b?I:A)}var V={x:y.x+E.x,y:y.y+E.y},H={x:m.x+S.x,y:m.y+S.y};Math.max(Math.abs(V.x-_[0].x),Math.abs(H.x-_[0].x))>=Math.max(Math.abs(V.y-_[0].y),Math.abs(H.y-_[0].y))?(r=(V.x+H.x)/2,o=_[0].y):(r=_[0].x,o=(V.y+H.y)/2)}return[c(c([i,{x:y.x+E.x,y:y.y+E.y}],u(_),!1),[{x:m.x+S.x,y:m.y+S.y},l],!1),r,o,N,P]}({source:{x:n,y:t},sourcePosition:o,target:{x:i,y:a},targetPosition:l,center:{x:h,y:v},offset:void 0===p?20:p}),5),y=g[0],m=g[1],x=g[2],b=g[3],w=g[4],_=y.reduce((function(e,n,t){var r="";return r=t>0&&t<y.length-1?function(e,n,t,r){var o=Math.min(P_(e,n)/2,P_(n,t)/2,r),i=n.x,a=n.y;if(e.x===i&&i===t.x||e.y===a&&a===t.y)return"L".concat(i," ").concat(a);if(e.y===a){var u=e.x<t.x?-1:1,c=e.y<t.y?1:-1;return"L ".concat(i+o*u,",").concat(a,"Q ").concat(i,",").concat(a," ").concat(i,",").concat(a+o*c)}var s=e.x<t.x?1:-1,l=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*l,"Q ").concat(i,",").concat(a," ").concat(i+o*s,",").concat(a)}(y[t-1],n,y[t+1],f):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,m,x,b,w]}var j_=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var I_=e.memo(gw((function(n,o){var i,a,u=n.type,c=void 0===u?"source":u,s=n.position,l=void 0===s?exports.Position.Top:s,d=n.isValidConnection,f=n.isConnectable,h=void 0===f||f,p=n.isConnectableStart,g=void 0===p||p,y=n.isConnectableEnd,m=void 0===y||y,b=n.id,w=n.onConnect,_=n.children,E=n.className,S=n.onMouseDown,k=n.onTouchStart,C=r(n,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),M=b||null,N="target"===c,P=Qb(),O=e.useContext(y_),j=Kb(j_,zw),I=j.connectOnClick,A=j.noPanClassName,z=j.rfId,T=Kb(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,s=(null==i?void 0:i.nodeId)===e&&(null==i?void 0:i.handleId)===n&&(null==i?void 0:i.type)===t;return{connectingFrom:(null==o?void 0:o.nodeId)===e&&(null==o?void 0:o.handleId)===n&&(null==o?void 0:o.type)===t,connectingTo:s,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===exports.ConnectionMode.Strict?(null==o?void 0:o.type)!==t:e!==(null==o?void 0:o.nodeId)||n!==(null==o?void 0:o.handleId),connectionInProcess:!!o,valid:s&&"valid"===c}}}(O,M,c),zw),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,V=T.connectionInProcess,H=T.valid;O||null===(a=(i=P.getState()).onError)||void 0===a||a.call(i,"010",uv.error010());var Y=function(e){var n=P.getState(),r=n.defaultEdgeOptions,o=n.onConnect,i=n.hasDefaultEdges,a=t(t({},r),e);if(i){var u=P.getState(),c=u.edges;(0,u.setEdges)(function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(r="id"in(o=e)&&"source"in o&&"target"in o?t({},e):t(t({},e),{id:C_(e)}),n)?n:(null===r.sourceHandle&&delete r.sourceHandle,null===r.targetHandle&&delete r.targetHandle,n.concat(r)):n;var r,o}(a,c))}null==o||o(a),null==w||w(a)},X=function(e){if(O){var n=Mw(e.nativeEvent);if(g&&(n&&0===e.button||!n)){var t=P.getState();Om.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:N,handleId:M,nodeId:O,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:d||t.isValidConnection,getTransform:function(){return P.getState().transform},getConnectionStartHandle:function(){return P.getState().connectionStartHandle}})}n?null==S||S(e):null==k||k(e)}};return v.jsx("div",t({"data-handleid":M,"data-nodeid":O,"data-handlepos":l,"data-id":"".concat(z,"-").concat(O,"-").concat(M,"-").concat(c),className:x(["ink-flow__handle","ink-flow__handle-".concat(l),"nodrag",A,E,{source:!N,target:N,connectable:h,connectablestart:g,connectableend:m,clickconnecting:D,connectingfrom:L,connectingto:B,valid:H,connectionindicator:h&&(!V||R)&&(V?m:g)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=P.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,a=n.isValidConnection,u=n.lib,s=n.rfId;if(O&&(o||g)){if(!o)return null==t||t(e.nativeEvent,{nodeId:O,handleId:M,handleType:c}),void P.setState({connectionClickStartHandle:{nodeId:O,type:c,handleId:M}});var l=function(e){var n;return(null===(n=e.getRootNode)||void 0===n?void 0:n.call(e))||(null===window||void 0===window?void 0:window.document)}(e.target),f=d||a,h=Om.isValid(e.nativeEvent,{handle:{nodeId:O,id:M,type:c},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:l,lib:u}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),P.setState({connectionClickStartHandle:null})}}:void 0,ref:o},C,{children:_}))})));var A_={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},z_={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r;return v.jsxs(v.Fragment,{children:[null==n?void 0:n.label,v.jsx(I_,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r,i=e.sourcePosition,a=void 0===i?exports.Position.Bottom:i;return v.jsxs(v.Fragment,{children:[v.jsx(I_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,v.jsx(I_,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?exports.Position.Top:r;return v.jsxs(v.Fragment,{children:[v.jsx(I_,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function T_(e){var n=e.id,t=e.store,r=e.unselect,o=void 0!==r&&r,i=e.nodeRef,a=t.getState(),u=a.addSelectedNodes,c=a.unselectNodesAndEdges,s=a.multiSelectionActive,l=a.nodeLookup,d=a.onError,f=l.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&s)&&(c({nodes:[f],edges:[]}),requestAnimationFrame((function(){var e;return null===(e=null==i?void 0:i.current)||void 0===e?void 0:e.blur()}))):u([n])):null==d||d("012",uv.error012(n))}var L_=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function B_(n){var r,o=n.id,i=n.onClick,c=n.onMouseEnter,s=n.onMouseMove,l=n.onMouseLeave,d=n.onContextMenu,f=n.onDoubleClick,h=n.nodesDraggable,p=n.elementsSelectable,g=n.nodesConnectable,y=n.nodesFocusable,m=n.resizeObserver,b=n.noDragClassName,w=n.noPanClassName,_=n.disableKeyboardA11y,E=n.rfId,S=n.nodeTypes,k=n.nodeExtent,C=n.nodeOrigin,M=n.onError,N=Kb((function(e){var n=e.nodeLookup.get(o),t=e.parentLookup.has(o);return{node:n,internals:n.internals,isParent:t}}),zw),P=N.node,O=N.internals,j=N.isParent,I=P.type||"default",A=(null==S?void 0:S[I])||z_[I];void 0===A&&(null==M||M("003",uv.error003(I)),I="default",A=z_.default);var z=!!(P.draggable||h&&void 0===P.draggable),T=!!(P.selectable||p&&void 0===P.selectable),L=!!(P.connectable||g&&void 0===P.connectable),B=!!(P.focusable||y&&void 0===P.focusable),D=Qb(),R=function(e){var n,t,r,o,i,a;return void 0!==(null!==(r=null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:e.width)&&void 0!==r?r:e.initialWidth)&&void 0!==(null!==(a=null!==(i=null===(o=e.measured)||void 0===o?void 0:o.height)&&void 0!==i?i:e.height)&&void 0!==a?a:e.initialHeight)}(P),V=function(n){var t=n.node,r=n.nodeType,o=n.hasDimensions,i=n.resizeObserver,a=Qb(),u=e.useRef(null),c=e.useRef(null),s=e.useRef(t.sourcePosition),l=e.useRef(t.targetPosition),d=e.useRef(r),f=o&&!!t.internals.handleBounds&&!t.hidden;return e.useEffect((function(){!u.current||f&&c.current===u.current||(c.current&&(null==i||i.unobserve(c.current)),null==i||i.observe(u.current),c.current=u.current)}),[f]),e.useEffect((function(){return function(){c.current&&(null==i||i.unobserve(c.current),c.current=null)}}),[]),e.useEffect((function(){if(u.current){var e=d.current!==r,n=s.current!==t.sourcePosition,o=l.current!==t.targetPosition;(e||n||o)&&(d.current=r,s.current=t.sourcePosition,l.current=t.targetPosition,a.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:u.current,force:!0}]])))}}),[t.id,r,t.sourcePosition,t.targetPosition]),u}({node:P,nodeType:I,hasDimensions:R,resizeObserver:m}),H=function(n){var t=n.nodeRef,r=n.disabled,o=void 0!==r&&r,i=n.noDragClassName,a=n.handleSelector,c=n.nodeId,s=n.isSelectable,l=Qb(),d=u(e.useState(!1),2),f=d[0],h=d[1],v=e.useRef();return e.useEffect((function(){v.current=Sm({getStoreItems:function(){return l.getState()},onNodeMouseDown:function(e){T_({id:e,store:l,nodeRef:t})},onDragStart:function(){h(!0)},onDragStop:function(){h(!1)}})}),[]),e.useEffect((function(){var e,n;if(o)null===(e=v.current)||void 0===e||e.destroy();else if(t.current)return null===(n=v.current)||void 0===n||n.update({noDragClassName:i,handleSelector:a,domNode:t.current,isSelectable:s,nodeId:c}),function(){var e;null===(e=v.current)||void 0===e||e.destroy()}}),[i,a,o,s,t,c]),f}({nodeRef:V,disabled:P.hidden||!z,noDragClassName:b,handleSelector:P.dragHandle,nodeId:o,isSelectable:T}),Y=function(){var n=Qb(),t=e.useCallback((function(e){var t,r,o=n.getState(),i=o.nodeExtent,c=o.snapToGrid,s=o.snapGrid,l=o.nodesDraggable,d=o.onError,f=o.updateNodePositions,h=o.nodeLookup,v=o.nodeOrigin,p=new Map,g=L_(l),y=c?s[0]:5,m=c?s[1]:5,x=e.direction.x*y*e.factor,b=e.direction.y*m*e.factor;try{for(var w=a(h),_=w.next();!_.done;_=w.next()){var E=u(_.value,2)[1];if(g(E)){var S={x:E.internals.positionAbsolute.x+x,y:E.internals.positionAbsolute.y+b};c&&(S=sw(S,s));var k=Qw({nodeId:E.id,nextPosition:S,nodeLookup:h,nodeExtent:i,nodeOrigin:v,onError:d}),C=k.position,M=k.positionAbsolute;E.position=C,E.internals.positionAbsolute=M,p.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=w.return)&&r.call(w)}finally{if(t)throw t.error}}f(p)}),[]);return t}();if(P.hidden)return null;var X=uw(P),Z=function(e){var n,t,r,o,i,a,u,c,s,l;return void 0===e.internals.handleBounds?{width:null!==(t=null!==(n=e.width)&&void 0!==n?n:e.initialWidth)&&void 0!==t?t:null===(r=e.style)||void 0===r?void 0:r.width,height:null!==(i=null!==(o=e.height)&&void 0!==o?o:e.initialHeight)&&void 0!==i?i:null===(a=e.style)||void 0===a?void 0:a.height}:{width:null!==(u=e.width)&&void 0!==u?u:null===(c=e.style)||void 0===c?void 0:c.width,height:null!==(s=e.height)&&void 0!==s?s:null===(l=e.style)||void 0===l?void 0:l.height}}(P),F=k?aw(O.positionAbsolute,k):O.positionAbsolute,U=bw(t(t(t({},F),X),{origin:P.origin||C})),W=T||z||i||c||s||l,G=c?function(e){return c(e,t({},O.userNode))}:void 0,q=s?function(e){return s(e,t({},O.userNode))}:void 0,$=l?function(e){return l(e,t({},O.userNode))}:void 0,K=d?function(e){return d(e,t({},O.userNode))}:void 0,Q=f?function(e){return f(e,t({},O.userNode))}:void 0;return v.jsx("div",{className:x(["ink-flow__node","ink-flow__node-".concat(I),(r={},r[w]=z,r),P.className,{selected:P.selected,selectable:T,parent:j,draggable:z,dragging:H}]),ref:V,style:t(t({zIndex:O.z,transform:"translate(".concat(U.x,"px,").concat(U.y,"px)"),pointerEvents:W?"all":"none",visibility:R?"visible":"hidden"},P.style),Z),"data-id":o,"data-testid":"rf__node-".concat(o),onMouseEnter:G,onMouseMove:q,onMouseLeave:$,onContextMenu:K,onClick:function(e){var n=D.getState(),r=n.selectNodesOnDrag,a=n.nodeDragThreshold;T&&(!r||!z||a>0)&&T_({id:o,store:D,nodeRef:V}),i&&i(e,t({},O.userNode))},onDoubleClick:Q,onKeyDown:B?function(e){if(!Cw(e.nativeEvent)&&!_)if(sv.includes(e.key)&&T){var n="Escape"===e.key;T_({id:o,store:D,unselect:n,nodeRef:V})}else z&&P.selected&&Object.prototype.hasOwnProperty.call(A_,e.key)&&(D.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~F.x,", y: ").concat(~~F.y)}),Y({direction:A_[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:B?0:void 0,role:B?"button":void 0,"aria-describedby":_?void 0:"".concat(x_,"-").concat(E),"aria-label":P.ariaLabel,children:v.jsx(m_,{value:o,children:v.jsx(A,t({id:o,data:P.data,type:I,positionAbsoluteX:F.x,positionAbsoluteY:F.y,selected:P.selected,isConnectable:L,sourcePosition:P.sourcePosition,targetPosition:P.targetPosition,dragging:H,dragHandle:P.dragHandle,zIndex:O.z},X))})})}var D_=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function R_(n){var t,r=Kb(D_,zw),o=r.nodesDraggable,i=r.nodesConnectable,a=r.nodesFocusable,c=r.elementsSelectable,s=r.onError,l=(t=!1,Kb(e.useCallback(g_(t),[t]),zw)),d=function(){var n=Kb(p_),t=u(e.useState((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(e){var t=new Map;e.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),n(t)}))})),1),r=t[0];return e.useEffect((function(){return function(){null==r||r.disconnect()}}),[r]),r}();return v.jsx("div",{className:"ink-flow__nodes",style:Tw,children:l.map((function(e){return v.jsx(B_,{id:e,nodeTypes:n.nodeTypes,nodeOrigin:n.nodeOrigin,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:d,nodesDraggable:o,nodesConnectable:i,nodesFocusable:a,elementsSelectable:c,onError:s},e)}))})}R_.displayName="NodeRenderer";var V_,H_=e.memo(R_),Y_=((V_={})[exports.MarkerType.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},V_[exports.MarkerType.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return v.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},V_);function X_(e,n){if(!e)return"";if("string"==typeof e)return e;var t=n?"".concat(n,"__"):"";return"".concat(t).concat(Object.keys(e).sort().map((function(n){return"".concat(n,"=").concat(e[n])})).join("&"))}var Z_=function(n){var t=n.id,r=n.type,o=n.color,i=n.width,a=void 0===i?12.5:i,u=n.height,c=void 0===u?12.5:u,s=n.markerUnits,l=void 0===s?"strokeWidth":s,d=n.strokeWidth,f=n.orient,h=void 0===f?"auto-start-reverse":f,p=function(n){var t=Qb(),r=e.useMemo((function(){var e,r;return Object.prototype.hasOwnProperty.call(Y_,n)?Y_[n]:(null===(r=(e=t.getState()).onError)||void 0===r||r.call(e,"009",uv.error009(n)),null)}),[n]);return r}(r);return p?v.jsx("marker",{className:"ink-flow__arrowhead",id:t,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:l,orient:h,refX:"0",refY:"0",children:v.jsx(p,{color:o,strokeWidth:d})}):null},F_=function(n){var r=n.defaultColor,o=n.rfId,i=Kb((function(e){return e.edges})),a=Kb((function(e){return e.defaultEdgeOptions})),u=e.useMemo((function(){var e=function(e,n){var r=n.id,o=n.defaultColor,i=n.defaultMarkerStart,a=n.defaultMarkerEnd,u=new Set;return e.reduce((function(e,n){return[n.markerStart||i,n.markerEnd||a].forEach((function(n){if(n&&"object"==typeof n){var i=X_(n,r);u.has(i)||(e.push(t({id:i,color:n.color||o},n)),u.add(i))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(i,{id:o,defaultColor:r,defaultMarkerStart:null==a?void 0:a.markerStart,defaultMarkerEnd:null==a?void 0:a.markerEnd});return e}),[i,a,o,r]);return u.length?v.jsx("svg",{className:"ink-flow__marker",children:v.jsx("defs",{children:u.map((function(e){return v.jsx(Z_,{id:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,strokeWidth:e.strokeWidth,orient:e.orient},e.id)}))})}):null};F_.displayName="MarkerDefinitions";var U_=e.memo(F_);function W_(n){var o=n.x,i=n.y,a=n.label,c=n.labelStyle,s=void 0===c?{}:c,l=n.labelShowBg,d=void 0===l||l,f=n.labelBgStyle,h=void 0===f?{}:f,p=n.labelBgPadding,g=void 0===p?[2,4]:p,y=n.labelBgBorderRadius,m=void 0===y?2:y,b=n.children,w=n.className,_=r(n,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),E=u(e.useState({x:1,y:0,width:0,height:0}),2),S=E[0],k=E[1],C=x(["ink-flow__edge-textwrapper",w]),M=e.useCallback((function(e){if(null!==e){var n=e.getBBox();k({x:n.x,y:n.y,width:n.width,height:n.height})}}),[]);return void 0!==a&&a?v.jsxs("g",t({transform:"translate(".concat(o-S.width/2," ").concat(i-S.height/2,")"),className:C,visibility:S.width?"visible":"hidden"},_,{children:[d&&v.jsx("rect",{width:S.width+2*g[0],x:-g[0],y:-g[1],height:S.height+2*g[1],className:"ink-flow__edge-textbg",style:h,rx:m,ry:m}),v.jsx("text",{className:"ink-flow__edge-text",y:S.height/2,dy:"0.3em",ref:M,style:s,children:a}),b]})):null}W_.displayName="EdgeText";var G_=e.memo(W_);function q_(e){var n=e.id,t=e.path,r=e.labelX,o=e.labelY,i=e.label,a=e.labelStyle,u=e.labelShowBg,c=e.labelBgStyle,s=e.labelBgPadding,l=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,p=e.className,g=e.interactionWidth,y=void 0===g?20:g;return v.jsxs(v.Fragment,{children:[v.jsx("path",{id:n,style:d,d:t,fill:"none",className:x(["ink-flow__edge-path",p]),markerEnd:f,markerStart:h}),y&&v.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:y,className:"ink-flow__edge-interaction"}),i&&cw(r)&&cw(o)?v.jsx(G_,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:s,labelBgBorderRadius:l}):null]})}function $_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===exports.Position.Left||n===exports.Position.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function K_(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=u($_({pos:o,x1:n,y1:t,x2:i,y2:a}),2),d=l[0],f=l[1],h=u($_({pos:s,x1:i,y1:a,x2:n,y2:t}),2),v=h[0],p=h[1],g=u(w_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:d,sourceControlY:f,targetControlX:v,targetControlY:p}),4),y=g[0],m=g[1],x=g[2],b=g[3];return["M".concat(n,",").concat(t," C").concat(d,",").concat(f," ").concat(v,",").concat(p," ").concat(i,",").concat(a),y,m,x,b]}function Q_(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,b=e.markerEnd,w=e.markerStart,_=e.interactionWidth,E=u(K_({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d}),3),S=E[0],k=E[1],C=E[2],M=n.isInternal?void 0:t;return v.jsx(q_,{id:M,path:S,labelX:k,labelY:C,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:b,markerStart:w,interactionWidth:_})}))}var J_=Q_({isInternal:!1}),eE=Q_({isInternal:!0});function nE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.sourcePosition,y=void 0===g?exports.Position.Bottom:g,m=e.targetPosition,x=void 0===m?exports.Position.Top:m,b=e.markerEnd,w=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(O_({sourceX:r,sourceY:o,sourcePosition:y,targetX:i,targetY:a,targetPosition:x,borderRadius:null==_?void 0:_.borderRadius,offset:null==_?void 0:_.offset}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(q_,{id:N,path:k,labelX:C,labelY:M,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:b,markerStart:w,interactionWidth:E})}))}J_.displayName="SimpleBezierEdge",eE.displayName="SimpleBezierEdgeInternal";var tE=nE({isInternal:!1}),rE=nE({isInternal:!0});function oE(n){return e.memo((function(o){var i,a=o.id,u=r(o,["id"]),c=n.isInternal?void 0:a;return v.jsx(tE,t({},u,{id:c,pathOptions:e.useMemo((function(){var e;return{borderRadius:0,offset:null===(e=u.pathOptions)||void 0===e?void 0:e.offset}}),[null===(i=u.pathOptions)||void 0===i?void 0:i.offset])}))}))}tE.displayName="SmoothStepEdge",rE.displayName="SmoothStepEdgeInternal";var iE=oE({isInternal:!1}),aE=oE({isInternal:!0});function uE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.label,s=e.labelStyle,l=e.labelShowBg,d=e.labelBgStyle,f=e.labelBgPadding,h=e.labelBgBorderRadius,p=e.style,g=e.markerEnd,y=e.markerStart,m=e.interactionWidth,x=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=u(S_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],c=i[1],s=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,c,s,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),b=x[0],w=x[1],_=x[2],E=n.isInternal?void 0:t;return v.jsx(q_,{id:E,path:b,labelX:w,labelY:_,label:c,labelStyle:s,labelShowBg:l,labelBgStyle:d,labelBgPadding:f,labelBgBorderRadius:h,style:p,markerEnd:g,markerStart:y,interactionWidth:m})}))}iE.displayName="StepEdge",aE.displayName="StepEdgeInternal";var cE=uE({isInternal:!1}),sE=uE({isInternal:!0});function lE(n){return e.memo((function(e){var t=e.id,r=e.sourceX,o=e.sourceY,i=e.targetX,a=e.targetY,c=e.sourcePosition,s=void 0===c?exports.Position.Bottom:c,l=e.targetPosition,d=void 0===l?exports.Position.Top:l,f=e.label,h=e.labelStyle,p=e.labelShowBg,g=e.labelBgStyle,y=e.labelBgPadding,m=e.labelBgBorderRadius,x=e.style,b=e.markerEnd,w=e.markerStart,_=e.pathOptions,E=e.interactionWidth,S=u(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?exports.Position.Bottom:r,i=e.targetX,a=e.targetY,c=e.targetPosition,s=void 0===c?exports.Position.Top:c,l=e.curvature,d=void 0===l?.25:l,f=u(E_({pos:o,x1:n,y1:t,x2:i,y2:a,c:d}),2),h=f[0],v=f[1],p=u(E_({pos:s,x1:i,y1:a,x2:n,y2:t,c:d}),2),g=p[0],y=p[1],m=u(w_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:h,sourceControlY:v,targetControlX:g,targetControlY:y}),4),x=m[0],b=m[1],w=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(h,",").concat(v," ").concat(g,",").concat(y," ").concat(i,",").concat(a),x,b,w,_]}({sourceX:r,sourceY:o,sourcePosition:s,targetX:i,targetY:a,targetPosition:d,curvature:null==_?void 0:_.curvature}),3),k=S[0],C=S[1],M=S[2],N=n.isInternal?void 0:t;return v.jsx(q_,{id:N,path:k,labelX:C,labelY:M,label:f,labelStyle:h,labelShowBg:p,labelBgStyle:g,labelBgPadding:y,labelBgBorderRadius:m,style:x,markerEnd:b,markerStart:w,interactionWidth:E})}))}cE.displayName="StraightEdge",sE.displayName="StraightEdgeInternal";var dE=lE({isInternal:!1}),fE=lE({isInternal:!0});dE.displayName="BezierEdge",fE.displayName="BezierEdgeInternal";var hE={default:fE,straight:sE,step:aE,smoothstep:rE,simplebezier:eE},vE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},pE=function(e,n,t){return t===exports.Position.Left?e-n:t===exports.Position.Right?e+n:e},gE=function(e,n,t){return t===exports.Position.Top?e-n:t===exports.Position.Bottom?e+n:e},yE="ink-flow__edgeupdater";function mE(e){var n=e.position,t=e.centerX,r=e.centerY,o=e.radius,i=void 0===o?10:o,a=e.onMouseDown,u=e.onMouseEnter,c=e.onMouseOut,s=e.type;return v.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:x([yE,"".concat(yE,"-").concat(s)]),cx:pE(t,i,n),cy:gE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function xE(e){var n=e.isUpdatable,t=e.edgeUpdaterRadius,r=e.edge,o=e.targetHandleId,i=e.sourceHandleId,a=e.sourceX,u=e.sourceY,c=e.targetX,s=e.targetY,l=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,p=e.onEdgeUpdateEnd,g=e.setUpdating,y=e.setUpdateHover,m=Qb(),x=function(e,n){if(0===e.button){var t=m.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,s=t.connectionMode,l=t.connectionRadius,d=t.lib,v=t.onConnectStart,y=t.onConnectEnd,x=t.cancelConnection,b=t.nodeLookup,w=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,C=n?"target":"source",M=n;g(!0),null==h||h(e,r,C);Om.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:s,connectionRadius:l,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:M,edgeUpdaterType:C,lib:d,flowId:w,cancelConnection:x,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:v,onConnectEnd:y,onEdgeUpdateEnd:function(e){g(!1),null==p||p(e,r,C)},updateConnection:E,getTransform:function(){return m.getState().transform},getConnectionStartHandle:function(){return m.getState().connectionStartHandle}})}},b=function(){return y(!0)},w=function(){return y(!1)};return v.jsxs(v.Fragment,{children:[("source"===n||!0===n)&&v.jsx(mE,{position:l,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return x(e,!0)},onMouseEnter:b,onMouseOut:w,type:"source"}),("target"===n||!0===n)&&v.jsx(mE,{position:d,centerX:c,centerY:s,radius:t,onMouseDown:function(e){return x(e,!1)},onMouseEnter:b,onMouseOut:w,type:"target"})]})}function bE(e){var n;return e&&!(!e.internals.handleBounds&&!(null===(n=e.handles)||void 0===n?void 0:n.length))&&!!(e.measured.width||e.width||e.initialWidth)}function wE(e){var n,t,r,o;if(!e)return null;var i=[],u=[];try{for(var c=a(e),s=c.next();!s.done;s=c.next()){var l=s.value;l.width=null!==(r=l.width)&&void 0!==r?r:1,l.height=null!==(o=l.height)&&void 0!==o?o:1,"source"===l.type?i.push(l):"target"===l.type&&u.push(l)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return{source:i,target:u}}function _E(e,n,t){var r,o;void 0===t&&(t=null);var i=(null!==(r=null==t?void 0:t.x)&&void 0!==r?r:0)+n.internals.positionAbsolute.x,a=(null!==(o=null==t?void 0:t.y)&&void 0!==o?o:0)+n.internals.positionAbsolute.y,u=null!=t?t:uw(n),c=u.width,s=u.height;switch(e){case exports.Position.Top:return[i+c/2,a];case exports.Position.Right:return[i+c,a+s/2];case exports.Position.Bottom:return[i+c/2,a+s];case exports.Position.Left:return[i,a+s/2]}}function EE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function SE(n){var r=n.id,o=n.edgesFocusable,i=n.edgesUpdatable,a=n.elementsSelectable,c=n.onClick,s=n.onDoubleClick,l=n.onContextMenu,d=n.onMouseEnter,f=n.onMouseMove,h=n.onMouseLeave,p=n.edgeUpdaterRadius,g=n.onEdgeUpdate,y=n.onEdgeUpdateStart,m=n.onEdgeUpdateEnd,b=n.rfId,w=n.edgeTypes,_=n.noPanClassName,E=n.onError,S=n.disableKeyboardA11y,k=Kb((function(e){return e.edgeLookup.get(r)})),C=Kb((function(e){return e.defaultEdgeOptions})),M=(k=C?t(t({},C),k):k).type||"default",N=(null==w?void 0:w[M])||hE[M];void 0===N&&(null==E||E("011",uv.error011(M)),M="default",N=hE.default);var P=!!(k.focusable||o&&void 0===k.focusable),O=void 0!==g&&(k.updatable||i&&void 0===k.updatable),j=!!(k.selectable||a&&void 0===k.selectable),I=e.useRef(null),A=u(e.useState(!1),2),z=A[0],T=A[1],L=u(e.useState(!1),2),B=L[0],D=L[1],R=Qb(),V=Kb(e.useCallback((function(e){var n=e.nodeLookup.get(k.source),o=e.nodeLookup.get(k.target);if(!n||!o)return t({zIndex:k.zIndex},vE);var i=function(e){var n,t,r,o,i,a=e.sourceNode,c=e.targetNode;if(!bE(a)||!bE(c))return null;var s=a.internals.handleBounds||wE(a.handles),l=c.internals.handleBounds||wE(c.handles),d=EE(null!==(n=null==s?void 0:s.source)&&void 0!==n?n:[],e.sourceHandle),f=EE(e.connectionMode===exports.ConnectionMode.Strict?null!==(t=null==l?void 0:l.target)&&void 0!==t?t:[]:(null!==(r=null==l?void 0:l.target)&&void 0!==r?r:[]).concat(null!==(o=null==l?void 0:l.source)&&void 0!==o?o:[]),e.targetHandle),h=(null==d?void 0:d.position)||exports.Position.Bottom,v=(null==f?void 0:f.position)||exports.Position.Top;if(!d||!f)return null===(i=e.onError)||void 0===i||i.call(e,"008",uv.error008(d?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var p=u(_E(h,a,d),2),g=p[0],y=p[1],m=u(_E(v,c,f),2);return{sourceX:g,sourceY:y,targetX:m[0],targetY:m[1],sourcePosition:h,targetPosition:v}}({id:r,sourceNode:n,targetNode:o,sourceHandle:k.sourceHandle||null,targetHandle:k.targetHandle||null,connectionMode:e.connectionMode,onError:E}),a=function(e){var n=e.sourceNode,t=e.targetNode,r=e.selected,o=void 0!==r&&r,i=e.zIndex,a=void 0===i?0:i,u=e.elevateOnSelect;if(void 0===u||!u)return a;var c=o||t.selected||n.selected,s=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?s:0)}({selected:k.selected,zIndex:k.zIndex,sourceNode:n,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return t({zIndex:a},i||vE)}),[k.source,k.target,k.sourceHandle,k.targetHandle,k.selected,k.zIndex]),zw),H=V.zIndex,Y=V.sourceX,X=V.sourceY,Z=V.targetX,F=V.targetY,U=V.sourcePosition,W=V.targetPosition,G=e.useMemo((function(){return k.markerStart?"url('#".concat(X_(k.markerStart,b),"')"):void 0}),[k.markerStart,b]),q=e.useMemo((function(){return k.markerEnd?"url('#".concat(X_(k.markerEnd,b),"')"):void 0}),[k.markerEnd,b]);if(k.hidden||null===Y||null===X||null===Z||null===F)return null;var $=s?function(e){s(e,t({},k))}:void 0,K=l?function(e){l(e,t({},k))}:void 0,Q=d?function(e){d(e,t({},k))}:void 0,J=f?function(e){f(e,t({},k))}:void 0,ee=h?function(e){h(e,t({},k))}:void 0;return v.jsx("svg",{style:{zIndex:H},children:v.jsxs("g",{className:x(["ink-flow__edge","ink-flow__edge-".concat(M),k.className,_,{selected:k.selected,animated:k.animated,inactive:!j&&!c,updating:z,selectable:j}]),onClick:function(e){var n,t=R.getState(),o=t.addSelectedEdges,i=t.unselectNodesAndEdges,a=t.multiSelectionActive;j&&(R.setState({nodesSelectionActive:!1}),k.selected&&a?(i({nodes:[],edges:[k]}),null===(n=I.current)||void 0===n||n.blur()):o([r])),c&&c(e,k)},onDoubleClick:$,onContextMenu:K,onMouseEnter:Q,onMouseMove:J,onMouseLeave:ee,onKeyDown:P?function(e){var n;if(!S&&sv.includes(e.key)&&j){var t=R.getState(),o=t.unselectNodesAndEdges,i=t.addSelectedEdges;"Escape"===e.key?(null===(n=I.current)||void 0===n||n.blur(),o({edges:[k]})):i([r])}}:void 0,tabIndex:P?0:void 0,role:P?"button":"img","data-id":r,"data-testid":"rf__edge-".concat(r),"aria-label":null===k.ariaLabel?void 0:k.ariaLabel||"Edge from ".concat(k.source," to ").concat(k.target),"aria-describedby":P?"".concat(b_,"-").concat(b):void 0,ref:I,children:[!B&&v.jsx(N,{id:r,source:k.source,target:k.target,type:k.type,selected:k.selected,animated:k.animated,label:k.label,labelStyle:k.labelStyle,labelShowBg:k.labelShowBg,labelBgStyle:k.labelBgStyle,labelBgPadding:k.labelBgPadding,labelBgBorderRadius:k.labelBgBorderRadius,sourceX:Y,sourceY:X,targetX:Z,targetY:F,sourcePosition:U,targetPosition:W,data:k.data,style:k.style,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle,markerStart:G,markerEnd:q,pathOptions:"pathOptions"in k?k.pathOptions:void 0,interactionWidth:k.interactionWidth}),O&&v.jsx(xE,{edge:k,isUpdatable:O,edgeUpdaterRadius:p,onEdgeUpdate:g,onEdgeUpdateStart:y,onEdgeUpdateEnd:m,sourceX:Y,sourceY:X,targetX:Z,targetY:F,sourcePosition:U,targetPosition:W,setUpdateHover:T,setUpdating:D,sourceHandleId:k.sourceHandle,targetHandleId:k.targetHandle})]})})}var kE=function(e){return{width:e.width,height:e.height,edgesFocusable:e.edgesFocusable,edgesUpdatable:e.edgesUpdatable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError}};function CE(n){var t=n.defaultMarkerColor,r=n.rfId,o=n.noPanClassName,i=n.onEdgeUpdate,a=n.onEdgeContextMenu,u=n.onEdgeMouseEnter,c=n.onEdgeMouseMove,s=n.onEdgeMouseLeave,l=n.onEdgeClick,d=n.edgeTypes,f=Kb(kE,zw),h=f.edgesFocusable,p=f.edgesUpdatable,g=f.elementsSelectable,y=f.onError,m=function(n){var t=Kb(e.useCallback((function(e){return e.edges.map((function(e){return e.id}))}),[n]),zw);return t}(!1);return v.jsxs("div",{className:"ink-flow__edges",children:[v.jsx(U_,{defaultColor:t,rfId:r}),m.map((function(e){return v.jsx(SE,{id:e,edgesFocusable:h,edgesUpdatable:p,elementsSelectable:g,noPanClassName:o,onEdgeUpdate:i,onContextMenu:a,onMouseEnter:u,onMouseMove:c,onMouseLeave:s,onClick:l,rfId:r,onError:y,edgeTypes:d},e)}))]})}CE.displayName="EdgeRenderer";var ME,NE=e.memo(CE),PE=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function OE(e){var n=e.children,t=Kb(PE);return v.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var jE=((ME={})[exports.Position.Left]=exports.Position.Right,ME[exports.Position.Right]=exports.Position.Left,ME[exports.Position.Top]=exports.Position.Bottom,ME[exports.Position.Bottom]=exports.Position.Top,ME),IE=function(n){var r,o,i=n.nodeId,a=n.handleType,c=n.style,s=n.type,l=void 0===s?exports.ConnectionLineType.Bezier:s,d=n.CustomComponent,f=n.connectionStatus,h=Kb(e.useCallback((function(e){var n;return{fromNode:e.nodeLookup.get(i),handleId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.handleId,toX:(e.connectionPosition.x-e.transform[0])/e.transform[2],toY:(e.connectionPosition.y-e.transform[1])/e.transform[2],connectionMode:e.connectionMode}}),[i]),zw),p=h.fromNode,g=h.handleId,y=h.toX,m=h.toY,x=h.connectionMode,b=null==p?void 0:p.internals.handleBounds,w=null==b?void 0:b[a];if(x===exports.ConnectionMode.Loose&&(w=w||(null==b?void 0:b["source"===a?"target":"source"])),!p||!w)return null;var _=g?w.find((function(e){return e.id===g})):w[0],E=_?_.x+_.width/2:(null!==(r=p.measured.width)&&void 0!==r?r:0)/2,S=_?_.y+_.height/2:null!==(o=p.measured.height)&&void 0!==o?o:0,k=p.internals.positionAbsolute.x+E,C=p.internals.positionAbsolute.y+S,M=null==_?void 0:_.position,N=M?jE[M]:null;if(!M||!N)return null;if(d)return v.jsx(d,{connectionLineType:l,connectionLineStyle:c,fromNode:p,fromHandle:_,fromX:k,fromY:C,toX:y,toY:m,fromPosition:M,toPosition:N,connectionStatus:f});var P="",O={sourceX:k,sourceY:C,sourcePosition:M,targetX:y,targetY:m,targetPosition:N};return P=l===exports.ConnectionLineType.Bezier?u(vm(O),1)[0]:l===exports.ConnectionLineType.Step?u(bm(t(t({},O),{borderRadius:0})),1)[0]:l===exports.ConnectionLineType.SmoothStep?u(bm(O),1)[0]:l===exports.ConnectionLineType.SimpleBezier?u(K_(O),1)[0]:"M".concat(k,",").concat(C," ").concat(y,",").concat(m),v.jsx("path",{d:P,fill:"none",className:"react-flow__connection-path",style:c})};IE.displayName="ConnectionLine";var AE=function(e){var n,t;return{nodeId:null===(n=e.connectionStartHandle)||void 0===n?void 0:n.nodeId,handleType:null===(t=e.connectionStartHandle)||void 0===t?void 0:t.type,nodesConnectable:e.nodesConnectable,connectionStatus:e.connectionStatus,width:e.width,height:e.height}};function zE(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=Kb(AE,zw),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,s=i.width,l=i.height,d=i.connectionStatus;return!!(a&&u&&s&&c)?v.jsx("svg",{style:n,width:s,height:l,className:"react-flow__connectionline react-flow__container",children:v.jsx("g",{className:x(["react-flow__connection",d]),children:v.jsx(IE,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function TE(e){var n=e.onNodeClick,t=e.onNodeDoubleClick,r=e.onNodeMouseEnter,o=e.onNodeMouseMove,i=e.onNodeMouseLeave,a=e.onNodeContextMenu,u=e.onEdgeClick,c=e.onEdgeDoubleClick,s=e.onEdgeMouseEnter,l=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,p=e.minZoom,g=e.maxZoom,y=e.noPanClassName,m=e.noDragClassName,x=e.nodeOrigin,b=e.viewport,w=e.disableKeyboardA11y,_=e.translateExtent,E=e.defaultViewport,S=e.nodeTypes,k=e.edgeTypes,C=e.elementsSelectable,M=e.defaultMarkerColor,N=e.connectionLineType,P=e.connectionLineStyle,O=e.connectionLineComponent,j=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return v.jsx(u_,{minZoom:p,maxZoom:g,noPanClassName:y,noDragClassName:m,isControlledViewport:!!b,disableKeyboardA11y:w,translateExtent:_,defaultViewport:E,elementsSelectable:C,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:v.jsxs(OE,{children:[v.jsx(NE,{rfId:h,edgeTypes:k,noPanClassName:y,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:s,onEdgeMouseMove:l,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:M}),v.jsx(zE,{style:P,type:N,component:O,containerStyle:j}),v.jsx("div",{className:"ink-flow__edgelabel-renderer"}),v.jsx(H_,{rfId:h,nodeTypes:S,nodeOrigin:x,noDragClassName:m,noPanClassName:y,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),v.jsx("div",{className:"ink-flow__viewport-portal"})]})})}TE.displayName="GraphView";var LE=e.memo(TE),BE=function(e){var n,t,r=void 0===e?{}:e,o=r.nodes,i=r.edges,a=r.defaultNodes,u=r.defaultEdges;r.width,r.height,r.fitView;var c=r.minZoom,s=r.maxZoom,l=new Map,d=new Map,f=new Map,h=new Map,v=null!==(n=null!=u?u:i)&&void 0!==n?n:[],p=null!==(t=null!=a?a:o)&&void 0!==t?t:[];tw(f,h,v),rw(p,l,d,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:p,nodeLookup:l,parentLookup:d,edges:v,edgeLookup:h,connectionLookup:f,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:c||.5,maxZoom:s||2,translateExtent:cv,nodeExtent:cv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:exports.ConnectionMode.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,fitViewOnInit:!1,fitViewDone:!1,fitViewOnInitOptions:void 0,selectNodesOnDrag:!0,multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:void 0,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1}},DE=function(e){var n,r,o=e.nodes,i=e.edges,s=e.defaultNodes,l=e.defaultEdges,d=e.width,f=e.height,h=e.fitView,v=e.minZoom,p=e.maxZoom;return n=function(e,n){return t(t({},BE({nodes:o,edges:i,width:d,height:f,fitView:h,defaultNodes:s,defaultEdges:l,minZoom:v,maxZoom:p})),{setNodes:function(t){var r=n();rw(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();tw(r.connectionLookup,r.edgeLookup,t),e({edges:t})},setDefaultNodesAndEdges:function(t,r){t&&((0,n().setNodes)(t),e({hasDefaultNodes:!0})),r&&((0,n().setEdges)(r),e({hasDefaultEdges:!0}))},updateNodeInternals:function(r){var o=n(),i=o.triggerNodeChanges,a=o.fitView,s=o.nodeLookup,l=o.parentLookup,d=o.fitViewOnInit,f=o.fitViewDone,h=o.fitViewOnInitOptions,v=o.domNode,p=o.nodeOrigin,g=o.debug,y=function(e,n,r,o,i){var a=null==o?void 0:o.querySelector(".xyflow__viewport"),s=!1;if(!a)return{changes:[],updatedInternals:s};var l=[],d=window.getComputedStyle(a),f=new window.DOMMatrixReadOnly(d.transform).m22,h=[];if(e.forEach((function(e){var r=n.get(e.id);if(null==r?void 0:r.hidden)n.set(r.id,t(t({},r),{internals:t(t({},r.internals),{handleBounds:void 0})})),s=!0;else if(r){var o=Sw(e.nodeElement),a=r.measured.width!==o.width||r.measured.height!==o.height;if(o.width&&o.height&&(a||!r.internals.handleBounds||e.force)){var u=t(t({},r),{measured:o,internals:t(t({},r.internals),{handleBounds:{source:Pw(".source",e.nodeElement,f,r.origin||i),target:Pw(".target",e.nodeElement,f,r.origin||i)}})});n.set(r.id,u),s=!0,a&&(l.push({id:u.id,type:"dimensions",dimensions:o}),u.expandParent&&u.parentId&&h.push({id:u.id,parentId:u.parentId,rect:dw(u,u.origin||i)}))}}})),h.length>0){var v=ow(h,n,r,i);l.push.apply(l,c([],u(v),!1))}return{changes:l,updatedInternals:s}}(r,s,l,v,p),m=y.changes;if(y.updatedInternals){Jb(s,{nodeOrigin:p});var x=f;!f&&d&&(x=a(t(t({},h),{nodes:null==h?void 0:h.nodes}))),e({fitViewDone:x}),(null==m?void 0:m.length)>0&&(g&&console.log("Ink Flow: trigger node changes",m),null==i||i(m))}},updateNodePositions:function(e,r){var o,i;void 0===r&&(r=!1);var s=[],l=[];try{for(var d=a(e),f=d.next();!f.done;f=d.next()){var h=u(f.value,2),v=h[0],p=h[1],g={id:v,type:"position",position:p.position,dragging:r};(null==p?void 0:p.expandParent)&&(null==p?void 0:p.parentId)&&g.position&&(s.push({id:v,parentId:p.parentId,rect:t(t({},p.internals.positionAbsolute),{width:p.measured.width,height:p.measured.height})}),g.position.x=Math.max(0,g.position.x),g.position.y=Math.max(0,g.position.y)),l.push(g)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}if(s.length>0){var y=n(),m=ow(s,y.nodeLookup,y.parentLookup);l.push.apply(l,c([],u(m),!1))}n().triggerNodeChanges(l)},triggerNodeChanges:function(e){var t=n(),r=t.onNodesChange,o=t.setNodes,i=t.nodes,a=t.hasDefaultNodes,u=t.debug;(null==e?void 0:e.length)&&(a&&o(Yw(e,i)),u&&console.log("Ink Flow: trigger node changes",e),null==r||r(e))},triggerEdgeChanges:function(e){var t=n(),r=t.onEdgesChange,o=t.setEdges,i=t.edges,a=t.hasDefaultEdges,u=t.debug;(null==e?void 0:e.length)&&(a&&o(Hw(e,i)),u&&console.log("Ink Flow: trigger edge changes",e),null==r||r(e))},addSelectedNodes:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,s=t.triggerEdgeChanges;r?a(e.map((function(e){return Xw(e,!0)}))):(a(Zw(i,new Set(c([],u(e),!1)),!0)),s(Zw(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,s=t.triggerEdgeChanges;r?s(e.map((function(e){return Xw(e,!0)}))):(s(Zw(o,new Set(c([],u(e),!1)))),a(Zw(i,new Set,!0)))},unselectNodesAndEdges:function(e){var t=void 0===e?{}:e,r=t.nodes,o=t.edges,i=n(),a=i.edges,u=i.nodes,c=i.triggerNodeChanges,s=i.triggerEdgeChanges,l=o||a,d=(r||u).map((function(e){return e.selected=!1,Xw(e.id,!1)})),f=l.map((function(e){return Xw(e.id,!1)}));c(d),s(f)},setMinZoom:function(t){var r=n(),o=r.panZoom,i=r.maxZoom;null==o||o.setScaleExtent([t,i]),e({minZoom:t})},setMaxZoom:function(t){var r=n(),o=r.panZoom,i=r.minZoom;null==o||o.setScaleExtent([i,t]),e({maxZoom:t})},setTranslateExtent:function(t){var r;null===(r=n().panZoom)||void 0===r||r.setTranslateExtent(t),e({translateExtent:t})},resetSelectedElements:function(){var e=n(),t=e.edges,r=e.nodes,o=e.triggerNodeChanges,i=e.triggerEdgeChanges,a=r.reduce((function(e,n){return n.selected?c(c([],u(e),!1),[Xw(n.id,!1)],!1):e}),[]),s=t.reduce((function(e,n){return n.selected?c(c([],u(e),!1),[Xw(n.id,!1)],!1):e}),[]);o(a),i(s)},setNodeExtent:function(r){var o,i,c=n().nodeLookup;try{for(var s=a(c),l=s.next();!l.done;l=s.next()){var d=u(l.value,2)[1],f=aw(d.position,r);c.set(d.id,t(t({},d),{internals:t(t({},d.internals),{positionAbsolute:f})}))}}catch(e){o={error:e}}finally{try{l&&!l.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}e({nodeExtent:r})},panBy:function(e){var t=n(),r=t.transform,o=t.width,i=t.height;return function(e){var n=e.delta,t=e.panZoom,r=e.transform,o=e.translateExtent,i=e.width,a=e.height;if(!t||!n.x&&!n.y)return!1;var u=t.setViewportConstrained({x:r[0]+n.x,y:r[1]+n.y,zoom:r[2]},[[0,0],[i,a]],o);return!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2])}({delta:e,panZoom:t.panZoom,transform:r,translateExtent:t.translateExtent,width:o,height:i})},fitView:function(e){var t=n(),r=t.panZoom,o=t.width,i=t.height,a=t.minZoom,u=t.maxZoom,c=t.nodeOrigin,s=t.nodeLookup;return!!r&&Kw({nodeLookup:s,width:o,height:i,panZoom:r,minZoom:a,maxZoom:u,nodeOrigin:c},e)},cancelConnection:function(){return e({connectionStatus:null,connectionStartHandle:null,connectionEndHandle:null})},updateConnection:function(r){var o,i=n().connectionPosition,a=t(t({},r),{connectionPosition:null!==(o=r.connectionPosition)&&void 0!==o?o:i});e(a)},reset:function(){return e(t({},BE()))}})},r=Object.is,n?j(n,r):j};function RE(n){var t=n.initialNodes,r=n.initialEdges,o=n.defaultNodes,i=n.defaultEdges,a=n.initialWidth,c=n.initialHeight,s=n.fitView,l=n.children,d=n.minZoom,f=n.maxZoom,h=u(e.useState((function(){return DE({nodes:t,edges:r,defaultNodes:o,defaultEdges:i,width:a,height:c,fitView:s,minZoom:d,maxZoom:f})})),1)[0];return v.jsx(A,{value:h,children:v.jsx(d_,{children:l})})}function VE(n){var t=n.children,r=n.nodes,o=n.edges,i=n.defaultNodes,a=n.defaultEdges,u=n.width,c=n.height,s=n.fitView,l=n.minZoom,d=n.maxZoom;return e.useContext(I)?v.jsx(v.Fragment,{children:t}):v.jsx(RE,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:s,minZoom:l,maxZoom:d,children:t})}var HE={x:0,y:0,zoom:1},YE=c(c([],u(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),XE=function(e){return{setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}},ZE={translateExtent:cv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function FE(n){var t=Kb(XE,zw),r=t.setNodes,o=t.setEdges,i=t.setMinZoom,u=t.setMaxZoom,c=t.setTranslateExtent,s=t.setNodeExtent,l=t.reset,d=t.setDefaultNodesAndEdges,f=Qb();e.useEffect((function(){return d(n.defaultNodes,n.defaultEdges),function(){h.current=ZE,l()}}),[]);var h=e.useRef(ZE);return e.useEffect((function(){var e,t,l;try{for(var d=a(YE),v=d.next();!v.done;v=d.next()){var p=v.value,g=n[p];g!==h.current[p]&&(void 0!==n[p]&&("nodes"===p?r(g):"edges"===p?o(g):"minZoom"===p?i(g):"maxZoom"===p?u(g):"translateExtent"===p?c(g):"nodeExtent"===p?s(g):"fitView"===p?f.setState({fitViewOnInit:g}):"fitViewOptions"===p?f.setState({fitViewOnInitOptions:g}):f.setState(((l={})[p]=g,l))))}}catch(n){e={error:n}}finally{try{v&&!v.done&&(t=d.return)&&t.call(d)}finally{if(e)throw e.error}}h.current=n}),YE.map((function(e){return n[e]}))),null}var UE={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var WE=gw((function(e,n){var o=e.nodes,i=e.edges,a=e.translateExtent,u=void 0===a?cv:a,c=e.defaultViewport,s=void 0===c?HE:c,l=e.minZoom,d=void 0===l?.5:l,f=e.maxZoom,h=void 0===f?2:f,p=e.defaultMarkerColor,g=void 0===p?"#b1b1b7":p,y=e.nodeOrigin,m=e.noDragClassName,b=e.noPanClassName,w=e.disableKeyboardA11y,_=e.nodeTypes,E=e.edgeTypes;e.connectionMode;var S=e.connectionLineType,k=void 0===S?exports.ConnectionLineType.Bezier:S,C=e.connectionLineStyle,M=e.connectionLineComponent,N=e.connectionLineContainerStyle,P=e.onNodeClick,O=e.onNodeDoubleClick,j=e.onNodeMouseEnter,I=e.onNodeMouseMove,A=e.onNodeMouseLeave,z=e.onNodeContextMenu,T=e.onEdgeClick,L=e.onEdgeMouseEnter,B=e.onEdgeMouseMove,D=e.onEdgeMouseLeave,R=e.onEdgeContextMenu,V=e.onEdgeDoubleClick,H=e.onNodesChange,Y=e.onEdgesChange,X=e.fitView,Z=e.fitViewOptions,F=e.nodeExtent,U=e.nodesDraggable,W=e.children,G=e.id,q=e.width,$=e.height,K=e.onPaneClick,Q=e.onPaneContextMenu,J=e.onPaneMouseEnter,ee=e.onPaneMouseMove,ne=e.onPaneMouseLeave,te=e.onPaneScroll,re=e.elementsSelectable,oe=void 0===re||re,ie=r(e,["nodes","edges","translateExtent","defaultViewport","minZoom","maxZoom","defaultMarkerColor","nodeOrigin","noDragClassName","noPanClassName","disableKeyboardA11y","nodeTypes","edgeTypes","connectionMode","connectionLineType","connectionLineStyle","connectionLineComponent","connectionLineContainerStyle","onNodeClick","onNodeDoubleClick","onNodeMouseEnter","onNodeMouseMove","onNodeMouseLeave","onNodeContextMenu","onEdgeClick","onEdgeMouseEnter","onEdgeMouseMove","onEdgeMouseLeave","onEdgeContextMenu","onEdgeDoubleClick","onNodesChange","onEdgesChange","fitView","fitViewOptions","nodeExtent","nodesDraggable","children","id","width","height","onPaneClick","onPaneContextMenu","onPaneMouseEnter","onPaneMouseMove","onPaneMouseLeave","onPaneScroll","elementsSelectable"]),ae=G||"1";return v.jsx("div",t({},ie,{ref:n,style:t({},UE),className:x(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:v.jsxs(VE,{nodes:o,edges:i,width:q,height:$,fitView:X,minZoom:d,maxZoom:h,children:[v.jsx(LE,{onNodeClick:P,onNodeMouseEnter:j,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:O,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:V,rfId:ae,nodeTypes:_,edgeTypes:E,minZoom:d,maxZoom:h,nodeOrigin:y,noDragClassName:m,noPanClassName:b,disableKeyboardA11y:w,translateExtent:u,defaultMarkerColor:g,connectionLineType:k,connectionLineStyle:C,connectionLineComponent:M,connectionLineContainerStyle:N,defaultViewport:s,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),v.jsx(FE,{nodes:o,edges:i,rfId:ae,onNodesChange:H,onEdgesChange:Y,fitView:X,fitViewOptions:Z,nodeExtent:F,nodesDraggable:U,elementsSelectable:oe}),W]})}))}));function GE(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 4.375C10.3452 4.375 10.625 4.65482 10.625 5V9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H10.625V15C10.625 15.3452 10.3452 15.625 10 15.625C9.65482 15.625 9.375 15.3452 9.375 15V10.625H5C4.65482 10.625 4.375 10.3452 4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H9.375V5C9.375 4.65482 9.65482 4.375 10 4.375Z",fill:"#6B7280"})})}function qE(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M4.375 10C4.375 9.65482 4.65482 9.375 5 9.375H15C15.3452 9.375 15.625 9.65482 15.625 10C15.625 10.3452 15.3452 10.625 15 10.625H5C4.65482 10.625 4.375 10.3452 4.375 10Z",fill:"#6B7280"})})}function $E(){return v.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:v.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10 1.875C10.3452 1.875 10.625 2.15482 10.625 2.5V3.57152C13.6929 3.86613 16.1339 6.30708 16.4285 9.375H17.5C17.8452 9.375 18.125 9.65482 18.125 10C18.125 10.3452 17.8452 10.625 17.5 10.625H16.4285C16.1339 13.6929 13.6929 16.1339 10.625 16.4285V17.5C10.625 17.8452 10.3452 18.125 10 18.125C9.65482 18.125 9.375 17.8452 9.375 17.5V16.4285C6.30708 16.1339 3.86613 13.6929 3.57152 10.625H2.5C2.15482 10.625 1.875 10.3452 1.875 10C1.875 9.65482 2.15482 9.375 2.5 9.375H3.57152C3.86613 6.30708 6.30708 3.86613 9.375 3.57152V2.5C9.375 2.15482 9.65482 1.875 10 1.875ZM4.82878 10.625H5.83333C6.17851 10.625 6.45833 10.3452 6.45833 10C6.45833 9.65482 6.17851 9.375 5.83333 9.375H4.82878C5.11304 6.99811 6.99811 5.11304 9.375 4.82878V5.83333C9.375 6.17851 9.65482 6.45833 10 6.45833C10.3452 6.45833 10.625 6.17851 10.625 5.83333V4.82878C13.0019 5.11304 14.887 6.99811 15.1712 9.375H14.1667C13.8215 9.375 13.5417 9.65482 13.5417 10C13.5417 10.3452 13.8215 10.625 14.1667 10.625H15.1712C14.887 13.0019 13.0019 14.887 10.625 15.1712V14.1667C10.625 13.8215 10.3452 13.5417 10 13.5417C9.65482 13.5417 9.375 13.8215 9.375 14.1667V15.1712C6.99811 14.887 5.11304 13.0019 4.82878 10.625Z",fill:"#6B7280"})})}function KE(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("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 QE(){return v.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:v.jsx("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"})})}function JE(e){var n=e.children,o=e.className,i=r(e,["children","className"]);return v.jsx("button",t({type:"button",className:x(["ink-flow__controls-button",o])},i,{children:n}))}var eS=function(e){return e.userSelectionActive?"none":"all"};function nS(e){var n=e.position,o=void 0===n?"top-left":n,i=e.children,a=e.className,s=e.style,l=r(e,["position","children","className","style"]),d=Kb(eS),f="".concat(o).split("-");return v.jsx("div",t({className:x(c(["ink-flow__panel",a],u(f),!1)),style:t(t({},s),{pointerEvents:d})},l,{children:i}))}var tS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function rS(e){var n=e.style,t=e.showZoom,r=void 0===t||t,o=e.showFitView,i=void 0===o||o,a=e.showInteractive,u=void 0===a||a,c=e.fitViewOptions,s=e.onZoomIn,l=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,p=e.children,g=e.position,y=void 0===g?"bottom-left":g,m=e.orientation,b=void 0===m?"vertical":m,w=e["aria-label"],_=void 0===w?"Ink Flow controls":w,E=Qb(),S=Kb(tS,zw),k=S.isInteractive,C=S.minZoomReached,M=S.maxZoomReached,N=v_(),P=N.zoomIn,O=N.zoomOut,j=N.fitView,I="horizontal"===b?"horizontal":"vertical";return v.jsxs(nS,{className:x(["ink-flow__controls",I,h]),position:y,style:n,"data-testid":"rf__controls","aria-label":_,children:[i&&v.jsx(JE,{className:"ink-flow__controls-fitview",onClick:function(){j(c),null==d||d()},"aria-label":"fit view",children:v.jsx($E,{})}),r&&v.jsxs("div",{className:"ink-flow__controls-zoom",children:[v.jsx(JE,{onClick:function(){P(),null==s||s()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:M,children:v.jsx(GE,{})}),v.jsx(JE,{onClick:function(){O(),null==l||l()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:C,children:v.jsx(qE,{})})]}),u&&v.jsx(JE,{className:"ink-flow__controls-interactive",onClick:function(){E.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),null==f||f(!k)},title:"toggle interactivity","aria-label":"toggle interactivity",children:k?v.jsx(QE,{}):v.jsx(KE,{})}),p]})}rS.displayName="Controls";var oS,iS,aS=e.memo(rS);function uS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return v.jsx("path",{strokeWidth:t,d:"M".concat(n[0]/2," 0 V").concat(n[1]," M0 ").concat(n[1]/2," H").concat(n[0]),className:x(["react-flow__background-pattern",r,o])})}function cS(e){var n=e.radius,t=e.className;return v.jsx("circle",{cx:n,cy:n,r:n,className:x(["react-flow__background-pattern","dots",t])})}exports.BackgroundVariant=void 0,(oS=exports.BackgroundVariant||(exports.BackgroundVariant={})).Lines="lines",oS.Dots="dots",oS.Cross="cross";var sS=((iS={})[exports.BackgroundVariant.Dots]=1,iS[exports.BackgroundVariant.Lines]=1,iS[exports.BackgroundVariant.Cross]=6,iS),lS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function dS(n){var r=n.id,o=n.variant,i=void 0===o?exports.BackgroundVariant.Dots:o,a=n.gap,u=void 0===a?20:a,c=n.size,s=n.lineWidth,l=void 0===s?1:s,d=n.offset,f=void 0===d?2:d,h=n.color,p=n.bgColor,g=n.style,y=n.className,m=n.patternClassName,b=e.useRef(null),w=Kb(lS,zw),_=w.transform,E=w.patternId,S=c||sS[i],k=i===exports.BackgroundVariant.Dots,C=i===exports.BackgroundVariant.Cross,M=Array.isArray(u)?u:[u,u],N=[M[0]*_[2]||1,M[1]*_[2]||1],P=S*_[2],O=C?[P,P]:N,j=k?[P/f,P/f]:[O[0]/f,O[1]/f],I="".concat(E).concat(r||"");return v.jsxs("svg",{className:x(["ink-flow__background",y]),style:t(t(t({},g),Tw),{"--xy-background-color-props":p,"--xy-background-pattern-color-props":h}),ref:b,"data-testid":"rf__background",children:[v.jsx("pattern",{id:I,x:_[0]%N[0],y:_[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(j[0],",-").concat(j[1],")"),children:k?v.jsx(cS,{radius:P/f,className:m}):v.jsx(uS,{dimensions:O,lineWidth:l,variant:i,className:m})}),v.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}dS.displayName="Background";var fS=e.memo(dS),hS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};exports.Background=fS,exports.BaseEdge=q_,exports.ControlButton=JE,exports.Controls=aS,exports.EdgeLabelRenderer=function(e){var t=e.children,r=Kb(hS);return r?n.createPortal(t,r):null},exports.Handle=I_,exports.InkFlowProvider=RE,exports.SmoothStepEdge=tE,exports.StepEdge=iE,exports.addEdge=function(e,n){return e.source&&e.target?function(e,n){return n.some((function(n){return!(n.source!==e.source||n.target!==e.target||n.sourceHandle!==e.sourceHandle&&(n.sourceHandle||e.sourceHandle)||n.targetHandle!==e.targetHandle&&(n.targetHandle||e.targetHandle))}))}(t=function(e){return"id"in e&&"source"in e&&"target"in e}(e)?z({},e):z(z({},e),{id:ym(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},exports.dagreLayout=function(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new av.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(z({rankdir:r},t));var i=e.map((function(e){return z({},e)}));i.forEach((function(e){var n,t;if(!e.id)throw new Error('Node "id" does not exist');var r=(null===(n=e.data)||void 0===n?void 0:n.width)||200,i=(null===(t=e.data)||void 0===t?void 0:t.height)||56;o.setNode(e.id,{width:r,height:i})})),n.forEach((function(e){o.setEdge(e.source,e.target)})),av.layout(o),i.forEach((function(e){var n=o.node(e.id),t="bottom",i="top";switch(r){case"TB":default:t="bottom",i="top";break;case"BT":t="top",i="bottom";break;case"LR":case"RL":t="right",i="left"}e.targetPosition=i,e.sourcePosition=t,e.position={x:n.x-n.width/2,y:n.y-n.height/2}}));var a=function(e){var n=e.centerNodeId,t=e.containerHeight,r=void 0===t?0:t,o=e.containerWidth,i=void 0===o?0:o,a=e.centerByBBox,u=e.nodes;if(!n&&!a||!r||!i)return Nv;if(null==n?void 0:n.trim()){var c=null==u?void 0:u.find((function(e){return e.id===(null==n?void 0:n.trim())}));if(c){var s=function(e){if(!e)return Nv;var n=Mv(e),t=n.width,r=n.height;return{y:e.position.y+r/2,x:e.position.x+t/2}}(c);return{x:i/2-s.x,y:r/2-s.y}}}return a?(s=function(e){if(!(null==e?void 0:e.length))return Nv;var n=dv(e),t=n.x,r=n.y;return{x:t+n.width/2,y:r+n.height/2}}(u),{x:i/2-s.x,y:r/2-s.y}):Nv}({centerByBBox:null==t?void 0:t.centerByBBox,centerNodeId:null==t?void 0:t.centerNodeId,nodes:i,containerWidth:null==t?void 0:t.width,containerHeight:null==t?void 0:t.height}),u=a.x,c=void 0===u?0:u,s=a.y,l=void 0===s?0:s;return i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+l}})),{nodes:i,edges:n}},exports.default=WE,exports.getBezierEdgeCenter=dm,exports.getBezierPath=vm,exports.getConnectedEdges=function(e,n){var t=new Set;return e.forEach((function(e){t.add(e.id)})),n.filter((function(e){return t.has(e.source)||t.has(e.target)}))},exports.getEdgeCenter=pm,exports.getIncomers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.target===e.id&&r.add(n.source)})),n.filter((function(e){return r.has(e.id)}))},exports.getNodesBounds=dv,exports.getOutgoers=function(e,n,t){if(!e.id)return[];var r=new Set;return t.forEach((function(n){n.source===e.id&&r.add(n.target)})),n.filter((function(e){return r.has(e.id)}))},exports.getSmoothStepPath=bm,exports.getStraightPath=function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=L(pm({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],s=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,s]},exports.getViewportForBounds=function(e,n,t,r,o,i){var a=n/(e.width*(1+i)),u=t/(e.height*(1+i)),c=Math.min(a,u),s=vv(c,r,o);return{x:n/2-(e.x+e.width/2)*s,y:t/2-(e.y+e.height/2)*s,zoom:s}},exports.updateEdge=function(e,n,t,r){void 0===r&&(r={shouldReplaceId:!0});var o=e.id,i=function(e,n){var t={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&n.indexOf(r)<0&&(t[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(t[r[o]]=e[r[o]])}return t}(e,["id"]);if(!n.source||!n.target)return t;if(!t.find((function(n){return n.id===e.id})))return t;var a=z(z({},i),{id:r.shouldReplaceId?ym(n):o,source:n.source,target:n.target,sourceHandle:n.sourceHandle,targetHandle:n.targetHandle});return t.filter((function(e){return e.id!==o})).concat(a)},exports.useEdgesState=function(n){var t=u(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Hw(e,n)}))}),[]);return[r,o,i]},exports.useInkFlow=v_,exports.useNodesState=function(n){var t=u(e.useState(n),2),r=t[0],o=t[1],i=e.useCallback((function(e){return o((function(n){return Yw(e,n)}))}),[]);return[r,o,i]},exports.useStore=Kb,exports.useStoreApi=Qb;
|
|
17
17
|
//# sourceMappingURL=index.cjs.js.map
|