@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/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
- import e,{createContext as n,useContext as t,useMemo as r,forwardRef as o,useState as i,useRef as a,useEffect as u,memo as c,useCallback as l,useLayoutEffect as s}from"react";import{createPortal as d}from"react-dom";var f=function(){return f=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},f.apply(this,arguments)};function h(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}function v(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function p(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function g(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 y(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 m(e,n,t){if(t||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 b(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var w,x={exports:{}},_={};x.exports=function(){if(w)return _;w=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},l=null,s=null;for(u in void 0!==r&&(l=""+r),void 0!==n.key&&(l=""+n.key),void 0!==n.ref&&(s=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:l,ref:s,props:c,_owner:i.current}}return _.Fragment=r,_.jsx=u,_.jsxs=u,_}();var E,S=x.exports,k={exports:{}};
1
+ import e,{createContext as n,useContext as t,useMemo as r,forwardRef as o,useState as i,useRef as a,useEffect as u,memo as c,useCallback as l,useLayoutEffect as s}from"react";import{createPortal as d}from"react-dom";var f=function(){return f=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},f.apply(this,arguments)};function h(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}function v(e,n,t,r){return new(t||(t=Promise))((function(o,i){function a(e){try{c(r.next(e))}catch(e){i(e)}}function u(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(a,u)}c((r=r.apply(e,n||[])).next())}))}function p(e,n){var t,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(u){return function(c){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(a=0)),a;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return a.label++,{value:u[1],done:!1};case 5:a.label++,r=u[1],u=[0];continue;case 7:u=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){a=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){a.label=u[1];break}if(6===u[0]&&a.label<o[1]){a.label=o[1],o=u;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(u);break}o[2]&&a.ops.pop(),a.trys.pop();continue}u=n.call(e,a)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,c])}}}function g(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 y(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 m(e,n,t){if(t||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 w(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}"function"==typeof SuppressedError&&SuppressedError;var b,x={exports:{}},_={};x.exports=function(){if(b)return _;b=1;var n=e,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,a={key:!0,ref:!0,__self:!0,__source:!0};function u(e,n,r){var u,c={},l=null,s=null;for(u in void 0!==r&&(l=""+r),void 0!==n.key&&(l=""+n.key),void 0!==n.ref&&(s=n.ref),n)o.call(n,u)&&!a.hasOwnProperty(u)&&(c[u]=n[u]);if(e&&e.defaultProps)for(u in n=e.defaultProps)void 0===c[u]&&(c[u]=n[u]);return{$$typeof:t,type:e,key:l,ref:s,props:c,_owner:i.current}}return _.Fragment=r,_.jsx=u,_.jsxs=u,_}();var E,S=x.exports,k={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see
5
5
  http://jedwatson.github.io/classnames
6
6
  */
7
- E=k,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&t.push(a)}}else if("object"===i)if(o.toString===Object.prototype.toString)for(var u in o)e.call(o,u)&&o[u]&&t.push(u);else t.push(o.toString())}}return t.join(" ")}E.exports?(n.default=n,E.exports=n):window.classNames=n}();var N,C,M,O=b(k.exports),j={exports:{}},P={},I={exports:{}},A={};function z(){return C||(C=1,I.exports=function(){if(N)return A;N=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),l=c[0].inst,s=c[1];return i((function(){l.value=t,l.getSnapshot=n,u(l)&&s({inst:l})}),[e,t,n]),o((function(){return u(l)&&s({inst:l}),e((function(){u(l)&&s({inst:l})}))}),[e]),a(t),t};return A.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,A}()),I.exports}
7
+ E=k,function(){var e={}.hasOwnProperty;function n(){for(var t=[],r=0;r<arguments.length;r++){var o=arguments[r];if(o){var i=typeof o;if("string"===i||"number"===i)t.push(o);else if(Array.isArray(o)){if(o.length){var a=n.apply(null,o);a&&t.push(a)}}else if("object"===i)if(o.toString===Object.prototype.toString)for(var u in o)e.call(o,u)&&o[u]&&t.push(u);else t.push(o.toString())}}return t.join(" ")}E.exports?(n.default=n,E.exports=n):window.classNames=n}();var N,C,M,O=w(k.exports),j={exports:{}},P={},I={exports:{}},A={};function z(){return C||(C=1,I.exports=function(){if(N)return A;N=1;var n=e,t="function"==typeof Object.is?Object.is:function(e,n){return e===n&&(0!==e||1/e==1/n)||e!=e&&n!=n},r=n.useState,o=n.useEffect,i=n.useLayoutEffect,a=n.useDebugValue;function u(e){var n=e.getSnapshot;e=e.value;try{var r=n();return!t(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,n){return n()}:function(e,n){var t=n(),c=r({inst:{value:t,getSnapshot:n}}),l=c[0].inst,s=c[1];return i((function(){l.value=t,l.getSnapshot=n,u(l)&&s({inst:l})}),[e,t,n]),o((function(){return u(l)&&s({inst:l}),e((function(){u(l)&&s({inst:l})}))}),[e]),a(t),t};return A.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c,A}()),I.exports}
8
8
  /**
9
9
  * @license React
10
10
  * use-sync-external-store-shim/with-selector.production.min.js
@@ -13,5 +13,5 @@ E=k,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
- */j.exports=function(){if(M)return P;M=1;var n=e,t=z(),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 P.useSyncExternalStoreWithSelector=function(e,n,t,l,s){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=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(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,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},P}();var T=b(j.exports);const L=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:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&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:B}=e,{useSyncExternalStoreWithSelector:D}=T,R=e=>e;function H(e,n=R,t){const r=D(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return B(r),r}const V=(e,n)=>{const t=(e=>e?L(e):L)(e),r=(e,r=n)=>H(t,e,r);return Object.assign(r,t),r};var Y=n(null),X=Y.Provider,F=function(){return F=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},F.apply(this,arguments)};function Z(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 U(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 W(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 G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,be,we,xe,_e,Ee,Se,ke,Ne,Ce,Me,Oe,je,Pe,Ie,Ae,ze,Te,Le,Be,De,Re,He,Ve,Ye,Xe,Fe,Ze,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,bn,wn,xn,_n,En,Sn,kn,Nn,Cn,Mn,On,jn,Pn,In,An,zn,Tn,Ln,Bn,Dn,Rn,Hn,Vn,Yn,Xn,Fn,Zn,Un,Wn,Gn,qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kn(){return K?$:(K=1,$=function(e,n){return e===n||e!=e&&n!=n})}function Qn(){if(J)return Q;J=1;var e=Kn();return Q=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Q}function Jn(){if(le)return ce;le=1;var e=q?G:(q=1,G=function(){this.__data__=[],this.size=0}),n=function(){if(ne)return ee;ne=1;var e=Qn(),n=Array.prototype.splice;return ee=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(re)return te;re=1;var e=Qn();return te=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(ie)return oe;ie=1;var e=Qn();return oe=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(ue)return ae;ue=1;var e=Qn();return ae=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,ce=i}function et(){if(be)return me;be=1;var e="object"==typeof qn&&qn&&qn.Object===Object&&qn;return me=e}function nt(){if(xe)return we;xe=1;var e=et(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return we=t}function tt(){if(Ee)return _e;Ee=1;var e=nt().Symbol;return _e=e}function rt(){if(Oe)return Me;Oe=1;var e=tt(),n=function(){if(ke)return Se;ke=1;var e=tt(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Se=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(Ce)return Ne;Ce=1;var e=Object.prototype.toString;return Ne=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 ot(){return Pe?je:(Pe=1,je=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function it(){if(Ae)return Ie;Ae=1;var e=rt(),n=ot();return Ie=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 at(){if(Re)return De;Re=1;var e=Function.prototype.toString;return De=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function ut(){if(Ze)return Fe;Ze=1;var e=function(){if(Ve)return He;Ve=1;var e=it(),n=function(){if(Be)return Le;Be=1;var e,n=function(){if(Te)return ze;Te=1;var e=nt()["__core-js_shared__"];return ze=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Le=function(e){return!!t&&t in e}}(),t=ot(),r=at(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return He=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=Xe?Ye:(Xe=1,Ye=function(e,n){return null==e?void 0:e[n]});return Fe=function(t,r){var o=n(t,r);return e(o)?o:void 0}}function ct(){if(We)return Ue;We=1;var e=ut()(nt(),"Map");return Ue=e}function lt(){if(qe)return Ge;qe=1;var e=ut()(Object,"create");return Ge=e}function st(){if(vn)return hn;vn=1;var e=fn?dn:(fn=1,dn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return hn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},hn}function dt(){if(Sn)return En;Sn=1;var e=function(){if(sn)return ln;sn=1;var e=function(){if(cn)return un;cn=1;var e=function(){if(Ke)return $e;Ke=1;var e=lt();return $e=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Je?Qe:(Je=1,Qe=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(nn)return en;nn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return en=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(rn)return tn;rn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return tn=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(an)return on;an=1;var e=lt();return on=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,un=i}(),n=Jn(),t=ct();return ln=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(gn)return pn;gn=1;var e=st();return pn=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(mn)return yn;mn=1;var e=st();return yn=function(n){return e(this,n).get(n)}}(),r=function(){if(wn)return bn;wn=1;var e=st();return bn=function(n){return e(this,n).has(n)}}(),o=function(){if(_n)return xn;_n=1;var e=st();return xn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},xn}();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,En=i}function ft(){if(Mn)return Cn;Mn=1;var e=Jn(),n=function(){if(de)return se;de=1;var e=Jn();return se=function(){this.__data__=new e,this.size=0}}(),t=he?fe:(he=1,fe=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=pe?ve:(pe=1,ve=function(e){return this.__data__.get(e)}),o=ye?ge:(ye=1,ge=function(e){return this.__data__.has(e)}),i=function(){if(Nn)return kn;Nn=1;var e=Jn(),n=ct(),t=dt();return kn=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,Cn=a}function ht(){return jn||(jn=1,On=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),On}function vt(){if(In)return Pn;In=1;var e=ut(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return Pn=n}function pt(){if(zn)return An;zn=1;var e=vt();return An=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function gt(){if(Ln)return Tn;Ln=1;var e=pt(),n=Kn(),t=Object.prototype.hasOwnProperty;return Tn=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 yt(){if(Dn)return Bn;Dn=1;var e=gt(),n=pt();return Bn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function mt(){return Yn?Vn:(Yn=1,Vn=function(e){return null!=e&&"object"==typeof e})}function bt(){if(Un)return Zn;Un=1;var e=function(){if(Fn)return Xn;Fn=1;var e=rt(),n=mt();return Xn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=mt(),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 Zn=i}function wt(){if(Gn)return Wn;Gn=1;var e=Array.isArray;return Wn=e}var xt,_t,Et,St,kt,Nt,Ct,Mt,Ot,jt,Pt,It={exports:{}};function At(){return Et||(Et=1,function(e,n){var t=nt(),r=_t?xt:(_t=1,xt=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}(It,It.exports)),It.exports}function zt(){if(kt)return St;kt=1;var e=/^(?:0|[1-9]\d*)$/;return St=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 Tt(){return Ct?Nt:(Ct=1,Nt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Lt(){return Pt?jt:(Pt=1,jt=function(e){return function(n){return e(n)}})}It.exports;var Bt,Dt,Rt,Ht,Vt,Yt,Xt,Ft,Zt,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er,nr,tr,rr,or,ir,ar,ur,cr,lr,sr={exports:{}};function dr(){return Bt||(Bt=1,e=sr,n=sr.exports,t=et(),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),sr.exports;var e,n,t,r,o,i,a}function fr(){if(Rt)return Dt;Rt=1;var e=function(){if(Ot)return Mt;Ot=1;var e=rt(),n=Tt(),t=mt(),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=Lt(),t=dr(),r=t&&t.isTypedArray,o=r?n(r):e;return Dt=o}function hr(){if(Vt)return Ht;Vt=1;var e=Hn?Rn:(Hn=1,Rn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=bt(),t=wt(),r=At(),o=zt(),i=fr(),a=Object.prototype.hasOwnProperty;return Ht=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||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},Ht}function vr(){if(Xt)return Yt;Xt=1;var e=Object.prototype;return Yt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function pr(){return Zt||(Zt=1,Ft=function(e,n){return function(t){return e(n(t))}}),Ft}function gr(){if(qt)return Gt;qt=1;var e=vr(),n=function(){if(Wt)return Ut;Wt=1;var e=pr()(Object.keys,Object);return Ut=e}(),t=Object.prototype.hasOwnProperty;return Gt=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 yr(){if(Kt)return $t;Kt=1;var e=it(),n=Tt();return $t=function(t){return null!=t&&n(t.length)&&!e(t)}}function mr(){if(Jt)return Qt;Jt=1;var e=hr(),n=gr(),t=yr();return Qt=function(r){return t(r)?e(r):n(r)}}function br(){if(ur)return ar;ur=1;var e=hr(),n=function(){if(ir)return or;ir=1;var e=ot(),n=vr(),t=rr?tr:(rr=1,tr=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return or=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=yr();return ar=function(r){return t(r)?e(r,!0):n(r)}}sr.exports;var wr,xr,_r,Er,Sr,kr,Nr,Cr,Mr,Or,jr,Pr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Hr,Vr,Yr,Xr,Fr,Zr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,bo,wo,xo,_o,Eo,So,ko,No,Co,Mo,Oo,jo,Po,Io,Ao,zo,To,Lo,Bo,Do,Ro,Ho,Vo,Yo,Xo,Fo,Zo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,bi,wi,xi,_i,Ei,Si,ki,Ni,Ci,Mi,Oi,ji,Pi,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Hi,Vi,Yi,Xi,Fi,Zi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,ba,wa,xa,_a,Ea,Sa,ka,Na,Ca,Ma,Oa,ja,Pa,Ia,Aa,za,Ta,La,Ba,Da,Ra,Ha,Va,Ya,Xa,Fa,Za,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,bu,wu,xu,_u,Eu,Su,ku,Nu,Cu,Mu,Ou,ju,Pu,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Hu,Vu,Yu,Xu,Fu,Zu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,bc,wc,xc,_c,Ec,Sc,kc,Nc,Cc,Mc,Oc,jc,Pc={exports:{}};function Ic(){return wr||(wr=1,function(e,n){var t=nt(),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}}(Pc,Pc.exports)),Pc.exports}function Ac(){return _r||(_r=1,xr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),xr}function zc(){return Sr||(Sr=1,Er=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}),Er}function Tc(){return Nr?kr:(Nr=1,kr=function(){return[]})}function Lc(){if(Mr)return Cr;Mr=1;var e=zc(),n=Tc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Cr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Bc(){return Ir||(Ir=1,Pr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),Pr}function Dc(){if(zr)return Ar;zr=1;var e=pr()(Object.getPrototypeOf,Object);return Ar=e}function Rc(){if(Lr)return Tr;Lr=1;var e=Bc(),n=Dc(),t=Lc(),r=Tc(),o=Object.getOwnPropertySymbols;return Tr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Hc(){if(Hr)return Rr;Hr=1;var e=Bc(),n=wt();return Rr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Vc(){if(Yr)return Vr;Yr=1;var e=Hc(),n=Lc(),t=mr();return Vr=function(r){return e(r,t,n)}}function Yc(){if($r)return qr;$r=1;var e=ut()(nt(),"Set");return qr=e}function Xc(){if(eo)return Jr;eo=1;var e=function(){if(Ur)return Zr;Ur=1;var e=ut()(nt(),"DataView");return Zr=e}(),n=ct(),t=function(){if(Gr)return Wr;Gr=1;var e=ut()(nt(),"Promise");return Wr=e}(),r=Yc(),o=function(){if(Qr)return Kr;Qr=1;var e=ut()(nt(),"WeakMap");return Kr=e}(),i=rt(),a=at(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[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)!=l||o&&y(new o)!=s)&&(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 l;case g:return s}return n}),Jr=y}function Fc(){if(oo)return ro;oo=1;var e=nt().Uint8Array;return ro=e}function Zc(){if(ao)return io;ao=1;var e=Fc();return io=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Uc(){if(po)return vo;po=1;var e=Zc();return vo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Wc(){if(bo)return mo;bo=1;var e=ot(),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 mo=t}function Gc(){if(xo)return wo;xo=1;var e=Wc(),n=Dc(),t=vr();return wo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function qc(){if(Po)return jo;Po=1;var e=ft(),n=ht(),t=gt(),r=function(){if(nr)return er;nr=1;var e=yt(),n=mr();return er=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(lr)return cr;lr=1;var e=yt(),n=br();return cr=function(t,r){return t&&e(r,n(r),t)}}(),i=Ic(),a=Ac(),u=function(){if(jr)return Or;jr=1;var e=yt(),n=Lc();return Or=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Dr)return Br;Dr=1;var e=yt(),n=Rc();return Br=function(t,r){return e(t,n(t),r)}}(),l=Vc(),s=function(){if(Fr)return Xr;Fr=1;var e=Hc(),n=Rc(),t=br();return Xr=function(r){return e(r,t,n)}}(),d=Xc(),f=function(){if(to)return no;to=1;var e=Object.prototype.hasOwnProperty;return no=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},no}(),h=function(){if(yo)return go;yo=1;var e=Zc(),n=function(){if(co)return uo;co=1;var e=Zc();return uo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(so)return lo;so=1;var e=/\w*$/;return lo=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(ho)return fo;ho=1;var e=tt(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return fo=function(e){return t?Object(t.call(e)):{}}}(),o=Uc();return go=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=Gc(),p=wt(),g=At(),y=function(){if(ko)return So;ko=1;var e=function(){if(Eo)return _o;Eo=1;var e=Xc(),n=mt();return _o=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isMap,o=r?n(r):e;return So=o}(),m=ot(),b=function(){if(Oo)return Mo;Oo=1;var e=function(){if(Co)return No;Co=1;var e=Xc(),n=mt();return No=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isSet,o=r?n(r):e;return Mo=o}(),w=mr(),x=br(),_="[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,jo=function N(C,M,O,j,P,I){var A,z=1&M,T=2&M,L=4&M;if(O&&(A=P?O(C,j,P,I):O(C)),void 0!==A)return A;if(!m(C))return C;var B=p(C);if(B){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new e);var H=I.get(C);if(H)return H;I.set(C,A),b(C)?C.forEach((function(e){A.add(N(e,M,O,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,M,O,n,C,I))}));var V=B?void 0:(L?T?s:l:T?x:w)(C);return n(V||C,(function(e,n){V&&(e=C[n=e]),t(A,n,N(e,M,O,n,C,I))})),A},jo}function $c(){if(Ao)return Io;Ao=1;var e=qc();return Io=function(n){return e(n,4)}}function Kc(){return To?zo:(To=1,zo=function(e){return function(){return e}})}function Qc(){if(Ro)return Do;Ro=1;var e=(Bo?Lo:(Bo=1,Lo=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 Do=e}function Jc(){if(Vo)return Ho;Vo=1;var e=Qc(),n=mr();return Ho=function(t,r){return t&&e(t,r,n)}}function el(){if(Zo)return Fo;Zo=1;var e=Jc(),n=function(){if(Xo)return Yo;Xo=1;var e=yr();return Yo=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 Fo=t}function nl(){return Wo?Uo:(Wo=1,Uo=function(e){return e})}function tl(){if(qo)return Go;qo=1;var e=nl();return Go=function(n){return"function"==typeof n?n:e}}function rl(){if(Ko)return $o;Ko=1;var e=ht(),n=el(),t=tl(),r=wt();return $o=function(o,i){return(r(o)?e:n)(o,t(i))}}function ol(){return Jo?Qo:(Jo=1,Qo=rl())}function il(){if(ui)return ai;ui=1;var e=dt(),n=ri?ti:(ri=1,ti=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=ii?oi:(ii=1,oi=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,ai=r}function al(){return di?si:(di=1,si=function(e,n){return e.has(n)})}function ul(){if(hi)return fi;hi=1;var e=il(),n=(li||(li=1,ci=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}),ci),t=al();return fi=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))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<s;){var y=r[v],m=o[v];if(a)var b=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==b){if(b)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},fi}function cl(){return yi||(yi=1,gi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),gi}function ll(){if(Ei)return _i;Ei=1;var e=ft(),n=ul(),t=function(){if(bi)return mi;bi=1;var e=tt(),n=Fc(),t=Kn(),r=ul(),o=(pi||(pi=1,vi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),vi),i=cl(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return mi=function(e,a,c,l,s,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&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(xi)return wi;xi=1;var e=Vc(),n=Object.prototype.hasOwnProperty;return wi=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[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<s;){var y=t[f=l[d]],m=r[f];if(i)var b=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===b?y===m||a(y,m,o,i,u):b)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var w=t.constructor,x=r.constructor;w==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof w&&w instanceof w&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Xc(),i=wt(),a=At(),u=fr(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return _i=function(f,h,v,p,g,y){var m=i(f),b=i(h),w=m?l:o(f),x=b?l:o(h),_=(w=w==c?s:w)==s,E=(x=x==c?s:x)==s,S=w==x;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,w,v,p,g,y);if(!(1&v)){var k=_&&d.call(f,"__wrapped__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,M=N?h.value():h;return y||(y=new e),g(C,M,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function sl(){if(ki)return Si;ki=1;var e=ll(),n=mt();return Si=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))},Si}function dl(){if(Oi)return Mi;Oi=1;var e=ot();return Mi=function(n){return n==n&&!e(n)}}function fl(){return Ai?Ii:(Ai=1,Ii=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function hl(){if(Bi)return Li;Bi=1;var e=rt(),n=mt();return Li=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function vl(){if(Ri)return Di;Ri=1;var e=wt(),n=hl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Di=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 pl(){return Wi||(Wi=1,Ui=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}),Ui}function gl(){if(Ki)return $i;Ki=1;var e=function(){if(qi)return Gi;qi=1;var e=tt(),n=pl(),t=wt(),r=hl(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Gi=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},Gi}();return $i=function(n){return null==n?"":e(n)}}function yl(){if(Ji)return Qi;Ji=1;var e=wt(),n=vl(),t=function(){if(Zi)return Fi;Zi=1;var e=function(){if(Xi)return Yi;Xi=1;var e=function(){if(Vi)return Hi;Vi=1;var e=dt();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,Hi=n}();return Yi=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 Fi=r}(),r=gl();return Qi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function ml(){if(na)return ea;na=1;var e=hl();return ea=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function bl(){if(ra)return ta;ra=1;var e=yl(),n=ml();return ta=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 wl(){if(la)return ca;la=1;var e=yl(),n=bt(),t=wt(),r=zt(),o=Tt(),i=ml();return ca=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function xl(){if(da)return sa;da=1;var e=ua?aa:(ua=1,aa=function(e,n){return null!=e&&n in Object(e)}),n=wl();return sa=function(t,r){return null!=t&&n(t,r,e)}}function _l(){return pa?va:(pa=1,va=function(e){return function(n){return null==n?void 0:n[e]}})}function El(){if(xa)return wa;xa=1;var e=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ci)return Ni;Ci=1;var e=ft(),n=sl();return Ni=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(Pi)return ji;Pi=1;var e=dl(),n=mr();return ji=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=fl();return zi=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(ha)return fa;ha=1;var e=sl(),n=function(){if(ia)return oa;ia=1;var e=bl();return oa=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=xl(),r=vl(),o=dl(),i=fl(),a=ml();return fa=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=nl(),r=wt(),o=function(){if(ba)return ma;ba=1;var e=_l(),n=function(){if(ya)return ga;ya=1;var e=bl();return ga=function(n){return function(t){return e(t,n)}}}(),t=vl(),r=ml();return ma=function(o){return t(o)?e(r(o)):n(o)}}();return wa=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 Sl(){if(Ea)return _a;Ea=1;var e=zc(),n=function(){if(ni)return ei;ni=1;var e=el();return ei=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=El(),r=wt();return _a=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function kl(){if(Ca)return Na;Ca=1;var e=function(){if(ka)return Sa;ka=1;var e=Object.prototype.hasOwnProperty;return Sa=function(n,t){return null!=n&&e.call(n,t)}}(),n=wl();return Na=function(t,r){return null!=t&&n(t,r,e)}}function Nl(){if(Oa)return Ma;Oa=1;var e=gr(),n=Xc(),t=bt(),r=wt(),o=yr(),i=At(),a=vr(),u=fr(),c=Object.prototype.hasOwnProperty;return Ma=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Cl(){return Pa?ja:(Pa=1,ja=function(e){return void 0===e})}function Ml(){if(Aa)return Ia;Aa=1;var e=el(),n=yr();return Ia=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 Ol(){if(Ta)return za;Ta=1;var e=pl(),n=El(),t=Ml(),r=wt();return za=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function jl(){if(Va)return Ha;Va=1;var e=(Ba||(Ba=1,La=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}),La),n=el(),t=El(),r=Ra?Da:(Ra=1,Da=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=wt();return Ha=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},Ha}function Pl(){if(Ja)return Qa;Ja=1;var e=gr(),n=Xc(),t=yr(),r=function(){if(Xa)return Ya;Xa=1;var e=rt(),n=wt(),t=mt();return Ya=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ka)return $a;Ka=1;var e=function(){if(Za)return Fa;Za=1;var e=_l()("length");return Fa=e}(),n=function(){if(Wa)return Ua;Wa=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Ua=function(n){return e.test(n)}}(),t=function(){if(qa)return Ga;qa=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]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Ga=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return $a=function(r){return n(r)?t(r):e(r)}}();return Qa=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 Il(){if(nu)return eu;nu=1;var e=ht(),n=Wc(),t=Jc(),r=El(),o=Dc(),i=wt(),a=At(),u=it(),c=ot(),l=fr();return eu=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function Al(){if(iu)return ou;iu=1;var e=Bc(),n=function(){if(ru)return tu;ru=1;var e=tt(),n=bt(),t=wt(),r=e?e.isConcatSpreadable:void 0;return tu=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return ou=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},ou}function zl(){if(lu)return cu;lu=1;var e=uu?au:(uu=1,au=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 cu=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 l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},cu}function Tl(){if(pu)return vu;pu=1;var e=function(){if(du)return su;du=1;var e=Kc(),n=vt(),t=nl();return su=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(hu)return fu;hu=1;var e=Date.now;return fu=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)}},fu}(),t=n(e);return vu=t}function Ll(){if(yu)return gu;yu=1;var e=nl(),n=zl(),t=Tl();return gu=function(r,o){return t(n(r,o,e),r+"")},gu}function Bl(){return bu||(bu=1,mu=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}),mu}function Dl(){if(Tu)return zu;Tu=1;var e=il(),n=function(){if(Cu)return Nu;Cu=1;var e=function(){if(ku)return Su;ku=1;var e=Bl(),n=xu?wu:(xu=1,wu=function(e){return e!=e}),t=(Eu||(Eu=1,_u=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),_u);return Su=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},Su}();return Nu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},Nu}(),t=(Ou||(Ou=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=al(),o=function(){if(Au)return Iu;Au=1;var e=Yc(),n=Pu?ju:(Pu=1,ju=function(){}),t=cl(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Iu=r}(),i=cl();return zu=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],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 s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},zu}function Rl(){if(Bu)return Lu;Bu=1;var e=yr(),n=mt();return Lu=function(t){return n(t)&&e(t)}}function Hl(){if(Ru)return Du;Ru=1;var e=Al(),n=Ll(),t=Dl(),r=Rl(),o=n((function(n){return t(e(n,1,r,!0))}));return Du=o}function Vl(){if(Xu)return Yu;Xu=1;var e=function(){if(Vu)return Hu;Vu=1;var e=pl();return Hu=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=mr();return Yu=function(t){return null==t?[]:e(t,n(t))}}function Yl(){if(Zu)return Fu;var e;Zu=1;try{e={clone:$c(),constant:Kc(),each:ol(),filter:Sl(),has:kl(),isArray:wt(),isEmpty:Nl(),isFunction:it(),isUndefined:Cl(),keys:mr(),map:Ol(),reduce:jl(),size:Pl(),transform:Il(),union:Hl(),values:Vl()}}catch(e){}return e||(e=window._),Fu=e}function Xl(){if(Wu)return Uu;Wu=1;var e=Yl();Uu=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 l=u;u=c,c=l}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 l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=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[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=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=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,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))},Uu}function Fl(){if(Ju)return Qu;Ju=1;var e=Yl(),n=Xl();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 Qu={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 Zl(){if(nc)return ec;nc=1;var e=Yl();return ec=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},ec}function Ul(){if(rc)return tc;rc=1;var e=Yl();function n(){this._arr=[],this._keyIndices={}}return tc=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},tc}function Wl(){if(ic)return oc;ic=1;var e=Yl(),n=Ul();oc=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};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(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return oc}function Gl(){if(uc)return ac;uc=1;var e=Wl(),n=Yl();return ac=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function ql(){if(lc)return cc;lc=1;var e=Yl();return cc=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 l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},cc}function $l(){if(dc)return sc;dc=1;var e=Yl(),n=ql();return sc=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Kl(){if(hc)return fc;hc=1;var e=Yl();fc=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 fc}function Ql(){if(pc)return vc;pc=1;var e=Yl();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 vc=n,n.CycleException=t,t.prototype=new Error,vc}function Jl(){if(yc)return gc;yc=1;var e=Ql();return gc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function es(){if(bc)return mc;bc=1;var e=Yl();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 mc=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},mc}function ns(){if(xc)return wc;xc=1;var e=es();return wc=function(n,t){return e(n,t,"post")}}function ts(){if(Ec)return _c;Ec=1;var e=es();return _c=function(n,t){return e(n,t,"pre")}}function rs(){if(kc)return Sc;kc=1;var e=Yl(),n=Xl(),t=Ul();return Sc=function(r,o){var i,a=new n,u={},c=new t;function l(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 s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},Sc}Pc.exports;try{jc=function(){if(Oc)return Mc;Oc=1;var e=Ku?$u:(Ku=1,$u={Graph:Xl(),version:qu?Gu:(qu=1,Gu="2.1.8")});return Mc={Graph:e.Graph,json:Fl(),alg:Cc?Nc:(Cc=1,Nc={components:Zl(),dijkstra:Wl(),dijkstraAll:Gl(),findCycles:$l(),floydWarshall:Kl(),isAcyclic:Jl(),postorder:ns(),preorder:ts(),prim:rs(),tarjan:ql(),topsort:Ql()}),version:e.version}}()}catch(F){}jc||(jc=window.graphlib);var os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,bs,ws,xs,_s,Es,Ss,ks,Ns,Cs,Ms,Os,js,Ps,Is,As,zs,Ts,Ls,Bs,Ds,Rs,Hs,Vs,Ys,Xs,Fs,Zs,Us,Ws,Gs,qs,$s,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,bd,wd,xd,_d,Ed,Sd,kd,Nd,Cd,Md,Od,jd,Pd,Id,Ad,zd,Td,Ld,Bd,Dd,Rd,Hd,Vd,Yd,Xd=jc;function Fd(){if(us)return as;us=1;var e=Kn(),n=yr(),t=zt(),r=ot();return as=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 Zd(){if(bs)return ms;bs=1;var e=function(){if(ys)return gs;ys=1;var e=function(){if(ps)return vs;ps=1;var e=function(){if(hs)return fs;hs=1;var e=/\s/;return fs=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return vs=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=ot(),t=hl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return gs=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 l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return ms=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 Ud(){if(Cs)return Ns;Cs=1;var e=Al();return Ns=function(n){return null!=n&&n.length?e(n,1):[]}}function Wd(){if(Ts)return zs;Ts=1;var e=hl();return zs=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,l=a}return l},zs}function Gd(){if(Vs)return Hs;Vs=1;var e=pt(),n=Kn();return Hs=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function qd(){return Zs?Fs:(Zs=1,Fs=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function $d(){return rd?td:(rd=1,td=function(e,n){return e<n})}function Kd(){if(Ad)return Id;Ad=1;var e=pl(),n=bl(),t=El(),r=Ml(),o=(Cd||(Cd=1,Nd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),Nd),i=Lt(),a=function(){if(Pd)return jd;Pd=1;var e=function(){if(Od)return Md;Od=1;var e=hl();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,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return jd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=nl(),c=wt();return Id=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Yd={cloneDeep:function(){if(is)return os;is=1;var e=qc();return os=function(n){return e(n,5)}}(),constant:Kc(),defaults:function(){if(ls)return cs;ls=1;var e=Ll(),n=Kn(),t=Fd(),r=br(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),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]=s[v])}return e}));return cs=a}(),each:ol(),filter:Sl(),find:function(){if(ks)return Ss;ks=1;var e=function(){if(ds)return ss;ds=1;var e=El(),n=yr(),t=mr();return ss=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 l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),n=e(function(){if(Es)return _s;Es=1;var e=Bl(),n=El(),t=function(){if(xs)return ws;xs=1;var e=Zd();return ws=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return _s=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)},_s}());return Ss=n}(),flatten:Ud(),forEach:rl(),forIn:function(){if(Os)return Ms;Os=1;var e=Qc(),n=tl(),t=br();return Ms=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:kl(),isUndefined:Cl(),last:(Ps||(Ps=1,js=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),js),map:Ol(),mapValues:function(){if(As)return Is;As=1;var e=pt(),n=Jc(),t=El();return Is=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(Rs)return Ds;Rs=1;var e=Wd(),n=Bs?Ls:(Bs=1,Ls=function(e,n){return e>n}),t=nl();return Ds=function(r){return r&&r.length?e(r,t,n):void 0},Ds}(),merge:function(){if(nd)return ed;nd=1;var e=function(){if(Ks)return $s;Ks=1;var e=ft(),n=Gd(),t=Qc(),r=function(){if(qs)return Gs;qs=1;var e=Gd(),n=Ic(),t=Uc(),r=Ac(),o=Gc(),i=bt(),a=wt(),u=Rl(),c=At(),l=it(),s=ot(),d=function(){if(Xs)return Ys;Xs=1;var e=rt(),n=Dc(),t=mt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Ys=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=fr(),h=qd(),v=function(){if(Ws)return Us;Ws=1;var e=yt(),n=br();return Us=function(t){return e(t,n(t))}}();return Gs=function(p,g,y,m,b,w,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=w?w(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),M=!C&&c(E),O=!C&&!M&&f(E);k=E,C||M||O?a(_)?k=_:u(_)?k=r(_):M?(N=!1,k=n(E,!0)):O?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),b(k,E,m,w,x),x.delete(E)),e(p,y,k)}}}(),o=ot(),i=br(),a=qd();return $s=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},$s}(),n=function(){if(Js)return Qs;Js=1;var e=Ll(),n=Fd();return Qs=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 ed=n}(),min:function(){if(id)return od;id=1;var e=Wd(),n=$d(),t=nl();return od=function(r){return r&&r.length?e(r,t,n):void 0},od}(),minBy:function(){if(ud)return ad;ud=1;var e=Wd(),n=El(),t=$d();return ad=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},ad}(),now:function(){if(ld)return cd;ld=1;var e=nt();return cd=function(){return e.Date.now()}}(),pick:function(){if(bd)return md;bd=1;var e=function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=bl(),n=function(){if(dd)return sd;dd=1;var e=gt(),n=yl(),t=zt(),r=ot(),o=ml();return sd=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=yl();return fd=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=xl();return vd=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(yd)return gd;yd=1;var e=Ud(),n=zl(),t=Tl();return gd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return md=t}(),range:function(){if(kd)return Sd;kd=1;var e=function(){if(Ed)return _d;Ed=1;var e=function(){if(xd)return wd;xd=1;var e=Math.ceil,n=Math.max;return wd=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},wd}(),n=Fd(),t=Zd();return _d=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)}},_d}()();return Sd=e}(),reduce:jl(),sortBy:function(){if(Td)return zd;Td=1;var e=Al(),n=Kd(),t=Ll(),r=Fd(),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 zd=o}(),uniqueId:function(){if(Bd)return Ld;Bd=1;var e=gl(),n=0;return Ld=function(t){var r=++n;return e(t)+r},Ld}(),values:Vl(),zipObject:function(){if(Vd)return Hd;Vd=1;var e=gt(),n=(Rd||(Rd=1,Dd=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}),Dd);return Hd=function(t,r){return n(t||[],r||[],e)},Hd}()}}catch(F){}Yd||(Yd=window._);var Qd=Yd,Jd=ef;function ef(){var e={};e._next=e._prev=e,this._sentinel=e}function nf(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function tf(e,n){if("_next"!==e&&"_prev"!==e)return n}ef.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return nf(n),n},ef.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&nf(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},ef.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,tf)),t=t._prev;return"["+e.join(", ")+"]"};var rf=Qd,of=Xd.Graph,af=Jd,uf=rf.constant(1);function cf(e,n,t,r,o){var i=o?[]:void 0;return rf.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,lf(n,t,u)})),rf.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,lf(n,t,a)})),e.removeNode(r.v),i}function lf(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 sf=Qd,df=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new of,r=0,o=0;rf.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),rf.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=rf.range(o+r+3).map((function(){return new af})),a=r+1;return rf.forEach(t.nodes(),(function(e){lf(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||uf),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)cf(e,n,t,r);for(;r=i.dequeue();)cf(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(cf(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return rf.flatten(rf.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},ff={run:function(e){var n="greedy"===e.graph().acyclicer?df(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return sf.forEach(e.nodes(),(function o(i){sf.has(r,i)||(r[i]=!0,t[i]=!0,sf.forEach(e.outEdges(i),(function(e){sf.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);sf.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,sf.uniqueId("rev"))}))},undo:function(e){sf.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)}}))}},hf=Qd,vf=Xd.Graph,pf={addDummyNode:gf,simplify:function(e){var n=(new vf).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),hf.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 vf({multigraph:e.isMultigraph()}).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return hf.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,l=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)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=hf.map(hf.range(yf(e)+1),(function(){return[]}));return hf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;hf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank})));hf.forEach(e.nodes(),(function(t){var r=e.node(t);hf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];hf.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;hf.forEach(t,(function(n,t){hf.isUndefined(n)&&t%o!=0?--r:r&&hf.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),gf(e,"border",o,n)},maxRank:yf,partition:function(e,n){var t={lhs:[],rhs:[]};return hf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=hf.now();try{return n()}finally{console.log(e+" time: "+(hf.now()-t)+"ms")}},notime:function(e,n){return n()}};function gf(e,n,t,r){var o;do{o=hf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function yf(e){return hf.max(hf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!hf.isUndefined(t))return t})))}var mf=Qd,bf=pf,wf={run:function(e){e.graph().dummyChains=[],mf.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,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=bf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){mf.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)}))}},xf=Qd,_f=function(e){var n={};xf.forEach(e.sources(),(function t(r){var o=e.node(r);if(xf.has(n,r))return o.rank;n[r]=!0;var i=xf.min(xf.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}))},Ef=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Sf=Qd,kf=Xd.Graph,Nf=Ef,Cf=function(e){var n,t,r=new kf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Mf(r,e)<i;)n=Of(r,e),t=r.hasNode(n.v)?Nf(e,n):-Nf(e,n),jf(r,e,t);return r};function Mf(e,n){return Sf.forEach(e.nodes(),(function t(r){Sf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Nf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Of(e,n){return Sf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Nf(n,t)}))}function jf(e,n,t){Sf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var Pf=Qd,If=Cf,Af=Ef,zf=_f,Tf=Xd.alg.preorder,Lf=Xd.alg.postorder,Bf=pf.simplify,Df=Rf;function Rf(e){e=Bf(e),zf(e);var n,t=If(e);for(Yf(t),Hf(t,e);n=Ff(t);)Uf(t,e,n,Zf(t,e,n))}function Hf(e,n){var t=Lf(e,e.nodes());t=t.slice(0,t.length-1),Pf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Vf(e,n,t)}(e,n,t)}))}function Vf(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,Pf.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Yf(e,n){arguments.length<2&&(n=e.nodes()[0]),Xf(e,{},1,n)}function Xf(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,Pf.forEach(e.neighbors(r),(function(o){Pf.has(n,o)||(t=Xf(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Ff(e){return Pf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Zf(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 l=Pf.filter(n.edges(),(function(n){return c===Wf(e,e.node(n.v),u)&&c!==Wf(e,e.node(n.w),u)}));return Pf.minBy(l,(function(e){return Af(n,e)}))}function Uf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Yf(e),Hf(e,n),function(e,n){var t=Pf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=Tf(e,t);r=r.slice(1),Pf.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 Wf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Rf.initLowLimValues=Yf,Rf.initCutValues=Hf,Rf.calcCutValue=Vf,Rf.leaveEdge=Ff,Rf.enterEdge=Zf,Rf.exchangeEdges=Uf;var Gf=_f,qf=Cf,$f=Df,Kf=Gf;var Qf=Qd,Jf=Qd,eh=pf,nh={run:function(e){var n=eh.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Jf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Jf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Jf.max(Jf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Jf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Jf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Jf.forEach(e.children(),(function(a){th(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,Jf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function th(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=eh.addBorderNode(e,"_bt"),l=eh.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,Jf.forEach(u,(function(u){th(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.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,l,{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 rh=Qd,oh=pf;function ih(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=oh.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var ah=Qd,uh={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ch(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ah.forEach(e.nodes(),(function(n){sh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,sh),ah.has(t,"y")&&sh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){ah.forEach(e.nodes(),(function(n){dh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,dh),ah.has(t,"x")&&dh(t)}))}(e),ch(e))}};function ch(e){ah.forEach(e.nodes(),(function(n){lh(e.node(n))})),ah.forEach(e.edges(),(function(n){lh(e.edge(n))}))}function lh(e){var n=e.width;e.width=e.height,e.height=n}function sh(e){e.y=-e.y}function dh(e){var n=e.x;e.x=e.y,e.y=n}var fh=Qd,hh=Qd;function vh(e,n,t){for(var r=hh.zipObject(t,hh.map(t,(function(e,n){return n}))),o=hh.flatten(hh.map(n,(function(n){return hh.sortBy(hh.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=hh.map(new Array(a),(function(){return 0})),c=0;return hh.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 ph=Qd,gh=Qd,yh=Qd,mh=pf;function bh(e,n,t){for(var r;n.length&&(r=yh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var wh=Qd,xh=Qd,_h=Xd.Graph,Eh=Qd,Sh=Qd,kh=function(e){var n={},t=fh.filter(e.nodes(),(function(n){return!e.children(n).length})),r=fh.max(fh.map(t,(function(n){return e.node(n).rank}))),o=fh.map(fh.range(r+1),(function(){return[]}));var i=fh.sortBy(t,(function(n){return e.node(n).rank}));return fh.forEach(i,(function t(r){if(!fh.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),fh.forEach(e.successors(r),t)}})),o},Nh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=vh(e,n[r-1],n[r]);return t},Ch=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,l={};u&&(i=wh.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return ph.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ph.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);wh.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,wh.has(i,"barycenter")&&(a=t,u=i,wh.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 gh.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};gh.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),gh.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];gh.isUndefined(n)||gh.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(gh.isUndefined(n.barycenter)||gh.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),gh.forEach(o.in.reverse(),t(o)),gh.forEach(o.out,r(o))}return gh.map(gh.filter(n,(function(e){return!e.merged})),(function(e){return gh.pick(e,["vs","i","barycenter","weight"])}))}(gh.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){wh.forEach(e,(function(e){e.vs=wh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=mh.partition(e,(function(e){return yh.has(e,"barycenter")})),o=r.lhs,i=yh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=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})),l=bh(a,i,l),yh.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=bh(a,i,l)}));var s={vs:yh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=wh.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]);wh.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=xh.uniqueId("_root")););return n}(e),o=new _h({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return xh.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),xh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=xh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),xh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Oh=Xd.Graph,jh=pf;function Ph(e,n,t){return Sh.map(n,(function(n){return Mh(e,n,t)}))}function Ih(e,n){var t=new Oh;Sh.forEach(e,(function(e){var r=e.graph().root,o=Ch(e,r,t,n);Sh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};Eh.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 Ah(e,n){Sh.forEach(n,(function(n){Sh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var zh=Qd,Th=Xd.Graph,Lh=pf;function Bh(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 Dh(e,n,t){if(n>t){var r=n;n=t,t=r}return zh.has(e[n],t)}var Rh=Qd,Hh=pf,Vh=function(e){var n,t=Lh.buildLayerMatrix(e),r=zh.merge(function(e,n){var t={};return zh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=zh.last(r);return zh.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return zh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(zh.forEach(r.slice(i,c+1),(function(n){zh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||Bh(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;zh.forEach(zh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&zh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Bh(t,n,u)}))}))}return zh.reduce(n,(function(n,t){var o,i=-1,a=0;return zh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[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={};zh.forEach(["u","d"],(function(i){n="u"===i?t:zh.values(t).reverse(),zh.forEach(["l","r"],(function(t){"r"===t&&(n=zh.map(n,(function(e){return zh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return zh.forEach(n,(function(e){zh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),zh.forEach(n,(function(e){var n=-1;zh.forEach(e,(function(e){var u=r(e);if(u.length){u=zh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!Dh(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 Th,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,zh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,zh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return zh.forEach(n,(function(n){var r;zh.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)),zh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=zh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return zh.minBy(zh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return zh.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=zh.values(n),r=zh.min(t),o=zh.max(t);zh.forEach(["u","d"],(function(t){zh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=zh.values(c);(a="l"===i?r-zh.min(l):o-zh.max(l))&&(e[u]=zh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return zh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=zh.sortBy(zh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Yh=Qd,Xh=ff,Fh=wf,Zh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){$f(e)}(e);break;case"tight-tree":!function(e){Gf(e),qf(e)}(e);break;case"longest-path":Kf(e)}},Uh=pf.normalizeRanks,Wh=function(e){var n=function(e){var n={},t=0;return Qf.forEach(e.children(),(function r(o){var i=t;Qf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Qf.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),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>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,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},Gh=pf.removeEmptyRanks,qh=nh,$h=function(e){rh.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&rh.forEach(r,n),rh.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)ih(e,"borderLeft","_bl",t,o,i),ih(e,"borderRight","_br",t,o,i)}}))},Kh=uh,Qh=function(e){var n=jh.maxRank(e),t=Ph(e,Sh.range(1,n+1),"inEdges"),r=Ph(e,Sh.range(n-1,-1,-1),"outEdges"),o=kh(e);Ah(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ih(u%2?t:r,u%4>=2),o=jh.buildLayerMatrix(e);var l=Nh(e,o);l<a&&(c=0,i=Sh.cloneDeep(o),a=l)}Ah(e,i)},Jh=function(e){(function(e){var n=Hh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Rh.forEach(n,(function(n){var o=Rh.max(Rh.map(n,(function(n){return e.node(n).height})));Rh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Hh.asNonCompoundGraph(e)),Rh.forEach(Vh(e),(function(n,t){e.node(t).x=n}))},ev=pf,nv=Xd.Graph,tv=["nodesep","edgesep","ranksep","marginx","marginy"],rv={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ov=["acyclicer","ranker","rankdir","align"],iv=["width","height"],av={width:0,height:0},uv=["minlen","weight","width","height","labeloffset"],cv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lv=["labelpos"];function sv(e,n){return Yh.mapValues(Yh.pick(e,n),Number)}function dv(e){var n={};return Yh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var fv=Qd,hv=pf,vv=Xd.Graph,pv={debugOrdering:function(e){var n=hv.buildLayerMatrix(e),t=new vv({compound:!0,multigraph:!0}).setGraph({});return fv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),fv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),fv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),fv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},gv=$n({graphlib:Xd,layout:function(e,n){var t=n&&n.debugTiming?ev.time:ev.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new nv({multigraph:!0,compound:!0}),t=dv(e.graph());return n.setGraph(Yh.merge({},rv,sv(t,tv),Yh.pick(t,ov))),Yh.forEach(e.nodes(),(function(t){var r=dv(e.node(t));n.setNode(t,Yh.defaults(sv(r,iv),av)),n.setParent(t,e.parent(t))})),Yh.forEach(e.edges(),(function(t){var r=dv(e.edge(t));n.setEdge(t,Yh.merge({},cv,sv(r,uv),Yh.pick(r,lv)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Yh.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){Yh.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(){Xh.run(e)})),n(" nestingGraph.run",(function(){qh.run(e)})),n(" rank",(function(){Zh(ev.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Yh.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};ev.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Gh(e)})),n(" nestingGraph.cleanup",(function(){qh.cleanup(e)})),n(" normalizeRanks",(function(){Uh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Yh.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=Yh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Yh.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(){Fh.run(e)})),n(" parentDummyChains",(function(){Wh(e)})),n(" addBorderSegments",(function(){$h(e)})),n(" order",(function(){Qh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=ev.buildLayerMatrix(e);Yh.forEach(n,(function(n){var t=0;Yh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Yh.forEach(o.selfEdges,(function(n){ev.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(){Kh.adjust(e)})),n(" position",(function(){Jh(e)})),n(" positionSelfEdges",(function(){!function(e){Yh.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){Yh.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(Yh.last(t.borderLeft)),a=e.node(Yh.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}})),Yh.forEach(e.nodes(),(function(n){"border"===e.node(n).dummy&&e.removeNode(n)}))}(e)})),n(" normalize.undo",(function(){Fh.undo(e)})),n(" fixupEdgeLabelCoords",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Yh.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(){Kh.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)}Yh.forEach(e.nodes(),(function(n){c(e.node(n))})),Yh.forEach(e.edges(),(function(n){var t=e.edge(n);Yh.has(t,"x")&&c(t)})),n-=a,r-=u,Yh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Yh.forEach(e.edges(),(function(t){var o=e.edge(t);Yh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Yh.has(o,"x")&&(o.x-=n),Yh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Yh.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(ev.intersectRect(i,t)),o.points.push(ev.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Xh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Yh.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))})),Yh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Yh.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:pv,util:{time:pf.time,notime:pf.notime},version:"0.8.5"}),yv={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.")}},mv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],bv=["Enter"," ","Escape"],wv=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)}))},xv=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)}))},_v=function(e,n){void 0===n&&(n=[0,0]);var t=Vv(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}}},Ev=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=zv(t,n.nodeOrigin);return Pv(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Av(t)},Sv=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=zv(e,n.nodeOrigin);t=Pv(t,r)}})),Av(t)},kv=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 Nv(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),l=c.parentId?r.get(c.parentId):void 0,s=l?_v(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&Hv(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,b=d+v*m[0],w=f+p*m[1];h=[[b,w],[b+g-v,w+y-p]]}}else null==u||u("005",yv.error005());var x=Hv(h)?Mv(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var Cv=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Mv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Cv(e.x,n[0][0],n[1][0]),y:Cv(e.y,n[0][1],n[1][1])}},Ov=function(e,n,t){return e<n?Cv(Math.abs(e-n),1,50)/50:e>t?-Cv(Math.abs(e-t),1,50)/50:0},jv=function(e,n){return[20*Ov(e.x,35,n.width-35),20*Ov(e.y,35,n.height-35)]},Pv=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)}},Iv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Av=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},zv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=_v(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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)}},Tv=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])}},Lv=function(e,n,t,r){var o=e.x,i=e.y,a=U(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Tv(s,r):s},Bv=function(e,n){var t=e.x,r=e.y,o=U(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},Dv=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),l=Cv(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}},Rv=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 Hv(e){return void 0!==e&&"parent"!==e}function Vv(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 Yv={x:0,y:0};function Xv(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new gv.graphlib.Graph;o.setDefaultEdgeLabel((function(){return{}})),o.setGraph(F({rankdir:r},t));var i=e.map((function(e){return F({},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)})),gv.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 Yv;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 l=function(e){if(!e)return Yv;var n=Vv(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-l.x,y:r/2-l.y}}}return a?(l=function(e){if(!(null==e?void 0:e.length))return Yv;var n=Ev(e),t=n.x,r=n.y;return{x:t+n.width/2,y:r+n.height/2}}(u),{x:i/2-l.x,y:r/2-l.y}):Yv}({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,l=a.y,s=void 0===l?0:l;return i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+s}})),{nodes:i,edges:n}}var Fv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},Zv=function(e,n){return!!Fv(e)&&e.indexOf(n)>-1},Uv=function(e,n){if(!Fv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},Wv={}.toString,Gv=function(e,n){return Wv.call(e)==="[object "+n+"]"},qv=function(e){return Gv(e,"Function")},$v=function(e){return null==e},Kv=function(e){return Array.isArray?Array.isArray(e):Gv(e,"Array")},Qv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function Jv(e,n){if(e)if(Kv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(Qv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var ep=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return Jv(e,(function(t,r){qv(e)&&"prototype"===r||n.push(r)})),n};function np(e,n){var t=ep(n),r=t.length;if($v(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 tp=function(e){return"object"==typeof e&&null!==e},rp=function(e){if(!tp(e)||!Gv(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},op=function(e,n){if(void 0===n&&(n=[]),Kv(e))for(var t=0;t<e.length;t+=1)op(e[t],n);else n.push(e);return n},ip=function(e){if(Kv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},ap=function(e){if(Kv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},up=Array.prototype,cp=up.splice,lp=up.indexOf,sp=Array.prototype.splice,dp=function(e,n){if(!Fv(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,sp.call(e,i,1))}return e},fp=function(e,n,t){if(!Kv(e)&&!rp(e))return e;var r=t;return Jv(e,(function(e,t){r=n(r,e,t)})),r},hp=function(e){return Gv(e,"String")};function vp(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 pp=Object.prototype.hasOwnProperty;function gp(e,n){if(!n||!Kv(e))return{};for(var t,r={},o=qv(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),pp.call(r,t)?r[t].push(a):r[t]=[a]}return r}function yp(e,n){if(!n)return{0:e};if(!qv(n)){var t=Kv(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 gp(e,n)}var mp={},bp=function(e){return Gv(e,"Number")},wp=Number.isInteger?Number.isInteger:function(e){return bp(e)&&e%1==0},xp=180/Math.PI,_p=parseInt,Ep=Math.PI/180,Sp=function(e,n){return e.hasOwnProperty(n)},kp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return Jv(e,(function(t,r){qv(e)&&"prototype"===r||n.push(t)})),n},Np=function(e){return $v(e)?"":e.toString()},Cp={}.toString,Mp=function(e){return Cp.call(e).replace(/^\[object /,"").replace(/]$/,"")},Op=Object.prototype,jp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Op)};function Pp(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function Ip(e,n,t,r){return n&&Pp(e,n),t&&Pp(e,t),r&&Pp(e,r),e}var Ap=function(e){if("object"!=typeof e||null===e)return e;var n;if(Kv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=Ap(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=Ap(e[o]):n[o]=e[o];return n},zp=function(e,n){if(!qv(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 Tp(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&&rp(i)?(rp(e[o])||(e[o]={}),t<r?Tp(e[o],i,t+1,r):e[o]=n[o]):Kv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var Lp,Bp=Object.prototype.hasOwnProperty,Dp=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(hp(e)||hp(n))return!1;if(Fv(e)||Fv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=Dp(e[r],n[r]));r++);return t}if(tp(e)||tp(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=Dp(e[o[r]],n[o[r]]));r++);return t}return!1},Rp=function(e){return e},Hp=Object.prototype.hasOwnProperty,Vp={},Yp=zp((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return Lp||(Lp=document.createElement("canvas").getContext("2d")),Lp.font=[i,a,o,t+"px",r].join(" "),Lp.measureText(hp(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],kp(n)).join("")})),Xp=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}(),Fp=Object.freeze({__proto__:null,Cache:Xp,assign:Ip,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];qv(o)&&(o=o.prototype),Ip(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:Ap,contains:Zv,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)Tp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),Uv(e,(function(e){return!Zv(n,e)}))},each:Jv,endsWith:function(e,n){return!(!Kv(e)&&!hp(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){qv(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=Ip(i,e.prototype),e.superclass=o(n.prototype,n),Ip(i,t),Ip(e,r),e},filter:Uv,find:function(e,n){if(!Kv(e))return null;var t;if(qv(n)&&(t=n),rp(n)&&(t=function(e){return np(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(!$v(o)){t=Kv(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(!Kv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:op,forIn:Jv,get:function(e,n,t){for(var r=0,o=hp(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=Yp(r,t),u=hp(e)?e:Np(e),c=n,l=[];if(Yp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=Yp(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=Yp(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(Kv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=ip(n);return{min:ap(n),max:o}},getType:Mp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=yp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:gp,groupToMap:yp,has:Sp,hasKey:Sp,hasValue:function(e,n){return Zv(kp(e),n)},head:function(e){if(Fv(e))return e[0]},identity:function(e){return e},includes:Zv,indexOf:function(e,n){if(!Fv(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 Gv(e,"Arguments")},isArray:Kv,isArrayLike:Fv,isBoolean:function(e){return Gv(e,"Boolean")},isDate:function(e){return Gv(e,"Date")},isDecimal:function(e){return bp(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if($v(e))return!0;if(Fv(e))return!e.length;var n=Mp(e);if("Map"===n||"Set"===n)return!e.size;if(jp(e))return!Object.keys(e).length;for(var t in e)if(Bp.call(e,t))return!1;return!0},isEqual:Dp,isEqualWith:function(e,n,t){return qv(t)?!!t(e,n):Dp(e,n)},isError:function(e){return Gv(e,"Error")},isEven:function(e){return bp(e)&&e%2==0},isFinite:function(e){return bp(e)&&isFinite(e)},isFunction:qv,isInteger:wp,isMatch:np,isNegative:function(e){return bp(e)&&e<0},isNil:$v,isNull:function(e){return null===e},isNumber:bp,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:Qv,isObjectLike:tp,isOdd:function(e){return bp(e)&&e%2!=0},isPlainObject:rp,isPositive:function(e){return bp(e)&&e>0},isPrototype:jp,isRegExp:function(e){return Gv(e,"RegExp")},isString:hp,isType:Gv,isUndefined:function(e){return void 0===e},keys:ep,last:function(e){if(Fv(e))return e[e.length-1]},lowerCase:function(e){return Np(e).toLowerCase()},lowerFirst:function(e){var n=Np(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!Fv(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=Rp);var t={};return Qv(e)&&!$v(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:ip,maxBy:function(e,n){if(Kv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=qv(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:Yp,memoize:zp,min:ap,minBy:function(e,n){if(Kv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=qv(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:Ip,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=mp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,mp[e]=n}return n},omit:function(e,n){return fp(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 Kv(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||!rp(e))return{};var t={};return Jv(n,(function(n){Hp.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=lp.call(e,o))>-1;)cp.call(e,i,1);return e},pullAt:dp,reduce:fp,remove:function(e,n){var t=[];if(!Fv(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 dp(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=hp(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(Qv(r[e])||(r[e]=bp(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return $v(e)?0:Fv(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(qv(n))t=function(e,t){return n(e)-n(t)};else{var r=[];hp(n)?r.push(n):Kv(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!(!Kv(e)&&!hp(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)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=n-(l-u);return o=this,i=arguments,s<=0||s>n?(r&&(clearTimeout(r),r=null),u=l,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(e){return Fv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return xp*e},toInteger:_p,toRadian:function(e){return Ep*e},toString:Np,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return vp([].concat.apply([],e))},uniq:vp,uniqueId:function(e){return Vp[e=e||"g"]?Vp[e]+=1:Vp[e]=1,e+Vp[e]},upperCase:function(e){return Np(e).toUpperCase()},upperFirst:function(e){var n=Np(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:kp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!$v(i)){Kv(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}}),Zp={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}(Fp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},Up=Zp,Wp={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 Gp(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof Gp)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}Up.assign(Gp.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 qp=function(e,n,t){void 0===n&&(n={});var r,o=new Gp(e,n=Up.assign({},Wp,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 l=new Gp(a[c],n);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},$p=qp,Kp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=$p(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),Qp=Kp;function Jp(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 eg(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){eg(e,n,t)}))}function ng(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(ng(e,n),t)})),t}function tg(e,n){eg(e,-ng(e,n),n)}function rg(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){rg(e,n.children[r],t)}))}function og(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){og(e,n,t)}))}Jp.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(Jp.fromNode(e,n))})),n?new Jp(e.height,e.width,e.x,t):new Jp(e.width,e.height,e.y,t)};var ig=qp,ag=function(e,n){for(var t=ig(e.data,n,!0),r=ig(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}},ug=ag,cg=["LR","RL","TB","BT","H","V"],lg=["LR","RL","H"],sg=cg[0],dg=function(e,n,t){var r=n.direction||sg;if(n.isHorizontal=function(e){return lg.indexOf(e)>-1}(r),r&&-1===cg.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===cg[0])t(e,n);else if(r===cg[1])t(e,n),e.right2left();else if(r===cg[2])t(e,n);else if(r===cg[3])t(e,n),e.bottom2top();else if(r===cg[4]||r===cg[5]){var o=ug(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 fg(e,n){return fg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},fg(e,n)}var hg=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,l=e.c[n],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(e,n,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?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,l,s):r&&!l&&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 l(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}og(e,t);var s=Jp.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=l(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=l(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)}(s),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)}(s,0),rg(s,e,t),tg(e,t),e},vg=dg,pg=Zp,gg=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,fg(n,t),r.prototype.execute=function(){return vg(this.rootNode,this.options,hg)},r}(Qp),yg={},mg=Zp;function bg(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 wg={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function xg(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){xg(e,n.children[r],t)}))}function _g(e,n){return _g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},_g(e,n)}var Eg=function(e,n){void 0===n&&(n={}),n=mg.assign({},wg,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 bg(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),xg(o,e,n.isHorizontal),e},Sg=dg,kg=Zp,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,_g(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Sg(e.rootNode,e.options,Eg)},r}(Qp),Cg={},Mg=Zp;function Og(e,n){return Og=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Og(e,n)}var jg=Qp,Pg=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+Mg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Mg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},Ig=ag,Ag=Zp,zg=["LR","RL","H"],Tg=zg[0],Lg=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,Og(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?Tg:a,c=e.align;if(u&&-1===zg.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===zg[0])Pg(n,r,i,c);else if(u===zg[1])Pg(n,r,i,c),n.right2left();else if(u===zg[2]){var l=Ig(n,e),s=l.left,d=l.right;Pg(s,r,i,c),s.right2left(),Pg(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(jg),Bg={},Dg=Zp;function Rg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=Rg(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function Hg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){Hg(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 Vg={getSubTreeSep:function(){return 0}};function Yg(e,n){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Yg(e,n)}var Xg=function(e,n){void 0===n&&(n={}),n=Dg.assign({},Vg,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,Rg(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}}}})),Hg(e)},Fg=dg,Zg=Zp,Ug=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,Yg(n,t),r.prototype.execute=function(){return Fg(this.rootNode,this.options,Xg)},r}(Qp),Wg={};$n({compactBox:function(e,n){return n=pg.assign({},yg,n),new gg(e,n).execute()},dendrogram:function(e,n){return n=kg.assign({},Cg,n),new Ng(e,n).execute()},indented:function(e,n){return n=Ag.assign({},Bg,n),new Lg(e,n).execute()},mindmap:function(e,n){return n=Zg.assign({},Wg,n),new Ug(e,n).execute()}});var Gg={value:()=>{}};function qg(){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 $g(r)}function $g(e){this._=e}function Kg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Qg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Gg,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}$g.prototype=qg.prototype={constructor:$g,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]=Qg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Qg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Kg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new $g(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 Jg="http://www.w3.org/1999/xhtml",ey={svg:"http://www.w3.org/2000/svg",xhtml:Jg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ny(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),ey.hasOwnProperty(n)?{space:ey[n],local:e}:e}function ty(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Jg&&n.documentElement.namespaceURI===Jg?n.createElement(e):n.createElementNS(t,e)}}function ry(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function oy(e){var n=ny(e);return(n.local?ry:ty)(n)}function iy(){}function ay(e){return null==e?iy:function(){return this.querySelector(e)}}function uy(){return[]}function cy(e){return null==e?uy:function(){return this.querySelectorAll(e)}}function ly(e){return function(){return this.matches(e)}}function sy(e){return function(n){return n.matches(e)}}var dy=Array.prototype.find;function fy(){return this.firstElementChild}var hy=Array.prototype.filter;function vy(){return Array.from(this.children)}function py(e){return new Array(e.length)}function gy(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function yy(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new gy(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function my(e,n,t,r,o,i,a){var u,c,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new gy(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function by(e){return e.__data__}function wy(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function xy(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function _y(e){return function(){this.removeAttribute(e)}}function Ey(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sy(e,n){return function(){this.setAttribute(e,n)}}function ky(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Ny(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function Cy(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 My(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Oy(e){return function(){this.style.removeProperty(e)}}function jy(e,n,t){return function(){this.style.setProperty(e,n,t)}}function Py(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function Iy(e,n){return e.style.getPropertyValue(n)||My(e).getComputedStyle(e,null).getPropertyValue(n)}function Ay(e){return function(){delete this[e]}}function zy(e,n){return function(){this[e]=n}}function Ty(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function Ly(e){return e.trim().split(/^|\s+/)}function By(e){return e.classList||new Dy(e)}function Dy(e){this._node=e,this._names=Ly(e.getAttribute("class")||"")}function Ry(e,n){for(var t=By(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function Hy(e,n){for(var t=By(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Vy(e){return function(){Ry(this,e)}}function Yy(e){return function(){Hy(this,e)}}function Xy(e,n){return function(){(n.apply(this,arguments)?Ry:Hy)(this,e)}}function Fy(){this.textContent=""}function Zy(e){return function(){this.textContent=e}}function Uy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Wy(){this.innerHTML=""}function Gy(e){return function(){this.innerHTML=e}}function qy(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function $y(){this.nextSibling&&this.parentNode.appendChild(this)}function Ky(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qy(){return null}function Jy(){var e=this.parentNode;e&&e.removeChild(this)}function em(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function nm(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function tm(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 rm(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 om(e,n,t){var r=My(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 im(e,n){return function(){return om(this,e,n)}}function am(e,n){return function(){return om(this,e,n.apply(this,arguments))}}gy.prototype={constructor:gy,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)}},Dy.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 um=[null];function cm(e,n){this._groups=e,this._parents=n}function lm(){return new cm([[document.documentElement]],um)}function sm(e){return"string"==typeof e?new cm([[document.querySelector(e)]],[document.documentElement]):new cm([[e]],um)}function dm(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]}cm.prototype=lm.prototype={constructor:cm,select:function(e){"function"!=typeof e&&(e=ay(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,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new cm(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):cy(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,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new cm(r,o)},selectChild:function(e){return this.select(null==e?fy:function(e){return function(){return dy.call(this.children,e)}}("function"==typeof e?e:sy(e)))},selectChildren:function(e){return this.selectAll(null==e?vy:function(e){return function(){return hy.call(this.children,e)}}("function"==typeof e?e:sy(e)))},filter:function(e){"function"!=typeof e&&(e=ly(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new cm(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,by);var t,r=n?my:yy,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),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=wy(e.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,n);for(var m,b,w=0,x=0;w<p;++w)if(m=g[w]){for(w>=x&&(x=w+1);!(b=y[x])&&++x<p;);m._next=b||null}}return(u=new cm(u,o))._enter=c,u._exit=l,u},enter:function(){return new cm(this._enter||this._groups.map(py),this._parents)},exit:function(){return new cm(this._exit||this._groups.map(py),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 l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new cm(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=xy);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,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new cm(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=ny(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?Ey:_y:"function"==typeof n?t.local?Cy:Ny:t.local?ky:Sy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Oy:"function"==typeof n?Py:jy)(e,n,null==t?"":t)):Iy(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?Ay:"function"==typeof n?Ty:zy)(e,n)):this.node()[e]},classed:function(e,n){var t=Ly(e+"");if(arguments.length<2){for(var r=By(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Xy:n?Vy:Yy)(t,n))},text:function(e){return arguments.length?this.each(null==e?Fy:("function"==typeof e?Uy:Zy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Wy:("function"==typeof e?qy:Gy)(e)):this.node().innerHTML},raise:function(){return this.each($y)},lower:function(){return this.each(Ky)},append:function(e){var n="function"==typeof e?e:oy(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:oy(e),r=null==n?Qy:"function"==typeof n?n:ay(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Jy)},clone:function(e){return this.select(e?nm:em)},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?rm:tm,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];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?am:im)(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 fm={passive:!1},hm={capture:!0,passive:!1};function vm(e){e.stopImmediatePropagation()}function pm(e){e.preventDefault(),e.stopImmediatePropagation()}function gm(e){var n=e.document.documentElement,t=sm(e).on("dragstart.drag",pm,hm);"onselectstart"in n?t.on("selectstart.drag",pm,hm):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ym(e,n){var t=e.document.documentElement,r=sm(e).on("dragstart.drag",null);n&&(r.on("click.drag",pm,hm),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 mm=e=>()=>e;function bm(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){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:l,enumerable:!0,configurable:!0},_:{value:s}})}function wm(e){return!e.ctrlKey&&!e.button}function xm(){return this.parentNode}function _m(e,n){return null==n?{x:e.x,y:e.y}:n}function Em(){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=Pm(e),c=u.x,l=u.y,s=Lv({x:c,y:l},a),d=i?Tv(s,r):s,f=d.x,h=d.y;return F({xSnapped:f,ySnapped:h},s)}bm.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var km,Nm,Cm,Mm,Om,jm,Pm=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 Im(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 Am(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function zm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case jm.Left:return[t-Am(t-o,a),r];case jm.Right:return[t+Am(o-t,a),r];case jm.Top:return[t,r-Am(r-i,a)];case jm.Bottom:return[t,r+Am(i-r,a)]}}function Tm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=U(zm({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=U(zm({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],y=U(Im({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],b=y[1],w=y[2],x=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,b,w,x]}function Lm(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"}(km||(km={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Nm||(Nm={})),function(e){e.Partial="partial",e.Full="full"}(Cm||(Cm={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(Mm||(Mm={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Om||(Om={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(jm||(jm={}));var Bm,Dm=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||"")},Rm=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)?F({},e):F(F({},e),{id:Dm(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},Hm=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=F(F({},i),{id:r.shouldReplaceId?Dm(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)};function Vm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=U(Lm({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var Ym=((Bm={})[jm.Left]={x:-1,y:0},Bm[jm.Right]={x:1,y:0},Bm[jm.Top]={x:0,y:-1},Bm[jm.Bottom]={x:0,y:1},Bm),Xm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Fm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=U(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?jm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?jm.Top:l,d=e.center,f=e.offset,h=Ym[u],v=Ym[s],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?jm.Bottom:t,o=e.target;return r===jm.Left||r===jm.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",b=y[m],w=[],x={x:0,y:0},_={x:0,y:0},E=U(Lm({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=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 M=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];w=h[m]===b?"x"===m?M:O:"x"===m?O:M}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(w="x"===m?h.x===b?P:j:h.y===b?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===b?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){var z="x"===m?"y":"x",T=h[m]===v[z],L=p[z]>g[z],B=p[z]<g[z];(1===h[m]&&(!T&&L||T&&B)||1!==h[m]&&(!T&&B||T&&L))&&(w="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-w[0].x),Math.abs(R.x-w[0].x))>=Math.max(Math.abs(D.y-w[0].y),Math.abs(R.y-w[0].y))?(r=(D.x+R.x)/2,o=w[0].y):(r=w[0].x,o=(D.y+R.y)/2)}return[W(W([i,{x:p.x+x.x,y:p.y+x.y}],U(w),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({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],b=v[4],w=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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[w,g,y,m,b]}function Zm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Zm(t,n))}function Um(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 Wm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=Z(a),s=l.next();!s.done;s=l.next()){var d=U(s.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(F(F({},v),{position:h.position}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(t=l.return)&&t.call(l)}finally{if(n)throw n.error}}if(!i)return[c[0],c];var p=u.get(i).internals.userNode;return[F(F({},p),{position:(null===(o=a.get(i))||void 0===o?void 0:o.position)||p.position}),c]}function Gm(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,l=!1,s={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 b(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,b=s.onError,w=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=Sv(c,{nodeOrigin:p});_=Iv(E)}try{for(var S=Z(c),k=S.next();!k.done;k=S.next()){var N=U(k.value,2),C=N[0],M=N[1],O={x:u-M.distance.x,y:l-M.distance.y};v&&(O=Tv(O,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!M.extent){var P=M.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+M.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+M.measured.height-_.y2+f[1][1]]]}var z=Nv({nodeId:C,nextPosition:O,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:b}),T=z.position,L=z.positionAbsolute;x=x||M.position.x!==T.x||M.position.y!==T.y,M.position=T,M.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(w(c,!0),n&&(o||g||!m&&y))){var B=U(Wm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=B[0],R=B[1];null==o||o(n,c,D,R),null==g||g(n,D,R),m||null==y||y(n,R)}}function w(){var e,n;if(d){var r=U(jv(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&b(a,null)}u=requestAnimationFrame(w)}}function x(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,b=i.onSelectionDragStart,w=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||w(),y&&p&&m&&(null==n||n(m));var x=Sm(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=Z(e),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Zm(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{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&b)){var _=U(Wm({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==b||b(e.sourceEvent,S)}}h=sm(g);var _=function(){var e,n,t,r,o=wm,i=xm,a=_m,u=Em,c={},l=qg("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,fm).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=b(this,i.call(this,a,u),a,u,"mouse");c&&(sm(a.view).on("mousemove.drag",v,hm).on("mouseup.drag",p,hm),gm(a.view),vm(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(pm(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){sm(e.view).on("mousemove.drag mouseup.drag",null),ym(e.view,t),pm(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=b(this,u,e,n,a[t].identifier,a[t]))&&(vm(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])&&(pm(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])&&(vm(e),t("end",e,o[n]))}function b(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=dm(i||t,n);if(null!=(h=a.call(e,new bm("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,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,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=dm(l||a,n),g=s}v.call(i,e,new bm(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:mm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:mm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:mm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:mm(!!e),f):u},f.on=function(){var e=l.on.apply(l,arguments);return e===l?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&&x(e);var l=Sm(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Pm(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(!l&&i&&f&&(l=!0,w()),!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&&x(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Pm(e.sourceEvent,d),b(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=U(Wm({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==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Um(n,".".concat(v),g))&&(!p||Um(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function qm(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 $m(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Km=function(){return!0},Qm=null;function Jm(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Km:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Pm(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,b={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var w=$m(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return b;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};b.connection=k,E&&S&&(r===km.Strict?f&&"source"===w||!f&&"target"===w:x!==o||_!==i)&&(b.endHandle={nodeId:x,handleId:_,type:w},b.isValid=d(k))}return b}var eb={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=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,b=n.isValidConnection,w=void 0===b?Km:b,x=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),N=0,C=Pm(e),M=C.x,O=C.y,j=null==k?void 0:k.elementFromPoint(M,O),P=$m(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Pm(e,I),z=!1,T=null,L=!1,B=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=Z(r),l=c.next();!l.done;l=c.next()){var s=U(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=qm(s,s.internals.handleBounds,"source",d),h=qm(s,s.internals.handleBounds,"target",d);u.push.apply(u,W(W([],U(f),!1),U(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Qm={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",H),k.addEventListener("mouseup",V),k.addEventListener("touchmove",H),k.addEventListener("touchend",V)}function R(){if(f&&I){var e=U(jv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),N=requestAnimationFrame(R)}}function H(e){S()||V(e);var n=E();A=Pm(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=Z(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}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}(Lv(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=Jm(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:w,doc:k,lib:d,flowId:h});B=f.handleDomNode,T=f.connection,L=f.isValid,_({connectionStartHandle:Qm,connectionPosition:t&&L?Bv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,l=L,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function V(e){(t||B)&&T&&L&&(null==y||y(T)),null==m||m(e),u&&(null==x||x(e)),p(),cancelAnimationFrame(N),z=!1,L=!1,T=null,B=null,Qm=null,k.removeEventListener("mousemove",H),k.removeEventListener("mouseup",V),k.removeEventListener("touchmove",H),k.removeEventListener("touchend",V)}},isValid:Jm};function nb(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function tb(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function rb(){}var ob=.7,ib=1/ob,ab="\\s*([+-]?\\d+)\\s*",ub="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cb="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lb=/^#([0-9a-f]{3,8})$/,sb=new RegExp(`^rgb\\(${ab},${ab},${ab}\\)$`),db=new RegExp(`^rgb\\(${cb},${cb},${cb}\\)$`),fb=new RegExp(`^rgba\\(${ab},${ab},${ab},${ub}\\)$`),hb=new RegExp(`^rgba\\(${cb},${cb},${cb},${ub}\\)$`),vb=new RegExp(`^hsl\\(${ub},${cb},${cb}\\)$`),pb=new RegExp(`^hsla\\(${ub},${cb},${cb},${ub}\\)$`),gb={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 yb(){return this.rgb().formatHex()}function mb(){return this.rgb().formatRgb()}function bb(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=lb.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?wb(n):3===t?new Eb(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?xb(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?xb(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=sb.exec(e))?new Eb(n[1],n[2],n[3],1):(n=db.exec(e))?new Eb(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=fb.exec(e))?xb(n[1],n[2],n[3],n[4]):(n=hb.exec(e))?xb(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=vb.exec(e))?Ob(n[1],n[2]/100,n[3]/100,1):(n=pb.exec(e))?Ob(n[1],n[2]/100,n[3]/100,n[4]):gb.hasOwnProperty(e)?wb(gb[e]):"transparent"===e?new Eb(NaN,NaN,NaN,0):null}function wb(e){return new Eb(e>>16&255,e>>8&255,255&e,1)}function xb(e,n,t,r){return r<=0&&(e=n=t=NaN),new Eb(e,n,t,r)}function _b(e,n,t,r){return 1===arguments.length?((o=e)instanceof rb||(o=bb(o)),o?new Eb((o=o.rgb()).r,o.g,o.b,o.opacity):new Eb):new Eb(e,n,t,null==r?1:r);var o}function Eb(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Sb(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}`}function kb(){const e=Nb(this.opacity);return`${1===e?"rgb(":"rgba("}${Cb(this.r)}, ${Cb(this.g)}, ${Cb(this.b)}${1===e?")":`, ${e})`}`}function Nb(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cb(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mb(e){return((e=Cb(e))<16?"0":"")+e.toString(16)}function Ob(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Pb(e,n,t,r)}function jb(e){if(e instanceof Pb)return new Pb(e.h,e.s,e.l,e.opacity);if(e instanceof rb||(e=bb(e)),!e)return new Pb;if(e instanceof Pb)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 Pb(a,u,c,e.opacity)}function Pb(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function Ib(e){return(e=(e||0)%360)<0?e+360:e}function Ab(e){return Math.max(0,Math.min(1,e||0))}function zb(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}nb(rb,bb,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yb,formatHex:yb,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return jb(this).formatHsl()},formatRgb:mb,toString:mb}),nb(Eb,_b,tb(rb,{brighter(e){return e=null==e?ib:Math.pow(ib,e),new Eb(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ob:Math.pow(ob,e),new Eb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Eb(Cb(this.r),Cb(this.g),Cb(this.b),Nb(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:Sb,formatHex:Sb,formatHex8:function(){return`#${Mb(this.r)}${Mb(this.g)}${Mb(this.b)}${Mb(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:kb,toString:kb})),nb(Pb,(function(e,n,t,r){return 1===arguments.length?jb(e):new Pb(e,n,t,null==r?1:r)}),tb(rb,{brighter(e){return e=null==e?ib:Math.pow(ib,e),new Pb(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ob:Math.pow(ob,e),new Pb(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 Eb(zb(e>=240?e-240:e+120,o,r),zb(e,o,r),zb(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Pb(Ib(this.h),Ab(this.s),Ab(this.l),Nb(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=Nb(this.opacity);return`${1===e?"hsl(":"hsla("}${Ib(this.h)}, ${100*Ab(this.s)}%, ${100*Ab(this.l)}%${1===e?")":`, ${e})`}`}}));var Tb=e=>()=>e;function Lb(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Tb(isNaN(e)?n:e)}var Bb=function e(n){var t=function(e){return 1==(e=+e)?Lb: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):Tb(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=_b(e)).r,(n=_b(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Lb(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 Db(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Rb=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hb=new RegExp(Rb.source,"g");function Vb(e,n){var t,r,o,i=Rb.lastIndex=Hb.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Rb.exec(e))&&(r=Hb.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:Db(t,r)})),i=Hb.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 Yb,Xb=180/Math.PI,Fb={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Zb(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)*Xb,skewX:Math.atan(c)*Xb,scaleX:a,scaleY:u}}function Ub(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:Db(e,o)},{i:c-2,x:Db(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:Db(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:Db(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:Db(e,t)},{i:u-2,x:Db(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 Wb=Ub((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Fb:Zb(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Gb=Ub((function(e){return null==e?Fb:(Yb||(Yb=document.createElementNS("http://www.w3.org/2000/svg","g")),Yb.setAttribute("transform",e),(e=Yb.transform.baseVal.consolidate())?Zb((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Fb)}),", ",")",")");function qb(e){return((e=Math.exp(e))+1/e)/2}var $b,Kb,Qb=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),b=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(m*m+1)-m);a=(w-b)/n,i=function(e){var r,o=e*a,i=qb(b),s=l/(t*g)*(i*(r=n*o+b,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[u+s*h,c+s*v,l*i/qb(n*o+b)]}}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),Jb=0,ew=0,nw=0,tw=1e3,rw=0,ow=0,iw=0,aw="object"==typeof performance&&performance.now?performance:Date,uw="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cw(){return ow||(uw(lw),ow=aw.now()+iw)}function lw(){ow=0}function sw(){this._call=this._time=this._next=null}function dw(e,n,t){var r=new sw;return r.restart(e,n,t),r}function fw(){ow=(rw=aw.now())+iw,Jb=ew=0;try{!function(){cw(),++Jb;for(var e,n=$b;n;)(e=ow-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Jb}()}finally{Jb=0,function(){for(var e,n,t=$b,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:$b=n);Kb=e,vw(r)}(),ow=0}}function hw(){var e=aw.now(),n=e-rw;n>tw&&(iw-=n,rw=e)}function vw(e){Jb||(ew&&(ew=clearTimeout(ew)),e-ow>24?(e<1/0&&(ew=setTimeout(fw,e-aw.now()-iw)),nw&&(nw=clearInterval(nw))):(nw||(rw=aw.now(),nw=setInterval(hw,tw)),Jb=1,uw(fw)))}function pw(e,n,t){var r=new sw;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}sw.prototype=dw.prototype={constructor:sw,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?cw():+t)+(null==n?0:+n),this._next||Kb===this||(Kb?Kb._next=this:$b=this,Kb=this),this._call=e,this._time=t,vw()},stop:function(){this._call&&(this._call=null,this._time=1/0,vw())}};var gw=qg("start","end","cancel","interrupt"),yw=[],mw=0,bw=2,ww=3,xw=5,_w=6;function Ew(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 l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===ww)return pw(i);4===f.state?(f.state=_w,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=_w,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(pw((function(){t.state===ww&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=bw,t.on.call("start",e,e.__data__,t.index,t.group),t.state===bw){for(t.state=ww,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=xw,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===xw&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=_w,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=dw((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:gw,tween:yw,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mw})}function Sw(e,n){var t=Nw(e,n);if(t.state>mw)throw new Error("too late; already scheduled");return t}function kw(e,n){var t=Nw(e,n);if(t.state>ww)throw new Error("too late; already running");return t}function Nw(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Cw(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>bw&&t.state<xw,t.state=_w,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 Mw(e,n){var t,r;return function(){var o=kw(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 Ow(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=kw(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function jw(e,n,t){var r=e._id;return e.each((function(){var e=kw(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Nw(e,r).value[n]}}function Pw(e,n){var t;return("number"==typeof n?Db:n instanceof bb?Bb:(t=bb(n))?(n=t,Bb):Vb)(e,n)}function Iw(e){return function(){this.removeAttribute(e)}}function Aw(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zw(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 Tw(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 Lw(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 Bw(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 Dw(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 Rw(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 Hw(e,n){return function(){Sw(this,e).delay=+n.apply(this,arguments)}}function Vw(e,n){return n=+n,function(){Sw(this,e).delay=n}}function Yw(e,n){return function(){kw(this,e).duration=+n.apply(this,arguments)}}function Xw(e,n){return n=+n,function(){kw(this,e).duration=n}}var Fw=lm.prototype.constructor;function Zw(e){return function(){this.style.removeProperty(e)}}var Uw=0;function Ww(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Gw(){return++Uw}var qw=lm.prototype;Ww.prototype={constructor:Ww,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=ay(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Ew(d[f],n,t,f,d,Nw(u,t)));return new Ww(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=cy(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Nw(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Ew(f,n,t,p,h,v);i.push(h),a.push(c)}return new Ww(i,a,n,t)},selectChild:qw.selectChild,selectChildren:qw.selectChildren,filter:function(e){"function"!=typeof e&&(e=ly(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Ww(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,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Ww(a,this._parents,this._name,this._id)},selection:function(){return new Fw(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=Gw(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Nw(a,n);Ew(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Ww(r,this._parents,e,t)},call:qw.call,nodes:qw.nodes,node:qw.node,size:qw.size,empty:qw.empty,each:qw.each,on:function(e,n){var t=this._id;return arguments.length<2?Nw(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)?Sw:kw;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=ny(e),r="transform"===t?Gb:Pw;return this.attrTween(e,"function"==typeof n?(t.local?Bw:Lw)(t,r,jw(this,"attr."+e,n)):null==n?(t.local?Aw:Iw)(t):(t.local?Tw:zw)(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=ny(e);return this.tween(t,(r.local?Dw:Rw)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Wb:Pw;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=Iy(this,e),a=(this.style.removeProperty(e),Iy(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,Zw(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=Iy(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=Iy(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,jw(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=kw(this,e),l=c.on,s=null==c.value[a]?i||(i=Zw(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=Iy(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}}(jw(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=Nw(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?Mw:Ow)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Hw:Vw)(n,e)):Nw(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Yw:Xw)(n,e)):Nw(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(){kw(this,e).ease=n}}(n,e)):Nw(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;kw(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=kw(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]:qw[Symbol.iterator]};var $w={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Kw(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}lm.prototype.interrupt=function(e){return this.each((function(){Cw(this,e)}))},lm.prototype.transition=function(e){var n,t;e instanceof Ww?(n=e._id,e=e._name):(n=Gw(),(t=$w).time=cw(),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,l=0;l<c;++l)(a=u[l])&&Ew(a,e,n,l,u,t||Kw(a,n));return new Ww(r,this._parents,e,n)};var Qw=e=>()=>e;function Jw(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 ex(e,n,t){this.k=e,this.x=n,this.y=t}ex.prototype={constructor:ex,scale:function(e){return 1===e?this:new ex(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new ex(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 nx=new ex(1,0,0);function tx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nx;return e.__zoom}function rx(e){e.stopImmediatePropagation()}function ox(e){e.preventDefault(),e.stopImmediatePropagation()}function ix(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function ax(){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 ux(){return this.__zoom||nx}function cx(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lx(){return navigator.maxTouchPoints||"ontouchstart"in this}function sx(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))}tx.prototype=ex.prototype;var dx,fx=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},hx=function(e){return{x:e.x,y:e.y,zoom:e.k}},vx=function(e){var n=e.x,t=e.y,r=e.zoom;return nx.translate(n,t).scale(r)},px=function(e,n){return e.target.closest(".".concat(n))},gx=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},yx=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},mx=function(e){var n=e.ctrlKey&&Rv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function bx(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,l=e.onTransformChange,s=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=ix,o=ax,i=sx,a=cx,u=lx,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=Qb,f=qg("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",ux).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",O).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 ex(n,e.x,e.y)}function b(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 ex(e.k,r,o)}function w(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(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?w(u):"function"==typeof t?t.apply(e,i):t,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new ex(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)))),s=dm(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Cw(this),t.start()}ox(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(b(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=sm(e.view).on("mousemove.zoom",(function(e){if(ox(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(b(a.that.__zoom,a.mouse[0]=dm(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),ym(e.view,a.moved),ox(e),a.event(e).end()}),!0),c=dm(e,o),s=e.clientX,d=e.clientY;gm(e.view),rx(e),a.mouse=[c,this.__zoom.invert(c)],Cw(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=dm(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(b(m(t,c),a,u),o.apply(this,n),l);ox(e),s>0?sm(this).transition().duration(s).call(x,d,a,e):sm(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(rx(t),a=0;a<s;++a)c=[c=dm(u=l[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)),Cw(this),d.start())}}function M(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(ox(e),t=0;t<s;++t)o=dm(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(b(r,o,a),u.extent,l))}}function O(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(rx(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=dm(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=sm(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",ux),e!==o?x(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?w(e):"function"==typeof t?t.apply(this,arguments):t,u=r.invert(a),c="function"==typeof n?n.apply(this,arguments):n;return i(b(m(r,c),a,u),e,l)}),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),l)}),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?w(e):"function"==typeof r?r.apply(this,arguments):r;return i(nx.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,l)}),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=sm(this.that).datum();f.call(e,this.that,new Jw(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:Qw(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:Qw(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Qw(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:Qw([[+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?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},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=sm(n).call(h);b({x:i.x,y:i.y,zoom:Cv(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(yx(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function b(e,n,t){var r=vx(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(mx),{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,b=e.panOnScrollSpeed,w=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=!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||px(e,n))return null;e.preventDefault(),r.call(this,e,o)}}({noWheelClassName:n,preventScrolling:w,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,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(px(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=dm(e),h=mx(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Nm.Vertical?0:e.deltaX*p,y=i===Nm.Horizontal?0:e.deltaY*p;!Rv()&&e.shiftKey&&i!==Nm.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=hx(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:b,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=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=hx(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:s,onPanZoomStart:u});h.on("start",C);var M=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||!gx(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,hx(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",M);var O=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&&gx(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&fx(n.prevViewport,e.transform))){var l=hx(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var j=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,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(px(e,"".concat(s,"-flow__node"))||px(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(px(e,c)&&"wheel"===e.type)return!1;if(px(e,l)&&("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:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=vx(e);return y(t,n),t},setViewportConstrained:b,getViewport:function(){var e=v?tx(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(yx(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(yx(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=vx(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"}(dx||(dx={}));F(F({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var wx=yv.error001();function xx(e,n){var r=t(Y);if(null===r)throw new Error(wx);return H(r,e,n)}function _x(){var e=t(Y);if(null===e)throw new Error(wx);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function Ex(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),d=Sx(c,e,f(f({},c.position),{z:(Ix(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=d.x,v=d.y,p=d.z,m=c.internals.positionAbsolute,b=h!==m.x||v!==m.y;(b||p!==c.internals.z)&&(c.internals=f(f({},c.internals),{positionAbsolute:b?{x:h,y:v}:m,z:p}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function Sx(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=kx(s,r).position;return Sx(s,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=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var kx=function(e,n){void 0===n&&(n=[0,0]);var t=Px(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 Nx(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=g(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),p="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(p)||new Map,b={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),b)),e.set(p,m.set("".concat(c,"-").concat(d),b))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Cx(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=f(f(f({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(Ix(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&Ex(n,r)}function Mx(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=g(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var p=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Tx(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Rx(p,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=kx(i,i.origin).position,u=Px(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 Ox=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},jx=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Ox(e.x,n[0][0],n[1][0]),y:Ox(e.y,n[0][1],n[1][1])}};function Px(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 Ix=function(e){return!isNaN(e)&&isFinite(e)},Ax=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])}},zx=function(e,n,t,r){var o=e.x,i=e.y,a=y(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Ax(s,r):s},Tx=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=kx(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}},Lx=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)}},Bx=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Dx=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Rx=function(e,n){return Dx(Lx(Bx(e),Bx(n)))};function Hx(e){return o(e)}var Vx=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)},Yx=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),l=Ox(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function Xx(e){return void 0!==e&&"parent"!==e}var Fx=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]}},Zx=function(e){return Ux(e)},Ux=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Wx=function(e){return Ix(e.width)&&Ix(e.height)&&Ix(e.x)&&Ix(e.y)},Gx=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},qx=["INPUT","SELECT","TEXTAREA"];function $x(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 qx.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Kx=function(e){return"clientX"in e},Qx=function(e,n){var t,r,o,i,a=Kx(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)}},Jx=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return f({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},Gx(e))}))},e_="undefined"!=typeof document?document:null;function n_(e,n){void 0===e&&(e=null),void 0===n&&(n={target:e_,actInsideInputWithModifier:!0});var t=y(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=y(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,m([],y(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||e_;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&$x(e))return!1;var t=r_(e.code,h);s.current.add(e[t]),t_(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&$x(e))return!1;var t=r_(e.code,h);t_(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function t_(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 r_(e,n){return n.includes(e)?"code":"key"}function o_(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 i_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var a_=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function u_(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Nm.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,b=e.translateExtent,w=e.minZoom,x=e.maxZoom,_=e.zoomActivationKeyCode,E=e.preventScrolling,k=void 0===E||E,N=e.children,C=e.noWheelClassName,M=e.noPanClassName,O=e.onViewportChange,j=e.isControlledViewport,P=_x(),I=a(null),A=xx(a_,o_),z=A.userSelectionActive,T=A.lib,L=n_(_),B=a();return function(e){var n=_x();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=Gx(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",yv.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(I),u((function(){if(I.current){B.current=bx({domNode:I.current,minZoom:w,maxZoom:x,translateExtent:b,viewport:m,onTransformChange:function(e){null==O||O({x:e[0],y:e[1],zoom:e[2]}),j||P.setState({transform:e})},onDraggingChange:function(e){return P.setState({paneDragging:e})},onPanZoomStart:function(e,n){var t=P.getState(),r=t.onViewportChangeStart,o=t.onMoveStart;null==o||o(e,n),null==r||r(n)},onPanZoom:function(e,n){var t=P.getState(),r=t.onViewportChange,o=t.onMove;null==o||o(e,n),null==r||r(n)},onPanZoomEnd:function(e,n){var t=P.getState(),r=t.onViewportChangeEnd,o=t.onMoveEnd;null==o||o(e,n),null==r||r(n)}});var e=B.current.getViewport(),n=e.x,t=e.y,r=e.zoom;return P.setState({panZoom:B.current,transform:[n,t,r],domNode:I.current.closest(".ink-flow")}),function(){var e;null===(e=B.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=B.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:L,preventScrolling:k,noPanClassName:M,userSelectionActive:z,noWheelClassName:C,lib:T})}),[n,r,i,l,d,h,p,y,L,k,M,z,C,T]),S.jsx("div",{className:"ink-flow__renderer",ref:I,style:i_,children:N})}var c_={actInsideInputWithModifier:!1};function l_(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 s_(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=g(e),d=s.next();!d.done;d=s.next()){if("add"!==(_=d.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=g(n),p=v.next();!p.done;p=v.next()){var y=p.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var b=f({},y);try{for(var w=(a=void 0,g(m)),x=w.next();!x.done;x=w.next()){var _;l_(_=x.value,b)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=w.return)&&u.call(w)}finally{if(a)throw a.error}}c.push(b)}else c.push(f({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function d_(e,n){return s_(e,n)}function f_(e,n){return s_(e,n)}function h_(e,n){return{id:e,type:"select",selected:n}}function v_(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(h_(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function p_(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=g(c),h=f.next();!h.done;h=f.next()){var v=h.value,p=l.get(v.id),m=null!==(a=null===(i=null==p?void 0:p.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:p;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var b=g(l),w=b.next();!w.done;w=b.next()){var x=y(w.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{w&&!w.done&&(o=b.return)&&o.call(b)}finally{if(r)throw r.error}}return s}function g_(e){return{id:e.id,type:"remove"}}var y_=function(e,n){void 0===n&&(n=[0,0]);var t=Px(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}}},m_=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=kx(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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 Lx(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Dx(t)},b_=function(e,n,t,r,o,i){var a,u,c,l,s,d,h,v,p=y(void 0===t?[0,0,1]:t,3),m=p[0],b=p[1],w=p[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=f(f({},zx(n,[m,b,w])),{width:n.width/w,height:n.height/w}),_=[];try{for(var E=g(e),S=E.next();!S.done;S=E.next()){var k=y(S.value,2)[1],N=k.measured,C=k.selectable,M=void 0===C||C,O=k.hidden,j=void 0!==O&&O,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(d=N.height)&&void 0!==d?d:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!M||j)){var A=Vx(x,Tx(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.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 x_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=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=m_(h,{nodeOrigin:f}),g=Yx(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,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 __(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),l=c.parentId?r.get(c.parentId):void 0,s=l?y_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&Xx(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,b=d+v*m[0],w=f+p*m[1];h=[[b,w],[b+g-v,w+y-p]]}}else null==u||u("005",yv.error005());var x=Xx(h)?jx(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function E_(e){return v(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,v,y,m,b,w,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,M=e.onBeforeDelete;return p(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=g(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(b=o.return)&&b.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=w_(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=g(c),h=f.next();!h.done;h=f.next())v=h.value,d(v)}catch(e){w={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(w)throw w.error}}return M?[4,M({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var S_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function k_(){var e=xx(S_,o_),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?S.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 N_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},C_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function M_(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=_x(),p=a(0),m=a(0),b=a(),w=a(new Map),x=xx(C_,o_),_=x.userSelectionActive,E=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(e){return c(e)}:void 0,j=E&&(n||_);return S.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:N_(C,h),onContextMenu:N_((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:N_(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(b.current=null==l?void 0:l.getBoundingClientRect(),E&&n&&0===e.button&&e.target===h.current&&b.current){w.current=new Map;try{for(var d=g(s),f=d.next();!f.done;f=d.next()){var p=y(f.value,2),m=p[0],x=p[1];w.current.set(x.source,(null===(i=w.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),w.current.set(x.target,(null===(a=w.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=Qx(e.nativeEvent,b.current),S=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:S,startY:k,x:S,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&b.current&&u){var y=Qx(e.nativeEvent,b.current),x=y.x,_=y.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=b_(d,k,l,!1,!0,s),C=new Set,M=new Set;try{for(var O=g(N),j=O.next();!j.done;j=O.next()){var P=j.value;M.add(P.id);var I=w.current.get(P.id);if(I)try{for(var A=(o=void 0,g(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.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){t={error:e}}finally{try{j&&!j.done&&(r=O.return)&&r.call(O)}finally{if(t)throw t.error}}if(p.current!==M.size)p.current=M.size,f(v_(d,M,!0));if(m.current!==C.size)m.current=C.size,h(v_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:p.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:p.current>0}),null==o||o(e)),N()}:d,ref:h,style:i_,children:[f,S.jsx(k_,{})]})}var O_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function j_(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,b=e.zoomOnScroll,w=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,E=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,M=e.translateExtent,O=e.minZoom,j=e.maxZoom,P=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,L=xx(O_);L.nodesSelectionActive;var B=L.userSelectionActive,D=n_(s),R=n_(g),H=R||N,V=R||x,Y=D||B||d&&!0!==H;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=_x(),o=n_(n,c_),i=n_(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),S.jsx(u_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:w,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!D&&H,defaultViewport:C,translateExtent:M,minZoom:O,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:S.jsx(M_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:H,isSelecting:!!Y,selectionMode:f,children:n})})}j_.displayName="FlowRenderer";var P_=c(j_);function I_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return d_(e,n)}))}),[]);return[t,r,o]}function A_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return f_(e,n)}))}),[]);return[t,r,o]}var z_="undefined"!=typeof window?s:u;function T_(e){var n=y(i(!1),2),t=n[0],r=n[1],o=y(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return z_((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var L_=n(null);function B_(e){var n=e.children,t=_x(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(p_({items:d,lookup:s}))}),[]),i=T_(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(p_({items:d,lookup:s}))}),[]),u=T_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return S.jsx(L_.Provider,{value:c,children:n})}var D_=function(){var e=_x();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=y(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=y(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&x_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],s=i/2-n*l,d=a/2-t*l;null==u||u.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Yx(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return zx(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=function(e,n){var t=e.x,r=e.y,o=y(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},R_=function(e){return!!e.panZoom};function H_(){var e=this,n=D_(),o=_x(),i=function(){var e=t(L_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=xx(R_);console.log("yk store",o.getState());var u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Zx(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=f({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],d=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-d}}return u}(l.position,l.parentId,u,c):l.position,d={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Tx(d)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&Zx(o)?o:f(f({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return f({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return f({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=y(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return f({},e)})),edges:i.map((function(e){return f({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return v(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,v,g,y,m,b=e.nodes,w=void 0===b?[]:b,x=e.edges,_=void 0===x?[]:x;return p(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,E_({nodesToRemove:w,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,v=h.length>0,g=f.length>0,v&&(y=h.map(g_),null==a||a(h),c(y)),g&&(m=f.map(g_),null==i||i(f),u(m)),(g||v)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=Wx(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=Tx(u?t:r),l=Vx(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=Wx(e)?e:r(e);if(!o)return!1;var i=Vx(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?f(f({},e),{data:r}):f(f({},e),{data:f(f({},e.data),r)})}),t)},checkAllNodeBeMeasured:function(){return o.getState().nodes.every((function(e){return e.measured}))}}}),[]);return r((function(){return f(f(f({},u),n),{viewportInitialized:a})}),[a])}var V_=function(e){return e.updateNodeInternals};var Y_=function(e){return function(n){return e?b_(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 X_=n(null),F_=X_.Provider;X_.Consumer;var Z_="ink-flow__node-desc",U_="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 G_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function q_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case jm.Left:return[t-G_(t-o,a),r];case jm.Right:return[t+G_(o-t,a),r];case jm.Top:return[t,r-G_(r-i,a)];case jm.Bottom:return[t,r+G_(i-r,a)]}}function $_(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_,Q_=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 J_=((K_={})[jm.Left]={x:-1,y:0},K_[jm.Right]={x:1,y:0},K_[jm.Top]={x:0,y:-1},K_[jm.Bottom]={x:0,y:1},K_),eE=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?jm.Bottom:t,o=e.target;return r===jm.Left||r===jm.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}},nE=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function tE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=y(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?jm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?jm.Top:l,d=e.center,f=e.offset,h=J_[u],v=J_[s],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},b=eE({source:p,sourcePosition:u,target:g}),w=0!==b.x?"x":"y",x=b[w],_=[],E={x:0,y:0},S={x:0,y:0},k=y($_({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],M=k[2],O=k[3];if(h[w]*v[w]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];_=h[w]===x?"x"===w?j:P:"x"===w?P:j}else{var I=[{x:p.x,y:g.y}],A=[{x:g.x,y:p.y}];if(_="x"===w?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[w]-c[w]);if(z<=f){var T=Math.min(f-1,f-z);h[w]===x?E[w]=(p[w]>i[w]?-1:1)*T:S[w]=(g[w]>c[w]?-1:1)*T}}if(u!==s){var L="x"===w?"y":"x",B=h[w]===v[L],D=p[L]>g[L],R=p[L]<g[L];(1===h[w]&&(!B&&D||B&&R)||1!==h[w]&&(!B&&R||B&&D))&&(_="x"===w?I:A)}var H={x:p.x+E.x,y:p.y+E.y},V={x:g.x+S.x,y:g.y+S.y};Math.max(Math.abs(H.x-_[0].x),Math.abs(V.x-_[0].x))>=Math.max(Math.abs(H.y-_[0].y),Math.abs(V.y-_[0].y))?(r=(H.x+V.x)/2,o=_[0].y):(r=_[0].x,o=(H.y+V.y)/2)}return[m(m([i,{x:p.x+E.x,y:p.y+E.y}],y(_),!1),[{x:g.x+S.x,y:g.y+S.y},c],!1),r,o,M,O]}({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],b=v[2],w=v[3],x=v[4],_=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(nE(e,n)/2,nE(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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,g,b,w,x]}var rE=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var oE=c(Hx((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?jm.Top:u,l=e.isValidConnection,s=e.isConnectable,d=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,b=e.onConnect,w=e.children,x=e.className,_=e.onMouseDown,E=e.onTouchStart,k=h(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=_x(),j=t(X_),P=xx(rE,o_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=xx(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(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:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===km.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:l&&"valid"===c}}}(j,N,a),o_),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,H=T.connectionInProcess,V=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",yv.error010());var Y=function(e){var n=M.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=f(f({},t),e);if(o){var a=M.getState(),u=a.edges;(0,a.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))}))}(t="id"in(r=e)&&"source"in r&&"target"in r?f({},e):f(f({},e),{id:Q_(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==b||b(i)},X=function(e){if(j){var n=Kx(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=M.getState();eb.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==_||_(e):null==E||E(e)}};return S.jsx("div",f({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:d,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:L,connectingto:B,valid:V,connectionindicator:d&&(!H||R)&&(H?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=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=l||u,h=eb.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:w}))})));var iE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aE={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?jm.Bottom:r;return S.jsxs(S.Fragment,{children:[null==n?void 0:n.label,S.jsx(oE,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?jm.Top:r,i=e.sourcePosition,a=void 0===i?jm.Bottom:i;return S.jsxs(S.Fragment,{children:[S.jsx(oE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,S.jsx(oE,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?jm.Top:r;return S.jsxs(S.Fragment,{children:[S.jsx(oE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function uE(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,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(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",yv.error012(n))}var cE=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function lE(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,d=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,p=e.elementsSelectable,m=e.nodesConnectable,b=e.nodesFocusable,w=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,E=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,M=e.nodeOrigin,j=e.onError,P=xx((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),o_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",L=(null==N?void 0:N[T])||aE[T];void 0===L&&(null==j||j("003",yv.error003(T)),T="default",L=aE.default);var B=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||p&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),H=!!(I.focusable||b&&void 0===I.focusable),V=_x(),Y=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)}(I),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=_x(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:w}),F=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=_x(),f=y(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=Gm({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){uE({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:I.hidden||!B,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),Z=function(){var e=_x(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=cE(c),p=a?u[0]:5,m=a?u[1]:5,b=n.direction.x*p*n.factor,w=n.direction.y*m*n.factor;try{for(var x=g(d),_=x.next();!_.done;_=x.next()){var E=y(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+b,y:E.internals.positionAbsolute.y+w};a&&(S=Ax(S,u));var k=__({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(I.hidden)return null;var U=Px(I),W=function(e){var n,t,r,o,i,a,u,c,l,s;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!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(I),G=C?jx(A.positionAbsolute,C):A.positionAbsolute,q=Fx(f(f(f({},G),U),{origin:I.origin||M})),$=D||B||r||o||c||s,K=o?function(e){return o(e,f({},A.userNode))}:void 0,Q=c?function(e){return c(e,f({},A.userNode))}:void 0,J=s?function(e){return s(e,f({},A.userNode))}:void 0,ee=d?function(e){return d(e,f({},A.userNode))}:void 0,ne=h?function(e){return h(e,f({},A.userNode))}:void 0;return S.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=B,n),I.className,{selected:I.selected,selectable:D,parent:z,draggable:B,dragging:F}]),ref:X,style:f(f({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),W),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:ee,onClick:function(e){var n=V.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;D&&(!o||!B||i>0)&&uE({id:t,store:V,nodeRef:X}),r&&r(e,f({},A.userNode))},onDoubleClick:ne,onKeyDown:H?function(e){if(!$x(e.nativeEvent)&&!E)if(bv.includes(e.key)&&D){var n="Escape"===e.key;uE({id:t,store:V,unselect:n,nodeRef:X})}else B&&I.selected&&Object.prototype.hasOwnProperty.call(iE,e.key)&&(V.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~G.x,", y: ").concat(~~G.y)}),Z({direction:iE[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":E?void 0:"".concat(Z_,"-").concat(k),"aria-label":I.ariaLabel,children:S.jsx(F_,{value:t,children:S.jsx(L,f({id:t,data:I.data,type:T,positionAbsoluteX:G.x,positionAbsoluteY:G.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:F,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var sE=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function dE(e){var n,t=xx(sE,o_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=xx(l(Y_(n=!1),[n]),o_),f=function(){var e=xx(V_),n=y(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return S.jsx("div",{className:"ink-flow__nodes",style:i_,children:d.map((function(n){return S.jsx(lE,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}dE.displayName="NodeRenderer";var fE,hE=c(dE),vE=((fE={})[Om.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},fE[Om.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},fE);function pE(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 gE=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=_x(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(vE,e)?vE[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",yv.error009(e)),null)}),[e]);return t}(t);return v?S.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:S.jsx(v,{color:o,strokeWidth:d})}):null},yE=function(e){var n=e.defaultColor,t=e.rfId,o=xx((function(e){return e.edges})),i=xx((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=pE(n,t);a.has(o)||(e.push(f({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?S.jsx("svg",{className:"ink-flow__marker",children:S.jsx("defs",{children:a.map((function(e){return S.jsx(gE,{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};yE.displayName="MarkerDefinitions";var mE=c(yE);function bE(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,d=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,g=e.labelBgBorderRadius,m=void 0===g?2:g,b=e.children,w=e.className,x=h(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=y(i({x:1,y:0,width:0,height:0}),2),E=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",w]),C=l((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!==r&&r?S.jsxs("g",f({transform:"translate(".concat(n-E.width/2," ").concat(t-E.height/2,")"),className:N,visibility:E.width?"visible":"hidden"},x,{children:[c&&S.jsx("rect",{width:E.width+2*p[0],x:-p[0],y:-p[1],height:E.height+2*p[1],className:"ink-flow__edge-textbg",style:d,rx:m,ry:m}),S.jsx("text",{className:"ink-flow__edge-text",y:E.height/2,dy:"0.3em",ref:C,style:a,children:r}),b]})):null}bE.displayName="EdgeText";var wE=c(bE);function xE(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,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return S.jsxs(S.Fragment,{children:[S.jsx("path",{id:n,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&S.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&Ix(r)&&Ix(o)?S.jsx(wE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function _E(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===jm.Left||n===jm.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function EE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=y(_E({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=y(_E({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=y(W_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),g=p[0],m=p[1],b=p[2],w=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),g,m,b,w]}function SE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?jm.Bottom:u,l=n.targetPosition,s=void 0===l?jm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,b=n.markerEnd,w=n.markerStart,x=n.interactionWidth,_=y(EE({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),E=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return S.jsx(xE,{id:C,path:E,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:b,markerStart:w,interactionWidth:x})}))}var kE=SE({isInternal:!1}),NE=SE({isInternal:!0});function CE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?jm.Bottom:v,g=n.targetPosition,m=void 0===g?jm.Top:g,b=n.markerEnd,w=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(tE({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(xE,{id:M,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:b,markerStart:w,interactionWidth:_})}))}kE.displayName="SimpleBezierEdge",NE.displayName="SimpleBezierEdgeInternal";var ME=CE({isInternal:!1}),OE=CE({isInternal:!0});function jE(e){return c((function(n){var t,o=n.id,i=h(n,["id"]),a=e.isInternal?void 0:o;return S.jsx(ME,f({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}ME.displayName="SmoothStepEdge",OE.displayName="SmoothStepEdgeInternal";var PE=jE({isInternal:!1}),IE=jE({isInternal:!0});function AE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,g=n.interactionWidth,m=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=y($_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),b=m[0],w=m[1],x=m[2],_=e.isInternal?void 0:t;return S.jsx(xE,{id:_,path:b,labelX:w,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:g})}))}PE.displayName="StepEdge",IE.displayName="StepEdgeInternal";var zE=AE({isInternal:!1}),TE=AE({isInternal:!0});function LE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?jm.Bottom:u,l=n.targetPosition,s=void 0===l?jm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,b=n.markerEnd,w=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=y(q_({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=y(q_({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],m=y(W_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),b=m[0],w=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),b,w,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(xE,{id:M,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:b,markerStart:w,interactionWidth:_})}))}zE.displayName="StraightEdge",TE.displayName="StraightEdgeInternal";var BE=LE({isInternal:!1}),DE=LE({isInternal:!0});BE.displayName="BezierEdge",DE.displayName="BezierEdgeInternal";var RE={default:DE,straight:TE,step:IE,smoothstep:OE,simplebezier:NE},HE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},VE=function(e,n,t){return t===jm.Left?e-n:t===jm.Right?e+n:e},YE=function(e,n,t){return t===jm.Top?e-n:t===jm.Bottom?e+n:e},XE="ink-flow__edgeupdater";function FE(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,l=e.type;return S.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([XE,"".concat(XE,"-").concat(l)]),cx:VE(t,i,n),cy:YE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function ZE(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,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=_x(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,b=t.cancelConnection,w=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);eb.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:w,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:b,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},b=function(){return g(!0)},w=function(){return g(!1)};return S.jsxs(S.Fragment,{children:[("source"===n||!0===n)&&S.jsx(FE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:b,onMouseOut:w,type:"source"}),("target"===n||!0===n)&&S.jsx(FE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:b,onMouseOut:w,type:"target"})]})}function UE(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=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=c.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&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function GE(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:Px(n),c=u.width,l=u.height;switch(e){case jm.Top:return[i+c/2,a];case jm.Right:return[i+c,a+l/2];case jm.Bottom:return[i+c/2,a+l];case jm.Left:return[i,a+l/2]}}function qE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function $E(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,d=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,g=e.edgeUpdaterRadius,m=e.onEdgeUpdate,b=e.onEdgeUpdateStart,w=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,E=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=xx((function(e){return e.edgeLookup.get(n)})),M=xx((function(e){return e.defaultEdgeOptions})),j=(C=M?f(f({},M),C):C).type||"default",P=(null==_?void 0:_[j])||RE[j];void 0===P&&(null==k||k("011",yv.error011(j)),j="default",P=RE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),L=y(i(!1),2),B=L[0],D=L[1],R=y(i(!1),2),H=R[0],V=R[1],Y=_x(),X=xx(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return f({zIndex:C.zIndex},HE);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!UE(a)||!UE(u))return null;var c=a.internals.handleBounds||WE(a.handles),l=u.internals.handleBounds||WE(u.handles),s=qE(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=qE(e.connectionMode===km.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),f=(null==s?void 0:s.position)||jm.Bottom,h=(null==d?void 0:d.position)||jm.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",yv.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=y(GE(f,a,s),2),p=v[0],g=v[1],m=y(GE(h,u,d),2);return{sourceX:p,sourceY:g,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=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,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return f({zIndex:i},o||HE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),o_),F=X.zIndex,Z=X.sourceX,U=X.sourceY,W=X.targetX,G=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(pE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(pE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===Z||null===U||null===W||null===G)return null;var J=s?function(e){s(e,f({},C))}:void 0,ee=d?function(e){d(e,f({},C))}:void 0,ne=h?function(e){h(e,f({},C))}:void 0,te=v?function(e){v(e,f({},C))}:void 0,re=p?function(e){p(e,f({},C))}:void 0;return S.jsx("svg",{style:{zIndex:F},children:S.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,E,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:B,selectable:z}]),onClick:function(e){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:J,onContextMenu:ee,onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onKeyDown:I?function(e){var t;if(!N&&bv.includes(e.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(U_,"-").concat(x):void 0,ref:T,children:[!H&&S.jsx(P,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:Z,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&S.jsx(ZE,{edge:C,isUpdatable:A,edgeUpdaterRadius:g,onEdgeUpdate:m,onEdgeUpdateStart:b,onEdgeUpdateEnd:w,sourceX:Z,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:V,sourceHandleId:C.sourceHandle,targetHandleId:C.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 QE(e){var n=e.defaultMarkerColor,t=e.rfId,r=e.noPanClassName,o=e.onEdgeUpdate,i=e.onEdgeContextMenu,a=e.onEdgeMouseEnter,u=e.onEdgeMouseMove,c=e.onEdgeMouseLeave,s=e.onEdgeClick,d=e.edgeTypes,f=xx(KE,o_),h=f.edgesFocusable,v=f.edgesUpdatable,p=f.elementsSelectable,g=f.onError,y=function(e){var n=xx(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),o_);return n}(!1);return S.jsxs("div",{className:"ink-flow__edges",children:[S.jsx(mE,{defaultColor:n,rfId:t}),y.map((function(e){return S.jsx($E,{id:e,edgesFocusable:h,edgesUpdatable:v,elementsSelectable:p,noPanClassName:r,onEdgeUpdate:o,onContextMenu:i,onMouseEnter:a,onMouseMove:u,onMouseLeave:c,onClick:s,rfId:t,onError:g,edgeTypes:d},e)}))]})}QE.displayName="EdgeRenderer";var JE,eS=c(QE),nS=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function tS(e){var n=e.children,t=xx(nS);return S.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var rS=((JE={})[jm.Left]=jm.Right,JE[jm.Right]=jm.Left,JE[jm.Top]=jm.Bottom,JE[jm.Bottom]=jm.Top,JE),oS=function(e){var n,t,r=e.nodeId,o=e.handleType,i=e.style,a=e.type,u=void 0===a?Mm.Bezier:a,c=e.CustomComponent,s=e.connectionStatus,d=xx(l((function(e){var n;return{fromNode:e.nodeLookup.get(r),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}}),[r]),o_),h=d.fromNode,v=d.handleId,p=d.toX,g=d.toY,m=d.connectionMode,b=null==h?void 0:h.internals.handleBounds,w=null==b?void 0:b[o];if(m===km.Loose&&(w=w||(null==b?void 0:b["source"===o?"target":"source"])),!h||!w)return null;var x=v?w.find((function(e){return e.id===v})):w[0],_=x?x.x+x.width/2:(null!==(n=h.measured.width)&&void 0!==n?n:0)/2,E=x?x.y+x.height/2:null!==(t=h.measured.height)&&void 0!==t?t:0,k=h.internals.positionAbsolute.x+_,N=h.internals.positionAbsolute.y+E,C=null==x?void 0:x.position,M=C?rS[C]:null;if(!C||!M)return null;if(c)return S.jsx(c,{connectionLineType:u,connectionLineStyle:i,fromNode:h,fromHandle:x,fromX:k,fromY:N,toX:p,toY:g,fromPosition:C,toPosition:M,connectionStatus:s});var O="",j={sourceX:k,sourceY:N,sourcePosition:C,targetX:p,targetY:g,targetPosition:M};return O=u===Mm.Bezier?y(Tm(j),1)[0]:u===Mm.Step?y(Fm(f(f({},j),{borderRadius:0})),1)[0]:u===Mm.SmoothStep?y(Fm(j),1)[0]:u===Mm.SimpleBezier?y(EE(j),1)[0]:"M".concat(k,",").concat(N," ").concat(p,",").concat(g),S.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:i})};oS.displayName="ConnectionLine";var iS=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 aS(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=xx(iS,o_),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,d=i.connectionStatus;return!!(a&&u&&l&&c)?S.jsx("svg",{style:n,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:O(["react-flow__connection",d]),children:S.jsx(oS,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function uS(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,l=e.onEdgeMouseEnter,s=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,v=e.minZoom,p=e.maxZoom,g=e.noPanClassName,y=e.noDragClassName,m=e.nodeOrigin,b=e.viewport,w=e.disableKeyboardA11y,x=e.translateExtent,_=e.defaultViewport,E=e.nodeTypes,k=e.edgeTypes,N=e.elementsSelectable,C=e.defaultMarkerColor,M=e.connectionLineType,O=e.connectionLineStyle,j=e.connectionLineComponent,P=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return S.jsx(P_,{minZoom:v,maxZoom:p,noPanClassName:g,noDragClassName:y,isControlledViewport:!!b,disableKeyboardA11y:w,translateExtent:x,defaultViewport:_,elementsSelectable:N,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:S.jsxs(tS,{children:[S.jsx(eS,{rfId:h,edgeTypes:k,noPanClassName:g,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:C}),S.jsx(aS,{style:O,type:M,component:j,containerStyle:P}),S.jsx("div",{className:"ink-flow__edgelabel-renderer"}),S.jsx(hE,{rfId:h,nodeTypes:E,nodeOrigin:m,noDragClassName:y,noPanClassName:g,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),S.jsx("div",{className:"ink-flow__viewport-portal"})]})})}uS.displayName="GraphView";var cS=c(uS),lS=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,l=new Map,s=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:[];Nx(s,d,f),Cx(h,c,l,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:h,nodeLookup:c,parentLookup:l,edges:f,edgeLookup:d,connectionLookup:s,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==a,hasDefaultEdges:void 0!==u,panZoom:null,minZoom:.5,maxZoom:2,translateExtent:mv,nodeExtent:mv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:km.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}},sS=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return n=function(e,n){return f(f({},lS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a})),{setNodes:function(t){var r=n();Cx(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Nx(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(t){var r=n(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,d=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,f(f({},t),{internals:f(f({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=Gx(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=f(f({},t),{measured:r,internals:f(f({},t.internals),{handleBounds:{source:Jx(".source",e.nodeElement,l,t.origin||o),target:Jx(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Tx(c,c.origin||o)}))}}})),s.length>0){var d=Mx(s,n,t,o);u.push.apply(u,m([],y(d),!1))}return{changes:u,updatedInternals:a}}(t,a,u,d,h),g=p.changes;if(p.updatedInternals){Ex(a,{nodeOrigin:h});var b=l;!l&&c&&(b=i(f(f({},s),{nodes:null==s?void 0:s.nodes}))),e({fitViewDone:b}),(null==g?void 0:g.length)>0&&(v&&console.log("Ink Flow: trigger node changes",g),null==o||o(g))}},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=y(c.value,2),s=l[0],d=l[1],h={id:s,type:"position",position:d.position,dragging:t};(null==d?void 0:d.expandParent)&&(null==d?void 0:d.parentId)&&h.position&&(i.push({id:s,parentId:d.parentId,rect:f(f({},d.internals.positionAbsolute),{width:d.measured.width,height:d.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),p=Mx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,m([],y(p),!1))}n().triggerNodeChanges(a)},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(f_(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(d_(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,u=t.triggerEdgeChanges;r?a(e.map((function(e){return h_(e,!0)}))):(a(v_(i,new Set(m([],y(e),!1)),!0)),u(v_(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return h_(e,!0)}))):(u(v_(o,new Set(m([],y(e),!1)))),a(v_(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,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,h_(e.id,!1)})),f=s.map((function(e){return h_(e.id,!1)}));c(d),l(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?m(m([],y(e),!1),[h_(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[h_(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=g(i),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=jx(c.position,t);i.set(c.id,f(f({},c),{internals:f(f({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},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,l=t.nodeLookup;return!!r&&x_({nodeLookup:l,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(t){var r,o=n().connectionPosition,i=f(f({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(f({},lS()))}})},t=Object.is,n?V(n,t):V};function dS(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=y(i((function(){return sS({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c})})),1)[0];return S.jsx(X,{value:s,children:S.jsx(B_,{children:l})})}function fS(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView;return t(Y)?S.jsx(S.Fragment,{children:n}):S.jsx(dS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,children:n})}var hS={x:0,y:0,zoom:1},vS=m(m([],y(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),pS=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}},gS={translateExtent:mv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yS(e){var n=xx(pS,o_),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=_x();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=gS,s()}}),[]);var h=a(gS);return u((function(){var n,a,u;try{for(var s=g(vS),d=s.next();!d.done;d=s.next()){var v=d.value,p=e[v];p!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(p):"edges"===v?r(p):"minZoom"===v?o(p):"maxZoom"===v?i(p):"translateExtent"===v?c(p):"nodeExtent"===v?l(p):"fitView"===v?f.setState({fitViewOnInit:p}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:p}):f.setState(((u={})[v]=p,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),vS.map((function(n){return e[n]}))),null}var mS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var bS=Hx((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?mv:o,a=e.defaultViewport,u=void 0===a?hS:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,d=void 0===s?2:s,v=e.defaultMarkerColor,p=void 0===v?"#b1b1b7":v,g=e.nodeOrigin,y=e.noDragClassName,m=e.noPanClassName,b=e.disableKeyboardA11y,w=e.nodeTypes,x=e.edgeTypes;e.connectionMode;var _=e.connectionLineType,E=void 0===_?Mm.Bezier:_,k=e.connectionLineStyle,N=e.connectionLineComponent,C=e.connectionLineContainerStyle,M=e.onNodeClick,j=e.onNodeDoubleClick,P=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,H=e.onEdgeDoubleClick,V=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=h(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 S.jsx("div",f({},ie,{ref:n,style:f({},mS),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:S.jsxs(fS,{nodes:t,edges:r,width:q,height:$,fitView:X,children:[S.jsx(cS,{onNodeClick:M,onNodeMouseEnter:P,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:j,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:H,rfId:ae,nodeTypes:w,edgeTypes:x,minZoom:l,maxZoom:d,nodeOrigin:g,noDragClassName:y,noPanClassName:m,disableKeyboardA11y:b,translateExtent:i,defaultMarkerColor:p,connectionLineType:E,connectionLineStyle:k,connectionLineComponent:N,connectionLineContainerStyle:C,defaultViewport:u,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),S.jsx(yS,{nodes:t,edges:r,rfId:ae,onNodesChange:V,onEdgesChange:Y,fitView:X,fitViewOptions:F,nodeExtent:Z,nodesDraggable:U,elementsSelectable:oe}),W]})}))}));function wS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 xS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 _S(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 ES(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 SS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 kS(e){var n=e.children,t=e.className,r=h(e,["children","className"]);return S.jsx("button",f({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:n}))}var NS=function(e){return e.userSelectionActive?"none":"all"};function CS(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=h(e,["position","children","className","style"]),u=xx(NS),c="".concat(t).split("-");return S.jsx("div",f({className:O(m(["ink-flow__panel",o],y(c),!1)),style:f(f({},i),{pointerEvents:u})},a,{children:r}))}var MS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function OS(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,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,b=e["aria-label"],w=void 0===b?"Ink Flow controls":b,x=_x(),_=xx(MS,o_),E=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=H_(),M=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return S.jsxs(CS,{className:O(["ink-flow__controls",I,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":w,children:[i&&S.jsx(kS,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},"aria-label":"fit view",children:S.jsx(_S,{})}),r&&S.jsxs("div",{className:"ink-flow__controls-zoom",children:[S.jsx(kS,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:N,children:S.jsx(wS,{})}),S.jsx(kS,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:k,children:S.jsx(xS,{})})]}),u&&S.jsx(kS,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),null==f||f(!E)},title:"toggle interactivity","aria-label":"toggle interactivity",children:E?S.jsx(SS,{}):S.jsx(ES,{})}),v]})}OS.displayName="Controls";var jS,PS,IS=c(OS);function AS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return S.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:O(["react-flow__background-pattern",r,o])})}function zS(e){var n=e.radius,t=e.className;return S.jsx("circle",{cx:n,cy:n,r:n,className:O(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(jS||(jS={}));var TS=((PS={})[jS.Dots]=1,PS[jS.Lines]=1,PS[jS.Cross]=6,PS),LS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function BS(e){var n=e.id,t=e.variant,r=void 0===t?jS.Dots:t,o=e.gap,i=void 0===o?20:o,u=e.size,c=e.lineWidth,l=void 0===c?1:c,s=e.offset,d=void 0===s?2:s,h=e.color,v=e.bgColor,p=e.style,g=e.className,y=e.patternClassName,m=a(null),b=xx(LS,o_),w=b.transform,x=b.patternId,_=u||TS[r],E=r===jS.Dots,k=r===jS.Cross,N=Array.isArray(i)?i:[i,i],C=[N[0]*w[2]||1,N[1]*w[2]||1],M=_*w[2],j=k?[M,M]:C,P=E?[M/d,M/d]:[j[0]/d,j[1]/d],I="".concat(x).concat(n||"");return S.jsxs("svg",{className:O(["ink-flow__background",g]),style:f(f(f({},p),i_),{"--xy-background-color-props":v,"--xy-background-pattern-color-props":h}),ref:m,"data-testid":"rf__background",children:[S.jsx("pattern",{id:I,x:w[0]%C[0],y:w[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(P[0],",-").concat(P[1],")"),children:E?S.jsx(zS,{radius:M/d,className:y}):S.jsx(AS,{dimensions:j,lineWidth:l,variant:r,className:y})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}BS.displayName="Background";var DS=c(BS),RS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};function HS(e){var n=e.children,t=xx(RS);return t?d(n,t):null}export{DS as Background,jS as BackgroundVariant,xE as BaseEdge,Mm as ConnectionLineType,km as ConnectionMode,kS as ControlButton,IS as Controls,HS as EdgeLabelRenderer,oE as Handle,dS as InkFlowProvider,Om as MarkerType,Nm as PanOnScrollMode,jm as Position,Cm as SelectionMode,ME as SmoothStepEdge,PE as StepEdge,Rm as addEdge,Xv as dagreLayout,bS as default,Im as getBezierEdgeCenter,Tm as getBezierPath,kv as getConnectedEdges,Lm as getEdgeCenter,xv as getIncomers,Ev as getNodesBounds,wv as getOutgoers,Fm as getSmoothStepPath,Vm as getStraightPath,Dv as getViewportForBounds,Hm as updateEdge,I_ as useEdgesState,H_ as useInkFlow,A_ as useNodesState,xx as useStore,_x as useStoreApi};
16
+ */j.exports=function(){if(M)return P;M=1;var n=e,t=z(),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 P.useSyncExternalStoreWithSelector=function(e,n,t,l,s){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=l(e),void 0!==s&&f.hasValue){var n=f.value;if(s(n,e))return i=n}return i=e}if(n=i,r(o,e))return n;var t=l(e);return void 0!==s&&s(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,l,s]);var h=o(e,d[0],d[1]);return a((function(){f.hasValue=!0,f.value=h}),[h]),c(h),h},P}();var T=w(j.exports);const L=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:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&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:B}=e,{useSyncExternalStoreWithSelector:D}=T,R=e=>e;function H(e,n=R,t){const r=D(e.subscribe,e.getState,e.getServerState||e.getInitialState,n,t);return B(r),r}const V=(e,n)=>{const t=(e=>e?L(e):L)(e),r=(e,r=n)=>H(t,e,r);return Object.assign(r,t),r};var Y=n(null),X=Y.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 F(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 U(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 W(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 G,q,$,K,Q,J,ee,ne,te,re,oe,ie,ae,ue,ce,le,se,de,fe,he,ve,pe,ge,ye,me,we,be,xe,_e,Ee,Se,ke,Ne,Ce,Me,Oe,je,Pe,Ie,Ae,ze,Te,Le,Be,De,Re,He,Ve,Ye,Xe,Ze,Fe,Ue,We,Ge,qe,$e,Ke,Qe,Je,en,nn,tn,rn,on,an,un,cn,ln,sn,dn,fn,hn,vn,pn,gn,yn,mn,wn,bn,xn,_n,En,Sn,kn,Nn,Cn,Mn,On,jn,Pn,In,An,zn,Tn,Ln,Bn,Dn,Rn,Hn,Vn,Yn,Xn,Zn,Fn,Un,Wn,Gn,qn="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function $n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Kn(){return K?$:(K=1,$=function(e,n){return e===n||e!=e&&n!=n})}function Qn(){if(J)return Q;J=1;var e=Kn();return Q=function(n,t){for(var r=n.length;r--;)if(e(n[r][0],t))return r;return-1},Q}function Jn(){if(le)return ce;le=1;var e=q?G:(q=1,G=function(){this.__data__=[],this.size=0}),n=function(){if(ne)return ee;ne=1;var e=Qn(),n=Array.prototype.splice;return ee=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(re)return te;re=1;var e=Qn();return te=function(n){var t=this.__data__,r=e(t,n);return r<0?void 0:t[r][1]}}(),r=function(){if(ie)return oe;ie=1;var e=Qn();return oe=function(n){return e(this.__data__,n)>-1}}(),o=function(){if(ue)return ae;ue=1;var e=Qn();return ae=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,ce=i}function et(){if(we)return me;we=1;var e="object"==typeof qn&&qn&&qn.Object===Object&&qn;return me=e}function nt(){if(xe)return be;xe=1;var e=et(),n="object"==typeof self&&self&&self.Object===Object&&self,t=e||n||Function("return this")();return be=t}function tt(){if(Ee)return _e;Ee=1;var e=nt().Symbol;return _e=e}function rt(){if(Oe)return Me;Oe=1;var e=tt(),n=function(){if(ke)return Se;ke=1;var e=tt(),n=Object.prototype,t=n.hasOwnProperty,r=n.toString,o=e?e.toStringTag:void 0;return Se=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(Ce)return Ne;Ce=1;var e=Object.prototype.toString;return Ne=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 ot(){return Pe?je:(Pe=1,je=function(e){var n=typeof e;return null!=e&&("object"==n||"function"==n)})}function it(){if(Ae)return Ie;Ae=1;var e=rt(),n=ot();return Ie=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 at(){if(Re)return De;Re=1;var e=Function.prototype.toString;return De=function(n){if(null!=n){try{return e.call(n)}catch(e){}try{return n+""}catch(e){}}return""}}function ut(){if(Fe)return Ze;Fe=1;var e=function(){if(Ve)return He;Ve=1;var e=it(),n=function(){if(Be)return Le;Be=1;var e,n=function(){if(Te)return ze;Te=1;var e=nt()["__core-js_shared__"];return ze=e}(),t=(e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||""))?"Symbol(src)_1."+e:"";return Le=function(e){return!!t&&t in e}}(),t=ot(),r=at(),o=/^\[object .+?Constructor\]$/,i=Function.prototype,a=Object.prototype,u=i.toString,c=a.hasOwnProperty,l=RegExp("^"+u.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");return He=function(i){return!(!t(i)||n(i))&&(e(i)?l:o).test(r(i))}}(),n=Xe?Ye:(Xe=1,Ye=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 ct(){if(We)return Ue;We=1;var e=ut()(nt(),"Map");return Ue=e}function lt(){if(qe)return Ge;qe=1;var e=ut()(Object,"create");return Ge=e}function st(){if(vn)return hn;vn=1;var e=fn?dn:(fn=1,dn=function(e){var n=typeof e;return"string"==n||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==e:null===e});return hn=function(n,t){var r=n.__data__;return e(t)?r["string"==typeof t?"string":"hash"]:r.map},hn}function dt(){if(Sn)return En;Sn=1;var e=function(){if(sn)return ln;sn=1;var e=function(){if(cn)return un;cn=1;var e=function(){if(Ke)return $e;Ke=1;var e=lt();return $e=function(){this.__data__=e?e(null):{},this.size=0}}(),n=Je?Qe:(Je=1,Qe=function(e){var n=this.has(e)&&delete this.__data__[e];return this.size-=n?1:0,n}),t=function(){if(nn)return en;nn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return en=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(rn)return tn;rn=1;var e=lt(),n=Object.prototype.hasOwnProperty;return tn=function(t){var r=this.__data__;return e?void 0!==r[t]:n.call(r,t)}}(),o=function(){if(an)return on;an=1;var e=lt();return on=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,un=i}(),n=Jn(),t=ct();return ln=function(){this.size=0,this.__data__={hash:new e,map:new(t||n),string:new e}}}(),n=function(){if(gn)return pn;gn=1;var e=st();return pn=function(n){var t=e(this,n).delete(n);return this.size-=t?1:0,t}}(),t=function(){if(mn)return yn;mn=1;var e=st();return yn=function(n){return e(this,n).get(n)}}(),r=function(){if(bn)return wn;bn=1;var e=st();return wn=function(n){return e(this,n).has(n)}}(),o=function(){if(_n)return xn;_n=1;var e=st();return xn=function(n,t){var r=e(this,n),o=r.size;return r.set(n,t),this.size+=r.size==o?0:1,this},xn}();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,En=i}function ft(){if(Mn)return Cn;Mn=1;var e=Jn(),n=function(){if(de)return se;de=1;var e=Jn();return se=function(){this.__data__=new e,this.size=0}}(),t=he?fe:(he=1,fe=function(e){var n=this.__data__,t=n.delete(e);return this.size=n.size,t}),r=pe?ve:(pe=1,ve=function(e){return this.__data__.get(e)}),o=ye?ge:(ye=1,ge=function(e){return this.__data__.has(e)}),i=function(){if(Nn)return kn;Nn=1;var e=Jn(),n=ct(),t=dt();return kn=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,Cn=a}function ht(){return jn||(jn=1,On=function(e,n){for(var t=-1,r=null==e?0:e.length;++t<r&&!1!==n(e[t],t,e););return e}),On}function vt(){if(In)return Pn;In=1;var e=ut(),n=function(){try{var n=e(Object,"defineProperty");return n({},"",{}),n}catch(e){}}();return Pn=n}function pt(){if(zn)return An;zn=1;var e=vt();return An=function(n,t,r){"__proto__"==t&&e?e(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}}function gt(){if(Ln)return Tn;Ln=1;var e=pt(),n=Kn(),t=Object.prototype.hasOwnProperty;return Tn=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 yt(){if(Dn)return Bn;Dn=1;var e=gt(),n=pt();return Bn=function(t,r,o,i){var a=!o;o||(o={});for(var u=-1,c=r.length;++u<c;){var l=r[u],s=i?i(o[l],t[l],l,o,t):void 0;void 0===s&&(s=t[l]),a?n(o,l,s):e(o,l,s)}return o}}function mt(){return Yn?Vn:(Yn=1,Vn=function(e){return null!=e&&"object"==typeof e})}function wt(){if(Un)return Fn;Un=1;var e=function(){if(Zn)return Xn;Zn=1;var e=rt(),n=mt();return Xn=function(t){return n(t)&&"[object Arguments]"==e(t)}}(),n=mt(),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 Fn=i}function bt(){if(Gn)return Wn;Gn=1;var e=Array.isArray;return Wn=e}var xt,_t,Et,St,kt,Nt,Ct,Mt,Ot,jt,Pt,It={exports:{}};function At(){return Et||(Et=1,function(e,n){var t=nt(),r=_t?xt:(_t=1,xt=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}(It,It.exports)),It.exports}function zt(){if(kt)return St;kt=1;var e=/^(?:0|[1-9]\d*)$/;return St=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 Tt(){return Ct?Nt:(Ct=1,Nt=function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991})}function Lt(){return Pt?jt:(Pt=1,jt=function(e){return function(n){return e(n)}})}It.exports;var Bt,Dt,Rt,Ht,Vt,Yt,Xt,Zt,Ft,Ut,Wt,Gt,qt,$t,Kt,Qt,Jt,er,nr,tr,rr,or,ir,ar,ur,cr,lr,sr={exports:{}};function dr(){return Bt||(Bt=1,e=sr,n=sr.exports,t=et(),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),sr.exports;var e,n,t,r,o,i,a}function fr(){if(Rt)return Dt;Rt=1;var e=function(){if(Ot)return Mt;Ot=1;var e=rt(),n=Tt(),t=mt(),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=Lt(),t=dr(),r=t&&t.isTypedArray,o=r?n(r):e;return Dt=o}function hr(){if(Vt)return Ht;Vt=1;var e=Hn?Rn:(Hn=1,Rn=function(e,n){for(var t=-1,r=Array(e);++t<e;)r[t]=n(t);return r}),n=wt(),t=bt(),r=At(),o=zt(),i=fr(),a=Object.prototype.hasOwnProperty;return Ht=function(u,c){var l=t(u),s=!l&&n(u),d=!l&&!s&&r(u),f=!l&&!s&&!d&&i(u),h=l||s||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},Ht}function vr(){if(Xt)return Yt;Xt=1;var e=Object.prototype;return Yt=function(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||e)}}function pr(){return Ft||(Ft=1,Zt=function(e,n){return function(t){return e(n(t))}}),Zt}function gr(){if(qt)return Gt;qt=1;var e=vr(),n=function(){if(Wt)return Ut;Wt=1;var e=pr()(Object.keys,Object);return Ut=e}(),t=Object.prototype.hasOwnProperty;return Gt=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 yr(){if(Kt)return $t;Kt=1;var e=it(),n=Tt();return $t=function(t){return null!=t&&n(t.length)&&!e(t)}}function mr(){if(Jt)return Qt;Jt=1;var e=hr(),n=gr(),t=yr();return Qt=function(r){return t(r)?e(r):n(r)}}function wr(){if(ur)return ar;ur=1;var e=hr(),n=function(){if(ir)return or;ir=1;var e=ot(),n=vr(),t=rr?tr:(rr=1,tr=function(e){var n=[];if(null!=e)for(var t in Object(e))n.push(t);return n}),r=Object.prototype.hasOwnProperty;return or=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=yr();return ar=function(r){return t(r)?e(r,!0):n(r)}}sr.exports;var br,xr,_r,Er,Sr,kr,Nr,Cr,Mr,Or,jr,Pr,Ir,Ar,zr,Tr,Lr,Br,Dr,Rr,Hr,Vr,Yr,Xr,Zr,Fr,Ur,Wr,Gr,qr,$r,Kr,Qr,Jr,eo,no,to,ro,oo,io,ao,uo,co,lo,so,fo,ho,vo,po,go,yo,mo,wo,bo,xo,_o,Eo,So,ko,No,Co,Mo,Oo,jo,Po,Io,Ao,zo,To,Lo,Bo,Do,Ro,Ho,Vo,Yo,Xo,Zo,Fo,Uo,Wo,Go,qo,$o,Ko,Qo,Jo,ei,ni,ti,ri,oi,ii,ai,ui,ci,li,si,di,fi,hi,vi,pi,gi,yi,mi,wi,bi,xi,_i,Ei,Si,ki,Ni,Ci,Mi,Oi,ji,Pi,Ii,Ai,zi,Ti,Li,Bi,Di,Ri,Hi,Vi,Yi,Xi,Zi,Fi,Ui,Wi,Gi,qi,$i,Ki,Qi,Ji,ea,na,ta,ra,oa,ia,aa,ua,ca,la,sa,da,fa,ha,va,pa,ga,ya,ma,wa,ba,xa,_a,Ea,Sa,ka,Na,Ca,Ma,Oa,ja,Pa,Ia,Aa,za,Ta,La,Ba,Da,Ra,Ha,Va,Ya,Xa,Za,Fa,Ua,Wa,Ga,qa,$a,Ka,Qa,Ja,eu,nu,tu,ru,ou,iu,au,uu,cu,lu,su,du,fu,hu,vu,pu,gu,yu,mu,wu,bu,xu,_u,Eu,Su,ku,Nu,Cu,Mu,Ou,ju,Pu,Iu,Au,zu,Tu,Lu,Bu,Du,Ru,Hu,Vu,Yu,Xu,Zu,Fu,Uu,Wu,Gu,qu,$u,Ku,Qu,Ju,ec,nc,tc,rc,oc,ic,ac,uc,cc,lc,sc,dc,fc,hc,vc,pc,gc,yc,mc,wc,bc,xc,_c,Ec,Sc,kc,Nc,Cc,Mc,Oc,jc,Pc={exports:{}};function Ic(){return br||(br=1,function(e,n){var t=nt(),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}}(Pc,Pc.exports)),Pc.exports}function Ac(){return _r||(_r=1,xr=function(e,n){var t=-1,r=e.length;for(n||(n=Array(r));++t<r;)n[t]=e[t];return n}),xr}function zc(){return Sr||(Sr=1,Er=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}),Er}function Tc(){return Nr?kr:(Nr=1,kr=function(){return[]})}function Lc(){if(Mr)return Cr;Mr=1;var e=zc(),n=Tc(),t=Object.prototype.propertyIsEnumerable,r=Object.getOwnPropertySymbols;return Cr=r?function(n){return null==n?[]:(n=Object(n),e(r(n),(function(e){return t.call(n,e)})))}:n}function Bc(){return Ir||(Ir=1,Pr=function(e,n){for(var t=-1,r=n.length,o=e.length;++t<r;)e[o+t]=n[t];return e}),Pr}function Dc(){if(zr)return Ar;zr=1;var e=pr()(Object.getPrototypeOf,Object);return Ar=e}function Rc(){if(Lr)return Tr;Lr=1;var e=Bc(),n=Dc(),t=Lc(),r=Tc(),o=Object.getOwnPropertySymbols;return Tr=o?function(r){for(var o=[];r;)e(o,t(r)),r=n(r);return o}:r}function Hc(){if(Hr)return Rr;Hr=1;var e=Bc(),n=bt();return Rr=function(t,r,o){var i=r(t);return n(t)?i:e(i,o(t))}}function Vc(){if(Yr)return Vr;Yr=1;var e=Hc(),n=Lc(),t=mr();return Vr=function(r){return e(r,t,n)}}function Yc(){if($r)return qr;$r=1;var e=ut()(nt(),"Set");return qr=e}function Xc(){if(eo)return Jr;eo=1;var e=function(){if(Ur)return Fr;Ur=1;var e=ut()(nt(),"DataView");return Fr=e}(),n=ct(),t=function(){if(Gr)return Wr;Gr=1;var e=ut()(nt(),"Promise");return Wr=e}(),r=Yc(),o=function(){if(Qr)return Kr;Qr=1;var e=ut()(nt(),"WeakMap");return Kr=e}(),i=rt(),a=at(),u="[object Map]",c="[object Promise]",l="[object Set]",s="[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)!=l||o&&y(new o)!=s)&&(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 l;case g:return s}return n}),Jr=y}function Zc(){if(oo)return ro;oo=1;var e=nt().Uint8Array;return ro=e}function Fc(){if(ao)return io;ao=1;var e=Zc();return io=function(n){var t=new n.constructor(n.byteLength);return new e(t).set(new e(n)),t}}function Uc(){if(po)return vo;po=1;var e=Fc();return vo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.length)}}function Wc(){if(wo)return mo;wo=1;var e=ot(),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 mo=t}function Gc(){if(xo)return bo;xo=1;var e=Wc(),n=Dc(),t=vr();return bo=function(r){return"function"!=typeof r.constructor||t(r)?{}:e(n(r))}}function qc(){if(Po)return jo;Po=1;var e=ft(),n=ht(),t=gt(),r=function(){if(nr)return er;nr=1;var e=yt(),n=mr();return er=function(t,r){return t&&e(r,n(r),t)}}(),o=function(){if(lr)return cr;lr=1;var e=yt(),n=wr();return cr=function(t,r){return t&&e(r,n(r),t)}}(),i=Ic(),a=Ac(),u=function(){if(jr)return Or;jr=1;var e=yt(),n=Lc();return Or=function(t,r){return e(t,n(t),r)}}(),c=function(){if(Dr)return Br;Dr=1;var e=yt(),n=Rc();return Br=function(t,r){return e(t,n(t),r)}}(),l=Vc(),s=function(){if(Zr)return Xr;Zr=1;var e=Hc(),n=Rc(),t=wr();return Xr=function(r){return e(r,t,n)}}(),d=Xc(),f=function(){if(to)return no;to=1;var e=Object.prototype.hasOwnProperty;return no=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},no}(),h=function(){if(yo)return go;yo=1;var e=Fc(),n=function(){if(co)return uo;co=1;var e=Fc();return uo=function(n,t){var r=t?e(n.buffer):n.buffer;return new n.constructor(r,n.byteOffset,n.byteLength)}}(),t=function(){if(so)return lo;so=1;var e=/\w*$/;return lo=function(n){var t=new n.constructor(n.source,e.exec(n));return t.lastIndex=n.lastIndex,t}}(),r=function(){if(ho)return fo;ho=1;var e=tt(),n=e?e.prototype:void 0,t=n?n.valueOf:void 0;return fo=function(e){return t?Object(t.call(e)):{}}}(),o=Uc();return go=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=Gc(),p=bt(),g=At(),y=function(){if(ko)return So;ko=1;var e=function(){if(Eo)return _o;Eo=1;var e=Xc(),n=mt();return _o=function(t){return n(t)&&"[object Map]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isMap,o=r?n(r):e;return So=o}(),m=ot(),w=function(){if(Oo)return Mo;Oo=1;var e=function(){if(Co)return No;Co=1;var e=Xc(),n=mt();return No=function(t){return n(t)&&"[object Set]"==e(t)}}(),n=Lt(),t=dr(),r=t&&t.isSet,o=r?n(r):e;return Mo=o}(),b=mr(),x=wr(),_="[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,jo=function N(C,M,O,j,P,I){var A,z=1&M,T=2&M,L=4&M;if(O&&(A=P?O(C,j,P,I):O(C)),void 0!==A)return A;if(!m(C))return C;var B=p(C);if(B){if(A=f(C),!z)return a(C,A)}else{var D=d(C),R=D==E||"[object GeneratorFunction]"==D;if(g(C))return i(C,z);if(D==S||D==_||R&&!P){if(A=T||R?{}:v(C),!z)return T?c(C,o(A,C)):u(C,r(A,C))}else{if(!k[D])return P?C:{};A=h(C,D,z)}}I||(I=new e);var H=I.get(C);if(H)return H;I.set(C,A),w(C)?C.forEach((function(e){A.add(N(e,M,O,e,C,I))})):y(C)&&C.forEach((function(e,n){A.set(n,N(e,M,O,n,C,I))}));var V=B?void 0:(L?T?s:l:T?x:b)(C);return n(V||C,(function(e,n){V&&(e=C[n=e]),t(A,n,N(e,M,O,n,C,I))})),A},jo}function $c(){if(Ao)return Io;Ao=1;var e=qc();return Io=function(n){return e(n,4)}}function Kc(){return To?zo:(To=1,zo=function(e){return function(){return e}})}function Qc(){if(Ro)return Do;Ro=1;var e=(Bo?Lo:(Bo=1,Lo=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 Do=e}function Jc(){if(Vo)return Ho;Vo=1;var e=Qc(),n=mr();return Ho=function(t,r){return t&&e(t,r,n)}}function el(){if(Fo)return Zo;Fo=1;var e=Jc(),n=function(){if(Xo)return Yo;Xo=1;var e=yr();return Yo=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 nl(){return Wo?Uo:(Wo=1,Uo=function(e){return e})}function tl(){if(qo)return Go;qo=1;var e=nl();return Go=function(n){return"function"==typeof n?n:e}}function rl(){if(Ko)return $o;Ko=1;var e=ht(),n=el(),t=tl(),r=bt();return $o=function(o,i){return(r(o)?e:n)(o,t(i))}}function ol(){return Jo?Qo:(Jo=1,Qo=rl())}function il(){if(ui)return ai;ui=1;var e=dt(),n=ri?ti:(ri=1,ti=function(e){return this.__data__.set(e,"__lodash_hash_undefined__"),this}),t=ii?oi:(ii=1,oi=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,ai=r}function al(){return di?si:(di=1,si=function(e,n){return e.has(n)})}function ul(){if(hi)return fi;hi=1;var e=il(),n=(li||(li=1,ci=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}),ci),t=al();return fi=function(r,o,i,a,u,c){var l=1&i,s=r.length,d=o.length;if(s!=d&&!(l&&d>s))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<s;){var y=r[v],m=o[v];if(a)var w=l?a(m,y,v,o,r,c):a(y,m,v,r,o,c);if(void 0!==w){if(w)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},fi}function cl(){return yi||(yi=1,gi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e){t[++n]=e})),t}),gi}function ll(){if(Ei)return _i;Ei=1;var e=ft(),n=ul(),t=function(){if(wi)return mi;wi=1;var e=tt(),n=Zc(),t=Kn(),r=ul(),o=(pi||(pi=1,vi=function(e){var n=-1,t=Array(e.size);return e.forEach((function(e,r){t[++n]=[r,e]})),t}),vi),i=cl(),a=e?e.prototype:void 0,u=a?a.valueOf:void 0;return mi=function(e,a,c,l,s,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&l;if(h||(h=i),e.size!=a.size&&!v)return!1;var p=f.get(e);if(p)return p==a;l|=2,f.set(e,a);var g=r(h(e),h(a),l,s,d,f);return f.delete(e),g;case"[object Symbol]":if(u)return u.call(e)==u.call(a)}return!1}}(),r=function(){if(xi)return bi;xi=1;var e=Vc(),n=Object.prototype.hasOwnProperty;return bi=function(t,r,o,i,a,u){var c=1&o,l=e(t),s=l.length;if(s!=e(r).length&&!c)return!1;for(var d=s;d--;){var f=l[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<s;){var y=t[f=l[d]],m=r[f];if(i)var w=c?i(m,y,f,r,t,u):i(y,m,f,t,r,u);if(!(void 0===w?y===m||a(y,m,o,i,u):w)){p=!1;break}g||(g="constructor"==f)}if(p&&!g){var b=t.constructor,x=r.constructor;b==x||!("constructor"in t)||!("constructor"in r)||"function"==typeof b&&b instanceof b&&"function"==typeof x&&x instanceof x||(p=!1)}return u.delete(t),u.delete(r),p}}(),o=Xc(),i=bt(),a=At(),u=fr(),c="[object Arguments]",l="[object Array]",s="[object Object]",d=Object.prototype.hasOwnProperty;return _i=function(f,h,v,p,g,y){var m=i(f),w=i(h),b=m?l:o(f),x=w?l:o(h),_=(b=b==c?s:b)==s,E=(x=x==c?s:x)==s,S=b==x;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__"),N=E&&d.call(h,"__wrapped__");if(k||N){var C=k?f.value():f,M=N?h.value():h;return y||(y=new e),g(C,M,v,p,y)}}return!!S&&(y||(y=new e),r(f,h,v,p,g,y))}}function sl(){if(ki)return Si;ki=1;var e=ll(),n=mt();return Si=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))},Si}function dl(){if(Oi)return Mi;Oi=1;var e=ot();return Mi=function(n){return n==n&&!e(n)}}function fl(){return Ai?Ii:(Ai=1,Ii=function(e,n){return function(t){return null!=t&&t[e]===n&&(void 0!==n||e in Object(t))}})}function hl(){if(Bi)return Li;Bi=1;var e=rt(),n=mt();return Li=function(t){return"symbol"==typeof t||n(t)&&"[object Symbol]"==e(t)}}function vl(){if(Ri)return Di;Ri=1;var e=bt(),n=hl(),t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,r=/^\w*$/;return Di=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 pl(){return Wi||(Wi=1,Ui=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}),Ui}function gl(){if(Ki)return $i;Ki=1;var e=function(){if(qi)return Gi;qi=1;var e=tt(),n=pl(),t=bt(),r=hl(),o=e?e.prototype:void 0,i=o?o.toString:void 0;return Gi=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},Gi}();return $i=function(n){return null==n?"":e(n)}}function yl(){if(Ji)return Qi;Ji=1;var e=bt(),n=vl(),t=function(){if(Fi)return Zi;Fi=1;var e=function(){if(Xi)return Yi;Xi=1;var e=function(){if(Vi)return Hi;Vi=1;var e=dt();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,Hi=n}();return Yi=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=gl();return Qi=function(o,i){return e(o)?o:n(o,i)?[o]:t(r(o))}}function ml(){if(na)return ea;na=1;var e=hl();return ea=function(n){if("string"==typeof n||e(n))return n;var t=n+"";return"0"==t&&1/n==-1/0?"-0":t}}function wl(){if(ra)return ta;ra=1;var e=yl(),n=ml();return ta=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 bl(){if(la)return ca;la=1;var e=yl(),n=wt(),t=bt(),r=zt(),o=Tt(),i=ml();return ca=function(a,u,c){for(var l=-1,s=(u=e(u,a)).length,d=!1;++l<s;){var f=i(u[l]);if(!(d=null!=a&&c(a,f)))break;a=a[f]}return d||++l!=s?d:!!(s=null==a?0:a.length)&&o(s)&&r(f,s)&&(t(a)||n(a))}}function xl(){if(da)return sa;da=1;var e=ua?aa:(ua=1,aa=function(e,n){return null!=e&&n in Object(e)}),n=bl();return sa=function(t,r){return null!=t&&n(t,r,e)}}function _l(){return pa?va:(pa=1,va=function(e){return function(n){return null==n?void 0:n[e]}})}function El(){if(xa)return ba;xa=1;var e=function(){if(Ti)return zi;Ti=1;var e=function(){if(Ci)return Ni;Ci=1;var e=ft(),n=sl();return Ni=function(t,r,o,i){var a=o.length,u=a,c=!i;if(null==t)return!u;for(t=Object(t);a--;){var l=o[a];if(c&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++a<u;){var s=(l=o[a])[0],d=t[s],f=l[1];if(c&&l[2]){if(void 0===d&&!(s in t))return!1}else{var h=new e;if(i)var v=i(d,f,s,t,r,h);if(!(void 0===v?n(f,d,3,i,h):v))return!1}}return!0}}(),n=function(){if(Pi)return ji;Pi=1;var e=dl(),n=mr();return ji=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=fl();return zi=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(ha)return fa;ha=1;var e=sl(),n=function(){if(ia)return oa;ia=1;var e=wl();return oa=function(n,t,r){var o=null==n?void 0:e(n,t);return void 0===o?r:o}}(),t=xl(),r=vl(),o=dl(),i=fl(),a=ml();return fa=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=nl(),r=bt(),o=function(){if(wa)return ma;wa=1;var e=_l(),n=function(){if(ya)return ga;ya=1;var e=wl();return ga=function(n){return function(t){return e(t,n)}}}(),t=vl(),r=ml();return ma=function(o){return t(o)?e(r(o)):n(o)}}();return ba=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 Sl(){if(Ea)return _a;Ea=1;var e=zc(),n=function(){if(ni)return ei;ni=1;var e=el();return ei=function(n,t){var r=[];return e(n,(function(e,n,o){t(e,n,o)&&r.push(e)})),r}}(),t=El(),r=bt();return _a=function(o,i){return(r(o)?e:n)(o,t(i,3))}}function kl(){if(Ca)return Na;Ca=1;var e=function(){if(ka)return Sa;ka=1;var e=Object.prototype.hasOwnProperty;return Sa=function(n,t){return null!=n&&e.call(n,t)}}(),n=bl();return Na=function(t,r){return null!=t&&n(t,r,e)}}function Nl(){if(Oa)return Ma;Oa=1;var e=gr(),n=Xc(),t=wt(),r=bt(),o=yr(),i=At(),a=vr(),u=fr(),c=Object.prototype.hasOwnProperty;return Ma=function(l){if(null==l)return!0;if(o(l)&&(r(l)||"string"==typeof l||"function"==typeof l.splice||i(l)||u(l)||t(l)))return!l.length;var s=n(l);if("[object Map]"==s||"[object Set]"==s)return!l.size;if(a(l))return!e(l).length;for(var d in l)if(c.call(l,d))return!1;return!0}}function Cl(){return Pa?ja:(Pa=1,ja=function(e){return void 0===e})}function Ml(){if(Aa)return Ia;Aa=1;var e=el(),n=yr();return Ia=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 Ol(){if(Ta)return za;Ta=1;var e=pl(),n=El(),t=Ml(),r=bt();return za=function(o,i){return(r(o)?e:t)(o,n(i,3))}}function jl(){if(Va)return Ha;Va=1;var e=(Ba||(Ba=1,La=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}),La),n=el(),t=El(),r=Ra?Da:(Ra=1,Da=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=bt();return Ha=function(i,a,u){var c=o(i)?e:r,l=arguments.length<3;return c(i,t(a,4),u,l,n)},Ha}function Pl(){if(Ja)return Qa;Ja=1;var e=gr(),n=Xc(),t=yr(),r=function(){if(Xa)return Ya;Xa=1;var e=rt(),n=bt(),t=mt();return Ya=function(r){return"string"==typeof r||!n(r)&&t(r)&&"[object String]"==e(r)}}(),o=function(){if(Ka)return $a;Ka=1;var e=function(){if(Fa)return Za;Fa=1;var e=_l()("length");return Za=e}(),n=function(){if(Wa)return Ua;Wa=1;var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");return Ua=function(n){return e.test(n)}}(),t=function(){if(qa)return Ga;qa=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]?",l=c+u+"(?:\\u200d(?:"+[o,i,a].join("|")+")"+c+u+")*",s="(?:"+[o+t+"?",t,i,a,n].join("|")+")",d=RegExp(r+"(?="+r+")|"+s+l,"g");return Ga=function(e){for(var n=d.lastIndex=0;d.test(e);)++n;return n}}();return $a=function(r){return n(r)?t(r):e(r)}}();return Qa=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 Il(){if(nu)return eu;nu=1;var e=ht(),n=Wc(),t=Jc(),r=El(),o=Dc(),i=bt(),a=At(),u=it(),c=ot(),l=fr();return eu=function(s,d,f){var h=i(s),v=h||a(s)||l(s);if(d=r(d,4),null==f){var p=s&&s.constructor;f=v?h?new p:[]:c(s)&&u(p)?n(o(s)):{}}return(v?e:t)(s,(function(e,n,t){return d(f,e,n,t)})),f}}function Al(){if(iu)return ou;iu=1;var e=Bc(),n=function(){if(ru)return tu;ru=1;var e=tt(),n=wt(),t=bt(),r=e?e.isConcatSpreadable:void 0;return tu=function(e){return t(e)||n(e)||!!(r&&e&&e[r])}}();return ou=function t(r,o,i,a,u){var c=-1,l=r.length;for(i||(i=n),u||(u=[]);++c<l;){var s=r[c];o>0&&i(s)?o>1?t(s,o-1,i,a,u):e(u,s):a||(u[u.length]=s)}return u},ou}function zl(){if(lu)return cu;lu=1;var e=uu?au:(uu=1,au=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 cu=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 l=Array(r+1);++a<r;)l[a]=i[a];return l[r]=o(c),e(t,this,l)}},cu}function Tl(){if(pu)return vu;pu=1;var e=function(){if(du)return su;du=1;var e=Kc(),n=vt(),t=nl();return su=n?function(t,r){return n(t,"toString",{configurable:!0,enumerable:!1,value:e(r),writable:!0})}:t}(),n=function(){if(hu)return fu;hu=1;var e=Date.now;return fu=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)}},fu}(),t=n(e);return vu=t}function Ll(){if(yu)return gu;yu=1;var e=nl(),n=zl(),t=Tl();return gu=function(r,o){return t(n(r,o,e),r+"")},gu}function Bl(){return wu||(wu=1,mu=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}),mu}function Dl(){if(Tu)return zu;Tu=1;var e=il(),n=function(){if(Cu)return Nu;Cu=1;var e=function(){if(ku)return Su;ku=1;var e=Bl(),n=xu?bu:(xu=1,bu=function(e){return e!=e}),t=(Eu||(Eu=1,_u=function(e,n,t){for(var r=t-1,o=e.length;++r<o;)if(e[r]===n)return r;return-1}),_u);return Su=function(r,o,i){return o==o?t(r,o,i):e(r,n,i)},Su}();return Nu=function(n,t){return!(null==n||!n.length)&&e(n,t,0)>-1},Nu}(),t=(Ou||(Ou=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=al(),o=function(){if(Au)return Iu;Au=1;var e=Yc(),n=Pu?ju:(Pu=1,ju=function(){}),t=cl(),r=e&&1/t(new e([,-0]))[1]==1/0?function(n){return new e(n)}:n;return Iu=r}(),i=cl();return zu=function(a,u,c){var l=-1,s=n,d=a.length,f=!0,h=[],v=h;if(c)f=!1,s=t;else if(d>=200){var p=u?null:o(a);if(p)return i(p);f=!1,s=r,v=new e}else v=u?[]:h;e:for(;++l<d;){var g=a[l],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 s(v,y,c)||(v!==h&&v.push(y),h.push(g))}return h},zu}function Rl(){if(Bu)return Lu;Bu=1;var e=yr(),n=mt();return Lu=function(t){return n(t)&&e(t)}}function Hl(){if(Ru)return Du;Ru=1;var e=Al(),n=Ll(),t=Dl(),r=Rl(),o=n((function(n){return t(e(n,1,r,!0))}));return Du=o}function Vl(){if(Xu)return Yu;Xu=1;var e=function(){if(Vu)return Hu;Vu=1;var e=pl();return Hu=function(n,t){return e(t,(function(e){return n[e]}))}}(),n=mr();return Yu=function(t){return null==t?[]:e(t,n(t))}}function Yl(){if(Fu)return Zu;var e;Fu=1;try{e={clone:$c(),constant:Kc(),each:ol(),filter:Sl(),has:kl(),isArray:bt(),isEmpty:Nl(),isFunction:it(),isUndefined:Cl(),keys:mr(),map:Ol(),reduce:jl(),size:Pl(),transform:Il(),union:Hl(),values:Vl()}}catch(e){}return e||(e=window._),Zu=e}function Xl(){if(Wu)return Uu;Wu=1;var e=Yl();Uu=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 l=u;u=c,c=l}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 l=u(this._isDirected,n,t,r);if(e.has(this._edgeLabels,l))return a&&(this._edgeLabels[l]=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[l]=a?o:this._defaultEdgeLabelFn(n,t,r);var s=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=s.v,t=s.w,Object.freeze(s),this._edgeObjs[l]=s,i(this._preds[t],n),i(this._sucs[n],t),this._in[t][l]=s,this._out[n][l]=s,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))},Uu}function Zl(){if(Ju)return Qu;Ju=1;var e=Yl(),n=Xl();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 Qu={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 Fl(){if(nc)return ec;nc=1;var e=Yl();return ec=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},ec}function Ul(){if(rc)return tc;rc=1;var e=Yl();function n(){this._arr=[],this._keyIndices={}}return tc=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},tc}function Wl(){if(ic)return oc;ic=1;var e=Yl(),n=Ul();oc=function(e,r,o,i){return function(e,t,r,o){var i,a,u={},c=new n,l=function(e){var n=e.v!==i?e.v:e.w,t=u[n],o=r(e),l=a.distance+o;if(o<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+o);l<t.distance&&(t.distance=l,t.predecessor=i,c.decrease(n,l))};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(l);return u}(e,String(r),o||t,i||function(n){return e.outEdges(n)})};var t=e.constant(1);return oc}function Gl(){if(uc)return ac;uc=1;var e=Wl(),n=Yl();return ac=function(t,r,o){return n.transform(t.nodes(),(function(n,i){n[i]=e(t,i,r,o)}),{})}}function ql(){if(lc)return cc;lc=1;var e=Yl();return cc=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 l,s=[];do{l=r.pop(),o[l].onStack=!1,s.push(l)}while(u!==l);i.push(s)}}return n.nodes().forEach((function(n){e.has(o,n)||a(n)})),i},cc}function $l(){if(dc)return sc;dc=1;var e=Yl(),n=ql();return sc=function(t){return e.filter(n(t),(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])}))}}function Kl(){if(hc)return fc;hc=1;var e=Yl();fc=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 fc}function Ql(){if(pc)return vc;pc=1;var e=Yl();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 vc=n,n.CycleException=t,t.prototype=new Error,vc}function Jl(){if(yc)return gc;yc=1;var e=Ql();return gc=function(n){try{e(n)}catch(n){if(n instanceof e.CycleException)return!1;throw n}return!0}}function es(){if(wc)return mc;wc=1;var e=Yl();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 mc=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},mc}function ns(){if(xc)return bc;xc=1;var e=es();return bc=function(n,t){return e(n,t,"post")}}function ts(){if(Ec)return _c;Ec=1;var e=es();return _c=function(n,t){return e(n,t,"pre")}}function rs(){if(kc)return Sc;kc=1;var e=Yl(),n=Xl(),t=Ul();return Sc=function(r,o){var i,a=new n,u={},c=new t;function l(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 s=!1;c.size()>0;){if(i=c.removeMin(),e.has(u,i))a.setEdge(i,u[i]);else{if(s)throw new Error("Input graph is not connected: "+r);s=!0}r.nodeEdges(i).forEach(l)}return a},Sc}Pc.exports;try{jc=function(){if(Oc)return Mc;Oc=1;var e=Ku?$u:(Ku=1,$u={Graph:Xl(),version:qu?Gu:(qu=1,Gu="2.1.8")});return Mc={Graph:e.Graph,json:Zl(),alg:Cc?Nc:(Cc=1,Nc={components:Fl(),dijkstra:Wl(),dijkstraAll:Gl(),findCycles:$l(),floydWarshall:Kl(),isAcyclic:Jl(),postorder:ns(),preorder:ts(),prim:rs(),tarjan:ql(),topsort:Ql()}),version:e.version}}()}catch(Z){}jc||(jc=window.graphlib);var os,is,as,us,cs,ls,ss,ds,fs,hs,vs,ps,gs,ys,ms,ws,bs,xs,_s,Es,Ss,ks,Ns,Cs,Ms,Os,js,Ps,Is,As,zs,Ts,Ls,Bs,Ds,Rs,Hs,Vs,Ys,Xs,Zs,Fs,Us,Ws,Gs,qs,$s,Ks,Qs,Js,ed,nd,td,rd,od,id,ad,ud,cd,ld,sd,dd,fd,hd,vd,pd,gd,yd,md,wd,bd,xd,_d,Ed,Sd,kd,Nd,Cd,Md,Od,jd,Pd,Id,Ad,zd,Td,Ld,Bd,Dd,Rd,Hd,Vd,Yd,Xd=jc;function Zd(){if(us)return as;us=1;var e=Kn(),n=yr(),t=zt(),r=ot();return as=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 Fd(){if(ws)return ms;ws=1;var e=function(){if(ys)return gs;ys=1;var e=function(){if(ps)return vs;ps=1;var e=function(){if(hs)return fs;hs=1;var e=/\s/;return fs=function(n){for(var t=n.length;t--&&e.test(n.charAt(t)););return t}}(),n=/^\s+/;return vs=function(t){return t?t.slice(0,e(t)+1).replace(n,""):t}}(),n=ot(),t=hl(),r=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;return gs=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 l=o.test(u);return l||i.test(u)?a(u.slice(2),l?2:8):r.test(u)?NaN:+u}}(),n=1/0;return ms=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 Ud(){if(Cs)return Ns;Cs=1;var e=Al();return Ns=function(n){return null!=n&&n.length?e(n,1):[]}}function Wd(){if(Ts)return zs;Ts=1;var e=hl();return zs=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,l=a}return l},zs}function Gd(){if(Vs)return Hs;Vs=1;var e=pt(),n=Kn();return Hs=function(t,r,o){(void 0!==o&&!n(t[r],o)||void 0===o&&!(r in t))&&e(t,r,o)}}function qd(){return Fs?Zs:(Fs=1,Zs=function(e,n){if(("constructor"!==n||"function"!=typeof e[n])&&"__proto__"!=n)return e[n]})}function $d(){return rd?td:(rd=1,td=function(e,n){return e<n})}function Kd(){if(Ad)return Id;Ad=1;var e=pl(),n=wl(),t=El(),r=Ml(),o=(Cd||(Cd=1,Nd=function(e,n){var t=e.length;for(e.sort(n);t--;)e[t]=e[t].value;return e}),Nd),i=Lt(),a=function(){if(Pd)return jd;Pd=1;var e=function(){if(Od)return Md;Od=1;var e=hl();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,l=t==t,s=e(t);if(!c&&!s&&!a&&n>t||a&&u&&l&&!c&&!s||o&&u&&l||!r&&l||!i)return 1;if(!o&&!a&&!s&&n<t||s&&r&&i&&!o&&!a||c&&r&&i||!u&&i||!l)return-1}return 0}}();return jd=function(n,t,r){for(var o=-1,i=n.criteria,a=t.criteria,u=i.length,c=r.length;++o<u;){var l=e(i[o],a[o]);if(l)return o>=c?l:l*("desc"==r[o]?-1:1)}return n.index-t.index}}(),u=nl(),c=bt();return Id=function(l,s,d){s=s.length?e(s,(function(e){return c(e)?function(t){return n(t,1===e.length?e[0]:e)}:e})):[u];var f=-1;s=e(s,i(t));var h=r(l,(function(n,t,r){return{criteria:e(s,(function(e){return e(n)})),index:++f,value:n}}));return o(h,(function(e,n){return a(e,n,d)}))}}try{Yd={cloneDeep:function(){if(is)return os;is=1;var e=qc();return os=function(n){return e(n,5)}}(),constant:Kc(),defaults:function(){if(ls)return cs;ls=1;var e=Ll(),n=Kn(),t=Zd(),r=wr(),o=Object.prototype,i=o.hasOwnProperty,a=e((function(e,a){e=Object(e);var u=-1,c=a.length,l=c>2?a[2]:void 0;for(l&&t(a[0],a[1],l)&&(c=1);++u<c;)for(var s=a[u],d=r(s),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]=s[v])}return e}));return cs=a}(),each:ol(),filter:Sl(),find:function(){if(ks)return Ss;ks=1;var e=function(){if(ds)return ss;ds=1;var e=El(),n=yr(),t=mr();return ss=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 l=r(o,i,a);return l>-1?u[c?o[l]:l]:void 0}}}(),n=e(function(){if(Es)return _s;Es=1;var e=Bl(),n=El(),t=function(){if(xs)return bs;xs=1;var e=Fd();return bs=function(n){var t=e(n),r=t%1;return t==t?r?t-r:t:0}}(),r=Math.max;return _s=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)},_s}());return Ss=n}(),flatten:Ud(),forEach:rl(),forIn:function(){if(Os)return Ms;Os=1;var e=Qc(),n=tl(),t=wr();return Ms=function(r,o){return null==r?r:e(r,n(o),t)}}(),has:kl(),isUndefined:Cl(),last:(Ps||(Ps=1,js=function(e){var n=null==e?0:e.length;return n?e[n-1]:void 0}),js),map:Ol(),mapValues:function(){if(As)return Is;As=1;var e=pt(),n=Jc(),t=El();return Is=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(Rs)return Ds;Rs=1;var e=Wd(),n=Bs?Ls:(Bs=1,Ls=function(e,n){return e>n}),t=nl();return Ds=function(r){return r&&r.length?e(r,t,n):void 0},Ds}(),merge:function(){if(nd)return ed;nd=1;var e=function(){if(Ks)return $s;Ks=1;var e=ft(),n=Gd(),t=Qc(),r=function(){if(qs)return Gs;qs=1;var e=Gd(),n=Ic(),t=Uc(),r=Ac(),o=Gc(),i=wt(),a=bt(),u=Rl(),c=At(),l=it(),s=ot(),d=function(){if(Xs)return Ys;Xs=1;var e=rt(),n=Dc(),t=mt(),r=Function.prototype,o=Object.prototype,i=r.toString,a=o.hasOwnProperty,u=i.call(Object);return Ys=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=fr(),h=qd(),v=function(){if(Ws)return Us;Ws=1;var e=yt(),n=wr();return Us=function(t){return e(t,n(t))}}();return Gs=function(p,g,y,m,w,b,x){var _=h(p,y),E=h(g,y),S=x.get(E);if(S)e(p,y,S);else{var k=b?b(_,E,y+"",p,g,x):void 0,N=void 0===k;if(N){var C=a(E),M=!C&&c(E),O=!C&&!M&&f(E);k=E,C||M||O?a(_)?k=_:u(_)?k=r(_):M?(N=!1,k=n(E,!0)):O?(N=!1,k=t(E,!0)):k=[]:d(E)||i(E)?(k=_,i(_)?k=v(_):s(_)&&!l(_)||(k=o(E))):N=!1}N&&(x.set(E,k),w(k,E,m,b,x),x.delete(E)),e(p,y,k)}}}(),o=ot(),i=wr(),a=qd();return $s=function u(c,l,s,d,f){c!==l&&t(l,(function(t,i){if(f||(f=new e),o(t))r(c,l,i,s,u,d,f);else{var h=d?d(a(c,i),t,i+"",c,l,f):void 0;void 0===h&&(h=t),n(c,i,h)}}),i)},$s}(),n=function(){if(Js)return Qs;Js=1;var e=Ll(),n=Zd();return Qs=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 ed=n}(),min:function(){if(id)return od;id=1;var e=Wd(),n=$d(),t=nl();return od=function(r){return r&&r.length?e(r,t,n):void 0},od}(),minBy:function(){if(ud)return ad;ud=1;var e=Wd(),n=El(),t=$d();return ad=function(r,o){return r&&r.length?e(r,n(o,2),t):void 0},ad}(),now:function(){if(ld)return cd;ld=1;var e=nt();return cd=function(){return e.Date.now()}}(),pick:function(){if(wd)return md;wd=1;var e=function(){if(pd)return vd;pd=1;var e=function(){if(hd)return fd;hd=1;var e=wl(),n=function(){if(dd)return sd;dd=1;var e=gt(),n=yl(),t=zt(),r=ot(),o=ml();return sd=function(i,a,u,c){if(!r(i))return i;for(var l=-1,s=(a=n(a,i)).length,d=s-1,f=i;null!=f&&++l<s;){var h=o(a[l]),v=u;if("__proto__"===h||"constructor"===h||"prototype"===h)return i;if(l!=d){var p=f[h];void 0===(v=c?c(p,h,f):void 0)&&(v=r(p)?p:t(a[l+1])?[]:{})}e(f,h,v),f=f[h]}return i}}(),t=yl();return fd=function(r,o,i){for(var a=-1,u=o.length,c={};++a<u;){var l=o[a],s=e(r,l);i(s,l)&&n(c,t(l,r),s)}return c}}(),n=xl();return vd=function(t,r){return e(t,r,(function(e,r){return n(t,r)}))}}(),n=function(){if(yd)return gd;yd=1;var e=Ud(),n=zl(),t=Tl();return gd=function(r){return t(n(r,void 0,e),r+"")}}(),t=n((function(n,t){return null==n?{}:e(n,t)}));return md=t}(),range:function(){if(kd)return Sd;kd=1;var e=function(){if(Ed)return _d;Ed=1;var e=function(){if(xd)return bd;xd=1;var e=Math.ceil,n=Math.max;return bd=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},bd}(),n=Zd(),t=Fd();return _d=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)}},_d}()();return Sd=e}(),reduce:jl(),sortBy:function(){if(Td)return zd;Td=1;var e=Al(),n=Kd(),t=Ll(),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 zd=o}(),uniqueId:function(){if(Bd)return Ld;Bd=1;var e=gl(),n=0;return Ld=function(t){var r=++n;return e(t)+r},Ld}(),values:Vl(),zipObject:function(){if(Vd)return Hd;Vd=1;var e=gt(),n=(Rd||(Rd=1,Dd=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}),Dd);return Hd=function(t,r){return n(t||[],r||[],e)},Hd}()}}catch(Z){}Yd||(Yd=window._);var Qd=Yd,Jd=ef;function ef(){var e={};e._next=e._prev=e,this._sentinel=e}function nf(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function tf(e,n){if("_next"!==e&&"_prev"!==e)return n}ef.prototype.dequeue=function(){var e=this._sentinel,n=e._prev;if(n!==e)return nf(n),n},ef.prototype.enqueue=function(e){var n=this._sentinel;e._prev&&e._next&&nf(e),e._next=n._next,n._next._prev=e,n._next=e,e._prev=n},ef.prototype.toString=function(){for(var e=[],n=this._sentinel,t=n._prev;t!==n;)e.push(JSON.stringify(t,tf)),t=t._prev;return"["+e.join(", ")+"]"};var rf=Qd,of=Xd.Graph,af=Jd,uf=rf.constant(1);function cf(e,n,t,r,o){var i=o?[]:void 0;return rf.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,lf(n,t,u)})),rf.forEach(e.outEdges(r.v),(function(r){var o=e.edge(r),i=r.w,a=e.node(i);a.in-=o,lf(n,t,a)})),e.removeNode(r.v),i}function lf(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 sf=Qd,df=function(e,n){if(e.nodeCount()<=1)return[];var t=function(e,n){var t=new of,r=0,o=0;rf.forEach(e.nodes(),(function(e){t.setNode(e,{v:e,in:0,out:0})})),rf.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=rf.range(o+r+3).map((function(){return new af})),a=r+1;return rf.forEach(t.nodes(),(function(e){lf(i,a,t.node(e))})),{graph:t,buckets:i,zeroIdx:a}}(e,n||uf),r=function(e,n,t){for(var r,o=[],i=n[n.length-1],a=n[0];e.nodeCount();){for(;r=a.dequeue();)cf(e,n,t,r);for(;r=i.dequeue();)cf(e,n,t,r);if(e.nodeCount())for(var u=n.length-2;u>0;--u)if(r=n[u].dequeue()){o=o.concat(cf(e,n,t,r,!0));break}}return o}(t.graph,t.buckets,t.zeroIdx);return rf.flatten(rf.map(r,(function(n){return e.outEdges(n.v,n.w)})),!0)},ff={run:function(e){var n="greedy"===e.graph().acyclicer?df(e,function(e){return function(n){return e.edge(n).weight}}(e)):function(e){var n=[],t={},r={};return sf.forEach(e.nodes(),(function o(i){sf.has(r,i)||(r[i]=!0,t[i]=!0,sf.forEach(e.outEdges(i),(function(e){sf.has(t,e.w)?n.push(e):o(e.w)})),delete t[i])})),n}(e);sf.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,sf.uniqueId("rev"))}))},undo:function(e){sf.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)}}))}},hf=Qd,vf=Xd.Graph,pf={addDummyNode:gf,simplify:function(e){var n=(new vf).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){n.setNode(t,e.node(t))})),hf.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 vf({multigraph:e.isMultigraph()}).setGraph(e.graph());return hf.forEach(e.nodes(),(function(t){e.children(t).length||n.setNode(t,e.node(t))})),hf.forEach(e.edges(),(function(t){n.setEdge(t,e.edge(t))})),n},successorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.outEdges(n),(function(n){t[n.w]=(t[n.w]||0)+e.edge(n).weight})),t}));return hf.zipObject(e.nodes(),n)},predecessorWeights:function(e){var n=hf.map(e.nodes(),(function(n){var t={};return hf.forEach(e.inEdges(n),(function(n){t[n.v]=(t[n.v]||0)+e.edge(n).weight})),t}));return hf.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,l=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)*l?(u<0&&(l=-l),t=l*a/u,r=l):(a<0&&(c=-c),t=c,r=c*u/a),{x:o+t,y:i+r}},buildLayerMatrix:function(e){var n=hf.map(hf.range(yf(e)+1),(function(){return[]}));return hf.forEach(e.nodes(),(function(t){var r=e.node(t),o=r.rank;hf.isUndefined(o)||(n[o][r.order]=t)})),n},normalizeRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank})));hf.forEach(e.nodes(),(function(t){var r=e.node(t);hf.has(r,"rank")&&(r.rank-=n)}))},removeEmptyRanks:function(e){var n=hf.min(hf.map(e.nodes(),(function(n){return e.node(n).rank}))),t=[];hf.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;hf.forEach(t,(function(n,t){hf.isUndefined(n)&&t%o!=0?--r:r&&hf.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),gf(e,"border",o,n)},maxRank:yf,partition:function(e,n){var t={lhs:[],rhs:[]};return hf.forEach(e,(function(e){n(e)?t.lhs.push(e):t.rhs.push(e)})),t},time:function(e,n){var t=hf.now();try{return n()}finally{console.log(e+" time: "+(hf.now()-t)+"ms")}},notime:function(e,n){return n()}};function gf(e,n,t,r){var o;do{o=hf.uniqueId(r)}while(e.hasNode(o));return t.dummy=n,e.setNode(o,t),o}function yf(e){return hf.max(hf.map(e.nodes(),(function(n){var t=e.node(n).rank;if(!hf.isUndefined(t))return t})))}var mf=Qd,wf=pf,bf={run:function(e){e.graph().dummyChains=[],mf.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,l=n.name,s=e.edge(n),d=s.labelRank;if(c!==a+1){for(e.removeEdge(n),o=0,++a;a<c;++o,++a)s.points=[],r={width:0,height:0,edgeLabel:s,edgeObj:n,rank:a},t=wf.addDummyNode(e,"edge",r,"_d"),a===d&&(r.width=s.width,r.height=s.height,r.dummy="edge-label",r.labelpos=s.labelpos),e.setEdge(i,t,{weight:s.weight},l),0===o&&e.graph().dummyChains.push(t),i=t;e.setEdge(i,u,{weight:s.weight},l)}}(e,n)}))},undo:function(e){mf.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)}))}},xf=Qd,_f=function(e){var n={};xf.forEach(e.sources(),(function t(r){var o=e.node(r);if(xf.has(n,r))return o.rank;n[r]=!0;var i=xf.min(xf.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}))},Ef=function(e,n){return e.node(n.w).rank-e.node(n.v).rank-e.edge(n).minlen},Sf=Qd,kf=Xd.Graph,Nf=Ef,Cf=function(e){var n,t,r=new kf({directed:!1}),o=e.nodes()[0],i=e.nodeCount();for(r.setNode(o,{});Mf(r,e)<i;)n=Of(r,e),t=r.hasNode(n.v)?Nf(e,n):-Nf(e,n),jf(r,e,t);return r};function Mf(e,n){return Sf.forEach(e.nodes(),(function t(r){Sf.forEach(n.nodeEdges(r),(function(o){var i=o.v,a=r===i?o.w:i;e.hasNode(a)||Nf(n,o)||(e.setNode(a,{}),e.setEdge(r,a,{}),t(a))}))})),e.nodeCount()}function Of(e,n){return Sf.minBy(n.edges(),(function(t){if(e.hasNode(t.v)!==e.hasNode(t.w))return Nf(n,t)}))}function jf(e,n,t){Sf.forEach(e.nodes(),(function(e){n.node(e).rank+=t}))}var Pf=Qd,If=Cf,Af=Ef,zf=_f,Tf=Xd.alg.preorder,Lf=Xd.alg.postorder,Bf=pf.simplify,Df=Rf;function Rf(e){e=Bf(e),zf(e);var n,t=If(e);for(Yf(t),Hf(t,e);n=Zf(t);)Uf(t,e,n,Ff(t,e,n))}function Hf(e,n){var t=Lf(e,e.nodes());t=t.slice(0,t.length-1),Pf.forEach(t,(function(t){!function(e,n,t){var r=e.node(t).parent;e.edge(t,r).cutvalue=Vf(e,n,t)}(e,n,t)}))}function Vf(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,Pf.forEach(n.nodeEdges(t),(function(i){var u,c,l=i.v===t,s=l?i.w:i.v;if(s!==r){var d=l===o,f=n.edge(i).weight;if(a+=d?f:-f,u=t,c=s,e.hasEdge(u,c)){var h=e.edge(t,s).cutvalue;a+=d?-h:h}}})),a}function Yf(e,n){arguments.length<2&&(n=e.nodes()[0]),Xf(e,{},1,n)}function Xf(e,n,t,r,o){var i=t,a=e.node(r);return n[r]=!0,Pf.forEach(e.neighbors(r),(function(o){Pf.has(n,o)||(t=Xf(e,n,t,o,r))})),a.low=i,a.lim=t++,o?a.parent=o:delete a.parent,t}function Zf(e){return Pf.find(e.edges(),(function(n){return e.edge(n).cutvalue<0}))}function Ff(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 l=Pf.filter(n.edges(),(function(n){return c===Wf(e,e.node(n.v),u)&&c!==Wf(e,e.node(n.w),u)}));return Pf.minBy(l,(function(e){return Af(n,e)}))}function Uf(e,n,t,r){var o=t.v,i=t.w;e.removeEdge(o,i),e.setEdge(r.v,r.w,{}),Yf(e),Hf(e,n),function(e,n){var t=Pf.find(e.nodes(),(function(e){return!n.node(e).parent})),r=Tf(e,t);r=r.slice(1),Pf.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 Wf(e,n,t){return t.low<=n.lim&&n.lim<=t.lim}Rf.initLowLimValues=Yf,Rf.initCutValues=Hf,Rf.calcCutValue=Vf,Rf.leaveEdge=Zf,Rf.enterEdge=Ff,Rf.exchangeEdges=Uf;var Gf=_f,qf=Cf,$f=Df,Kf=Gf;var Qf=Qd,Jf=Qd,eh=pf,nh={run:function(e){var n=eh.addDummyNode(e,"root",{},"_root"),t=function(e){var n={};function t(r,o){var i=e.children(r);i&&i.length&&Jf.forEach(i,(function(e){t(e,o+1)})),n[r]=o}return Jf.forEach(e.children(),(function(e){t(e,1)})),n}(e),r=Jf.max(Jf.values(t))-1,o=2*r+1;e.graph().nestingRoot=n,Jf.forEach(e.edges(),(function(n){e.edge(n).minlen*=o}));var i=function(e){return Jf.reduce(e.edges(),(function(n,t){return n+e.edge(t).weight}),0)}(e)+1;Jf.forEach(e.children(),(function(a){th(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,Jf.forEach(e.edges(),(function(n){e.edge(n).nestingEdge&&e.removeEdge(n)}))}};function th(e,n,t,r,o,i,a){var u=e.children(a);if(u.length){var c=eh.addBorderNode(e,"_bt"),l=eh.addBorderNode(e,"_bb"),s=e.node(a);e.setParent(c,a),s.borderTop=c,e.setParent(l,a),s.borderBottom=l,Jf.forEach(u,(function(u){th(e,n,t,r,o,i,u);var s=e.node(u),d=s.borderTop?s.borderTop:u,f=s.borderBottom?s.borderBottom:u,h=s.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,l,{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 rh=Qd,oh=pf;function ih(e,n,t,r,o,i){var a={width:0,height:0,rank:i,borderType:n},u=o[n][i-1],c=oh.addDummyNode(e,"border",a,t);o[n][i]=c,e.setParent(c,r),u&&e.setEdge(u,c,{weight:1})}var ah=Qd,uh={adjust:function(e){var n=e.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||ch(e)},undo:function(e){var n=e.graph().rankdir.toLowerCase();"bt"!==n&&"rl"!==n||function(e){ah.forEach(e.nodes(),(function(n){sh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,sh),ah.has(t,"y")&&sh(t)}))}(e),"lr"!==n&&"rl"!==n||(function(e){ah.forEach(e.nodes(),(function(n){dh(e.node(n))})),ah.forEach(e.edges(),(function(n){var t=e.edge(n);ah.forEach(t.points,dh),ah.has(t,"x")&&dh(t)}))}(e),ch(e))}};function ch(e){ah.forEach(e.nodes(),(function(n){lh(e.node(n))})),ah.forEach(e.edges(),(function(n){lh(e.edge(n))}))}function lh(e){var n=e.width;e.width=e.height,e.height=n}function sh(e){e.y=-e.y}function dh(e){var n=e.x;e.x=e.y,e.y=n}var fh=Qd,hh=Qd;function vh(e,n,t){for(var r=hh.zipObject(t,hh.map(t,(function(e,n){return n}))),o=hh.flatten(hh.map(n,(function(n){return hh.sortBy(hh.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=hh.map(new Array(a),(function(){return 0})),c=0;return hh.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 ph=Qd,gh=Qd,yh=Qd,mh=pf;function wh(e,n,t){for(var r;n.length&&(r=yh.last(n)).i<=t;)n.pop(),e.push(r.vs),t++;return t}var bh=Qd,xh=Qd,_h=Xd.Graph,Eh=Qd,Sh=Qd,kh=function(e){var n={},t=fh.filter(e.nodes(),(function(n){return!e.children(n).length})),r=fh.max(fh.map(t,(function(n){return e.node(n).rank}))),o=fh.map(fh.range(r+1),(function(){return[]}));var i=fh.sortBy(t,(function(n){return e.node(n).rank}));return fh.forEach(i,(function t(r){if(!fh.has(n,r)){n[r]=!0;var i=e.node(r);o[i.rank].push(r),fh.forEach(e.successors(r),t)}})),o},Nh=function(e,n){for(var t=0,r=1;r<n.length;++r)t+=vh(e,n[r-1],n[r]);return t},Ch=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,l={};u&&(i=bh.filter(i,(function(e){return e!==u&&e!==c})));var s=function(e,n){return ph.map(n,(function(n){var t=e.inEdges(n);if(t.length){var r=ph.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);bh.forEach(s,(function(t){if(n.children(t.v).length){var i=e(n,t.v,r,o);l[t.v]=i,bh.has(i,"barycenter")&&(a=t,u=i,bh.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 gh.forEach(e,(function(e,n){var r=t[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:n};gh.isUndefined(e.barycenter)||(r.barycenter=e.barycenter,r.weight=e.weight)})),gh.forEach(n.edges(),(function(e){var n=t[e.v],r=t[e.w];gh.isUndefined(n)||gh.isUndefined(r)||(r.indegree++,n.out.push(t[e.w]))})),function(e){var n=[];function t(e){return function(n){n.merged||(gh.isUndefined(n.barycenter)||gh.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),gh.forEach(o.in.reverse(),t(o)),gh.forEach(o.out,r(o))}return gh.map(gh.filter(n,(function(e){return!e.merged})),(function(e){return gh.pick(e,["vs","i","barycenter","weight"])}))}(gh.filter(t,(function(e){return!e.indegree})))}(s,r);!function(e,n){bh.forEach(e,(function(e){e.vs=bh.flatten(e.vs.map((function(e){return n[e]?n[e].vs:e})),!0)}))}(d,l);var f=function(e,n){var t,r=mh.partition(e,(function(e){return yh.has(e,"barycenter")})),o=r.lhs,i=yh.sortBy(r.rhs,(function(e){return-e.i})),a=[],u=0,c=0,l=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})),l=wh(a,i,l),yh.forEach(o,(function(e){l+=e.vs.length,a.push(e.vs),u+=e.barycenter*e.weight,c+=e.weight,l=wh(a,i,l)}));var s={vs:yh.flatten(a,!0)};return c&&(s.barycenter=u/c,s.weight=c),s}(d,o);if(u&&(f.vs=bh.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]);bh.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=xh.uniqueId("_root")););return n}(e),o=new _h({compound:!0}).setGraph({root:r}).setDefaultNodeLabel((function(n){return e.node(n)}));return xh.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),xh.forEach(e[t](i),(function(n){var t=n.v===i?n.w:n.v,r=o.edge(t,i),a=xh.isUndefined(r)?0:r.weight;o.setEdge(t,i,{weight:e.edge(n).weight+a})})),xh.has(a,"minRank")&&o.setNode(i,{borderLeft:a.borderLeft[n],borderRight:a.borderRight[n]}))})),o},Oh=Xd.Graph,jh=pf;function Ph(e,n,t){return Sh.map(n,(function(n){return Mh(e,n,t)}))}function Ih(e,n){var t=new Oh;Sh.forEach(e,(function(e){var r=e.graph().root,o=Ch(e,r,t,n);Sh.forEach(o.vs,(function(n,t){e.node(n).order=t})),function(e,n,t){var r,o={};Eh.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 Ah(e,n){Sh.forEach(n,(function(n){Sh.forEach(n,(function(n,t){e.node(n).order=t}))}))}var zh=Qd,Th=Xd.Graph,Lh=pf;function Bh(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 Dh(e,n,t){if(n>t){var r=n;n=t,t=r}return zh.has(e[n],t)}var Rh=Qd,Hh=pf,Vh=function(e){var n,t=Lh.buildLayerMatrix(e),r=zh.merge(function(e,n){var t={};return zh.reduce(n,(function(n,r){var o=0,i=0,a=n.length,u=zh.last(r);return zh.forEach(r,(function(n,c){var l=function(e,n){if(e.node(n).dummy)return zh.find(e.predecessors(n),(function(n){return e.node(n).dummy}))}(e,n),s=l?e.node(l).order:a;(l||n===u)&&(zh.forEach(r.slice(i,c+1),(function(n){zh.forEach(e.predecessors(n),(function(r){var i=e.node(r),a=i.order;!(a<o||s<a)||i.dummy&&e.node(n).dummy||Bh(t,r,n)}))})),i=c+1,o=s)})),r})),t}(e,t),function(e,n){var t={};function r(n,r,o,i,a){var u;zh.forEach(zh.range(r,o),(function(r){u=n[r],e.node(u).dummy&&zh.forEach(e.predecessors(u),(function(n){var r=e.node(n);r.dummy&&(r.order<i||r.order>a)&&Bh(t,n,u)}))}))}return zh.reduce(n,(function(n,t){var o,i=-1,a=0;return zh.forEach(t,(function(u,c){if("border"===e.node(u).dummy){var l=e.predecessors(u);l.length&&(o=e.node(l[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={};zh.forEach(["u","d"],(function(i){n="u"===i?t:zh.values(t).reverse(),zh.forEach(["l","r"],(function(t){"r"===t&&(n=zh.map(n,(function(e){return zh.values(e).reverse()})));var a=("u"===i?e.predecessors:e.successors).bind(e),u=function(e,n,t,r){var o={},i={},a={};return zh.forEach(n,(function(e){zh.forEach(e,(function(e,n){o[e]=e,i[e]=e,a[e]=n}))})),zh.forEach(n,(function(e){var n=-1;zh.forEach(e,(function(e){var u=r(e);if(u.length){u=zh.sortBy(u,(function(e){return a[e]}));for(var c=(u.length-1)/2,l=Math.floor(c),s=Math.ceil(c);l<=s;++l){var d=u[l];i[e]===e&&n<a[d]&&!Dh(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 Th,i=e.graph(),a=function(e,n,t){return function(r,o,i){var a,u=r.node(o),c=r.node(i),l=0;if(l+=u.width/2,zh.has(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":a=-u.width/2;break;case"r":a=u.width/2}if(a&&(l+=t?a:-a),a=0,l+=(u.dummy?n:e)/2,l+=(c.dummy?n:e)/2,l+=c.width/2,zh.has(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":a=c.width/2;break;case"r":a=-c.width/2}return a&&(l+=t?a:-a),a=0,l}}(i.nodesep,i.edgesep,r);return zh.forEach(n,(function(n){var r;zh.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)),zh.forEach(r,(function(e){i[e]=i[t[e]]})),i}(e,n,u.root,u.align,"r"===t);"r"===t&&(c=zh.mapValues(c,(function(e){return-e}))),o[i+t]=c}))}));var i=function(e,n){return zh.minBy(zh.values(n),(function(n){var t=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;return zh.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=zh.values(n),r=zh.min(t),o=zh.max(t);zh.forEach(["u","d"],(function(t){zh.forEach(["l","r"],(function(i){var a,u=t+i,c=e[u];if(c!==n){var l=zh.values(c);(a="l"===i?r-zh.min(l):o-zh.max(l))&&(e[u]=zh.mapValues(c,(function(e){return e+a})))}}))}))}(o,i),function(e,n){return zh.mapValues(e.ul,(function(t,r){if(n)return e[n.toLowerCase()][r];var o=zh.sortBy(zh.map(e,r));return(o[1]+o[2])/2}))}(o,e.graph().align)},Yh=Qd,Xh=ff,Zh=bf,Fh=function(e){switch(e.graph().ranker){case"network-simplex":default:!function(e){$f(e)}(e);break;case"tight-tree":!function(e){Gf(e),qf(e)}(e);break;case"longest-path":Kf(e)}},Uh=pf.normalizeRanks,Wh=function(e){var n=function(e){var n={},t=0;return Qf.forEach(e.children(),(function r(o){var i=t;Qf.forEach(e.children(o),r),n[o]={low:i,lim:t++}})),n}(e);Qf.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),l=Math.max(n[t].lim,n[r].lim);o=t;do{o=e.parent(o),a.push(o)}while(o&&(n[o].low>c||l>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,l=a[c],s=!0;t!==o.w;){if(r=e.node(t),s){for(;(l=a[c])!==u&&e.node(l).maxRank<r.rank;)c++;l===u&&(s=!1)}if(!s){for(;c<a.length-1&&e.node(l=a[c+1]).minRank<=r.rank;)c++;l=a[c]}e.setParent(t,l),t=e.successors(t)[0]}}))},Gh=pf.removeEmptyRanks,qh=nh,$h=function(e){rh.forEach(e.children(),(function n(t){var r=e.children(t),o=e.node(t);if(r.length&&rh.forEach(r,n),rh.has(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(var i=o.minRank,a=o.maxRank+1;i<a;++i)ih(e,"borderLeft","_bl",t,o,i),ih(e,"borderRight","_br",t,o,i)}}))},Kh=uh,Qh=function(e){var n=jh.maxRank(e),t=Ph(e,Sh.range(1,n+1),"inEdges"),r=Ph(e,Sh.range(n-1,-1,-1),"outEdges"),o=kh(e);Ah(e,o);for(var i,a=Number.POSITIVE_INFINITY,u=0,c=0;c<4;++u,++c){Ih(u%2?t:r,u%4>=2),o=jh.buildLayerMatrix(e);var l=Nh(e,o);l<a&&(c=0,i=Sh.cloneDeep(o),a=l)}Ah(e,i)},Jh=function(e){(function(e){var n=Hh.buildLayerMatrix(e),t=e.graph().ranksep,r=0;Rh.forEach(n,(function(n){var o=Rh.max(Rh.map(n,(function(n){return e.node(n).height})));Rh.forEach(n,(function(n){e.node(n).y=r+o/2})),r+=o+t}))})(e=Hh.asNonCompoundGraph(e)),Rh.forEach(Vh(e),(function(n,t){e.node(t).x=n}))},ev=pf,nv=Xd.Graph,tv=["nodesep","edgesep","ranksep","marginx","marginy"],rv={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ov=["acyclicer","ranker","rankdir","align"],iv=["width","height"],av={width:0,height:0},uv=["minlen","weight","width","height","labeloffset"],cv={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},lv=["labelpos"];function sv(e,n){return Yh.mapValues(Yh.pick(e,n),Number)}function dv(e){var n={};return Yh.forEach(e,(function(e,t){n[t.toLowerCase()]=e})),n}var fv=Qd,hv=pf,vv=Xd.Graph,pv={debugOrdering:function(e){var n=hv.buildLayerMatrix(e),t=new vv({compound:!0,multigraph:!0}).setGraph({});return fv.forEach(e.nodes(),(function(n){t.setNode(n,{label:n}),t.setParent(n,"layer"+e.node(n).rank)})),fv.forEach(e.edges(),(function(e){t.setEdge(e.v,e.w,{},e.name)})),fv.forEach(n,(function(e,n){var r="layer"+n;t.setNode(r,{rank:"same"}),fv.reduce(e,(function(e,n){return t.setEdge(e,n,{style:"invis"}),n}))})),t}},gv=$n({graphlib:Xd,layout:function(e,n){var t=n&&n.debugTiming?ev.time:ev.notime;t("layout",(function(){var n=t(" buildLayoutGraph",(function(){return function(e){var n=new nv({multigraph:!0,compound:!0}),t=dv(e.graph());return n.setGraph(Yh.merge({},rv,sv(t,tv),Yh.pick(t,ov))),Yh.forEach(e.nodes(),(function(t){var r=dv(e.node(t));n.setNode(t,Yh.defaults(sv(r,iv),av)),n.setParent(t,e.parent(t))})),Yh.forEach(e.edges(),(function(t){var r=dv(e.edge(t));n.setEdge(t,Yh.merge({},cv,sv(r,uv),Yh.pick(r,lv)))})),n}(e)}));t(" runLayout",(function(){!function(e,n){n(" makeSpaceForEdgeLabels",(function(){!function(e){var n=e.graph();n.ranksep/=2,Yh.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){Yh.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(){Xh.run(e)})),n(" nestingGraph.run",(function(){qh.run(e)})),n(" rank",(function(){Fh(ev.asNonCompoundGraph(e))})),n(" injectEdgeLabelProxies",(function(){!function(e){Yh.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};ev.addDummyNode(e,"edge-proxy",o,"_ep")}}))}(e)})),n(" removeEmptyRanks",(function(){Gh(e)})),n(" nestingGraph.cleanup",(function(){qh.cleanup(e)})),n(" normalizeRanks",(function(){Uh(e)})),n(" assignRankMinMax",(function(){!function(e){var n=0;Yh.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=Yh.max(n,r.maxRank))})),e.graph().maxRank=n}(e)})),n(" removeEdgeLabelProxies",(function(){!function(e){Yh.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(){Wh(e)})),n(" addBorderSegments",(function(){$h(e)})),n(" order",(function(){Qh(e)})),n(" insertSelfEdges",(function(){!function(e){var n=ev.buildLayerMatrix(e);Yh.forEach(n,(function(n){var t=0;Yh.forEach(n,(function(n,r){var o=e.node(n);o.order=r+t,Yh.forEach(o.selfEdges,(function(n){ev.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(){Kh.adjust(e)})),n(" position",(function(){Jh(e)})),n(" positionSelfEdges",(function(){!function(e){Yh.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){Yh.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(Yh.last(t.borderLeft)),a=e.node(Yh.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}})),Yh.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){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);if(Yh.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(){Kh.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)}Yh.forEach(e.nodes(),(function(n){c(e.node(n))})),Yh.forEach(e.edges(),(function(n){var t=e.edge(n);Yh.has(t,"x")&&c(t)})),n-=a,r-=u,Yh.forEach(e.nodes(),(function(t){var o=e.node(t);o.x-=n,o.y-=r})),Yh.forEach(e.edges(),(function(t){var o=e.edge(t);Yh.forEach(o.points,(function(e){e.x-=n,e.y-=r})),Yh.has(o,"x")&&(o.x-=n),Yh.has(o,"y")&&(o.y-=r)})),i.width=t-n+a,i.height=o-r+u}(e)})),n(" assignNodeIntersects",(function(){!function(e){Yh.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(ev.intersectRect(i,t)),o.points.push(ev.intersectRect(a,r))}))}(e)})),n(" reversePoints",(function(){!function(e){Yh.forEach(e.edges(),(function(n){var t=e.edge(n);t.reversed&&t.points.reverse()}))}(e)})),n(" acyclic.undo",(function(){Xh.undo(e)}))}(n,t)})),t(" updateInputGraph",(function(){!function(e,n){Yh.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))})),Yh.forEach(e.edges(),(function(t){var r=e.edge(t),o=n.edge(t);r.points=o.points,Yh.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:pv,util:{time:pf.time,notime:pf.notime},version:"0.8.5"}),yv={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.")}},mv=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],wv=["Enter"," ","Escape"],bv=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)}))},xv=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)}))},_v=function(e,n){void 0===n&&(n=[0,0]);var t=Vv(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}}},Ev=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=zv(t,n.nodeOrigin);return Pv(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Av(t)},Sv=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=zv(e,n.nodeOrigin);t=Pv(t,r)}})),Av(t)},kv=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 Nv(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),l=c.parentId?r.get(c.parentId):void 0,s=l?_v(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&Hv(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Hv(h)?Mv(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}var Cv=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},Mv=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Cv(e.x,n[0][0],n[1][0]),y:Cv(e.y,n[0][1],n[1][1])}},Ov=function(e,n,t){return e<n?Cv(Math.abs(e-n),1,50)/50:e>t?-Cv(Math.abs(e-t),1,50)/50:0},jv=function(e,n){return[20*Ov(e.x,35,n.width-35),20*Ov(e.y,35,n.height-35)]},Pv=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)}},Iv=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Av=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},zv=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=_v(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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)}},Tv=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])}},Lv=function(e,n,t,r){var o=e.x,i=e.y,a=U(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Tv(s,r):s},Bv=function(e,n){var t=e.x,r=e.y,o=U(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}},Dv=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),l=Cv(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}},Rv=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 Hv(e){return void 0!==e&&"parent"!==e}function Vv(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 Yv={x:0,y:0};function Xv(e,n,t){var r=(null==t?void 0:t.rankdir)||"TB",o=new gv.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)})),gv.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 Yv;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 l=function(e){if(!e)return Yv;var n=Vv(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-l.x,y:r/2-l.y}}}return a?(l=function(e){if(!(null==e?void 0:e.length))return Yv;var n=Ev(e),t=n.x,r=n.y;return{x:t+n.width/2,y:r+n.height/2}}(u),{x:i/2-l.x,y:r/2-l.y}):Yv}({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,l=a.y,s=void 0===l?0:l;return i.forEach((function(e){e.position={x:e.position.x+c,y:e.position.y+s}})),{nodes:i,edges:n}}var Zv=function(e){return null!==e&&"function"!=typeof e&&isFinite(e.length)},Fv=function(e,n){return!!Zv(e)&&e.indexOf(n)>-1},Uv=function(e,n){if(!Zv(e))return e;for(var t=[],r=0;r<e.length;r++){var o=e[r];n(o,r)&&t.push(o)}return t},Wv={}.toString,Gv=function(e,n){return Wv.call(e)==="[object "+n+"]"},qv=function(e){return Gv(e,"Function")},$v=function(e){return null==e},Kv=function(e){return Array.isArray?Array.isArray(e):Gv(e,"Array")},Qv=function(e){var n=typeof e;return null!==e&&"object"===n||"function"===n};function Jv(e,n){if(e)if(Kv(e))for(var t=0,r=e.length;t<r&&!1!==n(e[t],t);t++);else if(Qv(e))for(var o in e)if(e.hasOwnProperty(o)&&!1===n(e[o],o))break}var ep=Object.keys?function(e){return Object.keys(e)}:function(e){var n=[];return Jv(e,(function(t,r){qv(e)&&"prototype"===r||n.push(r)})),n};function np(e,n){var t=ep(n),r=t.length;if($v(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 tp=function(e){return"object"==typeof e&&null!==e},rp=function(e){if(!tp(e)||!Gv(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},op=function(e,n){if(void 0===n&&(n=[]),Kv(e))for(var t=0;t<e.length;t+=1)op(e[t],n);else n.push(e);return n},ip=function(e){if(Kv(e))return e.reduce((function(e,n){return Math.max(e,n)}),e[0])},ap=function(e){if(Kv(e))return e.reduce((function(e,n){return Math.min(e,n)}),e[0])},up=Array.prototype,cp=up.splice,lp=up.indexOf,sp=Array.prototype.splice,dp=function(e,n){if(!Zv(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,sp.call(e,i,1))}return e},fp=function(e,n,t){if(!Kv(e)&&!rp(e))return e;var r=t;return Jv(e,(function(e,t){r=n(r,e,t)})),r},hp=function(e){return Gv(e,"String")};function vp(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 pp=Object.prototype.hasOwnProperty;function gp(e,n){if(!n||!Kv(e))return{};for(var t,r={},o=qv(n)?n:function(e){return e[n]},i=0;i<e.length;i++){var a=e[i];t=o(a),pp.call(r,t)?r[t].push(a):r[t]=[a]}return r}function yp(e,n){if(!n)return{0:e};if(!qv(n)){var t=Kv(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 gp(e,n)}var mp={},wp=function(e){return Gv(e,"Number")},bp=Number.isInteger?Number.isInteger:function(e){return wp(e)&&e%1==0},xp=180/Math.PI,_p=parseInt,Ep=Math.PI/180,Sp=function(e,n){return e.hasOwnProperty(n)},kp=Object.values?function(e){return Object.values(e)}:function(e){var n=[];return Jv(e,(function(t,r){qv(e)&&"prototype"===r||n.push(t)})),n},Np=function(e){return $v(e)?"":e.toString()},Cp={}.toString,Mp=function(e){return Cp.call(e).replace(/^\[object /,"").replace(/]$/,"")},Op=Object.prototype,jp=function(e){var n=e&&e.constructor;return e===("function"==typeof n&&n.prototype||Op)};function Pp(e,n){for(var t in n)n.hasOwnProperty(t)&&"constructor"!==t&&void 0!==n[t]&&(e[t]=n[t])}function Ip(e,n,t,r){return n&&Pp(e,n),t&&Pp(e,t),r&&Pp(e,r),e}var Ap=function(e){if("object"!=typeof e||null===e)return e;var n;if(Kv(e)){n=[];for(var t=0,r=e.length;t<r;t++)"object"==typeof e[t]&&null!=e[t]?n[t]=Ap(e[t]):n[t]=e[t]}else for(var o in n={},e)"object"==typeof e[o]&&null!=e[o]?n[o]=Ap(e[o]):n[o]=e[o];return n},zp=function(e,n){if(!qv(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 Tp(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&&rp(i)?(rp(e[o])||(e[o]={}),t<r?Tp(e[o],i,t+1,r):e[o]=n[o]):Kv(i)?(e[o]=[],e[o]=e[o].concat(i)):void 0!==i&&(e[o]=i)}}var Lp,Bp=Object.prototype.hasOwnProperty,Dp=function(e,n){if(e===n)return!0;if(!e||!n)return!1;if(hp(e)||hp(n))return!1;if(Zv(e)||Zv(n)){if(e.length!==n.length)return!1;for(var t=!0,r=0;r<e.length&&(t=Dp(e[r],n[r]));r++);return t}if(tp(e)||tp(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=Dp(e[o[r]],n[o[r]]));r++);return t}return!1},Rp=function(e){return e},Hp=Object.prototype.hasOwnProperty,Vp={},Yp=zp((function(e,n){void 0===n&&(n={});var t=n.fontSize,r=n.fontFamily,o=n.fontWeight,i=n.fontStyle,a=n.fontVariant;return Lp||(Lp=document.createElement("canvas").getContext("2d")),Lp.font=[i,a,o,t+"px",r].join(" "),Lp.measureText(hp(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],kp(n)).join("")})),Xp=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}(),Zp=Object.freeze({__proto__:null,Cache:Xp,assign:Ip,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];qv(o)&&(o=o.prototype),Ip(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:Ap,contains:Fv,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)Tp(e,n[r]);return e},difference:function(e,n){return void 0===n&&(n=[]),Uv(e,(function(e){return!Fv(n,e)}))},each:Jv,endsWith:function(e,n){return!(!Kv(e)&&!hp(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){qv(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=Ip(i,e.prototype),e.superclass=o(n.prototype,n),Ip(i,t),Ip(e,r),e},filter:Uv,find:function(e,n){if(!Kv(e))return null;var t;if(qv(n)&&(t=n),rp(n)&&(t=function(e){return np(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(!$v(o)){t=Kv(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(!Kv(e))return[];for(var n=[],t=0;t<e.length;t++)n=n.concat(e[t]);return n},flattenDeep:op,forIn:Jv,get:function(e,n,t){for(var r=0,o=hp(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=Yp(r,t),u=hp(e)?e:Np(e),c=n,l=[];if(Yp(e,t)<=n)return e;for(;o=u.substr(0,16),!((i=Yp(o,t))+a>c&&i>c);)if(l.push(o),c-=i,!(u=u.substr(16)))return l.join("");for(;o=u.substr(0,1),!((i=Yp(o,t))+a>c);)if(l.push(o),c-=i,!(u=u.substr(1)))return l.join("");return""+l.join("")+r},getRange:function(e){var n=e.filter((function(e){return!isNaN(e)}));if(!n.length)return{min:0,max:0};if(Kv(e[0])){for(var t=[],r=0;r<e.length;r++)t=t.concat(e[r]);n=t}var o=ip(n);return{min:ap(n),max:o}},getType:Mp,getWrapBehavior:function(e,n){return e["_wrap_"+n]},group:function(e,n){if(!n)return[e];var t=yp(e,n),r=[];for(var o in t)r.push(t[o]);return r},groupBy:gp,groupToMap:yp,has:Sp,hasKey:Sp,hasValue:function(e,n){return Fv(kp(e),n)},head:function(e){if(Zv(e))return e[0]},identity:function(e){return e},includes:Fv,indexOf:function(e,n){if(!Zv(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 Gv(e,"Arguments")},isArray:Kv,isArrayLike:Zv,isBoolean:function(e){return Gv(e,"Boolean")},isDate:function(e){return Gv(e,"Date")},isDecimal:function(e){return wp(e)&&e%1!=0},isElement:function(e){return e instanceof Element||e instanceof HTMLDocument},isEmpty:function(e){if($v(e))return!0;if(Zv(e))return!e.length;var n=Mp(e);if("Map"===n||"Set"===n)return!e.size;if(jp(e))return!Object.keys(e).length;for(var t in e)if(Bp.call(e,t))return!1;return!0},isEqual:Dp,isEqualWith:function(e,n,t){return qv(t)?!!t(e,n):Dp(e,n)},isError:function(e){return Gv(e,"Error")},isEven:function(e){return wp(e)&&e%2==0},isFinite:function(e){return wp(e)&&isFinite(e)},isFunction:qv,isInteger:bp,isMatch:np,isNegative:function(e){return wp(e)&&e<0},isNil:$v,isNull:function(e){return null===e},isNumber:wp,isNumberEqual:function(e,n,t){return void 0===t&&(t=1e-5),Math.abs(e-n)<t},isObject:Qv,isObjectLike:tp,isOdd:function(e){return wp(e)&&e%2!=0},isPlainObject:rp,isPositive:function(e){return wp(e)&&e>0},isPrototype:jp,isRegExp:function(e){return Gv(e,"RegExp")},isString:hp,isType:Gv,isUndefined:function(e){return void 0===e},keys:ep,last:function(e){if(Zv(e))return e[e.length-1]},lowerCase:function(e){return Np(e).toLowerCase()},lowerFirst:function(e){var n=Np(e);return n.charAt(0).toLowerCase()+n.substring(1)},map:function(e,n){if(!Zv(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=Rp);var t={};return Qv(e)&&!$v(e)&&Object.keys(e).forEach((function(r){t[r]=n(e[r],r)})),t},max:ip,maxBy:function(e,n){if(Kv(e)){for(var t,r=-1/0,o=0;o<e.length;o++){var i=e[o],a=qv(n)?n(i):i[n];a>r&&(t=i,r=a)}return t}},measureTextWidth:Yp,memoize:zp,min:ap,minBy:function(e,n){if(Kv(e)){for(var t,r=1/0,o=0;o<e.length;o++){var i=e[o],a=qv(n)?n(i):i[n];a<r&&(t=i,r=a)}return t}},mix:Ip,mod:function(e,n){return(e%n+n)%n},noop:function(){},number2color:function(e){var n=mp[e];if(!n){for(var t=e.toString(16),r=t.length;r<6;r++)t="0"+t;n="#"+t,mp[e]=n}return n},omit:function(e,n){return fp(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 Kv(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||!rp(e))return{};var t={};return Jv(n,(function(n){Hp.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=lp.call(e,o))>-1;)cp.call(e,i,1);return e},pullAt:dp,reduce:fp,remove:function(e,n){var t=[];if(!Zv(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 dp(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=hp(n)?n.split("."):n;return o.forEach((function(e,n){n<o.length-1?(Qv(r[e])||(r[e]=wp(o[n+1])?[]:{}),r=r[e]):r[e]=t})),e},size:function(e){return $v(e)?0:Zv(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(qv(n))t=function(e,t){return n(e)-n(t)};else{var r=[];hp(n)?r.push(n):Kv(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!(!Kv(e)&&!hp(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)},l=function(){var l=Date.now();u||!1!==t.leading||(u=l);var s=n-(l-u);return o=this,i=arguments,s<=0||s>n?(r&&(clearTimeout(r),r=null),u=l,a=e.apply(o,i),r||(o=i=null)):r||!1===t.trailing||(r=setTimeout(c,s)),a};return l.cancel=function(){clearTimeout(r),u=0,r=o=i=null},l},toArray:function(e){return Zv(e)?Array.prototype.slice.call(e):[]},toDegree:function(e){return xp*e},toInteger:_p,toRadian:function(e){return Ep*e},toString:Np,union:function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return vp([].concat.apply([],e))},uniq:vp,uniqueId:function(e){return Vp[e=e||"g"]?Vp[e]+=1:Vp[e]=1,e+Vp[e]},upperCase:function(e){return Np(e).toUpperCase()},upperFirst:function(e){var n=Np(e);return n.charAt(0).toUpperCase()+n.substring(1)},values:kp,valuesOfKey:function(e,n){for(var t=[],r={},o=0;o<e.length;o++){var i=e[o][n];if(!$v(i)){Kv(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}}),Fp={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}(Zp).mix,getHeight:function(e,n,t,r){return void 0===r&&(r="height"),"center"===t?(e[r]+n[r])/2:e.height}},Up=Fp,Wp={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 Gp(e,n){var t=this;if(t.vgap=t.hgap=0,e instanceof Gp)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}Up.assign(Gp.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 qp=function(e,n,t){void 0===n&&(n={});var r,o=new Gp(e,n=Up.assign({},Wp,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 l=new Gp(a[c],n);r.children[c]=l,i.push(l),l.parent=r,l.depth=r.depth+1}}return o},$p=qp,Kp=function(){function e(e,n){void 0===n&&(n={}),this.options=n,this.rootNode=$p(e,n)}return e.prototype.execute=function(){throw new Error("please override this method")},e}(),Qp=Kp;function Jp(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 eg(e,n,t){t?e.y+=n:e.x+=n,e.children.forEach((function(e){eg(e,n,t)}))}function ng(e,n){var t=n?e.y:e.x;return e.children.forEach((function(e){t=Math.min(ng(e,n),t)})),t}function tg(e,n){eg(e,-ng(e,n),n)}function rg(e,n,t){t?n.y=e.x:n.x=e.x,e.c.forEach((function(e,r){rg(e,n.children[r],t)}))}function og(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){og(e,n,t)}))}Jp.fromNode=function(e,n){if(!e)return null;var t=[];return e.children.forEach((function(e){t.push(Jp.fromNode(e,n))})),n?new Jp(e.height,e.width,e.x,t):new Jp(e.width,e.height,e.y,t)};var ig=qp,ag=function(e,n){for(var t=ig(e.data,n,!0),r=ig(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}},ug=ag,cg=["LR","RL","TB","BT","H","V"],lg=["LR","RL","H"],sg=cg[0],dg=function(e,n,t){var r=n.direction||sg;if(n.isHorizontal=function(e){return lg.indexOf(e)>-1}(r),r&&-1===cg.indexOf(r))throw new TypeError("Invalid direction: "+r);if(r===cg[0])t(e,n);else if(r===cg[1])t(e,n),e.right2left();else if(r===cg[2])t(e,n);else if(r===cg[3])t(e,n),e.bottom2top();else if(r===cg[4]||r===cg[5]){var o=ug(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 fg(e,n){return fg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},fg(e,n)}var hg=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,l=e.c[n],s=l.mod;null!==r&&null!==l;){c(r)>t.low&&(t=t.nxt);var d=o+r.prelim+r.w-(s+l.prelim);d>0&&(s+=d,i(e,n,t.index,d));var f=c(r),h=c(l);f<=h&&null!==(r=u(r))&&(o+=r.mod),f>=h&&null!==(l=a(l))&&(s+=l.mod)}!r&&l?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,l,s):r&&!l&&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 l(e,n,t){for(;null!==t&&e>=t.low;)t=t.nxt;return{low:e,index:n,nxt:t}}og(e,t);var s=Jp.fromNode(e,t);return function e(n){if(0!==n.cs){e(n.c[0]);for(var t=l(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=l(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)}(s),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)}(s,0),rg(s,e,t),tg(e,t),e},vg=dg,pg=Fp,gg=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,fg(n,t),r.prototype.execute=function(){return vg(this.rootNode,this.options,hg)},r}(Qp),yg={},mg=Fp;function wg(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 bg={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function xg(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){xg(e,n.children[r],t)}))}function _g(e,n){return _g=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},_g(e,n)}var Eg=function(e,n){void 0===n&&(n={}),n=mg.assign({},bg,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 wg(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),xg(o,e,n.isHorizontal),e},Sg=dg,kg=Fp,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,_g(n,t),r.prototype.execute=function(){var e=this;return e.rootNode.width=0,Sg(e.rootNode,e.options,Eg)},r}(Qp),Cg={},Mg=Fp;function Og(e,n){return Og=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Og(e,n)}var jg=Qp,Pg=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+Mg.getHeight(n,e,o),n.parent&&e.parent.id!==n.parent.id){var a=n.parent,u=a.y+Mg.getHeight(a,e,o);e.y=u>e.y?u:e.y}}else e.y=0}(e,o,n,t,r),o=e}))},Ig=ag,Ag=Fp,zg=["LR","RL","H"],Tg=zg[0],Lg=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,Og(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?Tg:a,c=e.align;if(u&&-1===zg.indexOf(u))throw new TypeError("Invalid direction: "+u);if(u===zg[0])Pg(n,r,i,c);else if(u===zg[1])Pg(n,r,i,c),n.right2left();else if(u===zg[2]){var l=Ig(n,e),s=l.left,d=l.right;Pg(s,r,i,c),s.right2left(),Pg(d,r,i,c);var f=s.getBoundingBox();d.translate(f.width,0),n.x=d.x-n.width/2}return n},r}(jg),Bg={},Dg=Fp;function Rg(e,n){var t=0;return e.children.length?e.children.forEach((function(e){t+=Rg(e,n)})):t=e.height,e._subTreeSep=n.getSubTreeSep(e.data),e.totalHeight=Math.max(e.height,t)+2*e._subTreeSep,e.totalHeight}function Hg(e){var n=e.children,t=n.length;if(t){n.forEach((function(e){Hg(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 Vg={getSubTreeSep:function(){return 0}};function Yg(e,n){return Yg=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,n){return e.__proto__=n,e},Yg(e,n)}var Xg=function(e,n){void 0===n&&(n={}),n=Dg.assign({},Vg,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,Rg(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}}}})),Hg(e)},Zg=dg,Fg=Fp,Ug=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,Yg(n,t),r.prototype.execute=function(){return Zg(this.rootNode,this.options,Xg)},r}(Qp),Wg={};$n({compactBox:function(e,n){return n=pg.assign({},yg,n),new gg(e,n).execute()},dendrogram:function(e,n){return n=kg.assign({},Cg,n),new Ng(e,n).execute()},indented:function(e,n){return n=Ag.assign({},Bg,n),new Lg(e,n).execute()},mindmap:function(e,n){return n=Fg.assign({},Wg,n),new Ug(e,n).execute()}});var Gg={value:()=>{}};function qg(){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 $g(r)}function $g(e){this._=e}function Kg(e,n){for(var t,r=0,o=e.length;r<o;++r)if((t=e[r]).name===n)return t.value}function Qg(e,n,t){for(var r=0,o=e.length;r<o;++r)if(e[r].name===n){e[r]=Gg,e=e.slice(0,r).concat(e.slice(r+1));break}return null!=t&&e.push({name:n,value:t}),e}$g.prototype=qg.prototype={constructor:$g,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]=Qg(o[t],e.name,n);else if(null==n)for(t in o)o[t]=Qg(o[t],e.name,null);return this}for(;++a<u;)if((t=(e=i[a]).type)&&(t=Kg(o[t],e.name)))return t},copy:function(){var e={},n=this._;for(var t in n)e[t]=n[t].slice();return new $g(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 Jg="http://www.w3.org/1999/xhtml",ey={svg:"http://www.w3.org/2000/svg",xhtml:Jg,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ny(e){var n=e+="",t=n.indexOf(":");return t>=0&&"xmlns"!==(n=e.slice(0,t))&&(e=e.slice(t+1)),ey.hasOwnProperty(n)?{space:ey[n],local:e}:e}function ty(e){return function(){var n=this.ownerDocument,t=this.namespaceURI;return t===Jg&&n.documentElement.namespaceURI===Jg?n.createElement(e):n.createElementNS(t,e)}}function ry(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function oy(e){var n=ny(e);return(n.local?ry:ty)(n)}function iy(){}function ay(e){return null==e?iy:function(){return this.querySelector(e)}}function uy(){return[]}function cy(e){return null==e?uy:function(){return this.querySelectorAll(e)}}function ly(e){return function(){return this.matches(e)}}function sy(e){return function(n){return n.matches(e)}}var dy=Array.prototype.find;function fy(){return this.firstElementChild}var hy=Array.prototype.filter;function vy(){return Array.from(this.children)}function py(e){return new Array(e.length)}function gy(e,n){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=n}function yy(e,n,t,r,o,i){for(var a,u=0,c=n.length,l=i.length;u<l;++u)(a=n[u])?(a.__data__=i[u],r[u]=a):t[u]=new gy(e,i[u]);for(;u<c;++u)(a=n[u])&&(o[u]=a)}function my(e,n,t,r,o,i,a){var u,c,l,s=new Map,d=n.length,f=i.length,h=new Array(d);for(u=0;u<d;++u)(c=n[u])&&(h[u]=l=a.call(c,c.__data__,u,n)+"",s.has(l)?o[u]=c:s.set(l,c));for(u=0;u<f;++u)l=a.call(e,i[u],u,i)+"",(c=s.get(l))?(r[u]=c,c.__data__=i[u],s.delete(l)):t[u]=new gy(e,i[u]);for(u=0;u<d;++u)(c=n[u])&&s.get(h[u])===c&&(o[u]=c)}function wy(e){return e.__data__}function by(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function xy(e,n){return e<n?-1:e>n?1:e>=n?0:NaN}function _y(e){return function(){this.removeAttribute(e)}}function Ey(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Sy(e,n){return function(){this.setAttribute(e,n)}}function ky(e,n){return function(){this.setAttributeNS(e.space,e.local,n)}}function Ny(e,n){return function(){var t=n.apply(this,arguments);null==t?this.removeAttribute(e):this.setAttribute(e,t)}}function Cy(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 My(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Oy(e){return function(){this.style.removeProperty(e)}}function jy(e,n,t){return function(){this.style.setProperty(e,n,t)}}function Py(e,n,t){return function(){var r=n.apply(this,arguments);null==r?this.style.removeProperty(e):this.style.setProperty(e,r,t)}}function Iy(e,n){return e.style.getPropertyValue(n)||My(e).getComputedStyle(e,null).getPropertyValue(n)}function Ay(e){return function(){delete this[e]}}function zy(e,n){return function(){this[e]=n}}function Ty(e,n){return function(){var t=n.apply(this,arguments);null==t?delete this[e]:this[e]=t}}function Ly(e){return e.trim().split(/^|\s+/)}function By(e){return e.classList||new Dy(e)}function Dy(e){this._node=e,this._names=Ly(e.getAttribute("class")||"")}function Ry(e,n){for(var t=By(e),r=-1,o=n.length;++r<o;)t.add(n[r])}function Hy(e,n){for(var t=By(e),r=-1,o=n.length;++r<o;)t.remove(n[r])}function Vy(e){return function(){Ry(this,e)}}function Yy(e){return function(){Hy(this,e)}}function Xy(e,n){return function(){(n.apply(this,arguments)?Ry:Hy)(this,e)}}function Zy(){this.textContent=""}function Fy(e){return function(){this.textContent=e}}function Uy(e){return function(){var n=e.apply(this,arguments);this.textContent=null==n?"":n}}function Wy(){this.innerHTML=""}function Gy(e){return function(){this.innerHTML=e}}function qy(e){return function(){var n=e.apply(this,arguments);this.innerHTML=null==n?"":n}}function $y(){this.nextSibling&&this.parentNode.appendChild(this)}function Ky(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Qy(){return null}function Jy(){var e=this.parentNode;e&&e.removeChild(this)}function em(){var e=this.cloneNode(!1),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function nm(){var e=this.cloneNode(!0),n=this.parentNode;return n?n.insertBefore(e,this.nextSibling):e}function tm(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 rm(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 om(e,n,t){var r=My(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 im(e,n){return function(){return om(this,e,n)}}function am(e,n){return function(){return om(this,e,n.apply(this,arguments))}}gy.prototype={constructor:gy,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)}},Dy.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 um=[null];function cm(e,n){this._groups=e,this._parents=n}function lm(){return new cm([[document.documentElement]],um)}function sm(e){return"string"==typeof e?new cm([[document.querySelector(e)]],[document.documentElement]):new cm([[e]],um)}function dm(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]}cm.prototype=lm.prototype={constructor:cm,select:function(e){"function"!=typeof e&&(e=ay(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,l=r[o]=new Array(c),s=0;s<c;++s)(i=u[s])&&(a=e.call(i,i.__data__,s,u))&&("__data__"in i&&(a.__data__=i.__data__),l[s]=a);return new cm(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):cy(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,l=0;l<c;++l)(a=u[l])&&(r.push(e.call(a,a.__data__,l,u)),o.push(a));return new cm(r,o)},selectChild:function(e){return this.select(null==e?fy:function(e){return function(){return dy.call(this.children,e)}}("function"==typeof e?e:sy(e)))},selectChildren:function(e){return this.selectAll(null==e?vy:function(e){return function(){return hy.call(this.children,e)}}("function"==typeof e?e:sy(e)))},filter:function(e){"function"!=typeof e&&(e=ly(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new cm(r,this._parents)},data:function(e,n){if(!arguments.length)return Array.from(this,wy);var t,r=n?my:yy,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),l=new Array(a),s=0;s<a;++s){var d=o[s],f=i[s],h=f.length,v=by(e.call(d,d&&d.__data__,s,o)),p=v.length,g=c[s]=new Array(p),y=u[s]=new Array(p);r(d,f,g,y,l[s]=new Array(h),v,n);for(var m,w,b=0,x=0;b<p;++b)if(m=g[b]){for(b>=x&&(x=b+1);!(w=y[x])&&++x<p;);m._next=w||null}}return(u=new cm(u,o))._enter=c,u._exit=l,u},enter:function(){return new cm(this._enter||this._groups.map(py),this._parents)},exit:function(){return new cm(this._exit||this._groups.map(py),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 l,s=t[c],d=r[c],f=s.length,h=u[c]=new Array(f),v=0;v<f;++v)(l=s[v]||d[v])&&(h[v]=l);for(;c<o;++c)u[c]=t[c];return new cm(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=xy);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,l=o[i]=new Array(c),s=0;s<c;++s)(a=u[s])&&(l[s]=a);l.sort(n)}return new cm(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=ny(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?Ey:_y:"function"==typeof n?t.local?Cy:Ny:t.local?ky:Sy)(t,n))},style:function(e,n,t){return arguments.length>1?this.each((null==n?Oy:"function"==typeof n?Py:jy)(e,n,null==t?"":t)):Iy(this.node(),e)},property:function(e,n){return arguments.length>1?this.each((null==n?Ay:"function"==typeof n?Ty:zy)(e,n)):this.node()[e]},classed:function(e,n){var t=Ly(e+"");if(arguments.length<2){for(var r=By(this.node()),o=-1,i=t.length;++o<i;)if(!r.contains(t[o]))return!1;return!0}return this.each(("function"==typeof n?Xy:n?Vy:Yy)(t,n))},text:function(e){return arguments.length?this.each(null==e?Zy:("function"==typeof e?Uy:Fy)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Wy:("function"==typeof e?qy:Gy)(e)):this.node().innerHTML},raise:function(){return this.each($y)},lower:function(){return this.each(Ky)},append:function(e){var n="function"==typeof e?e:oy(e);return this.select((function(){return this.appendChild(n.apply(this,arguments))}))},insert:function(e,n){var t="function"==typeof e?e:oy(e),r=null==n?Qy:"function"==typeof n?n:ay(n);return this.select((function(){return this.insertBefore(t.apply(this,arguments),r.apply(this,arguments)||null)}))},remove:function(){return this.each(Jy)},clone:function(e){return this.select(e?nm:em)},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?rm:tm,r=0;r<a;++r)this.each(u(i[r],n,t));return this}var u=this.node().__on;if(u)for(var c,l=0,s=u.length;l<s;++l)for(r=0,c=u[l];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?am:im)(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 fm={passive:!1},hm={capture:!0,passive:!1};function vm(e){e.stopImmediatePropagation()}function pm(e){e.preventDefault(),e.stopImmediatePropagation()}function gm(e){var n=e.document.documentElement,t=sm(e).on("dragstart.drag",pm,hm);"onselectstart"in n?t.on("selectstart.drag",pm,hm):(n.__noselect=n.style.MozUserSelect,n.style.MozUserSelect="none")}function ym(e,n){var t=e.document.documentElement,r=sm(e).on("dragstart.drag",null);n&&(r.on("click.drag",pm,hm),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 mm=e=>()=>e;function wm(e,{sourceEvent:n,subject:t,target:r,identifier:o,active:i,x:a,y:u,dx:c,dy:l,dispatch:s}){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:l,enumerable:!0,configurable:!0},_:{value:s}})}function bm(e){return!e.ctrlKey&&!e.button}function xm(){return this.parentNode}function _m(e,n){return null==n?{x:e.x,y:e.y}:n}function Em(){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=Pm(e),c=u.x,l=u.y,s=Lv({x:c,y:l},a),d=i?Tv(s,r):s,f=d.x,h=d.y;return Z({xSnapped:f,ySnapped:h},s)}wm.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var km,Nm,Cm,Mm,Om,jm,Pm=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 Im(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 Am(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function zm(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case jm.Left:return[t-Am(t-o,a),r];case jm.Right:return[t+Am(o-t,a),r];case jm.Top:return[t,r-Am(r-i,a)];case jm.Bottom:return[t,r+Am(i-r,a)]}}function Tm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=U(zm({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=U(zm({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],y=U(Im({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),m=y[0],w=y[1],b=y[2],x=y[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),m,w,b,x]}function Lm(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"}(km||(km={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(Nm||(Nm={})),function(e){e.Partial="partial",e.Full="full"}(Cm||(Cm={})),function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(Mm||(Mm={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(Om||(Om={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(jm||(jm={}));var Bm,Dm=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||"")},Rm=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:Dm(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t},Hm=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?Dm(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)};function Vm(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=U(Lm({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}var Ym=((Bm={})[jm.Left]={x:-1,y:0},Bm[jm.Right]={x:1,y:0},Bm[jm.Top]={x:0,y:-1},Bm[jm.Bottom]={x:0,y:1},Bm),Xm=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function Zm(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=U(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?jm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?jm.Top:l,d=e.center,f=e.offset,h=Ym[u],v=Ym[s],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?jm.Bottom:t,o=e.target;return r===jm.Left||r===jm.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",w=y[m],b=[],x={x:0,y:0},_={x:0,y:0},E=U(Lm({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),S=E[0],k=E[1],N=E[2],C=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 M=[{x:r,y:p.y},{x:r,y:g.y}],O=[{x:p.x,y:o},{x:g.x,y:o}];b=h[m]===w?"x"===m?M:O:"x"===m?O:M}else{var j=[{x:p.x,y:g.y}],P=[{x:g.x,y:p.y}];if(b="x"===m?h.x===w?P:j:h.y===w?j:P,u===s){var I=Math.abs(i[m]-c[m]);if(I<=f){var A=Math.min(f-1,f-I);h[m]===w?x[m]=(p[m]>i[m]?-1:1)*A:_[m]=(g[m]>c[m]?-1:1)*A}}if(u!==s){var z="x"===m?"y":"x",T=h[m]===v[z],L=p[z]>g[z],B=p[z]<g[z];(1===h[m]&&(!T&&L||T&&B)||1!==h[m]&&(!T&&B||T&&L))&&(b="x"===m?j:P)}var D={x:p.x+x.x,y:p.y+x.y},R={x:g.x+_.x,y:g.y+_.y};Math.max(Math.abs(D.x-b[0].x),Math.abs(R.x-b[0].x))>=Math.max(Math.abs(D.y-b[0].y),Math.abs(R.y-b[0].y))?(r=(D.x+R.x)/2,o=b[0].y):(r=b[0].x,o=(D.y+R.y)/2)}return[W(W([i,{x:p.x+x.x,y:p.y+x.y}],U(b),!1),[{x:g.x+_.x,y:g.y+_.y},c],!1),r,o,N,C]}({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],w=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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+r}),"");return[b,g,y,m,w]}function Fm(e,n){if(!e.parentId)return!1;var t=n.get(e.parentId);return!!t&&(!!t.selected||Fm(t,n))}function Um(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 Wm(e){var n,t,r,o,i=e.nodeId,a=e.dragItems,u=e.nodeLookup,c=[];try{for(var l=F(a),s=l.next();!s.done;s=l.next()){var d=U(s.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{s&&!s.done&&(t=l.return)&&t.call(l)}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 Gm(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,l=!1,s={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 w(e,n){var r,i,u=e.x,l=e.y,s=t(),d=s.nodeLookup,f=s.nodeExtent,h=s.snapGrid,v=s.snapToGrid,p=s.nodeOrigin,g=s.onNodeDrag,y=s.onSelectionDrag,w=s.onError,b=s.updateNodePositions;a={x:u,y:l};var x=!1,_={x:0,y:0,x2:0,y2:0};if(c.size>1&&f){var E=Sv(c,{nodeOrigin:p});_=Iv(E)}try{for(var S=F(c),k=S.next();!k.done;k=S.next()){var N=U(k.value,2),C=N[0],M=N[1],O={x:u-M.distance.x,y:l-M.distance.y};v&&(O=Tv(O,h));var j=[[f[0][0],f[0][1]],[f[1][0],f[1][1]]];if(c.size>1&&f&&!M.extent){var P=M.internals.positionAbsolute,I=P.x-_.x+f[0][0],A=P.x+M.measured.width-_.x2+f[1][0];j=[[I,P.y-_.y+f[0][1]],[A,P.y+M.measured.height-_.y2+f[1][1]]]}var z=Nv({nodeId:C,nextPosition:O,nodeLookup:d,nodeExtent:j,nodeOrigin:p,onError:w}),T=z.position,L=z.positionAbsolute;x=x||M.position.x!==T.x||M.position.y!==T.y,M.position=T,M.internals.positionAbsolute=L}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}if(x&&(b(c,!0),n&&(o||g||!m&&y))){var B=U(Wm({nodeId:m,dragItems:c,nodeLookup:d}),2),D=B[0],R=B[1];null==o||o(n,c,D,R),null==g||g(n,D,R),m||null==y||y(n,R)}}function b(){var e,n;if(d){var r=U(jv(s,d),2),o=r[0],i=r[1];if(0!==o||0!==i){var c=t(),l=c.transform,f=c.panBy;a.x=(null!==(e=a.x)&&void 0!==e?e:0)-o/l[2],a.y=(null!==(n=a.y)&&void 0!==n?n:0)-i/l[2],f({x:o,y:i})&&w(a,null)}u=requestAnimationFrame(b)}}function x(e){var o,i=t(),u=i.nodeLookup,l=i.multiSelectionActive,s=i.nodesDraggable,d=i.transform,h=i.snapGrid,v=i.snapToGrid,p=i.selectNodesOnDrag,g=i.onNodeDragStart,w=i.onSelectionDragStart,b=i.unselectNodesAndEdges;f=!0,p&&y||l||!m||(null===(o=u.get(m))||void 0===o?void 0:o.selected)||b(),y&&p&&m&&(null==n||n(m));var x=Sm(e.sourceEvent,{transform:d,snapGrid:h,snapToGrid:v});if(a=x,c=function(e,n,t,r){var o,i,a,u,c=new Map;try{for(var l=F(e),s=l.next();!s.done;s=l.next()){var d=U(s.value,2),f=d[0],h=d[1];if((h.selected||h.id===r)&&(!h.parentId||!Fm(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{s&&!s.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return c}(u,s,x,m),c.size>0&&(r||g||!m&&w)){var _=U(Wm({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==w||w(e.sourceEvent,S)}}h=sm(g);var _=function(){var e,n,t,r,o=bm,i=xm,a=_m,u=Em,c={},l=qg("start","drag","end"),s=0,d=0;function f(e){e.on("mousedown.drag",h).filter(u).on("touchstart.drag",g).on("touchmove.drag",y,fm).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=w(this,i.call(this,a,u),a,u,"mouse");c&&(sm(a.view).on("mousemove.drag",v,hm).on("mouseup.drag",p,hm),gm(a.view),vm(a),t=!1,e=a.clientX,n=a.clientY,c("start",a))}}function v(r){if(pm(r),!t){var o=r.clientX-e,i=r.clientY-n;t=o*o+i*i>d}c.mouse("drag",r)}function p(e){sm(e.view).on("mousemove.drag mouseup.drag",null),ym(e.view,t),pm(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=w(this,u,e,n,a[t].identifier,a[t]))&&(vm(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])&&(pm(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])&&(vm(e),t("end",e,o[n]))}function w(e,n,t,r,o,i){var u,d,h,v=l.copy(),p=dm(i||t,n);if(null!=(h=a.call(e,new wm("beforestart",{sourceEvent:t,target:f,identifier:o,active:s,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,l){var g,y=p;switch(i){case"start":c[o]=t,g=s++;break;case"end":delete c[o],--s;case"drag":p=dm(l||a,n),g=s}v.call(i,e,new wm(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:mm(!!e),f):o},f.container=function(e){return arguments.length?(i="function"==typeof e?e:mm(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:mm(e),f):a},f.touchable=function(e){return arguments.length?(u="function"==typeof e?e:mm(!!e),f):u},f.on=function(){var e=l.on.apply(l,arguments);return e===l?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&&x(e);var l=Sm(e.sourceEvent,{transform:i,snapGrid:u,snapToGrid:c});a=l,d=(null==r?void 0:r.getBoundingClientRect())||null,s=Pm(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(!l&&i&&f&&(l=!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&&x(e)}(a.x!==g.xSnapped||a.y!==g.ySnapped)&&c&&f&&(s=Pm(e.sourceEvent,d),w(g,e.sourceEvent))})).on("end",(function(e){if(f&&(l=!1,f=!1,cancelAnimationFrame(u),c.size>0)){var n=t(),r=n.nodeLookup,o=n.updateNodePositions,a=n.onNodeDragStop,s=n.onSelectionDragStop;if(o(c,!1),i||a||!m&&s){var d=U(Wm({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==s||s(e.sourceEvent,v)}}})).filter((function(e){var n=e.target;return!e.button&&(!v||!Um(n,".".concat(v),g))&&(!p||Um(n,p,g))}));h.call(_)},destroy:function(){null==h||h.on(".drag",null)}}}function qm(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 $m(e,n){return e||((null==n?void 0:n.classList.contains("target"))?"target":(null==n?void 0:n.classList.contains("source"))?"source":null)}var Km=function(){return!0},Qm=null;function Jm(e,n){var t=n.handle,r=n.connectionMode,o=n.fromNodeId,i=n.fromHandleId,a=n.fromType,u=n.doc,c=n.lib,l=n.flowId,s=n.isValidConnection,d=void 0===s?Km:s,f="target"===a,h=t?u.querySelector(".".concat(c,'-flow__handle[data-id="').concat(l,"-").concat(null==t?void 0:t.nodeId,"-").concat(null==t?void 0:t.id,"-").concat(null==t?void 0:t.type,'"]')):null,v=Pm(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,w={handleDomNode:m,isValid:!1,connection:null,endHandle:null};if(m){var b=$m(void 0,m),x=m.getAttribute("data-nodeid"),_=m.getAttribute("data-handleid"),E=m.classList.contains("connectable"),S=m.classList.contains("connectableend");if(!x)return w;var k={source:f?x:o,sourceHandle:f?_:i,target:f?o:x,targetHandle:f?i:_};w.connection=k,E&&S&&(r===km.Strict?f&&"source"===b||!f&&"target"===b:x!==o||_!==i)&&(w.endHandle={nodeId:x,handleId:_,type:b},w.isValid=d(k))}return w}var ew={onPointerDown:function(e,n){var t,r=n.connectionMode,o=n.connectionRadius,i=n.handleId,a=n.nodeId,u=n.edgeUpdaterType,c=n.isTarget,l=n.domNode,s=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,w=n.isValidConnection,b=void 0===w?Km:w,x=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),N=0,C=Pm(e),M=C.x,O=C.y,j=null==k?void 0:k.elementFromPoint(M,O),P=$m(u,j),I=null==l?void 0:l.getBoundingClientRect();if(I&&P){var A=Pm(e,I),z=!1,T=null,L=!1,B=null,D=function(e){var n,t,r=e.nodeLookup,o=e.nodeId,i=e.handleId,a=e.handleType,u=[];try{for(var c=F(r),l=c.next();!l.done;l=c.next()){var s=U(l.value,2)[1];if(s.internals.handleBounds){var d="".concat(o,"-").concat(i,"-").concat(a),f=qm(s,s.internals.handleBounds,"source",d),h=qm(s,s.internals.handleBounds,"target",d);u.push.apply(u,W(W([],U(f),!1),U(h),!1))}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(t=c.return)&&t.call(c)}finally{if(n)throw n.error}}return u}({nodeLookup:s,nodeId:a,handleId:i,handleType:P});_({connectionPosition:A,connectionStatus:null,connectionStartHandle:Qm={nodeId:a,handleId:i,type:P},connectionEndHandle:null}),null==g||g(e,{nodeId:a,handleId:i,handleType:P}),k.addEventListener("mousemove",H),k.addEventListener("mouseup",V),k.addEventListener("touchmove",H),k.addEventListener("touchend",V)}function R(){if(f&&I){var e=U(jv(A,I),2),n=e[0],t=e[1];v({x:n,y:t}),N=requestAnimationFrame(R)}}function H(e){S()||V(e);var n=E();A=Pm(e,I),t=function(e,n,t){var r,o,i=[],a=1/0;try{for(var u=F(t),c=u.next();!c.done;c=u.next()){var l=c.value,s=Math.sqrt(Math.pow(l.x-e.x,2)+Math.pow(l.y-e.y,2));s<=n&&(s<a?i=[l]:s===a&&i.push(l),a=s)}}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}(Lv(A,n,!1,[1,1]),o,D),z||(R(),z=!0);var u,l,s,f=Jm(e,{handle:t,connectionMode:r,fromNodeId:a,fromHandleId:i,fromType:c?"target":"source",isValidConnection:b,doc:k,lib:d,flowId:h});B=f.handleDomNode,T=f.connection,L=f.isValid,_({connectionStartHandle:Qm,connectionPosition:t&&L?Bv({x:t.x,y:t.y},n):A,connectionStatus:(u=!!t,l=L,s=null,l?s="valid":u&&!l&&(s="invalid"),s),connectionEndHandle:f.endHandle})}function V(e){(t||B)&&T&&L&&(null==y||y(T)),null==m||m(e),u&&(null==x||x(e)),p(),cancelAnimationFrame(N),z=!1,L=!1,T=null,B=null,Qm=null,k.removeEventListener("mousemove",H),k.removeEventListener("mouseup",V),k.removeEventListener("touchmove",H),k.removeEventListener("touchend",V)}},isValid:Jm};function nw(e,n,t){e.prototype=n.prototype=t,t.constructor=e}function tw(e,n){var t=Object.create(e.prototype);for(var r in n)t[r]=n[r];return t}function rw(){}var ow=.7,iw=1/ow,aw="\\s*([+-]?\\d+)\\s*",uw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",cw="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lw=/^#([0-9a-f]{3,8})$/,sw=new RegExp(`^rgb\\(${aw},${aw},${aw}\\)$`),dw=new RegExp(`^rgb\\(${cw},${cw},${cw}\\)$`),fw=new RegExp(`^rgba\\(${aw},${aw},${aw},${uw}\\)$`),hw=new RegExp(`^rgba\\(${cw},${cw},${cw},${uw}\\)$`),vw=new RegExp(`^hsl\\(${uw},${cw},${cw}\\)$`),pw=new RegExp(`^hsla\\(${uw},${cw},${cw},${uw}\\)$`),gw={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 yw(){return this.rgb().formatHex()}function mw(){return this.rgb().formatRgb()}function ww(e){var n,t;return e=(e+"").trim().toLowerCase(),(n=lw.exec(e))?(t=n[1].length,n=parseInt(n[1],16),6===t?bw(n):3===t?new Ew(n>>8&15|n>>4&240,n>>4&15|240&n,(15&n)<<4|15&n,1):8===t?xw(n>>24&255,n>>16&255,n>>8&255,(255&n)/255):4===t?xw(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=sw.exec(e))?new Ew(n[1],n[2],n[3],1):(n=dw.exec(e))?new Ew(255*n[1]/100,255*n[2]/100,255*n[3]/100,1):(n=fw.exec(e))?xw(n[1],n[2],n[3],n[4]):(n=hw.exec(e))?xw(255*n[1]/100,255*n[2]/100,255*n[3]/100,n[4]):(n=vw.exec(e))?Ow(n[1],n[2]/100,n[3]/100,1):(n=pw.exec(e))?Ow(n[1],n[2]/100,n[3]/100,n[4]):gw.hasOwnProperty(e)?bw(gw[e]):"transparent"===e?new Ew(NaN,NaN,NaN,0):null}function bw(e){return new Ew(e>>16&255,e>>8&255,255&e,1)}function xw(e,n,t,r){return r<=0&&(e=n=t=NaN),new Ew(e,n,t,r)}function _w(e,n,t,r){return 1===arguments.length?((o=e)instanceof rw||(o=ww(o)),o?new Ew((o=o.rgb()).r,o.g,o.b,o.opacity):new Ew):new Ew(e,n,t,null==r?1:r);var o}function Ew(e,n,t,r){this.r=+e,this.g=+n,this.b=+t,this.opacity=+r}function Sw(){return`#${Mw(this.r)}${Mw(this.g)}${Mw(this.b)}`}function kw(){const e=Nw(this.opacity);return`${1===e?"rgb(":"rgba("}${Cw(this.r)}, ${Cw(this.g)}, ${Cw(this.b)}${1===e?")":`, ${e})`}`}function Nw(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Cw(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mw(e){return((e=Cw(e))<16?"0":"")+e.toString(16)}function Ow(e,n,t,r){return r<=0?e=n=t=NaN:t<=0||t>=1?e=n=NaN:n<=0&&(e=NaN),new Pw(e,n,t,r)}function jw(e){if(e instanceof Pw)return new Pw(e.h,e.s,e.l,e.opacity);if(e instanceof rw||(e=ww(e)),!e)return new Pw;if(e instanceof Pw)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 Pw(a,u,c,e.opacity)}function Pw(e,n,t,r){this.h=+e,this.s=+n,this.l=+t,this.opacity=+r}function Iw(e){return(e=(e||0)%360)<0?e+360:e}function Aw(e){return Math.max(0,Math.min(1,e||0))}function zw(e,n,t){return 255*(e<60?n+(t-n)*e/60:e<180?t:e<240?n+(t-n)*(240-e)/60:n)}nw(rw,ww,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yw,formatHex:yw,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return jw(this).formatHsl()},formatRgb:mw,toString:mw}),nw(Ew,_w,tw(rw,{brighter(e){return e=null==e?iw:Math.pow(iw,e),new Ew(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?ow:Math.pow(ow,e),new Ew(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Ew(Cw(this.r),Cw(this.g),Cw(this.b),Nw(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:Sw,formatHex:Sw,formatHex8:function(){return`#${Mw(this.r)}${Mw(this.g)}${Mw(this.b)}${Mw(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:kw,toString:kw})),nw(Pw,(function(e,n,t,r){return 1===arguments.length?jw(e):new Pw(e,n,t,null==r?1:r)}),tw(rw,{brighter(e){return e=null==e?iw:Math.pow(iw,e),new Pw(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?ow:Math.pow(ow,e),new Pw(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 Ew(zw(e>=240?e-240:e+120,o,r),zw(e,o,r),zw(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new Pw(Iw(this.h),Aw(this.s),Aw(this.l),Nw(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=Nw(this.opacity);return`${1===e?"hsl(":"hsla("}${Iw(this.h)}, ${100*Aw(this.s)}%, ${100*Aw(this.l)}%${1===e?")":`, ${e})`}`}}));var Tw=e=>()=>e;function Lw(e,n){var t=n-e;return t?function(e,n){return function(t){return e+t*n}}(e,t):Tw(isNaN(e)?n:e)}var Bw=function e(n){var t=function(e){return 1==(e=+e)?Lw: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):Tw(isNaN(n)?t:n)}}(n);function r(e,n){var r=t((e=_w(e)).r,(n=_w(n)).r),o=t(e.g,n.g),i=t(e.b,n.b),a=Lw(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 Dw(e,n){return e=+e,n=+n,function(t){return e*(1-t)+n*t}}var Rw=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hw=new RegExp(Rw.source,"g");function Vw(e,n){var t,r,o,i=Rw.lastIndex=Hw.lastIndex=0,a=-1,u=[],c=[];for(e+="",n+="";(t=Rw.exec(e))&&(r=Hw.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:Dw(t,r)})),i=Hw.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 Yw,Xw=180/Math.PI,Zw={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Fw(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)*Xw,skewX:Math.atan(c)*Xw,scaleX:a,scaleY:u}}function Uw(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:Dw(e,o)},{i:c-2,x:Dw(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:Dw(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:Dw(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:Dw(e,t)},{i:u-2,x:Dw(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 Ww=Uw((function(e){const n=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return n.isIdentity?Zw:Fw(n.a,n.b,n.c,n.d,n.e,n.f)}),"px, ","px)","deg)"),Gw=Uw((function(e){return null==e?Zw:(Yw||(Yw=document.createElementNS("http://www.w3.org/2000/svg","g")),Yw.setAttribute("transform",e),(e=Yw.transform.baseVal.consolidate())?Fw((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Zw)}),", ",")",")");function qw(e){return((e=Math.exp(e))+1/e)/2}var $w,Kw,Qw=function e(n,t,r){function o(e,o){var i,a,u=e[0],c=e[1],l=e[2],s=o[0],d=o[1],f=o[2],h=s-u,v=d-c,p=h*h+v*v;if(p<1e-12)a=Math.log(f/l)/n,i=function(e){return[u+e*h,c+e*v,l*Math.exp(n*e*a)]};else{var g=Math.sqrt(p),y=(f*f-l*l+r*p)/(2*l*t*g),m=(f*f-l*l-r*p)/(2*f*t*g),w=Math.log(Math.sqrt(y*y+1)-y),b=Math.log(Math.sqrt(m*m+1)-m);a=(b-w)/n,i=function(e){var r,o=e*a,i=qw(w),s=l/(t*g)*(i*(r=n*o+w,((r=Math.exp(2*r))-1)/(r+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[u+s*h,c+s*v,l*i/qw(n*o+w)]}}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),Jw=0,eb=0,nb=0,tb=1e3,rb=0,ob=0,ib=0,ab="object"==typeof performance&&performance.now?performance:Date,ub="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function cb(){return ob||(ub(lb),ob=ab.now()+ib)}function lb(){ob=0}function sb(){this._call=this._time=this._next=null}function db(e,n,t){var r=new sb;return r.restart(e,n,t),r}function fb(){ob=(rb=ab.now())+ib,Jw=eb=0;try{!function(){cb(),++Jw;for(var e,n=$w;n;)(e=ob-n._time)>=0&&n._call.call(void 0,e),n=n._next;--Jw}()}finally{Jw=0,function(){for(var e,n,t=$w,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:$w=n);Kw=e,vb(r)}(),ob=0}}function hb(){var e=ab.now(),n=e-rb;n>tb&&(ib-=n,rb=e)}function vb(e){Jw||(eb&&(eb=clearTimeout(eb)),e-ob>24?(e<1/0&&(eb=setTimeout(fb,e-ab.now()-ib)),nb&&(nb=clearInterval(nb))):(nb||(rb=ab.now(),nb=setInterval(hb,tb)),Jw=1,ub(fb)))}function pb(e,n,t){var r=new sb;return n=null==n?0:+n,r.restart((t=>{r.stop(),e(t+n)}),n,t),r}sb.prototype=db.prototype={constructor:sb,restart:function(e,n,t){if("function"!=typeof e)throw new TypeError("callback is not a function");t=(null==t?cb():+t)+(null==n?0:+n),this._next||Kw===this||(Kw?Kw._next=this:$w=this,Kw=this),this._call=e,this._time=t,vb()},stop:function(){this._call&&(this._call=null,this._time=1/0,vb())}};var gb=qg("start","end","cancel","interrupt"),yb=[],mb=0,wb=2,bb=3,xb=5,_b=6;function Eb(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 l,s,d,f;if(1!==t.state)return u();for(l in o)if((f=o[l]).name===t.name){if(f.state===bb)return pb(i);4===f.state?(f.state=_b,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete o[l]):+l<n&&(f.state=_b,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete o[l])}if(pb((function(){t.state===bb&&(t.state=4,t.timer.restart(a,t.delay,t.time),a(c))})),t.state=wb,t.on.call("start",e,e.__data__,t.index,t.group),t.state===wb){for(t.state=bb,r=new Array(d=t.tween.length),l=0,s=-1;l<d;++l)(f=t.tween[l].value.call(e,e.__data__,t.index,t.group))&&(r[++s]=f);r.length=s+1}}function a(n){for(var o=n<t.duration?t.ease.call(null,n/t.duration):(t.timer.restart(u),t.state=xb,1),i=-1,a=r.length;++i<a;)r[i].call(e,o);t.state===xb&&(t.on.call("end",e,e.__data__,t.index,t.group),u())}function u(){for(var r in t.state=_b,t.timer.stop(),delete o[n],o)return;delete e.__transition}o[n]=t,t.timer=db((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:gb,tween:yb,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:mb})}function Sb(e,n){var t=Nb(e,n);if(t.state>mb)throw new Error("too late; already scheduled");return t}function kb(e,n){var t=Nb(e,n);if(t.state>bb)throw new Error("too late; already running");return t}function Nb(e,n){var t=e.__transition;if(!t||!(t=t[n]))throw new Error("transition not found");return t}function Cb(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>wb&&t.state<xb,t.state=_b,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 Mb(e,n){var t,r;return function(){var o=kb(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 Ob(e,n,t){var r,o;if("function"!=typeof t)throw new Error;return function(){var i=kb(this,e),a=i.tween;if(a!==r){o=(r=a).slice();for(var u={name:n,value:t},c=0,l=o.length;c<l;++c)if(o[c].name===n){o[c]=u;break}c===l&&o.push(u)}i.tween=o}}function jb(e,n,t){var r=e._id;return e.each((function(){var e=kb(this,r);(e.value||(e.value={}))[n]=t.apply(this,arguments)})),function(e){return Nb(e,r).value[n]}}function Pb(e,n){var t;return("number"==typeof n?Dw:n instanceof ww?Bw:(t=ww(n))?(n=t,Bw):Vw)(e,n)}function Ib(e){return function(){this.removeAttribute(e)}}function Ab(e){return function(){this.removeAttributeNS(e.space,e.local)}}function zb(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 Tb(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 Lb(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 Bb(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 Db(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 Rb(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 Hb(e,n){return function(){Sb(this,e).delay=+n.apply(this,arguments)}}function Vb(e,n){return n=+n,function(){Sb(this,e).delay=n}}function Yb(e,n){return function(){kb(this,e).duration=+n.apply(this,arguments)}}function Xb(e,n){return n=+n,function(){kb(this,e).duration=n}}var Zb=lm.prototype.constructor;function Fb(e){return function(){this.style.removeProperty(e)}}var Ub=0;function Wb(e,n,t,r){this._groups=e,this._parents=n,this._name=t,this._id=r}function Gb(){return++Ub}var qb=lm.prototype;Wb.prototype={constructor:Wb,select:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=ay(e));for(var r=this._groups,o=r.length,i=new Array(o),a=0;a<o;++a)for(var u,c,l=r[a],s=l.length,d=i[a]=new Array(s),f=0;f<s;++f)(u=l[f])&&(c=e.call(u,u.__data__,f,l))&&("__data__"in u&&(c.__data__=u.__data__),d[f]=c,Eb(d[f],n,t,f,d,Nb(u,t)));return new Wb(i,this._parents,n,t)},selectAll:function(e){var n=this._name,t=this._id;"function"!=typeof e&&(e=cy(e));for(var r=this._groups,o=r.length,i=[],a=[],u=0;u<o;++u)for(var c,l=r[u],s=l.length,d=0;d<s;++d)if(c=l[d]){for(var f,h=e.call(c,c.__data__,d,l),v=Nb(c,t),p=0,g=h.length;p<g;++p)(f=h[p])&&Eb(f,n,t,p,h,v);i.push(h),a.push(c)}return new Wb(i,a,n,t)},selectChild:qb.selectChild,selectChildren:qb.selectChildren,filter:function(e){"function"!=typeof e&&(e=ly(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]=[],l=0;l<u;++l)(i=a[l])&&e.call(i,i.__data__,l,a)&&c.push(i);return new Wb(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,l=n[u],s=t[u],d=l.length,f=a[u]=new Array(d),h=0;h<d;++h)(c=l[h]||s[h])&&(f[h]=c);for(;u<r;++u)a[u]=n[u];return new Wb(a,this._parents,this._name,this._id)},selection:function(){return new Zb(this._groups,this._parents)},transition:function(){for(var e=this._name,n=this._id,t=Gb(),r=this._groups,o=r.length,i=0;i<o;++i)for(var a,u=r[i],c=u.length,l=0;l<c;++l)if(a=u[l]){var s=Nb(a,n);Eb(a,e,t,l,u,{time:s.time+s.delay+s.duration,delay:0,duration:s.duration,ease:s.ease})}return new Wb(r,this._parents,e,t)},call:qb.call,nodes:qb.nodes,node:qb.node,size:qb.size,empty:qb.empty,each:qb.each,on:function(e,n){var t=this._id;return arguments.length<2?Nb(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)?Sb:kb;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=ny(e),r="transform"===t?Gw:Pb;return this.attrTween(e,"function"==typeof n?(t.local?Bb:Lb)(t,r,jb(this,"attr."+e,n)):null==n?(t.local?Ab:Ib)(t):(t.local?Tb:zb)(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=ny(e);return this.tween(t,(r.local?Db:Rb)(r,n))},style:function(e,n,t){var r="transform"==(e+="")?Ww:Pb;return null==n?this.styleTween(e,function(e,n){var t,r,o;return function(){var i=Iy(this,e),a=(this.style.removeProperty(e),Iy(this,e));return i===a?null:i===t&&a===r?o:o=n(t=i,r=a)}}(e,r)).on("end.style."+e,Fb(e)):"function"==typeof n?this.styleTween(e,function(e,n,t){var r,o,i;return function(){var a=Iy(this,e),u=t(this),c=u+"";return null==u&&(this.style.removeProperty(e),c=u=Iy(this,e)),a===c?null:a===r&&c===o?i:(o=c,i=n(r=a,u))}}(e,r,jb(this,"style."+e,n))).each(function(e,n){var t,r,o,i,a="style."+n,u="end."+a;return function(){var c=kb(this,e),l=c.on,s=null==c.value[a]?i||(i=Fb(n)):void 0;l===t&&o===s||(r=(t=l).copy()).on(u,o=s),c.on=r}}(this._id,e)):this.styleTween(e,function(e,n,t){var r,o,i=t+"";return function(){var a=Iy(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}}(jb(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=Nb(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?Mb:Ob)(t,e,n))},delay:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Hb:Vb)(n,e)):Nb(this.node(),n).delay},duration:function(e){var n=this._id;return arguments.length?this.each(("function"==typeof e?Yb:Xb)(n,e)):Nb(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(){kb(this,e).ease=n}}(n,e)):Nb(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;kb(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=kb(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]:qb[Symbol.iterator]};var $b={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Kb(e,n){for(var t;!(t=e.__transition)||!(t=t[n]);)if(!(e=e.parentNode))throw new Error(`transition ${n} not found`);return t}lm.prototype.interrupt=function(e){return this.each((function(){Cb(this,e)}))},lm.prototype.transition=function(e){var n,t;e instanceof Wb?(n=e._id,e=e._name):(n=Gb(),(t=$b).time=cb(),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,l=0;l<c;++l)(a=u[l])&&Eb(a,e,n,l,u,t||Kb(a,n));return new Wb(r,this._parents,e,n)};var Qb=e=>()=>e;function Jb(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 ex(e,n,t){this.k=e,this.x=n,this.y=t}ex.prototype={constructor:ex,scale:function(e){return 1===e?this:new ex(this.k*e,this.x,this.y)},translate:function(e,n){return 0===e&0===n?this:new ex(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 nx=new ex(1,0,0);function tx(e){for(;!e.__zoom;)if(!(e=e.parentNode))return nx;return e.__zoom}function rx(e){e.stopImmediatePropagation()}function ox(e){e.preventDefault(),e.stopImmediatePropagation()}function ix(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function ax(){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 ux(){return this.__zoom||nx}function cx(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function lx(){return navigator.maxTouchPoints||"ontouchstart"in this}function sx(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))}tx.prototype=ex.prototype;var dx,fx=function(e,n){return e.x!==n.x||e.y!==n.y||e.zoom!==n.k},hx=function(e){return{x:e.x,y:e.y,zoom:e.k}},vx=function(e){var n=e.x,t=e.y,r=e.zoom;return nx.translate(n,t).scale(r)},px=function(e,n){return e.target.closest(".".concat(n))},gx=function(e,n){return 2===n&&Array.isArray(e)&&e.includes(2)},yx=function(e,n){return void 0===n&&(n=0),"number"==typeof n&&n>0?e.transition().duration(n):e},mx=function(e){var n=e.ctrlKey&&Rv()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*n};function wx(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,l=e.onTransformChange,s=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=ix,o=ax,i=sx,a=cx,u=lx,c=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],s=250,d=Qw,f=qg("start","zoom","end"),h=500,v=150,p=0,g=10;function y(e){e.property("__zoom",ux).on("wheel.zoom",S,{passive:!1}).on("mousedown.zoom",k).on("dblclick.zoom",N).filter(u).on("touchstart.zoom",C).on("touchmove.zoom",M).on("touchend.zoom touchcancel.zoom",O).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 ex(n,e.x,e.y)}function w(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 ex(e.k,r,o)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function x(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,l=Math.max(u[1][0]-u[0][0],u[1][1]-u[0][1]),s=e.__zoom,f="function"==typeof n?n.apply(e,i):n,h=d(s.invert(c).concat(l/s.k),f.invert(c).concat(l/f.k));return function(e){if(1===e)e=f;else{var n=h(e),t=l/n[2];e=new ex(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)))),s=dm(e);if(t.wheel)t.mouse[0][0]===s[0]&&t.mouse[0][1]===s[1]||(t.mouse[1]=o.invert(t.mouse[0]=s)),clearTimeout(t.wheel);else{if(o.k===u)return;t.mouse=[s,o.invert(s)],Cb(this),t.start()}ox(e),t.wheel=setTimeout((function(){t.wheel=null,t.end()}),v),t.zoom("mouse",i(w(m(o,u),t.mouse[0],t.mouse[1]),t.extent,l))}}function k(e,...n){if(!t&&r.apply(this,arguments)){var o=e.currentTarget,a=_(this,n,!0).event(e),u=sm(e.view).on("mousemove.zoom",(function(e){if(ox(e),!a.moved){var n=e.clientX-s,t=e.clientY-d;a.moved=n*n+t*t>p}a.event(e).zoom("mouse",i(w(a.that.__zoom,a.mouse[0]=dm(e,o),a.mouse[1]),a.extent,l))}),!0).on("mouseup.zoom",(function(e){u.on("mousemove.zoom mouseup.zoom",null),ym(e.view,a.moved),ox(e),a.event(e).end()}),!0),c=dm(e,o),s=e.clientX,d=e.clientY;gm(e.view),rx(e),a.mouse=[c,this.__zoom.invert(c)],Cb(this),a.start()}}function N(e,...n){if(r.apply(this,arguments)){var t=this.__zoom,a=dm(e.changedTouches?e.changedTouches[0]:e,this),u=t.invert(a),c=t.k*(e.shiftKey?.5:2),d=i(w(m(t,c),a,u),o.apply(this,n),l);ox(e),s>0?sm(this).transition().duration(s).call(x,d,a,e):sm(this).call(y.transform,d,a,e)}}function C(t,...o){if(r.apply(this,arguments)){var i,a,u,c,l=t.touches,s=l.length,d=_(this,o,t.changedTouches.length===s).event(t);for(rx(t),a=0;a<s;++a)c=[c=dm(u=l[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)),Cb(this),d.start())}}function M(e,...n){if(this.__zooming){var t,r,o,a,u=_(this,n).event(e),c=e.changedTouches,s=c.length;for(ox(e),t=0;t<s;++t)o=dm(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(w(r,o,a),u.extent,l))}}function O(e,...r){if(this.__zooming){var o,i,a=_(this,r).event(e),u=e.changedTouches,c=u.length;for(rx(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=dm(i,this),Math.hypot(n[0]-i[0],n[1]-i[1])<g)){var l=sm(this).on("dblclick.zoom");l&&l.apply(this,arguments)}}}return y.transform=function(e,n,t,r){var o=e.selection?e.selection():e;o.property("__zoom",ux),e!==o?x(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(w(m(r,c),a,u),e,l)}),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),l)}),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(nx.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,l)}),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=sm(this.that).datum();f.call(e,this.that,new Jb(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:Qb(+e),y):a},y.filter=function(e){return arguments.length?(r="function"==typeof e?e:Qb(!!e),y):r},y.touchable=function(e){return arguments.length?(u="function"==typeof e?e:Qb(!!e),y):u},y.extent=function(e){return arguments.length?(o="function"==typeof e?e:Qb([[+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?(l[0][0]=+e[0][0],l[1][0]=+e[1][0],l[0][1]=+e[0][1],l[1][1]=+e[1][1],y):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},y.constrain=function(e){return arguments.length?(i=e,y):i},y.duration=function(e){return arguments.length?(s=+e,y):s},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=sm(n).call(h);w({x:i.x,y:i.y,zoom:Cv(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(yx(v,null==n?void 0:n.duration),e))}function m(){h.on("zoom",null)}function w(e,n,t){var r=vx(e),o=null==h?void 0:h.constrain()(r,n,t);return o&&y(o),o}return h.wheelDelta(mx),{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,w=e.panOnScrollSpeed,b=e.preventScrolling,x=e.zoomOnPinch,_=e.zoomOnScroll,E=e.zoomOnDoubleClick,S=e.zoomActivationKeyPressed,k=e.lib;o&&!d.isZoomingOrPanning&&m();var N=!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||px(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,l=e.onPanZoom,s=e.onPanZoomEnd;return function(e){if(px(e,t))return!1;e.preventDefault(),e.stopImmediatePropagation();var d=r.property("__zoom").k||1;if(e.ctrlKey&&u){var f=dm(e),h=mx(e),v=d*Math.pow(2,h);o.scaleTo(r,v,f,e)}else{var p=1===e.deltaMode?20:1,g=i===Nm.Vertical?0:e.deltaX*p,y=i===Nm.Horizontal?0:e.deltaY*p;!Rv()&&e.shiftKey&&i!==Nm.Vertical&&(g=e.deltaY*p,y=0),o.translateBy(r,-g/d*a,-y/d*a,{internal:!0});var m=hx(r.property("__zoom"));clearTimeout(n.panScrollTimeout),n.isPanScrolling||(n.isPanScrolling=!0,null==c||c(e,m)),n.isPanScrolling&&(null==l||l(e,m),n.panScrollTimeout=setTimeout((function(){null==s||s(e,m),n.isPanScrolling=!1}),150))}}}({zoomPanValues:d,noWheelClassName:n,d3Selection:v,d3Zoom:h,panOnScrollMode:y,panOnScrollSpeed:w,zoomOnPinch:x,onPanZoomStart:u,onPanZoom:a,onPanZoomEnd:c});if(v.on("wheel.zoom",N,{passive:!1}),!o){var C=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=hx(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:s,onPanZoomStart:u});h.on("start",C);var M=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||!gx(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,hx(e.transform)))}}({zoomPanValues:d,panOnDrag:f,onPaneContextMenu:!!r,onPanZoom:a,onTransformChange:l});h.on("zoom",M);var O=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&&gx(t,null!==(c=n.mouseButton)&&void 0!==c?c:0)&&!n.usedRightMouseButton&&e.sourceEvent&&a(e.sourceEvent),n.usedRightMouseButton=!1,o(!1),i&&fx(n.prevViewport,e.transform))){var l=hx(e.transform);n.prevViewport=l,clearTimeout(n.timerId),n.timerId=setTimeout((function(){null==i||i(e.sourceEvent,l)}),r?150:0)}}}({zoomPanValues:d,panOnDrag:f,panOnScroll:i,onPaneContextMenu:r,onPanZoomEnd:c,onDraggingChange:s});h.on("end",O)}var j=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,l=e.noPanClassName,s=e.lib;return function(e){var d=n||t,f=r&&e.ctrlKey;if(1===e.button&&"mousedown"===e.type&&(px(e,"".concat(s,"-flow__node"))||px(e,"".concat(s,"-flow__edge"))))return!0;if(!(o||d||i||a||r))return!1;if(u)return!1;if(px(e,c)&&"wheel"===e.type)return!1;if(px(e,l)&&("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:x,userSelectionActive:o,noPanClassName:t,noWheelClassName:n,lib:k});h.filter(j),E?v.on("dblclick.zoom",g):v.on("dblclick.zoom",null)},destroy:m,setViewport:function(e,n){var t=vx(e);return y(t,n),t},setViewportConstrained:w,getViewport:function(){var e=v?tx(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(yx(v,null==n?void 0:n.duration),e))},scaleBy:function(e,n){v&&(null==h||h.scaleBy(yx(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=vx(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"}(dx||(dx={}));Z(Z({},{width:0,height:0,x:0,y:0}),{pointerX:0,pointerY:0,aspectRatio:1});var bx=yv.error001();function xx(e,n){var r=t(Y);if(null===r)throw new Error(bx);return H(r,e,n)}function _x(){var e=t(Y);if(null===e)throw new Error(bx);return r((function(){return{getState:e.getState,setState:e.setState,subscribe:e.subscribe}}),[e])}function Ex(e,n){var t,r,o;void 0===n&&(n={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{}});var i=(null==n?void 0:n.elevateNodesOnSelect)?1e3:0;try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=c.parentId;if(l){if(!e.has(l))throw new Error("Parent node ".concat(l," not found"));var s=e.get(l),d=Sx(c,e,f(f({},c.position),{z:(Ix(c.zIndex)?c.zIndex:0)+(c.selected?i:0)}),null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:n.nodeOrigin),h=d.x,v=d.y,p=d.z,m=c.internals.positionAbsolute,w=h!==m.x||v!==m.y;(w||p!==c.internals.z)&&(c.internals=f(f({},c.internals),{positionAbsolute:w?{x:h,y:v}:m,z:p}))}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}}function Sx(e,n,t,r){var o,i,a,u,c,l;if(void 0===r&&(r=[0,0]),!e.parentId)return t;var s=n.get(e.parentId),d=kx(s,r).position;return Sx(s,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=s.internals.z)&&void 0!==a?a:0)>(null!==(u=t.z)&&void 0!==u?u:0)?null!==(c=s.internals.z)&&void 0!==c?c:0:null!==(l=t.z)&&void 0!==l?l:0},s.origin||r)}var kx=function(e,n){void 0===n&&(n=[0,0]);var t=Px(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 Nx(e,n,t){var r,o;e.clear(),n.clear();try{for(var i=g(t),a=i.next();!a.done;a=i.next()){var u=a.value,c=u.source,l=u.target,s=u.sourceHandle,d=void 0===s?null:s,f=u.targetHandle,h=void 0===f?null:f,v="".concat(c,"-source-").concat(d),p="".concat(l,"-target-").concat(h),y=e.get(v)||new Map,m=e.get(p)||new Map,w={edgeId:u.id,source:c,target:l,sourceHandle:d,targetHandle:h};n.set(u.id,u),e.set(v,y.set("".concat(l,"-").concat(h),w)),e.set(p,m.set("".concat(c,"-").concat(d),w))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(o=i.return)&&o.call(i)}finally{if(r)throw r.error}}}function Cx(e,n,t,r){void 0===r&&(r={nodeOrigin:[0,0],elevateNodesOnSelect:!0,defaults:{},checkEquality:!0});var o=new Map(n);n.clear(),t.clear();var i=(null==r?void 0:r.elevateNodesOnSelect)?1e3:0;e.forEach((function(e){var a,u,c=o.get(e.id);if(r.checkEquality&&e===(null==c?void 0:c.internals.userNode)||(c=f(f(f({},r.defaults),e),{measured:{width:null===(a=e.measured)||void 0===a?void 0:a.width,height:null===(u=e.measured)||void 0===u?void 0:u.height},internals:{positionAbsolute:e.position,handleBounds:null==c?void 0:c.internals.handleBounds,z:(Ix(e.zIndex)?e.zIndex:0)+(e.selected?i:0),userNode:e}})),n.set(e.id,c),e.parentId){var l=t.get(e.parentId);l?l.push(c):t.set(e.parentId,[c])}})),t.size>0&&Ex(n,r)}function Mx(e,n,t,r){var o,i,a,u,c,l=[],s=new Map;try{for(var d=g(e),f=d.next();!f.done;f=d.next()){var h=f.value,v=n.get(h.parentId);if(v){var p=null!==(u=null===(a=s.get(h.parentId))||void 0===a?void 0:a.expandedRect)&&void 0!==u?u:Tx(v,null!==(c=v.origin)&&void 0!==c?c:r),y=Rx(p,h.rect);s.set(h.parentId,{expandedRect:y,parent:v})}}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}return s.size>0&&s.forEach((function(n,r){var o=n.expandedRect,i=n.parent,a=kx(i,i.origin).position,u=Px(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 Ox=function(e,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),Math.min(Math.max(e,n),t)},jx=function(e,n){return void 0===e&&(e={x:0,y:0}),{x:Ox(e.x,n[0][0],n[1][0]),y:Ox(e.y,n[0][1],n[1][1])}};function Px(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 Ix=function(e){return!isNaN(e)&&isFinite(e)},Ax=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])}},zx=function(e,n,t,r){var o=e.x,i=e.y,a=y(n,3),u=a[0],c=a[1],l=a[2];void 0===t&&(t=!1),void 0===r&&(r=[1,1]);var s={x:(o-u)/l,y:(i-c)/l};return t?Ax(s,r):s},Tx=function(e,n){var t,r,o,i,a,u;void 0===n&&(n=[0,0]);var c=kx(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}},Lx=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)}},Bx=function(e){var n=e.x,t=e.y;return{x:n,y:t,x2:n+e.width,y2:t+e.height}},Dx=function(e){var n=e.x,t=e.y;return{x:n,y:t,width:e.x2-n,height:e.y2-t}},Rx=function(e,n){return Dx(Lx(Bx(e),Bx(n)))};function Hx(e){return o(e)}var Vx=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)},Yx=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),l=Ox(c,r,o);return{x:n/2-(e.x+e.width/2)*l,y:t/2-(e.y+e.height/2)*l,zoom:l}};function Xx(e){return void 0!==e&&"parent"!==e}var Zx=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]}},Fx=function(e){return Ux(e)},Ux=function(e){return"id"in e&&"position"in e&&!("source"in e)&&!("target"in e)};var Wx=function(e){return Ix(e.width)&&Ix(e.height)&&Ix(e.x)&&Ix(e.y)},Gx=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},qx=["INPUT","SELECT","TEXTAREA"];function $x(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 qx.includes(null==r?void 0:r.nodeName)||(null==r?void 0:r.hasAttribute("contenteditable"))||!!(null==r?void 0:r.closest(".nokey"))}var Kx=function(e){return"clientX"in e},Qx=function(e,n){var t,r,o,i,a=Kx(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)}},Jx=function(e,n,t,r){void 0===r&&(r=[0,0]);var o=n.querySelectorAll(e);if(!o||!o.length)return null;var i=Array.from(o),a=n.getBoundingClientRect(),u=a.width*r[0],c=a.height*r[1];return i.map((function(e){var n=e.getBoundingClientRect();return f({id:e.getAttribute("data-handleid"),position:e.getAttribute("data-handlepos"),x:(n.left-a.left-u)/t,y:(n.top-a.top-c)/t},Gx(e))}))},e_="undefined"!=typeof document?document:null;function n_(e,n){void 0===e&&(e=null),void 0===n&&(n={target:e_,actInsideInputWithModifier:!0});var t=y(i(!1),2),o=t[0],c=t[1],l=a(!1),s=a(new Set([])),d=y(r((function(){if(null!==e){var n=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),t=n.reduce((function(e,n){return e.concat.apply(e,m([],y(n),!1))}),[]);return[n,t]}return[[],[]]}),[e]),2),f=d[0],h=d[1];return u((function(){var t=(null==n?void 0:n.target)||e_;if(null!==e){var r=function(e){if(l.current=e.ctrlKey||e.metaKey||e.shiftKey,(!l.current||l.current&&!n.actInsideInputWithModifier)&&$x(e))return!1;var t=r_(e.code,h);s.current.add(e[t]),t_(f,s.current,!1)&&(e.preventDefault(),c(!0))},o=function(e){if((!l.current||l.current&&!n.actInsideInputWithModifier)&&$x(e))return!1;var t=r_(e.code,h);t_(f,s.current,!0)?(c(!1),s.current.clear()):s.current.delete(e[t]),"Meta"===e.key&&s.current.clear(),l.current=!1},i=function(){s.current.clear(),c(!1)};return null==t||t.addEventListener("keydown",r),null==t||t.addEventListener("keyup",o),window.addEventListener("blur",i),window.addEventListener("contextmenu",i),function(){null==t||t.removeEventListener("keydown",r),null==t||t.removeEventListener("keyup",o),window.removeEventListener("blur",i),window.removeEventListener("contextmenu",i)}}}),[e,c]),o}function t_(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 r_(e,n){return n.includes(e)?"code":"key"}function o_(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 i_={position:"absolute",width:"100%",height:"100%",top:0,left:0};var a_=function(e){return{userSelectionActive:e.userSelectionActive,lib:e.lib}};function u_(e){var n=e.onPaneContextMenu,t=e.zoomOnScroll,r=void 0===t||t,o=e.zoomOnPinch,i=void 0===o||o,c=e.panOnScroll,l=void 0!==c&&c,s=e.panOnScrollSpeed,d=void 0===s?.5:s,f=e.panOnScrollMode,h=void 0===f?Nm.Free:f,v=e.zoomOnDoubleClick,p=void 0===v||v,g=e.panOnDrag,y=void 0===g||g,m=e.defaultViewport,w=e.translateExtent,b=e.zoomActivationKeyCode,x=e.preventScrolling,_=void 0===x||x,E=e.children,k=e.noWheelClassName,N=e.noPanClassName,C=e.onViewportChange,M=e.isControlledViewport,O=_x(),j=a(null),P=xx(a_,o_),I=P.userSelectionActive,A=P.lib,z=n_(b),T=a();return function(e){var n=_x();u((function(){var t=function(){var t,r;if(!e.current)return!1;var o=Gx(e.current);0!==o.height&&0!==o.width||null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"004",yv.error004()),n.setState({width:o.width||500,height:o.height||500})};if(e.current){t(),window.addEventListener("resize",t);var r=new ResizeObserver((function(){return t()}));return r.observe(e.current),function(){window.removeEventListener("resize",t),r&&e.current&&r.unobserve(e.current)}}}),[])}(j),u((function(){if(j.current){var e=O.getState();T.current=wx({domNode:j.current,minZoom:e.minZoom,maxZoom:e.maxZoom,translateExtent:w,viewport:m,onTransformChange:function(e){null==C||C({x:e[0],y:e[1],zoom:e[2]}),M||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 n=T.current.getViewport(),t=n.x,r=n.y,o=n.zoom;return O.setState({panZoom:T.current,transform:[t,r,o],domNode:j.current.closest(".ink-flow")}),function(){var e;null===(e=T.current)||void 0===e||e.destroy()}}}),[]),u((function(){var e;null===(e=T.current)||void 0===e||e.update({onPaneContextMenu:n,zoomOnScroll:r,zoomOnPinch:i,panOnScroll:l,panOnScrollSpeed:d,panOnScrollMode:h,zoomOnDoubleClick:p,panOnDrag:y,zoomActivationKeyPressed:z,preventScrolling:_,noPanClassName:N,userSelectionActive:I,noWheelClassName:k,lib:A})}),[n,r,i,l,d,h,p,y,z,_,N,I,k,A]),S.jsx("div",{className:"ink-flow__renderer",ref:j,style:i_,children:E})}var c_={actInsideInputWithModifier:!1};function l_(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 s_(e,n){var t,r,o,i,a,u,c=[],l=new Map;try{for(var s=g(e),d=s.next();!d.done;d=s.next()){if("add"!==(_=d.value).type)if("remove"===_.type||"replace"===_.type)l.set(_.id,[_]);else{var h=l.get(_.id);h?h.push(_):l.set(_.id,[_])}else c.push(_.item)}}catch(e){t={error:e}}finally{try{d&&!d.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}try{for(var v=g(n),p=v.next();!p.done;p=v.next()){var y=p.value,m=l.get(y.id);if(m){if("remove"!==m[0].type)if("replace"!==m[0].type){var w=f({},y);try{for(var b=(a=void 0,g(m)),x=b.next();!x.done;x=b.next()){var _;l_(_=x.value,w)}}catch(e){a={error:e}}finally{try{x&&!x.done&&(u=b.return)&&u.call(b)}finally{if(a)throw a.error}}c.push(w)}else c.push(f({},m[0].item))}else c.push(y)}}catch(e){o={error:e}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(o)throw o.error}}return c}function d_(e,n){return s_(e,n)}function f_(e,n){return s_(e,n)}function h_(e,n){return{id:e,type:"select",selected:n}}function v_(e,n,t){var r,o;void 0===n&&(n=new Set),void 0===t&&(t=!1);var i=[];try{for(var a=g(e),u=a.next();!u.done;u=a.next()){var c=y(u.value,2),l=c[0],s=c[1],d=n.has(l);void 0===s.selected&&!d||s.selected===d||(t&&(s.selected=d),i.push(h_(s.id,d)))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}return i}function p_(e){var n,t,r,o,i,a,u=e.items,c=void 0===u?[]:u,l=e.lookup,s=[],d=new Map(c.map((function(e){return[e.id,e]})));try{for(var f=g(c),h=f.next();!h.done;h=f.next()){var v=h.value,p=l.get(v.id),m=null!==(a=null===(i=null==p?void 0:p.internals)||void 0===i?void 0:i.userNode)&&void 0!==a?a:p;void 0!==m&&m!==v&&s.push({id:v.id,item:v,type:"replace"}),void 0===m&&s.push({item:v,type:"add"})}}catch(e){n={error:e}}finally{try{h&&!h.done&&(t=f.return)&&t.call(f)}finally{if(n)throw n.error}}try{for(var w=g(l),b=w.next();!b.done;b=w.next()){var x=y(b.value,1)[0];void 0===d.get(x)&&s.push({id:x,type:"remove"})}}catch(e){r={error:e}}finally{try{b&&!b.done&&(o=w.return)&&o.call(w)}finally{if(r)throw r.error}}return s}function g_(e){return{id:e.id,type:"remove"}}var y_=function(e,n){void 0===n&&(n=[0,0]);var t=Px(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}}},m_=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=kx(e,n).positionAbsolute,l=c.x,s=c.y;return{x:l,y:s,x2:l+(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:s+(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 Lx(e,r)}),{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Dx(t)},w_=function(e,n,t,r,o,i){var a,u,c,l,s,d,h,v,p=y(void 0===t?[0,0,1]:t,3),m=p[0],w=p[1],b=p[2];void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=[0,0]);var x=f(f({},zx(n,[m,w,b])),{width:n.width/b,height:n.height/b}),_=[];try{for(var E=g(e),S=E.next();!S.done;S=E.next()){var k=y(S.value,2)[1],N=k.measured,C=k.selectable,M=void 0===C||C,O=k.hidden,j=void 0!==O&&O,P=null!==(s=null!==(l=null!==(c=N.width)&&void 0!==c?c:k.width)&&void 0!==l?l:k.initialWidth)&&void 0!==s?s:null,I=null!==(v=null!==(h=null!==(d=N.height)&&void 0!==d?d:k.height)&&void 0!==h?h:k.initialHeight)&&void 0!==v?v:null;if(!(o&&!M||j)){var A=Vx(x,Tx(k,i));(null===P||null===I||r&&A>0||A>=(null!=P?P:0)*(null!=I?I:0)||k.dragging)&&_.push(k)}}}catch(e){a={error:e}}finally{try{S&&!S.done&&(u=E.return)&&u.call(E)}finally{if(a)throw a.error}}return _},b_=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 x_(e,n){var t,r,o,i=e.nodeLookup,a=e.width,u=e.height,c=e.panZoom,l=e.minZoom,s=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=m_(h,{nodeOrigin:f}),g=p.width>=a||p.height>=u;if("overflow"===(null==n?void 0:n.when)&&!g)return;var y=Yx(p,a,u,null!==(t=null==n?void 0:n.minZoom)&&void 0!==t?t:l,null!==(r=null==n?void 0:n.maxZoom)&&void 0!==r?r:s,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 __(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),l=c.parentId?r.get(c.parentId):void 0,s=l?y_(l,l.origin||i).positionAbsolute:{x:0,y:0},d=s.x,f=s.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)l&&Xx(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(l){var v=c.measured.width,p=c.measured.height,g=l.measured.width,y=l.measured.height;if(v&&p&&g&&y){var m=c.origin||i,w=d+v*m[0],b=f+p*m[1];h=[[w,b],[w+g-v,b+y-p]]}}else null==u||u("005",yv.error005());var x=Xx(h)?jx(t,h):t;return{position:{x:x.x-d,y:x.y-f},positionAbsolute:x}}function E_(e){return v(this,arguments,void 0,(function(e){var n,t,r,o,i,a,u,c,l,s,d,f,h,v,y,m,w,b,x,_=e.nodesToRemove,E=void 0===_?[]:_,S=e.edgesToRemove,k=void 0===S?[]:S,N=e.nodes,C=e.edges,M=e.onBeforeDelete;return p(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=g(N),i=o.next();!i.done;i=o.next())a=i.value,r(a)}catch(e){m={error:e}}finally{try{i&&!i.done&&(w=o.return)&&w.call(o)}finally{if(m)throw m.error}}u=new Set(k.map((function(e){return e.id}))),c=C.filter((function(e){return!1!==e.deletable})),l=b_(t,c),s=l,d=function(e){u.has(e.id)&&!s.find((function(n){return n.id===e.id}))&&s.push(e)};try{for(f=g(c),h=f.next();!h.done;h=f.next())v=h.value,d(v)}catch(e){b={error:e}}finally{try{h&&!h.done&&(x=f.return)&&x.call(f)}finally{if(b)throw b.error}}return M?[4,M({nodes:t,edges:s})]:[2,{edges:s,nodes:t}];case 1:return"boolean"==typeof(y=e.sent())?[2,y?{edges:s,nodes:t}:{edges:[],nodes:[]}]:[2,y]}}))}))}var S_=function(e){return{userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect}};function k_(){var e=xx(S_,o_),n=e.userSelectionActive,t=e.userSelectionRect;return n&&t?S.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 N_=function(e,n){return function(t){t.target===n.current&&(null==e||e(t))}},C_=function(e){return{userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,dragging:e.paneDragging}};function M_(e){var n=e.isSelecting;e.selectionMode;var t=e.panOnDrag,r=e.onSelectionStart,o=e.onSelectionEnd,i=e.onPaneClick,u=e.onPaneContextMenu,c=e.onPaneScroll,l=e.onPaneMouseEnter,s=e.onPaneMouseMove,d=e.onPaneMouseLeave,f=e.children,h=a(null),v=_x(),p=a(0),m=a(0),w=a(),b=a(new Map),x=xx(C_,o_),_=x.userSelectionActive,E=x.elementsSelectable,k=x.dragging,N=function(){v.setState({userSelectionActive:!1,userSelectionRect:null}),p.current=0,m.current=0},C=function(e){null==i||i(e),v.getState().resetSelectedElements(),v.setState({nodesSelectionActive:!1})},M=c?function(e){return c(e)}:void 0,j=E&&(n||_);return S.jsxs("div",{className:O(["ink-flow__pane",{draggable:t,dragging:k,selection:n}]),onClick:j?void 0:N_(C,h),onContextMenu:N_((function(e){Array.isArray(t)&&(null==t?void 0:t.includes(2))?e.preventDefault():null==u||u(e)}),h),onWheel:N_(M,h),onMouseEnter:j?void 0:l,onMouseDown:j?function(e){var t,o,i,a,u=v.getState(),c=u.resetSelectedElements,l=u.domNode,s=u.edgeLookup;if(w.current=null==l?void 0:l.getBoundingClientRect(),E&&n&&0===e.button&&e.target===h.current&&w.current){b.current=new Map;try{for(var d=g(s),f=d.next();!f.done;f=d.next()){var p=y(f.value,2),m=p[0],x=p[1];b.current.set(x.source,(null===(i=b.current.get(x.source))||void 0===i?void 0:i.add(m))||new Set([m])),b.current.set(x.target,(null===(a=b.current.get(x.target))||void 0===a?void 0:a.add(m))||new Set([m]))}}catch(e){t={error:e}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(t)throw t.error}}var _=Qx(e.nativeEvent,w.current),S=_.x,k=_.y;c(),v.setState({userSelectionRect:{width:0,height:0,startX:S,startY:k,x:S,y:k}}),null==r||r(e)}}:void 0,onMouseMove:j?function(e){var t,r,o,i,a=v.getState(),u=a.userSelectionRect,c=a.edgeLookup,l=a.transform,s=a.nodeOrigin,d=a.nodeLookup,f=a.triggerNodeChanges,h=a.triggerEdgeChanges;if(n&&w.current&&u){var y=Qx(e.nativeEvent,w.current),x=y.x,_=y.y,E=u.startX,S=u.startY,k={startX:E,startY:S,x:x<E?x:E,y:_<S?_:S,width:Math.abs(x-E),height:Math.abs(_-S)},N=w_(d,k,l,!1,!0,s),C=new Set,M=new Set;try{for(var O=g(N),j=O.next();!j.done;j=O.next()){var P=j.value;M.add(P.id);var I=b.current.get(P.id);if(I)try{for(var A=(o=void 0,g(I)),z=A.next();!z.done;z=A.next()){var T=z.value;C.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){t={error:e}}finally{try{j&&!j.done&&(r=O.return)&&r.call(O)}finally{if(t)throw t.error}}if(p.current!==M.size)p.current=M.size,f(v_(d,M,!0));if(m.current!==C.size)m.current=C.size,h(v_(c,C));v.setState({userSelectionRect:k,userSelectionActive:!0,nodesSelectionActive:!1})}}:s,onMouseUp:j?function(e){if(0===e.button){var n=v.getState().userSelectionRect;!_&&n&&e.target===h.current&&(null==C||C(e)),v.setState({nodesSelectionActive:p.current>0}),N(),null==o||o(e)}}:void 0,onMouseLeave:j?function(e){_&&(v.setState({nodesSelectionActive:p.current>0}),null==o||o(e)),N()}:d,ref:h,style:i_,children:[f,S.jsx(k_,{})]})}var O_=function(e){return{nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive}};function j_(e){var n=e.children,t=e.onPaneClick,r=e.onPaneMouseEnter,o=e.onPaneMouseMove,i=e.onPaneMouseLeave,a=e.onPaneContextMenu,c=e.onPaneScroll,l=e.deleteKeyCode,s=e.selectionKeyCode,d=e.selectionOnDrag,f=e.selectionMode,h=e.onSelectionStart,v=e.onSelectionEnd,p=e.multiSelectionKeyCode,g=e.panActivationKeyCode,y=e.zoomActivationKeyCode,m=e.elementsSelectable,w=e.zoomOnScroll,b=e.zoomOnPinch,x=e.panOnScroll,_=e.panOnScrollSpeed,E=e.panOnScrollMode,k=e.zoomOnDoubleClick,N=e.panOnDrag,C=e.defaultViewport,M=e.translateExtent,O=e.minZoom,j=e.maxZoom,P=e.preventScrolling;e.onSelectionContextMenu;var I=e.noWheelClassName,A=e.noPanClassName;e.disableKeyboardA11y;var z=e.onViewportChange,T=e.isControlledViewport,L=xx(O_);L.nodesSelectionActive;var B=L.userSelectionActive,D=n_(s),R=n_(g),H=R||N,V=R||x,Y=D||B||d&&!0!==H;return function(e){var n=e.deleteKeyCode,t=e.multiSelectionKeyCode,r=_x(),o=n_(n,c_),i=n_(t);u((function(){if(o){var e=r.getState();e.edges,e.nodes,r.setState({nodesSelectionActive:!1})}}),[o]),u((function(){r.setState({multiSelectionActive:i})}),[i])}({deleteKeyCode:l,multiSelectionKeyCode:p}),S.jsx(u_,{onPaneContextMenu:a,elementsSelectable:m,zoomOnScroll:w,zoomOnPinch:b,panOnScroll:V,panOnScrollSpeed:_,panOnScrollMode:E,zoomOnDoubleClick:k,panOnDrag:!D&&H,defaultViewport:C,translateExtent:M,minZoom:O,maxZoom:j,zoomActivationKeyCode:y,preventScrolling:P,noWheelClassName:I,noPanClassName:A,onViewportChange:z,isControlledViewport:T,children:S.jsx(M_,{onSelectionStart:h,onSelectionEnd:v,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:o,onPaneMouseLeave:i,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:H,isSelecting:!!Y,selectionMode:f,children:n})})}j_.displayName="FlowRenderer";var P_=c(j_);function I_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return d_(e,n)}))}),[]);return[t,r,o]}function A_(e){var n=y(i(e),2),t=n[0],r=n[1],o=l((function(e){return r((function(n){return f_(e,n)}))}),[]);return[t,r,o]}var z_="undefined"!=typeof window?s:u;function T_(e){var n=y(i(!1),2),t=n[0],r=n[1],o=y(i((function(){return function(e){var n=[];return{get:function(){return n},reset:function(){n=[]},push:function(t){n.push(t),e()}}}((function(){return r(!0)}))})),1),a=o[0];return z_((function(){if(t){var n=a.get();n.length&&(e(n),a.reset()),r(!1)}else a.reset()}),[t]),a}var L_=n(null);function B_(e){var n=e.children,t=_x(),o=l((function(e){var n,r,o=t.getState(),i=o.nodes,a=void 0===i?[]:i,u=o.setNodes,c=o.hasDefaultNodes,l=o.onNodesChange,s=o.nodeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(p_({items:d,lookup:s}))}),[]),i=T_(o),a=l((function(e){var n,r,o=t.getState(),i=o.edges,a=void 0===i?[]:i,u=o.setEdges,c=o.hasDefaultEdges,l=o.onEdgesChange,s=o.edgeLookup,d=a;try{for(var f=g(e),h=f.next();!h.done;h=f.next()){var v=h.value;d="function"==typeof v?v(d):v}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}c?u(d):l&&l(p_({items:d,lookup:s}))}),[]),u=T_(a),c=r((function(){return{nodeQueue:i,edgeQueue:u}}),[]);return S.jsx(L_.Provider,{value:c,children:n})}var D_=function(){var e=_x();return r((function(){return{zoomIn:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1.2,{duration:null==n?void 0:n.duration})},zoomOut:function(n){var t;return null===(t=e.getState().panZoom)||void 0===t?void 0:t.scaleBy(1/1.2,{duration:null==n?void 0:n.duration})},zoomTo:function(n,t){var r;return null===(r=e.getState().panZoom)||void 0===r?void 0:r.scaleTo(n,{duration:null==t?void 0:t.duration})},getZoom:function(){return e.getState().transform[2]},setViewport:function(n,t){var r,o,i,a=e.getState(),u=y(a.transform,3),c=u[0],l=u[1],s=u[2],d=a.panZoom;null==d||d.setViewport({x:null!==(r=n.x)&&void 0!==r?r:c,y:null!==(o=n.y)&&void 0!==o?o:l,zoom:null!==(i=n.zoom)&&void 0!==i?i:s},{duration:null==t?void 0:t.duration})},getViewport:function(){var n=y(e.getState().transform,3);return{x:n[0],y:n[1],zoom:n[2]}},fitView:function(n){var t=e.getState(),r=t.nodeLookup,o=t.width,i=t.height,a=t.nodeOrigin,u=t.minZoom,c=t.maxZoom,l=t.panZoom;return!!l&&x_({nodeLookup:r,width:o,height:i,nodeOrigin:a,minZoom:u,maxZoom:c,panZoom:l},n)},setCenter:function(n,t,r){var o=e.getState(),i=o.width,a=o.height,u=o.panZoom,c=o.transform,l=void 0!==(null==r?void 0:r.zoom)?r.zoom:c[2],s=i/2-n*l,d=a/2-t*l;null==u||u.setViewport({x:s,y:d,zoom:l},{duration:null==r?void 0:r.duration})},fitBounds:function(n,t){var r,o=e.getState(),i=o.width,a=o.height,u=o.minZoom,c=o.maxZoom,l=o.panZoom,s=Yx(n,i,a,u,c,null!==(r=null==t?void 0:t.padding)&&void 0!==r?r:.1);null==l||l.setViewport(s,{duration:null==t?void 0:t.duration})},screenToFlowPosition:function(n,t){void 0===t&&(t={snapToGrid:!0});var r=e.getState(),o=r.transform,i=r.snapGrid,a=r.domNode;if(!a)return n;var u=a.getBoundingClientRect(),c=u.x,l=u.y,s={x:n.x-c,y:n.y-l};return zx(s,o,t.snapToGrid,i)},flowToScreenPosition:function(n){var t=e.getState(),r=t.transform,o=t.domNode;if(!o)return n;var i=o.getBoundingClientRect(),a=i.x,u=i.y,c=function(e,n){var t=e.x,r=e.y,o=y(n,3),i=o[0],a=o[1],u=o[2];return{x:t*u+i,y:r*u+a}}(n,r);return{x:c.x+a,y:c.y+u}}}}),[])},R_=function(e){return!!e.panZoom};function H_(){var e=this,n=D_(),o=_x(),i=function(){var e=t(L_);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),a=xx(R_);console.log("yk store",o.getState());var u=r((function(){var n=function(e){return o.getState().nodeLookup.get(e)},t=function(e){i.nodeQueue.push(e)},r=function(e){var n,t,r,i,a=o.getState(),u=a.nodeLookup,c=a.nodeOrigin,l=Fx(e)?e:u.get(e.id),s=l.parentId?function(e,n,t,r){var o,i;void 0===r&&(r=[0,0]);for(var a=n,u=f({},e);a;){var c=t.get(n);if(a=null==c?void 0:c.parentId,c){var l=c.origin||r,s=(null!==(o=c.measured.width)&&void 0!==o?o:0)*l[0],d=(null!==(i=c.measured.height)&&void 0!==i?i:0)*l[1];u.x+=c.position.x-s,u.y+=c.position.y-d}}return u}(l.position,l.parentId,u,c):l.position,d={id:l.id,position:s,width:null!==(t=null===(n=l.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:l.width,height:null!==(i=null===(r=l.measured)||void 0===r?void 0:r.height)&&void 0!==i?i:l.height,data:l.data};return Tx(d)},a=function(e,n,r){void 0===r&&(r={replace:!1}),t((function(t){return t.map((function(t){if(t.id===e){var o="function"==typeof n?n(t):n;return r.replace&&Fx(o)?o:f(f({},t),o)}return t}))}))};return{getNodes:function(){return o.getState().nodes.map((function(e){return f({},e)}))},getNode:function(e){var t;return null===(t=n(e))||void 0===t?void 0:t.internals.userNode},getInternalNode:n,getEdges:function(){var e=o.getState().edges;return(void 0===e?[]:e).map((function(e){return f({},e)}))},getEdge:function(e){return o.getState().edgeLookup.get(e)},setNodes:t,setEdges:function(e){i.edgeQueue.push(e)},addNodes:function(e){var n=Array.isArray(e)?e:[e];i.nodeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},addEdges:function(e){var n=Array.isArray(e)?e:[e];i.edgeQueue.push((function(e){return m(m([],y(e),!1),y(n),!1)}))},toObject:function(){var e=o.getState(),n=e.nodes,t=void 0===n?[]:n,r=e.edges,i=void 0===r?[]:r,a=y(e.transform,3),u=a[0],c=a[1],l=a[2];return{nodes:t.map((function(e){return f({},e)})),edges:i.map((function(e){return f({},e)})),viewport:{x:u,y:c,zoom:l}}},deleteElements:function(n){return v(e,[n],void 0,(function(e){var n,t,r,i,a,u,c,l,s,d,f,h,v,g,y,m,w=e.nodes,b=void 0===w?[]:w,x=e.edges,_=void 0===x?[]:x;return p(this,(function(e){switch(e.label){case 0:return n=o.getState(),t=n.nodes,r=n.edges,i=n.onNodesDelete,a=n.onEdgesDelete,u=n.triggerNodeChanges,c=n.triggerEdgeChanges,l=n.onDelete,s=n.onBeforeDelete,[4,E_({nodesToRemove:b,edgesToRemove:_,nodes:t,edges:r,onBeforeDelete:s})];case 1:return d=e.sent(),f=d.nodes,h=d.edges,v=h.length>0,g=f.length>0,v&&(y=h.map(g_),null==a||a(h),c(y)),g&&(m=f.map(g_),null==i||i(f),u(m)),(g||v)&&(null==l||l({nodes:f,edges:h})),[2,{deletedNodes:f,deletedEdges:h}]}}))}))},getIntersectingNodes:function(e,n,t){void 0===n&&(n=!0);var i=Wx(e),a=i?e:r(e),u=void 0!==t;return a?(t||o.getState().nodes).filter((function(t){var r=o.getState().nodeLookup.get(t.id);if(r&&!i&&(t.id===e.id||!r.internals.positionAbsolute))return!1;var c=Tx(u?t:r),l=Vx(c,a);return n&&l>0||l>=a.width*a.height})):[]},isNodeIntersecting:function(e,n,t){void 0===t&&(t=!0);var o=Wx(e)?e:r(e);if(!o)return!1;var i=Vx(o,n);return t&&i>0||i>=o.width*o.height},updateNode:a,updateNodeData:function(e,n,t){void 0===t&&(t={replace:!1}),a(e,(function(e){var r="function"==typeof n?n(e):n;return t.replace?f(f({},e),{data:r}):f(f({},e),{data:f(f({},e.data),r)})}),t)},checkAllNodeBeMeasured:function(){return o.getState().nodes.every((function(e){return e.measured}))}}}),[]);return r((function(){return f(f(f({},u),n),{viewportInitialized:a})}),[a])}var V_=function(e){return e.updateNodeInternals};var Y_=function(e){return function(n){return e?w_(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 X_=n(null),Z_=X_.Provider;X_.Consumer;var F_="ink-flow__node-desc",U_="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 G_(e,n){return e>=0?.5*e:25*n*Math.sqrt(-e)}function q_(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2,a=e.c;switch(n){case jm.Left:return[t-G_(t-o,a),r];case jm.Right:return[t+G_(o-t,a),r];case jm.Top:return[t,r-G_(r-i,a)];case jm.Bottom:return[t,r+G_(i-r,a)]}}function $_(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_,Q_=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 J_=((K_={})[jm.Left]={x:-1,y:0},K_[jm.Right]={x:1,y:0},K_[jm.Top]={x:0,y:-1},K_[jm.Bottom]={x:0,y:1},K_),eE=function(e){var n=e.source,t=e.sourcePosition,r=void 0===t?jm.Bottom:t,o=e.target;return r===jm.Left||r===jm.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}},nE=function(e,n){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))};function tE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.borderRadius,s=void 0===l?5:l,d=e.centerX,f=e.centerY,h=e.offset,v=y(function(e){var n,t,r,o,i=e.source,a=e.sourcePosition,u=void 0===a?jm.Bottom:a,c=e.target,l=e.targetPosition,s=void 0===l?jm.Top:l,d=e.center,f=e.offset,h=J_[u],v=J_[s],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},w=eE({source:p,sourcePosition:u,target:g}),b=0!==w.x?"x":"y",x=w[b],_=[],E={x:0,y:0},S={x:0,y:0},k=y($_({sourceX:i.x,sourceY:i.y,targetX:c.x,targetY:c.y}),4),N=k[0],C=k[1],M=k[2],O=k[3];if(h[b]*v[b]==-1){r=null!==(n=d.x)&&void 0!==n?n:N,o=null!==(t=d.y)&&void 0!==t?t:C;var j=[{x:r,y:p.y},{x:r,y:g.y}],P=[{x:p.x,y:o},{x:g.x,y:o}];_=h[b]===x?"x"===b?j:P:"x"===b?P:j}else{var I=[{x:p.x,y:g.y}],A=[{x:g.x,y:p.y}];if(_="x"===b?h.x===x?A:I:h.y===x?I:A,u===s){var z=Math.abs(i[b]-c[b]);if(z<=f){var T=Math.min(f-1,f-z);h[b]===x?E[b]=(p[b]>i[b]?-1:1)*T:S[b]=(g[b]>c[b]?-1:1)*T}}if(u!==s){var L="x"===b?"y":"x",B=h[b]===v[L],D=p[L]>g[L],R=p[L]<g[L];(1===h[b]&&(!B&&D||B&&R)||1!==h[b]&&(!B&&R||B&&D))&&(_="x"===b?I:A)}var H={x:p.x+E.x,y:p.y+E.y},V={x:g.x+S.x,y:g.y+S.y};Math.max(Math.abs(H.x-_[0].x),Math.abs(V.x-_[0].x))>=Math.max(Math.abs(H.y-_[0].y),Math.abs(V.y-_[0].y))?(r=(H.x+V.x)/2,o=_[0].y):(r=_[0].x,o=(H.y+V.y)/2)}return[m(m([i,{x:p.x+E.x,y:p.y+E.y}],y(_),!1),[{x:g.x+S.x,y:g.y+S.y},c],!1),r,o,M,O]}({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],w=v[2],b=v[3],x=v[4],_=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(nE(e,n)/2,nE(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 l=e.x<t.x?1:-1,s=e.y<t.y?-1:1;return"L ".concat(i,",").concat(a+o*s,"Q ").concat(i,",").concat(a," ").concat(i+o*l,",").concat(a)}(p[t-1],n,p[t+1],s):"".concat(0===t?"M":"L").concat(n.x," ").concat(n.y),e+=r}),"");return[_,g,w,b,x]}var rE=function(e){return{connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}};var oE=c(Hx((function(e,n){var r,o,i=e.type,a=void 0===i?"source":i,u=e.position,c=void 0===u?jm.Top:u,l=e.isValidConnection,s=e.isConnectable,d=void 0===s||s,v=e.isConnectableStart,p=void 0===v||v,g=e.isConnectableEnd,y=void 0===g||g,m=e.id,w=e.onConnect,b=e.children,x=e.className,_=e.onMouseDown,E=e.onTouchStart,k=h(e,["type","position","isValidConnection","isConnectable","isConnectableStart","isConnectableEnd","id","onConnect","children","className","onMouseDown","onTouchStart"]),N=m||null,C="target"===a,M=_x(),j=t(X_),P=xx(rE,o_),I=P.connectOnClick,A=P.noPanClassName,z=P.rfId,T=xx(function(e,n,t){return function(r){var o=r.connectionStartHandle,i=r.connectionEndHandle,a=r.connectionClickStartHandle,u=r.connectionMode,c=r.connectionStatus,l=(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:l,clickConnecting:(null==a?void 0:a.nodeId)===e&&(null==a?void 0:a.handleId)===n&&(null==a?void 0:a.type)===t,isPossibleEndHandle:u===km.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:l&&"valid"===c}}}(j,N,a),o_),L=T.connectingFrom,B=T.connectingTo,D=T.clickConnecting,R=T.isPossibleEndHandle,H=T.connectionInProcess,V=T.valid;j||null===(o=(r=M.getState()).onError)||void 0===o||o.call(r,"010",yv.error010());var Y=function(e){var n=M.getState(),t=n.defaultEdgeOptions,r=n.onConnect,o=n.hasDefaultEdges,i=f(f({},t),e);if(o){var a=M.getState(),u=a.edges;(0,a.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))}))}(t="id"in(r=e)&&"source"in r&&"target"in r?f({},e):f(f({},e),{id:Q_(e)}),n)?n:(null===t.sourceHandle&&delete t.sourceHandle,null===t.targetHandle&&delete t.targetHandle,n.concat(t)):n;var t,r}(i,u))}null==r||r(i),null==w||w(i)},X=function(e){if(j){var n=Kx(e.nativeEvent);if(p&&(n&&0===e.button||!n)){var t=M.getState();ew.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:C,handleId:N,nodeId:j,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:Y,isValidConnection:l||t.isValidConnection,getTransform:function(){return M.getState().transform},getConnectionStartHandle:function(){return M.getState().connectionStartHandle}})}n?null==_||_(e):null==E||E(e)}};return S.jsx("div",f({"data-handleid":N,"data-nodeid":j,"data-handlepos":c,"data-id":"".concat(z,"-").concat(j,"-").concat(N,"-").concat(a),className:O(["ink-flow__handle","ink-flow__handle-".concat(c),"nodrag",A,x,{source:!C,target:C,connectable:d,connectablestart:p,connectableend:y,clickconnecting:D,connectingfrom:L,connectingto:B,valid:V,connectionindicator:d&&(!H||R)&&(H?y:p)}]),onMouseDown:X,onTouchStart:X,onClick:I?function(e){var n=M.getState(),t=n.onClickConnectStart,r=n.onClickConnectEnd,o=n.connectionClickStartHandle,i=n.connectionMode,u=n.isValidConnection,c=n.lib,s=n.rfId;if(j&&(o||p)){if(!o)return null==t||t(e.nativeEvent,{nodeId:j,handleId:N,handleType:a}),void M.setState({connectionClickStartHandle:{nodeId:j,type:a,handleId:N}});var d=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=l||u,h=ew.isValid(e.nativeEvent,{handle:{nodeId:j,id:N,type:a},connectionMode:i,fromNodeId:o.nodeId,fromHandleId:o.handleId||null,fromType:o.type,isValidConnection:f,flowId:s,doc:d,lib:c}),v=h.connection;h.isValid&&v&&Y(v),null==r||r(e),M.setState({connectionClickStartHandle:null})}}:void 0,ref:n},k,{children:b}))})));var iE={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},aE={input:function(e){var n=e.data,t=e.isConnectable,r=e.sourcePosition,o=void 0===r?jm.Bottom:r;return S.jsxs(S.Fragment,{children:[null==n?void 0:n.label,S.jsx(oE,{type:"source",position:o,isConnectable:t})]})},default:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?jm.Top:r,i=e.sourcePosition,a=void 0===i?jm.Bottom:i;return S.jsxs(S.Fragment,{children:[S.jsx(oE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label,S.jsx(oE,{type:"source",position:a,isConnectable:t})]})},output:function(e){var n=e.data,t=e.isConnectable,r=e.targetPosition,o=void 0===r?jm.Top:r;return S.jsxs(S.Fragment,{children:[S.jsx(oE,{type:"target",position:o,isConnectable:t}),null==n?void 0:n.label]})},group:function(){return null}};function uE(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,l=a.multiSelectionActive,s=a.nodeLookup,d=a.onError,f=s.get(n);f?(t.setState({nodesSelectionActive:!1}),f.selected?(o||f.selected&&l)&&(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",yv.error012(n))}var cE=function(e){return function(n){return n.selected&&(n.draggable||e&&void 0===n.draggable)}};function lE(e){var n,t=e.id,r=e.onClick,o=e.onMouseEnter,c=e.onMouseMove,s=e.onMouseLeave,d=e.onContextMenu,h=e.onDoubleClick,v=e.nodesDraggable,p=e.elementsSelectable,m=e.nodesConnectable,w=e.nodesFocusable,b=e.resizeObserver,x=e.noDragClassName,_=e.noPanClassName,E=e.disableKeyboardA11y,k=e.rfId,N=e.nodeTypes,C=e.nodeExtent,M=e.nodeOrigin,j=e.onError,P=xx((function(e){var n=e.nodeLookup.get(t),r=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:r}}),o_),I=P.node,A=P.internals,z=P.isParent,T=I.type||"default",L=(null==N?void 0:N[T])||aE[T];void 0===L&&(null==j||j("003",yv.error003(T)),T="default",L=aE.default);var B=!!(I.draggable||v&&void 0===I.draggable),D=!!(I.selectable||p&&void 0===I.selectable),R=!!(I.connectable||m&&void 0===I.connectable),H=!!(I.focusable||w&&void 0===I.focusable),V=_x(),Y=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)}(I),X=function(e){var n=e.node,t=e.nodeType,r=e.hasDimensions,o=e.resizeObserver,i=_x(),c=a(null),l=a(null),s=a(n.sourcePosition),d=a(n.targetPosition),f=a(t),h=r&&!!n.internals.handleBounds&&!n.hidden;return u((function(){!c.current||h&&l.current===c.current||(l.current&&(null==o||o.unobserve(l.current)),null==o||o.observe(c.current),l.current=c.current)}),[h]),u((function(){return function(){l.current&&(null==o||o.unobserve(l.current),l.current=null)}}),[]),u((function(){if(c.current){var e=f.current!==t,r=s.current!==n.sourcePosition,o=d.current!==n.targetPosition;(e||r||o)&&(f.current=t,s.current=n.sourcePosition,d.current=n.targetPosition,i.getState().updateNodeInternals(new Map([[n.id,{id:n.id,nodeElement:c.current,force:!0}]])))}}),[n.id,t,n.sourcePosition,n.targetPosition]),c}({node:I,nodeType:T,hasDimensions:Y,resizeObserver:b}),Z=function(e){var n=e.nodeRef,t=e.disabled,r=void 0!==t&&t,o=e.noDragClassName,c=e.handleSelector,l=e.nodeId,s=e.isSelectable,d=_x(),f=y(i(!1),2),h=f[0],v=f[1],p=a();return u((function(){p.current=Gm({getStoreItems:function(){return d.getState()},onNodeMouseDown:function(e){uE({id:e,store:d,nodeRef:n})},onDragStart:function(){v(!0)},onDragStop:function(){v(!1)}})}),[]),u((function(){var e,t;if(r)null===(e=p.current)||void 0===e||e.destroy();else if(n.current)return null===(t=p.current)||void 0===t||t.update({noDragClassName:o,handleSelector:c,domNode:n.current,isSelectable:s,nodeId:l}),function(){var e;null===(e=p.current)||void 0===e||e.destroy()}}),[o,c,r,s,n,l]),h}({nodeRef:X,disabled:I.hidden||!B,noDragClassName:x,handleSelector:I.dragHandle,nodeId:t,isSelectable:D}),F=function(){var e=_x(),n=l((function(n){var t,r,o=e.getState(),i=o.nodeExtent,a=o.snapToGrid,u=o.snapGrid,c=o.nodesDraggable,l=o.onError,s=o.updateNodePositions,d=o.nodeLookup,f=o.nodeOrigin,h=new Map,v=cE(c),p=a?u[0]:5,m=a?u[1]:5,w=n.direction.x*p*n.factor,b=n.direction.y*m*n.factor;try{for(var x=g(d),_=x.next();!_.done;_=x.next()){var E=y(_.value,2)[1];if(v(E)){var S={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+b};a&&(S=Ax(S,u));var k=__({nodeId:E.id,nextPosition:S,nodeLookup:d,nodeExtent:i,nodeOrigin:f,onError:l}),N=k.position,C=k.positionAbsolute;E.position=N,E.internals.positionAbsolute=C,h.set(E.id,E)}}}catch(e){t={error:e}}finally{try{_&&!_.done&&(r=x.return)&&r.call(x)}finally{if(t)throw t.error}}s(h)}),[]);return n}();if(I.hidden)return null;var U=Px(I),W=function(e){var n,t,r,o,i,a,u,c,l,s;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!==(l=e.height)&&void 0!==l?l:null===(s=e.style)||void 0===s?void 0:s.height}}(I),G=C?jx(A.positionAbsolute,C):A.positionAbsolute,q=Zx(f(f(f({},G),U),{origin:I.origin||M})),$=D||B||r||o||c||s,K=o?function(e){return o(e,f({},A.userNode))}:void 0,Q=c?function(e){return c(e,f({},A.userNode))}:void 0,J=s?function(e){return s(e,f({},A.userNode))}:void 0,ee=d?function(e){return d(e,f({},A.userNode))}:void 0,ne=h?function(e){return h(e,f({},A.userNode))}:void 0;return S.jsx("div",{className:O(["ink-flow__node","ink-flow__node-".concat(T),(n={},n[_]=B,n),I.className,{selected:I.selected,selectable:D,parent:z,draggable:B,dragging:Z}]),ref:X,style:f(f({zIndex:A.z,transform:"translate(".concat(q.x,"px,").concat(q.y,"px)"),pointerEvents:$?"all":"none",visibility:Y?"visible":"hidden"},I.style),W),"data-id":t,"data-testid":"rf__node-".concat(t),onMouseEnter:K,onMouseMove:Q,onMouseLeave:J,onContextMenu:ee,onClick:function(e){var n=V.getState(),o=n.selectNodesOnDrag,i=n.nodeDragThreshold;D&&(!o||!B||i>0)&&uE({id:t,store:V,nodeRef:X}),r&&r(e,f({},A.userNode))},onDoubleClick:ne,onKeyDown:H?function(e){if(!$x(e.nativeEvent)&&!E)if(wv.includes(e.key)&&D){var n="Escape"===e.key;uE({id:t,store:V,unselect:n,nodeRef:X})}else B&&I.selected&&Object.prototype.hasOwnProperty.call(iE,e.key)&&(V.setState({ariaLiveMessage:"Moved selected node ".concat(e.key.replace("Arrow","").toLowerCase(),". New position, x: ").concat(~~G.x,", y: ").concat(~~G.y)}),F({direction:iE[e.key],factor:e.shiftKey?4:1}))}:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":E?void 0:"".concat(F_,"-").concat(k),"aria-label":I.ariaLabel,children:S.jsx(Z_,{value:t,children:S.jsx(L,f({id:t,data:I.data,type:T,positionAbsoluteX:G.x,positionAbsoluteY:G.y,selected:I.selected,isConnectable:R,sourcePosition:I.sourcePosition,targetPosition:I.targetPosition,dragging:Z,dragHandle:I.dragHandle,zIndex:A.z},U))})})}var sE=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError}};function dE(e){var n,t=xx(sE,o_),r=t.nodesDraggable,o=t.nodesConnectable,a=t.nodesFocusable,c=t.elementsSelectable,s=t.onError,d=xx(l(Y_(n=!1),[n]),o_),f=function(){var e=xx(V_),n=y(i((function(){return"undefined"==typeof ResizeObserver?null:new ResizeObserver((function(n){var t=new Map;n.forEach((function(e){var n=e.target.getAttribute("data-id");t.set(n,{id:n,nodeElement:e.target})})),e(t)}))})),1),t=n[0];return u((function(){return function(){null==t||t.disconnect()}}),[t]),t}();return S.jsx("div",{className:"ink-flow__nodes",style:i_,children:d.map((function(n){return S.jsx(lE,{id:n,nodeTypes:e.nodeTypes,nodeOrigin:e.nodeOrigin,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:r,nodesConnectable:o,nodesFocusable:a,elementsSelectable:c,onError:s},n)}))})}dE.displayName="NodeRenderer";var fE,hE=c(dE),vE=((fE={})[Om.Arrow]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"})},fE[Om.ArrowClosed]=function(e){var n=e.color,t=void 0===n?"none":n,r=e.strokeWidth,o=void 0===r?1:r;return S.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:o},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},fE);function pE(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 gE=function(e){var n=e.id,t=e.type,o=e.color,i=e.width,a=void 0===i?12.5:i,u=e.height,c=void 0===u?12.5:u,l=e.markerUnits,s=void 0===l?"strokeWidth":l,d=e.strokeWidth,f=e.orient,h=void 0===f?"auto-start-reverse":f,v=function(e){var n=_x(),t=r((function(){var t,r;return Object.prototype.hasOwnProperty.call(vE,e)?vE[e]:(null===(r=(t=n.getState()).onError)||void 0===r||r.call(t,"009",yv.error009(e)),null)}),[e]);return t}(t);return v?S.jsx("marker",{className:"ink-flow__arrowhead",id:n,markerWidth:"".concat(a),markerHeight:"".concat(c),viewBox:"-10 -10 20 20",markerUnits:s,orient:h,refX:"0",refY:"0",children:S.jsx(v,{color:o,strokeWidth:d})}):null},yE=function(e){var n=e.defaultColor,t=e.rfId,o=xx((function(e){return e.edges})),i=xx((function(e){return e.defaultEdgeOptions})),a=r((function(){var e=function(e,n){var t=n.id,r=n.defaultColor,o=n.defaultMarkerStart,i=n.defaultMarkerEnd,a=new Set;return e.reduce((function(e,n){return[n.markerStart||o,n.markerEnd||i].forEach((function(n){if(n&&"object"==typeof n){var o=pE(n,t);a.has(o)||(e.push(f({id:o,color:n.color||r},n)),a.add(o))}})),e}),[]).sort((function(e,n){return e.id.localeCompare(n.id)}))}(o,{id:t,defaultColor:n,defaultMarkerStart:null==i?void 0:i.markerStart,defaultMarkerEnd:null==i?void 0:i.markerEnd});return e}),[o,i,t,n]);return a.length?S.jsx("svg",{className:"ink-flow__marker",children:S.jsx("defs",{children:a.map((function(e){return S.jsx(gE,{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};yE.displayName="MarkerDefinitions";var mE=c(yE);function wE(e){var n=e.x,t=e.y,r=e.label,o=e.labelStyle,a=void 0===o?{}:o,u=e.labelShowBg,c=void 0===u||u,s=e.labelBgStyle,d=void 0===s?{}:s,v=e.labelBgPadding,p=void 0===v?[2,4]:v,g=e.labelBgBorderRadius,m=void 0===g?2:g,w=e.children,b=e.className,x=h(e,["x","y","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","children","className"]),_=y(i({x:1,y:0,width:0,height:0}),2),E=_[0],k=_[1],N=O(["ink-flow__edge-textwrapper",b]),C=l((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!==r&&r?S.jsxs("g",f({transform:"translate(".concat(n-E.width/2," ").concat(t-E.height/2,")"),className:N,visibility:E.width?"visible":"hidden"},x,{children:[c&&S.jsx("rect",{width:E.width+2*p[0],x:-p[0],y:-p[1],height:E.height+2*p[1],className:"ink-flow__edge-textbg",style:d,rx:m,ry:m}),S.jsx("text",{className:"ink-flow__edge-text",y:E.height/2,dy:"0.3em",ref:C,style:a,children:r}),w]})):null}wE.displayName="EdgeText";var bE=c(wE);function xE(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,l=e.labelBgPadding,s=e.labelBgBorderRadius,d=e.style,f=e.markerEnd,h=e.markerStart,v=e.className,p=e.interactionWidth,g=void 0===p?20:p;return S.jsxs(S.Fragment,{children:[S.jsx("path",{id:n,style:d,d:t,fill:"none",className:O(["ink-flow__edge-path",v]),markerEnd:f,markerStart:h}),g&&S.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:g,className:"ink-flow__edge-interaction"}),i&&Ix(r)&&Ix(o)?S.jsx(bE,{x:r,y:o,label:i,labelStyle:a,labelShowBg:u,labelBgStyle:c,labelBgPadding:l,labelBgBorderRadius:s}):null]})}function _E(e){var n=e.pos,t=e.x1,r=e.y1,o=e.x2,i=e.y2;return n===jm.Left||n===jm.Right?[.5*(t+o),r]:[t,.5*(r+i)]}function EE(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=y(_E({pos:o,x1:n,y1:t,x2:i,y2:a}),2),s=l[0],d=l[1],f=y(_E({pos:c,x1:i,y1:a,x2:n,y2:t}),2),h=f[0],v=f[1],p=y(W_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:s,sourceControlY:d,targetControlX:h,targetControlY:v}),4),g=p[0],m=p[1],w=p[2],b=p[3];return["M".concat(n,",").concat(t," C").concat(s,",").concat(d," ").concat(h,",").concat(v," ").concat(i,",").concat(a),g,m,w,b]}function SE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?jm.Bottom:u,l=n.targetPosition,s=void 0===l?jm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.interactionWidth,_=y(EE({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s}),3),E=_[0],k=_[1],N=_[2],C=e.isInternal?void 0:t;return S.jsx(xE,{id:C,path:E,labelX:k,labelY:N,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:x})}))}var kE=SE({isInternal:!1}),NE=SE({isInternal:!0});function CE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.sourcePosition,p=void 0===v?jm.Bottom:v,g=n.targetPosition,m=void 0===g?jm.Top:g,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(tE({sourceX:r,sourceY:o,sourcePosition:p,targetX:i,targetY:a,targetPosition:m,borderRadius:null==x?void 0:x.borderRadius,offset:null==x?void 0:x.offset}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(xE,{id:M,path:k,labelX:N,labelY:C,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:w,markerStart:b,interactionWidth:_})}))}kE.displayName="SimpleBezierEdge",NE.displayName="SimpleBezierEdgeInternal";var ME=CE({isInternal:!1}),OE=CE({isInternal:!0});function jE(e){return c((function(n){var t,o=n.id,i=h(n,["id"]),a=e.isInternal?void 0:o;return S.jsx(ME,f({},i,{id:a,pathOptions:r((function(){var e;return{borderRadius:0,offset:null===(e=i.pathOptions)||void 0===e?void 0:e.offset}}),[null===(t=i.pathOptions)||void 0===t?void 0:t.offset])}))}))}ME.displayName="SmoothStepEdge",OE.displayName="SmoothStepEdgeInternal";var PE=jE({isInternal:!1}),IE=jE({isInternal:!0});function AE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.label,c=n.labelStyle,l=n.labelShowBg,s=n.labelBgStyle,d=n.labelBgPadding,f=n.labelBgBorderRadius,h=n.style,v=n.markerEnd,p=n.markerStart,g=n.interactionWidth,m=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.targetX,o=e.targetY,i=y($_({sourceX:n,sourceY:t,targetX:r,targetY:o}),4),a=i[0],u=i[1],c=i[2],l=i[3];return["M ".concat(n,",").concat(t,"L ").concat(r,",").concat(o),a,u,c,l]}({sourceX:r,sourceY:o,targetX:i,targetY:a}),3),w=m[0],b=m[1],x=m[2],_=e.isInternal?void 0:t;return S.jsx(xE,{id:_,path:w,labelX:b,labelY:x,label:u,labelStyle:c,labelShowBg:l,labelBgStyle:s,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:v,markerStart:p,interactionWidth:g})}))}PE.displayName="StepEdge",IE.displayName="StepEdgeInternal";var zE=AE({isInternal:!1}),TE=AE({isInternal:!0});function LE(e){return c((function(n){var t=n.id,r=n.sourceX,o=n.sourceY,i=n.targetX,a=n.targetY,u=n.sourcePosition,c=void 0===u?jm.Bottom:u,l=n.targetPosition,s=void 0===l?jm.Top:l,d=n.label,f=n.labelStyle,h=n.labelShowBg,v=n.labelBgStyle,p=n.labelBgPadding,g=n.labelBgBorderRadius,m=n.style,w=n.markerEnd,b=n.markerStart,x=n.pathOptions,_=n.interactionWidth,E=y(function(e){var n=e.sourceX,t=e.sourceY,r=e.sourcePosition,o=void 0===r?jm.Bottom:r,i=e.targetX,a=e.targetY,u=e.targetPosition,c=void 0===u?jm.Top:u,l=e.curvature,s=void 0===l?.25:l,d=y(q_({pos:o,x1:n,y1:t,x2:i,y2:a,c:s}),2),f=d[0],h=d[1],v=y(q_({pos:c,x1:i,y1:a,x2:n,y2:t,c:s}),2),p=v[0],g=v[1],m=y(W_({sourceX:n,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:p,targetControlY:g}),4),w=m[0],b=m[1],x=m[2],_=m[3];return["M".concat(n,",").concat(t," C").concat(f,",").concat(h," ").concat(p,",").concat(g," ").concat(i,",").concat(a),w,b,x,_]}({sourceX:r,sourceY:o,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:null==x?void 0:x.curvature}),3),k=E[0],N=E[1],C=E[2],M=e.isInternal?void 0:t;return S.jsx(xE,{id:M,path:k,labelX:N,labelY:C,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:v,labelBgPadding:p,labelBgBorderRadius:g,style:m,markerEnd:w,markerStart:b,interactionWidth:_})}))}zE.displayName="StraightEdge",TE.displayName="StraightEdgeInternal";var BE=LE({isInternal:!1}),DE=LE({isInternal:!0});BE.displayName="BezierEdge",DE.displayName="BezierEdgeInternal";var RE={default:DE,straight:TE,step:IE,smoothstep:OE,simplebezier:NE},HE={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},VE=function(e,n,t){return t===jm.Left?e-n:t===jm.Right?e+n:e},YE=function(e,n,t){return t===jm.Top?e-n:t===jm.Bottom?e+n:e},XE="ink-flow__edgeupdater";function ZE(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,l=e.type;return S.jsx("circle",{onMouseDown:a,onMouseEnter:u,onMouseOut:c,className:O([XE,"".concat(XE,"-").concat(l)]),cx:VE(t,i,n),cy:YE(r,i,n),r:i,stroke:"transparent",fill:"transparent"})}function FE(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,l=e.targetY,s=e.sourcePosition,d=e.targetPosition,f=e.onEdgeUpdate,h=e.onEdgeUpdateStart,v=e.onEdgeUpdateEnd,p=e.setUpdating,g=e.setUpdateHover,y=_x(),m=function(e,n){if(0===e.button){var t=y.getState(),a=t.autoPanOnConnect,u=t.domNode,c=t.isValidConnection,l=t.connectionMode,s=t.connectionRadius,d=t.lib,g=t.onConnectStart,m=t.onConnectEnd,w=t.cancelConnection,b=t.nodeLookup,x=t.rfId,_=t.panBy,E=t.updateConnection,S=n?r.target:r.source,k=(n?o:i)||null,N=n?"target":"source",C=n;p(!0),null==h||h(e,r,N);ew.onPointerDown(e.nativeEvent,{autoPanOnConnect:a,connectionMode:l,connectionRadius:s,domNode:u,handleId:k,nodeId:S,nodeLookup:b,isTarget:C,edgeUpdaterType:N,lib:d,flowId:x,cancelConnection:w,panBy:_,isValidConnection:c,onConnect:function(e){return null==f?void 0:f(r,e)},onConnectStart:g,onConnectEnd:m,onEdgeUpdateEnd:function(e){p(!1),null==v||v(e,r,N)},updateConnection:E,getTransform:function(){return y.getState().transform},getConnectionStartHandle:function(){return y.getState().connectionStartHandle}})}},w=function(){return g(!0)},b=function(){return g(!1)};return S.jsxs(S.Fragment,{children:[("source"===n||!0===n)&&S.jsx(ZE,{position:s,centerX:a,centerY:u,radius:t,onMouseDown:function(e){return m(e,!0)},onMouseEnter:w,onMouseOut:b,type:"source"}),("target"===n||!0===n)&&S.jsx(ZE,{position:d,centerX:c,centerY:l,radius:t,onMouseDown:function(e){return m(e,!1)},onMouseEnter:w,onMouseOut:b,type:"target"})]})}function UE(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=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=c.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&&a.push(l)}}catch(e){n={error:e}}finally{try{c&&!c.done&&(t=u.return)&&t.call(u)}finally{if(n)throw n.error}}return{source:i,target:a}}function GE(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:Px(n),c=u.width,l=u.height;switch(e){case jm.Top:return[i+c/2,a];case jm.Right:return[i+c,a+l/2];case jm.Bottom:return[i+c/2,a+l];case jm.Left:return[i,a+l/2]}}function qE(e,n){return e&&(n?e.find((function(e){return e.id===n})):e[0])||null}function $E(e){var n=e.id,t=e.edgesFocusable,o=e.edgesUpdatable,u=e.elementsSelectable,c=e.onClick,s=e.onDoubleClick,d=e.onContextMenu,h=e.onMouseEnter,v=e.onMouseMove,p=e.onMouseLeave,g=e.edgeUpdaterRadius,m=e.onEdgeUpdate,w=e.onEdgeUpdateStart,b=e.onEdgeUpdateEnd,x=e.rfId,_=e.edgeTypes,E=e.noPanClassName,k=e.onError,N=e.disableKeyboardA11y,C=xx((function(e){return e.edgeLookup.get(n)})),M=xx((function(e){return e.defaultEdgeOptions})),j=(C=M?f(f({},M),C):C).type||"default",P=(null==_?void 0:_[j])||RE[j];void 0===P&&(null==k||k("011",yv.error011(j)),j="default",P=RE.default);var I=!!(C.focusable||t&&void 0===C.focusable),A=void 0!==m&&(C.updatable||o&&void 0===C.updatable),z=!!(C.selectable||u&&void 0===C.selectable),T=a(null),L=y(i(!1),2),B=L[0],D=L[1],R=y(i(!1),2),H=R[0],V=R[1],Y=_x(),X=xx(l((function(e){var t=e.nodeLookup.get(C.source),r=e.nodeLookup.get(C.target);if(!t||!r)return f({zIndex:C.zIndex},HE);var o=function(e){var n,t,r,o,i,a=e.sourceNode,u=e.targetNode;if(!UE(a)||!UE(u))return null;var c=a.internals.handleBounds||WE(a.handles),l=u.internals.handleBounds||WE(u.handles),s=qE(null!==(n=null==c?void 0:c.source)&&void 0!==n?n:[],e.sourceHandle),d=qE(e.connectionMode===km.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),f=(null==s?void 0:s.position)||jm.Bottom,h=(null==d?void 0:d.position)||jm.Top;if(!s||!d)return null===(i=e.onError)||void 0===i||i.call(e,"008",yv.error008(s?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;var v=y(GE(f,a,s),2),p=v[0],g=v[1],m=y(GE(h,u,d),2);return{sourceX:p,sourceY:g,targetX:m[0],targetY:m[1],sourcePosition:f,targetPosition:h}}({id:n,sourceNode:t,targetNode:r,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:e.connectionMode,onError:k}),i=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,l=Math.max(n.internals.z||0,t.internals.z||0,1e3);return a+(c?l:0)}({selected:C.selected,zIndex:C.zIndex,sourceNode:t,targetNode:r,elevateOnSelect:e.elevateEdgesOnSelect});return f({zIndex:i},o||HE)}),[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),o_),Z=X.zIndex,F=X.sourceX,U=X.sourceY,W=X.targetX,G=X.targetY,q=X.sourcePosition,$=X.targetPosition,K=r((function(){return C.markerStart?"url('#".concat(pE(C.markerStart,x),"')"):void 0}),[C.markerStart,x]),Q=r((function(){return C.markerEnd?"url('#".concat(pE(C.markerEnd,x),"')"):void 0}),[C.markerEnd,x]);if(C.hidden||null===F||null===U||null===W||null===G)return null;var J=s?function(e){s(e,f({},C))}:void 0,ee=d?function(e){d(e,f({},C))}:void 0,ne=h?function(e){h(e,f({},C))}:void 0,te=v?function(e){v(e,f({},C))}:void 0,re=p?function(e){p(e,f({},C))}:void 0;return S.jsx("svg",{style:{zIndex:Z},children:S.jsxs("g",{className:O(["ink-flow__edge","ink-flow__edge-".concat(j),C.className,E,{selected:C.selected,animated:C.animated,inactive:!z&&!c,updating:B,selectable:z}]),onClick:function(e){var t,r=Y.getState(),o=r.addSelectedEdges,i=r.unselectNodesAndEdges,a=r.multiSelectionActive;z&&(Y.setState({nodesSelectionActive:!1}),C.selected&&a?(i({nodes:[],edges:[C]}),null===(t=T.current)||void 0===t||t.blur()):o([n])),c&&c(e,C)},onDoubleClick:J,onContextMenu:ee,onMouseEnter:ne,onMouseMove:te,onMouseLeave:re,onKeyDown:I?function(e){var t;if(!N&&wv.includes(e.key)&&z){var r=Y.getState(),o=r.unselectNodesAndEdges,i=r.addSelectedEdges;"Escape"===e.key?(null===(t=T.current)||void 0===t||t.blur(),o({edges:[C]})):i([n])}}:void 0,tabIndex:I?0:void 0,role:I?"button":"img","data-id":n,"data-testid":"rf__edge-".concat(n),"aria-label":null===C.ariaLabel?void 0:C.ariaLabel||"Edge from ".concat(C.source," to ").concat(C.target),"aria-describedby":I?"".concat(U_,"-").concat(x):void 0,ref:T,children:[!H&&S.jsx(P,{id:n,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:K,markerEnd:Q,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),A&&S.jsx(FE,{edge:C,isUpdatable:A,edgeUpdaterRadius:g,onEdgeUpdate:m,onEdgeUpdateStart:w,onEdgeUpdateEnd:b,sourceX:F,sourceY:U,targetX:W,targetY:G,sourcePosition:q,targetPosition:$,setUpdateHover:D,setUpdating:V,sourceHandleId:C.sourceHandle,targetHandleId:C.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 QE(e){var n=e.defaultMarkerColor,t=e.rfId,r=e.noPanClassName,o=e.onEdgeUpdate,i=e.onEdgeContextMenu,a=e.onEdgeMouseEnter,u=e.onEdgeMouseMove,c=e.onEdgeMouseLeave,s=e.onEdgeClick,d=e.edgeTypes,f=xx(KE,o_),h=f.edgesFocusable,v=f.edgesUpdatable,p=f.elementsSelectable,g=f.onError,y=function(e){var n=xx(l((function(e){return e.edges.map((function(e){return e.id}))}),[e]),o_);return n}(!1);return S.jsxs("div",{className:"ink-flow__edges",children:[S.jsx(mE,{defaultColor:n,rfId:t}),y.map((function(e){return S.jsx($E,{id:e,edgesFocusable:h,edgesUpdatable:v,elementsSelectable:p,noPanClassName:r,onEdgeUpdate:o,onContextMenu:i,onMouseEnter:a,onMouseMove:u,onMouseLeave:c,onClick:s,rfId:t,onError:g,edgeTypes:d},e)}))]})}QE.displayName="EdgeRenderer";var JE,eS=c(QE),nS=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function tS(e){var n=e.children,t=xx(nS);return S.jsx("div",{className:"ink-flow__viewport xyflow__viewport ink-flow__container",style:{transform:t},children:n})}var rS=((JE={})[jm.Left]=jm.Right,JE[jm.Right]=jm.Left,JE[jm.Top]=jm.Bottom,JE[jm.Bottom]=jm.Top,JE),oS=function(e){var n,t,r=e.nodeId,o=e.handleType,i=e.style,a=e.type,u=void 0===a?Mm.Bezier:a,c=e.CustomComponent,s=e.connectionStatus,d=xx(l((function(e){var n;return{fromNode:e.nodeLookup.get(r),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}}),[r]),o_),h=d.fromNode,v=d.handleId,p=d.toX,g=d.toY,m=d.connectionMode,w=null==h?void 0:h.internals.handleBounds,b=null==w?void 0:w[o];if(m===km.Loose&&(b=b||(null==w?void 0:w["source"===o?"target":"source"])),!h||!b)return null;var x=v?b.find((function(e){return e.id===v})):b[0],_=x?x.x+x.width/2:(null!==(n=h.measured.width)&&void 0!==n?n:0)/2,E=x?x.y+x.height/2:null!==(t=h.measured.height)&&void 0!==t?t:0,k=h.internals.positionAbsolute.x+_,N=h.internals.positionAbsolute.y+E,C=null==x?void 0:x.position,M=C?rS[C]:null;if(!C||!M)return null;if(c)return S.jsx(c,{connectionLineType:u,connectionLineStyle:i,fromNode:h,fromHandle:x,fromX:k,fromY:N,toX:p,toY:g,fromPosition:C,toPosition:M,connectionStatus:s});var O="",j={sourceX:k,sourceY:N,sourcePosition:C,targetX:p,targetY:g,targetPosition:M};return O=u===Mm.Bezier?y(Tm(j),1)[0]:u===Mm.Step?y(Zm(f(f({},j),{borderRadius:0})),1)[0]:u===Mm.SmoothStep?y(Zm(j),1)[0]:u===Mm.SimpleBezier?y(EE(j),1)[0]:"M".concat(k,",").concat(N," ").concat(p,",").concat(g),S.jsx("path",{d:O,fill:"none",className:"react-flow__connection-path",style:i})};oS.displayName="ConnectionLine";var iS=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 aS(e){var n=e.containerStyle,t=e.style,r=e.type,o=e.component,i=xx(iS,o_),a=i.nodeId,u=i.handleType,c=i.nodesConnectable,l=i.width,s=i.height,d=i.connectionStatus;return!!(a&&u&&l&&c)?S.jsx("svg",{style:n,width:l,height:s,className:"react-flow__connectionline react-flow__container",children:S.jsx("g",{className:O(["react-flow__connection",d]),children:S.jsx(oS,{nodeId:a,handleType:u,style:t,type:r,CustomComponent:o,connectionStatus:d})})}):null}function uS(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,l=e.onEdgeMouseEnter,s=e.onEdgeMouseMove,d=e.onEdgeMouseLeave,f=e.onEdgeContextMenu,h=e.rfId,v=e.minZoom,p=e.maxZoom,g=e.noPanClassName,y=e.noDragClassName,m=e.nodeOrigin,w=e.viewport,b=e.disableKeyboardA11y,x=e.translateExtent,_=e.defaultViewport,E=e.nodeTypes,k=e.edgeTypes,N=e.elementsSelectable,C=e.defaultMarkerColor,M=e.connectionLineType,O=e.connectionLineStyle,j=e.connectionLineComponent,P=e.connectionLineContainerStyle,I=e.onPaneClick,A=e.onPaneContextMenu,z=e.onPaneMouseEnter,T=e.onPaneMouseMove,L=e.onPaneMouseLeave,B=e.onPaneScroll;return S.jsx(P_,{minZoom:v,maxZoom:p,noPanClassName:g,noDragClassName:y,isControlledViewport:!!w,disableKeyboardA11y:b,translateExtent:x,defaultViewport:_,elementsSelectable:N,onPaneClick:I,onPaneContextMenu:A,onPaneMouseEnter:z,onPaneMouseMove:T,onPaneMouseLeave:L,onPaneScroll:B,children:S.jsxs(tS,{children:[S.jsx(eS,{rfId:h,edgeTypes:k,noPanClassName:g,onEdgeClick:u,onEdgeDoubleClick:c,onEdgeMouseEnter:l,onEdgeMouseMove:s,onEdgeMouseLeave:d,onEdgeContextMenu:f,defaultMarkerColor:C}),S.jsx(aS,{style:O,type:M,component:j,containerStyle:P}),S.jsx("div",{className:"ink-flow__edgelabel-renderer"}),S.jsx(hE,{rfId:h,nodeTypes:E,nodeOrigin:m,noDragClassName:y,noPanClassName:g,disableKeyboardA11y:!1,onNodeClick:n,onNodeDoubleClick:t,onNodeMouseEnter:r,onNodeMouseMove:o,onNodeMouseLeave:i,onNodeContextMenu:a}),S.jsx("div",{className:"ink-flow__viewport-portal"})]})})}uS.displayName="GraphView";var cS=c(uS),lS=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,l=r.maxZoom,s=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:[];Nx(f,h,v),Cx(p,s,d,{nodeOrigin:[0,0],elevateNodesOnSelect:!1});return{rfId:"1",width:0,height:0,transform:[0,0,1],nodes:p,nodeLookup:s,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:l||2,translateExtent:mv,nodeExtent:mv,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:km.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}},sS=function(e){var n,t,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView,s=e.minZoom,d=e.maxZoom;return n=function(e,n){return f(f({},lS({nodes:r,edges:o,width:u,height:c,fitView:l,defaultNodes:i,defaultEdges:a,minZoom:s,maxZoom:d})),{setNodes:function(t){var r=n();Cx(t,r.nodeLookup,r.parentLookup,{nodeOrigin:r.nodeOrigin,elevateNodesOnSelect:r.elevateNodesOnSelect,checkEquality:!0}),e({nodes:t})},setEdges:function(t){var r=n();Nx(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(t){var r=n(),o=r.triggerNodeChanges,i=r.fitView,a=r.nodeLookup,u=r.parentLookup,c=r.fitViewOnInit,l=r.fitViewDone,s=r.fitViewOnInitOptions,d=r.domNode,h=r.nodeOrigin,v=r.debug,p=function(e,n,t,r,o){var i=null==r?void 0:r.querySelector(".xyflow__viewport"),a=!1;if(!i)return{changes:[],updatedInternals:a};var u=[],c=window.getComputedStyle(i),l=new window.DOMMatrixReadOnly(c.transform).m22,s=[];if(e.forEach((function(e){var t=n.get(e.id);if(null==t?void 0:t.hidden)n.set(t.id,f(f({},t),{internals:f(f({},t.internals),{handleBounds:void 0})})),a=!0;else if(t){var r=Gx(e.nodeElement),i=t.measured.width!==r.width||t.measured.height!==r.height;if(r.width&&r.height&&(i||!t.internals.handleBounds||e.force)){var c=f(f({},t),{measured:r,internals:f(f({},t.internals),{handleBounds:{source:Jx(".source",e.nodeElement,l,t.origin||o),target:Jx(".target",e.nodeElement,l,t.origin||o)}})});n.set(t.id,c),a=!0,i&&(u.push({id:c.id,type:"dimensions",dimensions:r}),c.expandParent&&c.parentId&&s.push({id:c.id,parentId:c.parentId,rect:Tx(c,c.origin||o)}))}}})),s.length>0){var d=Mx(s,n,t,o);u.push.apply(u,m([],y(d),!1))}return{changes:u,updatedInternals:a}}(t,a,u,d,h),g=p.changes;if(p.updatedInternals){Ex(a,{nodeOrigin:h});var w=l;!l&&c&&(w=i(f(f({},s),{nodes:null==s?void 0:s.nodes}))),e({fitViewDone:w}),(null==g?void 0:g.length)>0&&(v&&console.log("Ink Flow: trigger node changes",g),null==o||o(g))}},updateNodePositions:function(e,t){var r,o;void 0===t&&(t=!1);var i=[],a=[];try{for(var u=g(e),c=u.next();!c.done;c=u.next()){var l=y(c.value,2),s=l[0],d=l[1],h={id:s,type:"position",position:d.position,dragging:t};(null==d?void 0:d.expandParent)&&(null==d?void 0:d.parentId)&&h.position&&(i.push({id:s,parentId:d.parentId,rect:f(f({},d.internals.positionAbsolute),{width:d.measured.width,height:d.measured.height})}),h.position.x=Math.max(0,h.position.x),h.position.y=Math.max(0,h.position.y)),a.push(h)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}if(i.length>0){var v=n(),p=Mx(i,v.nodeLookup,v.parentLookup);a.push.apply(a,m([],y(p),!1))}n().triggerNodeChanges(a)},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(f_(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(d_(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,u=t.triggerEdgeChanges;r?a(e.map((function(e){return h_(e,!0)}))):(a(v_(i,new Set(m([],y(e),!1)),!0)),u(v_(o)))},addSelectedEdges:function(e){var t=n(),r=t.multiSelectionActive,o=t.edgeLookup,i=t.nodeLookup,a=t.triggerNodeChanges,u=t.triggerEdgeChanges;r?u(e.map((function(e){return h_(e,!0)}))):(u(v_(o,new Set(m([],y(e),!1)))),a(v_(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,l=i.triggerEdgeChanges,s=o||a,d=(r||u).map((function(e){return e.selected=!1,h_(e.id,!1)})),f=s.map((function(e){return h_(e.id,!1)}));c(d),l(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?m(m([],y(e),!1),[h_(n.id,!1)],!1):e}),[]),u=t.reduce((function(e,n){return n.selected?m(m([],y(e),!1),[h_(n.id,!1)],!1):e}),[]);o(a),i(u)},setNodeExtent:function(t){var r,o,i=n().nodeLookup;try{for(var a=g(i),u=a.next();!u.done;u=a.next()){var c=y(u.value,2)[1],l=jx(c.position,t);i.set(c.id,f(f({},c),{internals:f(f({},c.internals),{positionAbsolute:l})}))}}catch(e){r={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(r)throw r.error}}e({nodeExtent:t})},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,l=t.nodeLookup;return!!r&&x_({nodeLookup:l,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(t){var r,o=n().connectionPosition,i=f(f({},t),{connectionPosition:null!==(r=t.connectionPosition)&&void 0!==r?r:o});e(i)},reset:function(){return e(f({},lS()))}})},t=Object.is,n?V(n,t):V};function dS(e){var n=e.initialNodes,t=e.initialEdges,r=e.defaultNodes,o=e.defaultEdges,a=e.initialWidth,u=e.initialHeight,c=e.fitView,l=e.children,s=e.minZoom,d=e.maxZoom,f=y(i((function(){return sS({nodes:n,edges:t,defaultNodes:r,defaultEdges:o,width:a,height:u,fitView:c,minZoom:s,maxZoom:d})})),1)[0];return S.jsx(X,{value:f,children:S.jsx(B_,{children:l})})}function fS(e){var n=e.children,r=e.nodes,o=e.edges,i=e.defaultNodes,a=e.defaultEdges,u=e.width,c=e.height,l=e.fitView,s=e.minZoom,d=e.maxZoom;return t(Y)?S.jsx(S.Fragment,{children:n}):S.jsx(dS,{initialNodes:r,initialEdges:o,defaultNodes:i,defaultEdges:a,initialWidth:u,initialHeight:c,fitView:l,minZoom:s,maxZoom:d,children:n})}var hS={x:0,y:0,zoom:1},vS=m(m([],y(["nodes","edges","defaultNodes","defaultEdges","nodesDraggable","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","translateExtent","defaultEdgeOptions","fitView","fitViewOptions"]),!1),["rfId"],!1),pS=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}},gS={translateExtent:mv,nodeOrigin:[0,0],minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function yS(e){var n=xx(pS,o_),t=n.setNodes,r=n.setEdges,o=n.setMinZoom,i=n.setMaxZoom,c=n.setTranslateExtent,l=n.setNodeExtent,s=n.reset,d=n.setDefaultNodesAndEdges,f=_x();u((function(){return d(e.defaultNodes,e.defaultEdges),function(){h.current=gS,s()}}),[]);var h=a(gS);return u((function(){var n,a,u;try{for(var s=g(vS),d=s.next();!d.done;d=s.next()){var v=d.value,p=e[v];p!==h.current[v]&&(void 0!==e[v]&&("nodes"===v?t(p):"edges"===v?r(p):"minZoom"===v?o(p):"maxZoom"===v?i(p):"translateExtent"===v?c(p):"nodeExtent"===v?l(p):"fitView"===v?f.setState({fitViewOnInit:p}):"fitViewOptions"===v?f.setState({fitViewOnInitOptions:p}):f.setState(((u={})[v]=p,u))))}}catch(e){n={error:e}}finally{try{d&&!d.done&&(a=s.return)&&a.call(s)}finally{if(n)throw n.error}}h.current=e}),vS.map((function(n){return e[n]}))),null}var mS={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var wS=Hx((function(e,n){var t=e.nodes,r=e.edges,o=e.translateExtent,i=void 0===o?mv:o,a=e.defaultViewport,u=void 0===a?hS:a,c=e.minZoom,l=void 0===c?.5:c,s=e.maxZoom,d=void 0===s?2:s,v=e.defaultMarkerColor,p=void 0===v?"#b1b1b7":v,g=e.nodeOrigin,y=e.noDragClassName,m=e.noPanClassName,w=e.disableKeyboardA11y,b=e.nodeTypes,x=e.edgeTypes;e.connectionMode;var _=e.connectionLineType,E=void 0===_?Mm.Bezier:_,k=e.connectionLineStyle,N=e.connectionLineComponent,C=e.connectionLineContainerStyle,M=e.onNodeClick,j=e.onNodeDoubleClick,P=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,H=e.onEdgeDoubleClick,V=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=h(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 S.jsx("div",f({},ie,{ref:n,style:f({},mS),className:O(["ink-flow"]),"data-testid":"rf__wrapper",id:G,children:S.jsxs(fS,{nodes:t,edges:r,width:q,height:$,fitView:X,minZoom:l,maxZoom:d,children:[S.jsx(cS,{onNodeClick:M,onNodeMouseEnter:P,onNodeMouseMove:I,onNodeMouseLeave:A,onNodeContextMenu:z,onNodeDoubleClick:j,onEdgeClick:T,onEdgeMouseEnter:L,onEdgeMouseMove:B,onEdgeMouseLeave:D,onEdgeContextMenu:R,onEdgeDoubleClick:H,rfId:ae,nodeTypes:b,edgeTypes:x,minZoom:l,maxZoom:d,nodeOrigin:g,noDragClassName:y,noPanClassName:m,disableKeyboardA11y:w,translateExtent:i,defaultMarkerColor:p,connectionLineType:E,connectionLineStyle:k,connectionLineComponent:N,connectionLineContainerStyle:C,defaultViewport:u,onPaneClick:K,onPaneContextMenu:Q,onPaneMouseEnter:J,onPaneMouseMove:ee,onPaneMouseLeave:ne,onPaneScroll:te}),S.jsx(yS,{nodes:t,edges:r,rfId:ae,onNodesChange:V,onEdgesChange:Y,fitView:X,fitViewOptions:Z,nodeExtent:F,nodesDraggable:U,elementsSelectable:oe}),W]})}))}));function bS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 xS(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 _S(){return S.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:S.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 ES(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 SS(){return S.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:S.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 kS(e){var n=e.children,t=e.className,r=h(e,["children","className"]);return S.jsx("button",f({type:"button",className:O(["ink-flow__controls-button",t])},r,{children:n}))}var NS=function(e){return e.userSelectionActive?"none":"all"};function CS(e){var n=e.position,t=void 0===n?"top-left":n,r=e.children,o=e.className,i=e.style,a=h(e,["position","children","className","style"]),u=xx(NS),c="".concat(t).split("-");return S.jsx("div",f({className:O(m(["ink-flow__panel",o],y(c),!1)),style:f(f({},i),{pointerEvents:u})},a,{children:r}))}var MS=function(e){return{isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom}};function OS(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,l=e.onZoomIn,s=e.onZoomOut,d=e.onFitView,f=e.onInteractiveChange,h=e.className,v=e.children,p=e.position,g=void 0===p?"bottom-left":p,y=e.orientation,m=void 0===y?"vertical":y,w=e["aria-label"],b=void 0===w?"Ink Flow controls":w,x=_x(),_=xx(MS,o_),E=_.isInteractive,k=_.minZoomReached,N=_.maxZoomReached,C=H_(),M=C.zoomIn,j=C.zoomOut,P=C.fitView,I="horizontal"===m?"horizontal":"vertical";return S.jsxs(CS,{className:O(["ink-flow__controls",I,h]),position:g,style:n,"data-testid":"rf__controls","aria-label":b,children:[i&&S.jsx(kS,{className:"ink-flow__controls-fitview",onClick:function(){P(c),null==d||d()},"aria-label":"fit view",children:S.jsx(_S,{})}),r&&S.jsxs("div",{className:"ink-flow__controls-zoom",children:[S.jsx(kS,{onClick:function(){M(),null==l||l()},className:"ink-flow__controls-zoomin","aria-label":"zoom in",disabled:N,children:S.jsx(bS,{})}),S.jsx(kS,{onClick:function(){j(),null==s||s()},className:"ink-flow__controls-zoomout","aria-label":"zoom out",disabled:k,children:S.jsx(xS,{})})]}),u&&S.jsx(kS,{className:"ink-flow__controls-interactive",onClick:function(){x.setState({nodesDraggable:!E,nodesConnectable:!E,elementsSelectable:!E}),null==f||f(!E)},title:"toggle interactivity","aria-label":"toggle interactivity",children:E?S.jsx(SS,{}):S.jsx(ES,{})}),v]})}OS.displayName="Controls";var jS,PS,IS=c(OS);function AS(e){var n=e.dimensions,t=e.lineWidth,r=e.variant,o=e.className;return S.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:O(["react-flow__background-pattern",r,o])})}function zS(e){var n=e.radius,t=e.className;return S.jsx("circle",{cx:n,cy:n,r:n,className:O(["react-flow__background-pattern","dots",t])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(jS||(jS={}));var TS=((PS={})[jS.Dots]=1,PS[jS.Lines]=1,PS[jS.Cross]=6,PS),LS=function(e){return{transform:e.transform,patternId:"pattern-".concat(e.rfId)}};function BS(e){var n=e.id,t=e.variant,r=void 0===t?jS.Dots:t,o=e.gap,i=void 0===o?20:o,u=e.size,c=e.lineWidth,l=void 0===c?1:c,s=e.offset,d=void 0===s?2:s,h=e.color,v=e.bgColor,p=e.style,g=e.className,y=e.patternClassName,m=a(null),w=xx(LS,o_),b=w.transform,x=w.patternId,_=u||TS[r],E=r===jS.Dots,k=r===jS.Cross,N=Array.isArray(i)?i:[i,i],C=[N[0]*b[2]||1,N[1]*b[2]||1],M=_*b[2],j=k?[M,M]:C,P=E?[M/d,M/d]:[j[0]/d,j[1]/d],I="".concat(x).concat(n||"");return S.jsxs("svg",{className:O(["ink-flow__background",g]),style:f(f(f({},p),i_),{"--xy-background-color-props":v,"--xy-background-pattern-color-props":h}),ref:m,"data-testid":"rf__background",children:[S.jsx("pattern",{id:I,x:b[0]%C[0],y:b[1]%C[1],width:C[0],height:C[1],patternUnits:"userSpaceOnUse",patternTransform:"translate(-".concat(P[0],",-").concat(P[1],")"),children:E?S.jsx(zS,{radius:M/d,className:y}):S.jsx(AS,{dimensions:j,lineWidth:l,variant:r,className:y})}),S.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:"url(#".concat(I,")")})]})}BS.displayName="Background";var DS=c(BS),RS=function(e){var n;return null===(n=e.domNode)||void 0===n?void 0:n.querySelector(".ink-flow__edgelabel-renderer")};function HS(e){var n=e.children,t=xx(RS);return t?d(n,t):null}export{DS as Background,jS as BackgroundVariant,xE as BaseEdge,Mm as ConnectionLineType,km as ConnectionMode,kS as ControlButton,IS as Controls,HS as EdgeLabelRenderer,oE as Handle,dS as InkFlowProvider,Om as MarkerType,Nm as PanOnScrollMode,jm as Position,Cm as SelectionMode,ME as SmoothStepEdge,PE as StepEdge,Rm as addEdge,Xv as dagreLayout,wS as default,Im as getBezierEdgeCenter,Tm as getBezierPath,kv as getConnectedEdges,Lm as getEdgeCenter,xv as getIncomers,Ev as getNodesBounds,bv as getOutgoers,Zm as getSmoothStepPath,Vm as getStraightPath,Dv as getViewportForBounds,Hm as updateEdge,I_ as useEdgesState,H_ as useInkFlow,A_ as useNodesState,xx as useStore,_x as useStoreApi};
17
17
  //# sourceMappingURL=index.esm.js.map