!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).ReactFlow={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(t);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n,o,r={},i=Object.keys(e);for(o=0;o=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function a(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;oe.length)&&(t=e.length);for(var n=0,o=new Array(t);nr?n-f:n+f,p=s?0:Math.abs(i-o);return[h,o=0?.5*e:25*t*Math.sqrt(-e)}function F(t){var n,o,r=t.pos,i=t.x1,a=t.y1,l=t.x2,c=t.y2,u=t.c;switch(r){case e.Position.Left:n=i-K(i-l,u),o=a;break;case e.Position.Right:n=i+K(l-i,u),o=a;break;case e.Position.Top:n=i,o=a-K(a-c,u);break;case e.Position.Bottom:n=i,o=a+K(c-a,u)}return[n,o]}function q(t){var n=t.sourceX,o=t.sourceY,r=t.sourcePosition,i=void 0===r?e.Position.Bottom:r,a=t.targetX,l=t.targetY,c=t.targetPosition,u=void 0===c?e.Position.Top:c,s=t.curvature,d=void 0===s?.25:s,f=y(F({pos:i,x1:n,y1:o,x2:a,y2:l,c:d}),2),h=f[0],p=f[1],g=y(F({pos:u,x1:a,y1:l,x2:n,y2:o,c:d}),2),v=g[0],m=g[1];return"M".concat(n,",").concat(o," C").concat(h,",").concat(p," ").concat(v,",").concat(m," ").concat(a,",").concat(l)}function W(t){var n=t.sourceX,o=t.sourceY,r=t.sourcePosition,i=void 0===r?e.Position.Bottom:r,a=t.targetX,l=t.targetY,c=t.targetPosition,u=void 0===c?e.Position.Top:c,s=t.curvature,d=void 0===s?.25:s,f=y(F({pos:i,x1:n,y1:o,x2:a,y2:l,c:d}),2),h=f[0],p=f[1],g=y(F({pos:u,x1:a,y1:l,x2:n,y2:o,c:d}),2),v=.125*n+.375*h+.375*g[0]+.125*a,m=.125*o+.375*p+.375*g[1]+.125*l;return[v,m,Math.abs(v-n),Math.abs(m-o)]}var G=t.memo((function(t){var n=t.sourceX,r=t.sourceY,i=t.targetX,a=t.targetY,l=t.sourcePosition,c=void 0===l?e.Position.Bottom:l,u=t.targetPosition,s=void 0===u?e.Position.Top:u,d=t.label,f=t.labelStyle,h=t.labelShowBg,p=t.labelBgStyle,g=t.labelBgPadding,v=t.labelBgBorderRadius,m=t.style,b=t.markerEnd,w=t.markerStart,_={sourceX:n,sourceY:r,sourcePosition:c,targetX:i,targetY:a,targetPosition:s,curvature:t.curvature},S=q(_),E=y(W(_),2),O=E[0],P=E[1];return o.default.createElement(x,{path:S,centerX:O,centerY:P,label:d,labelStyle:f,labelShowBg:h,labelBgStyle:p,labelBgPadding:g,labelBgBorderRadius:v,style:m,markerEnd:b,markerStart:w})}));function Q(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(let o=0;o{const r="function"==typeof e?e(t):e;if(r!==t){const e=t;t=o?r:Object.assign({},t,r),n.forEach((n=>n(t,e)))}},r=()=>t,i={setState:o,getState:r,subscribe:(e,o,i)=>o||i?((e,o=r,i=Object.is)=>{console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");let a=o(t);function l(){const n=o(t);if(!i(a,n)){const t=a;e(a=n,t)}}return n.add(l),()=>n.delete(l)})(e,o,i):(n.add(e),()=>n.delete(e)),destroy:()=>n.clear()};return t=e(o,r,i),i}const J="undefined"==typeof window||!window.navigator||/ServerSideRendering|^Deno\//.test(window.navigator.userAgent)?t.useEffect:t.useLayoutEffect;var ee=function(e){return{width:e.offsetWidth,height:e.offsetHeight}},te=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;return Math.min(Math.max(e,t),n)},ne=function(e,t){return{x:te(e.x,t[0][0],t[1][0]),y:te(e.y,t[0][1],t[1][1])}},oe=function(e){var t,n;return(null===(t=e.getRootNode)||void 0===t?void 0:t.call(e))||(null===(n=window)||void 0===n?void 0:n.document)},re=function(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}},ie=function(e){var t=e.x,n=e.y;return{x:t,y:n,x2:t+e.width,y2:n+e.height}},ae=function(e){var t=e.x,n=e.y;return{x:t,y:n,width:e.x2-t,height:e.y2-n}},le=function(e){return!isNaN(e)&&isFinite(e)},ce=Symbol("internals");function ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function se(e){for(var t=1;t0||r>0||t.position.x<0||t.position.y<0){var i,a;if(n.style=se({},n.style)||{},n.style.width=null!==(i=n.style.width)&&void 0!==i?i:n.width,n.style.height=null!==(a=n.style.height)&&void 0!==a?a:n.height,o>0&&(n.style.width+=o),r>0&&(n.style.height+=r),t.position.x<0){var l=Math.abs(t.position.x);n.position.x=n.position.x-l,n.style.width+=l,t.position.x=0}if(t.position.y<0){var c=Math.abs(t.position.y);n.position.y=n.position.y-c,n.style.height+=c,t.position.y=0}n.width=n.style.width,n.height=n.style.height}}}function fe(e,t){if(e.some((function(e){return"reset"===e.type})))return e.filter((function(e){return"reset"===e.type})).map((function(e){return e.item}));var n=e.filter((function(e){return"add"===e.type})).map((function(e){return e.item}));return t.reduce((function(t,n){var o=e.find((function(e){return e.id===n.id}));if(o)switch(o.type){case"select":return t.push(se(se({},n),{},{selected:o.selected})),t;case"position":var r=se({},n);return void 0!==o.position&&(r.position=o.position),void 0!==o.positionAbsolute&&(r.positionAbsolute=o.positionAbsolute),void 0!==o.dragging&&(r.dragging=o.dragging),r.expandParent&&de(t,r),t.push(r),t;case"dimensions":var i=se({},n);return void 0!==o.dimensions&&(i.width=o.dimensions.width,i.height=o.dimensions.height),i.expandParent&&de(t,i),t.push(i),t;case"remove":return t}return t.push(n),t}),n)}function he(e,t){return fe(e,t)}function pe(e,t){return fe(e,t)}var ge=function(e,t){return{id:e,type:"select",selected:t}};function ve(e,t){return e.reduce((function(e,n){var o=t.includes(n.id);return!n.selected&&o?(n.selected=!0,e.push(ge(n.id,!0))):n.selected&&!o&&(n.selected=!1,e.push(ge(n.id,!1))),e}),[])}function me(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ye(e){for(var t=1;t{}};function xe(){for(var e,t=0,n=arguments.length,o={};t=0&&(n=e.slice(o+1),e=e.slice(0,o)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}}))}function Pe(e,t){for(var n,o=0,r=e.length;o0)for(var n,o,r=new Array(n),i=0;i=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Ne.hasOwnProperty(t)?{space:Ne[t],local:e}:e}function je(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Me&&t.documentElement.namespaceURI===Me?t.createElement(e):t.createElementNS(n,e)}}function De(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ae(e){var t=ke(e);return(t.local?De:je)(t)}function ze(){}function Ie(e){return null==e?ze:function(){return this.querySelector(e)}}function Be(e){return null==e?[]:Array.isArray(e)?e:Array.from(e)}function Te(){return[]}function Re(e){return null==e?Te:function(){return this.querySelectorAll(e)}}function Le(e){return function(){return this.matches(e)}}function He(e){return function(t){return t.matches(e)}}var Xe=Array.prototype.find;function Ye(){return this.firstElementChild}var Ve=Array.prototype.filter;function Ze(){return Array.from(this.children)}function Ue(e){return new Array(e.length)}function Ke(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Fe(e){return function(){return e}}function qe(e,t,n,o,r,i){for(var a,l=0,c=t.length,u=i.length;lt?1:e>=t?0:NaN}function Je(e){return function(){this.removeAttribute(e)}}function et(e){return function(){this.removeAttributeNS(e.space,e.local)}}function tt(e,t){return function(){this.setAttribute(e,t)}}function nt(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ot(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function rt(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function it(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function at(e){return function(){this.style.removeProperty(e)}}function lt(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ct(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ut(e,t){return e.style.getPropertyValue(t)||it(e).getComputedStyle(e,null).getPropertyValue(t)}function st(e){return function(){delete this[e]}}function dt(e,t){return function(){this[e]=t}}function ft(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function ht(e){return e.trim().split(/^|\s+/)}function pt(e){return e.classList||new gt(e)}function gt(e){this._node=e,this._names=ht(e.getAttribute("class")||"")}function vt(e,t){for(var n=pt(e),o=-1,r=t.length;++o=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}}))}function zt(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var Lt=[null];function Ht(e,t){this._groups=e,this._parents=t}function Xt(){return new Ht([[document.documentElement]],Lt)}function Yt(e){return"string"==typeof e?new Ht([[document.querySelector(e)]],[document.documentElement]):new Ht([[e]],Lt)}Ht.prototype=Xt.prototype={constructor:Ht,select:function(e){"function"!=typeof e&&(e=Ie(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r=_&&(_=w+1);!(b=v[_])&&++_=0;)(o=r[i])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=$e);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i1?this.each((null==t?at:"function"==typeof t?ct:lt)(e,t,null==n?"":n)):ut(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?st:"function"==typeof t?ft:dt)(e,t)):this.node()[e]},classed:function(e,t){var n=ht(e+"");if(arguments.length<2){for(var o=pt(this.node()),r=-1,i=n.length;++r()=>e;function Jt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:l,dx:c,dy:u,dispatch:s}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:u,enumerable:!0,configurable:!0},_:{value:s}})}function en(e){return!e.ctrlKey&&!e.button}function tn(){return this.parentNode}function nn(e,t){return null==t?{x:e.x,y:e.y}:t}function on(){return navigator.maxTouchPoints||"ontouchstart"in this}function rn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function an(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function ln(){}Jt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var cn=.7,un=1/cn,sn="\\s*([+-]?\\d+)\\s*",dn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",fn="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",hn=/^#([0-9a-f]{3,8})$/,pn=new RegExp("^rgb\\("+[sn,sn,sn]+"\\)$"),gn=new RegExp("^rgb\\("+[fn,fn,fn]+"\\)$"),vn=new RegExp("^rgba\\("+[sn,sn,sn,dn]+"\\)$"),mn=new RegExp("^rgba\\("+[fn,fn,fn,dn]+"\\)$"),yn=new RegExp("^hsl\\("+[dn,fn,fn]+"\\)$"),bn=new RegExp("^hsla\\("+[dn,fn,fn,dn]+"\\)$"),wn={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 _n(){return this.rgb().formatHex()}function Sn(){return this.rgb().formatRgb()}function xn(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=hn.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?En(t):3===n?new Mn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?On(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?On(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=pn.exec(e))?new Mn(t[1],t[2],t[3],1):(t=gn.exec(e))?new Mn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=vn.exec(e))?On(t[1],t[2],t[3],t[4]):(t=mn.exec(e))?On(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=yn.exec(e))?Dn(t[1],t[2]/100,t[3]/100,1):(t=bn.exec(e))?Dn(t[1],t[2]/100,t[3]/100,t[4]):wn.hasOwnProperty(e)?En(wn[e]):"transparent"===e?new Mn(NaN,NaN,NaN,0):null}function En(e){return new Mn(e>>16&255,e>>8&255,255&e,1)}function On(e,t,n,o){return o<=0&&(e=t=n=NaN),new Mn(e,t,n,o)}function Pn(e){return e instanceof ln||(e=xn(e)),e?new Mn((e=e.rgb()).r,e.g,e.b,e.opacity):new Mn}function Cn(e,t,n,o){return 1===arguments.length?Pn(e):new Mn(e,t,n,null==o?1:o)}function Mn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Nn(){return"#"+jn(this.r)+jn(this.g)+jn(this.b)}function kn(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function jn(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function Dn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new zn(e,t,n,o)}function An(e){if(e instanceof zn)return new zn(e.h,e.s,e.l,e.opacity);if(e instanceof ln||(e=xn(e)),!e)return new zn;if(e instanceof zn)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),a=NaN,l=i-r,c=(i+r)/2;return l?(a=t===i?(n-o)/l+6*(n0&&c<1?0:a,new zn(a,l,c,e.opacity)}function zn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function In(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}rn(ln,xn,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:_n,formatHex:_n,formatHsl:function(){return An(this).formatHsl()},formatRgb:Sn,toString:Sn}),rn(Mn,Cn,an(ln,{brighter:function(e){return e=null==e?un:Math.pow(un,e),new Mn(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?cn:Math.pow(cn,e),new Mn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){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:Nn,formatHex:Nn,formatRgb:kn,toString:kn})),rn(zn,(function(e,t,n,o){return 1===arguments.length?An(e):new zn(e,t,n,null==o?1:o)}),an(ln,{brighter:function(e){return e=null==e?un:Math.pow(un,e),new zn(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?cn:Math.pow(cn,e),new zn(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new Mn(In(e>=240?e-240:e+120,r,o),In(e,r,o),In(e<120?e+240:e-120,r,o),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));const Bn=Math.PI/180,Tn=180/Math.PI,Rn=.96422,Ln=.82521,Hn=4/29,Xn=6/29,Yn=3*Xn*Xn;function Vn(e){if(e instanceof Zn)return new Zn(e.l,e.a,e.b,e.opacity);if(e instanceof Gn)return Qn(e);e instanceof Mn||(e=Pn(e));var t,n,o=qn(e.r),r=qn(e.g),i=qn(e.b),a=Un((.2225045*o+.7168786*r+.0606169*i)/1);return o===r&&r===i?t=n=a:(t=Un((.4360747*o+.3850649*r+.1430804*i)/Rn),n=Un((.0139322*o+.0971045*r+.7141733*i)/Ln)),new Zn(116*a-16,500*(t-a),200*(a-n),e.opacity)}function Zn(e,t,n,o){this.l=+e,this.a=+t,this.b=+n,this.opacity=+o}function Un(e){return e>.008856451679035631?Math.pow(e,1/3):e/Yn+Hn}function Kn(e){return e>Xn?e*e*e:Yn*(e-Hn)}function Fn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function qn(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Wn(e){if(e instanceof Gn)return new Gn(e.h,e.c,e.l,e.opacity);if(e instanceof Zn||(e=Vn(e)),0===e.a&&0===e.b)return new Gn(NaN,0()=>e;function so(e,t){return function(n){return e+n*t}}function fo(e){return 1==(e=+e)?ho:function(t,n){return n-t?function(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}(t,n,e):uo(isNaN(t)?n:t)}}function ho(e,t){var n=t-e;return n?so(e,n):uo(isNaN(e)?t:e)}var po=function e(t){var n=fo(t);function o(e,t){var o=n((e=Cn(e)).r,(t=Cn(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=ho(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=r(t),e.b=i(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function go(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var vo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,mo=new RegExp(vo.source,"g");function yo(e,t){var n,o,r,i=vo.lastIndex=mo.lastIndex=0,a=-1,l=[],c=[];for(e+="",t+="";(n=vo.exec(e))&&(o=mo.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),l[a]?l[a]+=r:l[++a]=r),(n=n[0])===(o=o[0])?l[a]?l[a]+=o:l[++a]=o:(l[++a]=null,c.push({i:a,x:go(n,o)})),i=mo.lastIndex;return i180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:go(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,l,c),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:go(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,l,c),function(e,t,n,o,i,a){if(e!==n||t!==o){var l=i.push(r(i)+"scale(",null,",",null,")");a.push({i:l-4,x:go(e,n)},{i:l-2,x:go(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,l,c),i=a=null,function(e){for(var t,n=-1,o=c.length;++n180||n<-180?n-360*Math.round(n/360):n):uo(isNaN(e)?t:e)})),Mo(ho);var No,ko,jo=0,Do=0,Ao=0,zo=0,Io=0,Bo=0,To="object"==typeof performance&&performance.now?performance:Date,Ro="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Lo(){return Io||(Ro(Ho),Io=To.now()+Bo)}function Ho(){Io=0}function Xo(){this._call=this._time=this._next=null}function Yo(e,t,n){var o=new Xo;return o.restart(e,t,n),o}function Vo(){Io=(zo=To.now())+Bo,jo=Do=0;try{!function(){Lo(),++jo;for(var e,t=No;t;)(e=Io-t._time)>=0&&t._call.call(void 0,e),t=t._next;--jo}()}finally{jo=0,function(){var e,t,n=No,o=1/0;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:No=t);ko=e,Uo(o)}(),Io=0}}function Zo(){var e=To.now(),t=e-zo;t>1e3&&(Bo-=t,zo=e)}function Uo(e){jo||(Do&&(Do=clearTimeout(Do)),e-Io>24?(e<1/0&&(Do=setTimeout(Vo,e-To.now()-Bo)),Ao&&(Ao=clearInterval(Ao))):(Ao||(zo=To.now(),Ao=setInterval(Zo,1e3)),jo=1,Ro(Vo)))}function Ko(e,t,n){var o=new Xo;return t=null==t?0:+t,o.restart((n=>{o.stop(),e(n+t)}),t,n),o}Xo.prototype=Yo.prototype={constructor:Xo,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Lo():+n)+(null==t?0:+t),this._next||ko===this||(ko?ko._next=this:No=this,ko=this),this._call=e,this._time=n,Uo()},stop:function(){this._call&&(this._call=null,this._time=1/0,Uo())}};var Fo=xe("start","end","cancel","interrupt"),qo=[];function Wo(e,t,n,o,r,i){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,r=e.__transition;function i(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(i){var u,s,d,f;if(1!==n.state)return c();for(u in r)if((f=r[u]).name===n.name){if(3===f.state)return Ko(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[u]):+u0)throw new Error("too late; already scheduled");return n}function Qo(e,t){var n=$o(e,t);if(n.state>3)throw new Error("too late; already running");return n}function $o(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Jo(e,t){var n,o,r,i=e.__transition,a=!0;if(i){for(r in t=null==t?null:t+"",i)(n=i[r]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete i[r]):a=!1;a&&delete e.__transition}}function er(e,t){var n,o;return function(){var r=Qo(this,e),i=r.tween;if(i!==n)for(var a=0,l=(o=n=i).length;a=0&&(e=e.slice(0,t)),!e||"start"===e}))}(t)?Go:Qo;return function(){var a=i(this,e),l=a.on;l!==o&&(r=(o=l).copy()).on(t,n),a.on=r}}var wr=Xt.prototype.constructor;function _r(e){return function(){this.style.removeProperty(e)}}function Sr(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function xr(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&Sr(e,i,n)),o}return i._value=t,i}function Er(e){return function(t){this.textContent=e.call(this,t)}}function Or(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Er(o)),t}return o._value=e,o}var Pr=0;function Cr(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Mr(){return++Pr}var Nr=Xt.prototype;Cr.prototype={constructor:Cr,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Ie(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a()=>e;function Br(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Tr(e,t,n){this.k=e,this.x=t,this.y=n}Tr.prototype={constructor:Tr,scale:function(e){return 1===e?this:new Tr(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Tr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Rr=new Tr(1,0,0);function Lr(e){e.stopImmediatePropagation()}function Hr(e){e.preventDefault(),e.stopImmediatePropagation()}function Xr(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Yr(){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 Vr(){return this.__zoom||Rr}function Zr(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ur(){return navigator.maxTouchPoints||"ontouchstart"in this}function Kr(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a))}function Fr(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function qr(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:[0,0,1],o=y(n,3),r=o[0],i=o[1],a=o[2],l=arguments.length>3&&void 0!==arguments[3]&&arguments[3],c=arguments.length>4&&void 0!==arguments[4]&&arguments[4],u=ie({x:(t.x-r)/a,y:(t.y-i)/a,width:t.width/a,height:t.height/a}),s=[];return e.forEach((function(e){var t=e.positionAbsolute,n=e.width,o=e.height,r=e.selectable;if(c&&!(void 0===r||r))return!1;var i=ie(qr(qr({},t),{},{width:n||0,height:o||0})),a=Math.max(0,Math.min(u.x2,i.x2)-Math.max(u.x,i.x)),d=Math.max(0,Math.min(u.y2,i.y2)-Math.max(u.y,i.y)),f=Math.ceil(a*d);(void 0===n||void 0===o||null===n||null===o||l&&f>0||f>=(n||0)*(o||0))&&s.push(e)})),s},oi=function(e,t){var n=e.map((function(e){return e.id}));return t.filter((function(e){return n.includes(e.source)||n.includes(e.target)}))},ri=function(e,t,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:.1,a=t/(e.width*(1+i)),l=n/(e.height*(1+i)),c=Math.min(a,l),u=te(c,o,r),s=e.x+e.width/2,d=e.y+e.height/2,f=t/2-s*u,h=n/2-d*u;return[f,h,u]},ii=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return e.transition().duration(t)};function ai(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function li(e){for(var t=1;t(null!==(f=o.z)&&void 0!==f?f:0)?null!==(h=null===(p=v[ce])||void 0===p?void 0:p.z)&&void 0!==h?h:0:null!==(g=o.z)&&void 0!==g?g:0})}function ui(e,t){var n=new Map,o={};return e.forEach((function(e){var r,i=le(e.zIndex)?e.zIndex:e.selected?1e3:0,a=t.get(e.id),l=li(li({width:null==a?void 0:a.width,height:null==a?void 0:a.height},e),{},{positionAbsolute:{x:e.position.x,y:e.position.y}});e.parentNode&&(l.parentNode=e.parentNode,o[e.parentNode]=!0),Object.defineProperty(l,ce,{enumerable:!1,value:{handleBounds:null==a||null===(r=a[ce])||void 0===r?void 0:r.handleBounds,z:i}}),n.set(e.id,l)})),n.forEach((function(e){if(e.parentNode&&!n.has(e.parentNode))throw new Error("Parent node ".concat(e.parentNode," not found"));if(e.parentNode||o[e.id]){var t,r,i=ci(e,n,o,li(li({},e.position),{},{z:null!==(t=null===(r=e[ce])||void 0===r?void 0:r.z)&&void 0!==t?t:0})),a=i.x,l=i.y,c=i.z;e.positionAbsolute={x:a,y:l},e[ce].z=c,o[e.id]&&(e[ce].isParent=!0)}})),n}function si(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e(),o=n.nodeInternals,r=n.width,i=n.height,a=n.minZoom,l=n.maxZoom,c=n.d3Zoom,u=n.d3Selection,s=n.fitViewOnInitDone,d=n.fitViewOnInit;if((t.initial&&!s&&d||!t.initial)&&c&&u){var f=Array.from(o.values()).filter((function(e){return t.includeHiddenNodes?e.width&&e.height:!e.hidden})),h=f.every((function(e){return e.width&&e.height}));if(f.length>0&&h){var p,g,v,m=ti(f),b=ri(m,r,i,null!==(p=t.minZoom)&&void 0!==p?p:a,null!==(g=t.maxZoom)&&void 0!==g?g:l,null!==(v=t.padding)&&void 0!==v?v:.1),w=y(b,3),_=w[0],S=w[1],x=w[2],E=Rr.translate(_,S).scale(x);return"number"==typeof t.duration&&t.duration>0?c.transform(ii(u,t.duration),E):c.transform(u,E),!0}}return!1}function di(e,t){return e.forEach((function(e){var n,o=t.get(e.id);o&&t.set(o.id,li(li({},o),{},(r(n={},ce,o[ce]),r(n,"selected",e.selected),n)))})),new Map(t)}function fi(e,t){return t.map((function(t){var n=e.find((function(e){return e.id===t.id}));return n&&(t.selected=n.selected),t}))}function hi(e){var t=e.changedNodes,n=e.changedEdges,o=e.get,r=e.set,i=o(),a=i.nodeInternals,l=i.edges,c=i.onNodesChange,u=i.onEdgesChange,s=i.hasDefaultNodes,d=i.hasDefaultEdges;null!=t&&t.length&&(s&&r({nodeInternals:di(t,a)}),null==c||c(t)),null!=n&&n.length&&(d&&r({edges:fi(n,l)}),null==u||u(n))}var pi=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],gi={width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:pi,nodeExtent:pi,nodesSelectionActive:!1,userSelectionActive:!1,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionMode:e.ConnectionMode.Strict,domNode:null,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,elementsSelectable:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,multiSelectionActive:!1,reactFlowVersion:"10.3.17",connectionStartHandle:null,connectOnClick:!0};function vi(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function mi(e){for(var t=1;t{const i=t.useRef();return i.current||(n&&(console.warn("Provider initialStore is deprecated and will be removed in the next version."),o||(o=()=>n)),i.current=o()),t.createElement(e.Provider,{value:i.current},r)},useStore:(n,o=Object.is)=>{const r=t.useContext(e);if(!r)throw new Error("Seems like you have not used zustand provider as an ancestor.");return r(n,o)},useStoreApi:()=>{const n=t.useContext(e);if(!n)throw new Error("Seems like you have not used zustand provider as an ancestor.");return t.useMemo((()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe,destroy:n.destroy})),[n])}}}(),bi=yi.Provider,wi=yi.useStore,_i=yi.useStoreApi,Si=function(){return function(e){const n="function"==typeof e?$(e):e,o=(e=n.getState,o=Object.is)=>{const[,r]=t.useReducer((e=>e+1),0),i=n.getState(),a=t.useRef(i),l=t.useRef(e),c=t.useRef(o),u=t.useRef(!1),s=t.useRef();let d;void 0===s.current&&(s.current=e(i));let f=!1;(a.current!==i||l.current!==e||c.current!==o||u.current)&&(d=e(i),f=!o(s.current,d)),J((()=>{f&&(s.current=d),a.current=i,l.current=e,c.current=o,u.current=!1}));const h=t.useRef(i);J((()=>{const e=()=>{try{const e=n.getState(),t=l.current(e);c.current(s.current,t)||(a.current=e,s.current=t,r())}catch(e){u.current=!0,r()}},t=n.subscribe(e);return n.getState()!==h.current&&e(),t}),[]);const p=f?d:s.current;return t.useDebugValue(p),p};return Object.assign(o,n),o[Symbol.iterator]=function(){console.warn("[useStore, api] = create() is deprecated and will be removed in v4");const e=[o,n];return{next(){const t=e.length<=0;return{value:e.shift(),done:t}}}},o}((function(e,t){return mi(mi({},gi),{},{setNodes:function(n){e({nodeInternals:ui(n,t().nodeInternals)})},setEdges:function(n){var o=t().defaultEdgeOptions,r=void 0===o?{}:o;e({edges:n.map((function(e){return mi(mi({},r),e)}))})},setDefaultNodesAndEdges:function(t,n){var o=void 0!==t,r=void 0!==n,i=o?ui(t,new Map):new Map;e({nodeInternals:i,edges:r?n:[],hasDefaultNodes:o,hasDefaultEdges:r})},updateNodeDimensions:function(n){var o=t(),i=o.onNodesChange,a=o.nodeInternals,l=o.fitViewOnInit,c=o.fitViewOnInitDone,u=o.fitViewOnInitOptions,s=o.domNode,d=null==s?void 0:s.querySelector(".react-flow__viewport");if(d){var f=window.getComputedStyle(d),h=new window.DOMMatrixReadOnly(f.transform).m22,p=n.reduce((function(e,t){var n=a.get(t.id);if(n){var o=ee(t.nodeElement);!(!o.width||!o.height||n.width===o.width&&n.height===o.height&&!t.forceUpdate)&&(a.set(n.id,mi(mi({},n),{},r({},ce,mi(mi({},n[ce]),{},{handleBounds:{source:be(".source",t.nodeElement,h),target:be(".target",t.nodeElement,h)}})),o)),e.push({id:n.id,type:"dimensions",dimensions:o}))}return e}),[]),g=c||l&&!c&&si(t,mi({initial:!0},u));e({nodeInternals:new Map(a),fitViewOnInitDone:g}),(null==p?void 0:p.length)>0&&(null==i||i(p))}},updateNodePositions:function(n){var o=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t(),a=i.onNodesChange,l=i.nodeInternals,c=i.hasDefaultNodes;if(c||a){var u=n.map((function(e){var t={id:e.id,type:"position",dragging:r};return o&&(t.positionAbsolute=e.positionAbsolute,t.position=e.position),t}));if(null!=u&&u.length){if(c){var s=he(u,Array.from(l.values())),d=ui(s,l);e({nodeInternals:d})}null==a||a(u)}}},addSelectedNodes:function(n){var o,r=t(),i=r.multiSelectionActive,a=r.nodeInternals,l=r.edges,c=null;i?o=n.map((function(e){return ge(e,!0)})):(o=ve(Array.from(a.values()),n),c=ve(l,[])),hi({changedNodes:o,changedEdges:c,get:t,set:e})},addSelectedEdges:function(n){var o,r=t(),i=r.multiSelectionActive,a=r.edges,l=r.nodeInternals,c=null;i?o=n.map((function(e){return ge(e,!0)})):(o=ve(a,n),c=ve(Array.from(l.values()),[])),hi({changedNodes:c,changedEdges:o,get:t,set:e})},unselectNodesAndEdges:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=n.nodes,r=n.edges,i=t(),a=i.nodeInternals,l=i.edges,c=o||Array.from(a.values()),u=r||l,s=c.map((function(e){return e.selected=!1,ge(e.id,!1)})),d=u.map((function(e){return ge(e.id,!1)}));hi({changedNodes:s,changedEdges:d,get:t,set:e})},setMinZoom:function(n){var o=t(),r=o.d3Zoom,i=o.maxZoom;null==r||r.scaleExtent([n,i]),e({minZoom:n})},setMaxZoom:function(n){var o=t(),r=o.d3Zoom,i=o.minZoom;null==r||r.scaleExtent([i,n]),e({maxZoom:n})},setTranslateExtent:function(n){var o=t().d3Zoom;null==o||o.translateExtent(n),e({translateExtent:n})},resetSelectedElements:function(){var n=t(),o=n.nodeInternals,r=n.edges;hi({changedNodes:Array.from(o.values()).filter((function(e){return e.selected})).map((function(e){return ge(e.id,!1)})),changedEdges:r.filter((function(e){return e.selected})).map((function(e){return ge(e.id,!1)})),get:t,set:e})},setNodeExtent:function(n){var o=t().nodeInternals;o.forEach((function(e){e.positionAbsolute=ne(e.position,n)})),e({nodeExtent:n,nodeInternals:new Map(o)})},reset:function(){return e(mi({},gi))}})}))},xi=t.createContext(null),Ei=xi.Provider;function Oi(t,n,o,r,i,a,l){var c=l.elementFromPoint(t.clientX,t.clientY),u=(null==c?void 0:c.classList.contains("target"))||!1,s=(null==c?void 0:c.classList.contains("source"))||!1,d={elementBelow:c,isValid:!1,connection:{source:null,target:null,sourceHandle:null,targetHandle:null},isHoveringHandle:!1};if(c&&(u||s)){d.isHoveringHandle=!0;var f=c.getAttribute("data-nodeid"),h=c.getAttribute("data-handleid"),p=o?{source:f,sourceHandle:h,target:r,targetHandle:i}:{source:r,sourceHandle:i,target:f,targetHandle:h};d.connection=p,(n!==e.ConnectionMode.Strict||(o&&s||!o&&u))&&(d.isValid=a(p))}return d}function Pi(e){null==e||e.classList.remove("react-flow__handle-valid"),null==e||e.classList.remove("react-flow__handle-connecting")}function Ci(e){var t=e.event,n=e.handleId,o=e.nodeId,r=e.onConnect,i=e.isTarget,a=e.getState,l=e.setState,c=e.isValidConnection,u=e.elementEdgeUpdaterType,s=e.onEdgeUpdateEnd,d=t.target.closest(".react-flow"),f=oe(t.target);if(f){var h=f.elementFromPoint(t.clientX,t.clientY),p=null==h?void 0:h.classList.contains("target"),g=null==h?void 0:h.classList.contains("source");if(d&&(p||g||u)){var v,m=a(),y=m.onConnectStart,b=m.connectionMode,w=u||(p?"target":"source"),_=d.getBoundingClientRect();l({connectionPosition:{x:t.clientX-_.left,y:t.clientY-_.top},connectionNodeId:o,connectionHandleId:n,connectionHandleType:w}),null==y||y(t,{nodeId:o,handleId:n,handleType:w}),f.addEventListener("mousemove",S),f.addEventListener("mouseup",(function e(t){var d=a(),h=d.onConnectStop,p=d.onConnectEnd,g=Oi(t,b,i,o,n,c,f),m=g.connection,y=g.isValid;null==h||h(t),y&&(null==r||r(m)),null==p||p(t),u&&s&&s(t),Pi(v),l({connectionNodeId:null,connectionHandleId:null,connectionHandleType:null}),f.removeEventListener("mousemove",S),f.removeEventListener("mouseup",e)}))}}function S(e){l({connectionPosition:{x:e.clientX-_.left,y:e.clientY-_.top}});var t=Oi(e,b,i,o,n,c,f),r=t.connection,a=t.elementBelow,u=t.isValid;if(!t.isHoveringHandle)return Pi(v);r.source!==r.target&&a&&(Pi(v),v=a,a.classList.add("react-flow__handle-connecting"),a.classList.toggle("react-flow__handle-valid",u))}}xi.Consumer;var Mi=["type","position","isValidConnection","isConnectable","id","onConnect","children","className","onMouseDown"];function Ni(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ki(e){for(var t=1;t2&&void 0!==arguments[2]?arguments[2]:null,r=((null==o?void 0:o.x)||0)+n.x,i=((null==o?void 0:o.y)||0)+n.y,a=(null==o?void 0:o.width)||n.width,l=(null==o?void 0:o.height)||n.height;switch(t){case e.Position.Top:return{x:r+a/2,y:i};case e.Position.Right:return{x:r+a,y:i+l/2};case e.Position.Bottom:return{x:r+a/2,y:i+l};case e.Position.Left:return{x:r,y:i+l/2}}}function oa(e,t){if(!e)return null;var n=null;return 1!==e.length&&t?t&&(n=e.find((function(e){return e.id===t}))):n=e[0],void 0===n?null:n}function ra(e,t){var n,o,r,i,a,l=e.get(t),c=(null==l||null===(n=l[ce])||void 0===n?void 0:n.handleBounds)||null,u=!(l&&c&&l.width&&l.height&&void 0!==(null===(o=l.positionAbsolute)||void 0===o?void 0:o.x)&&void 0!==(null===(r=l.positionAbsolute)||void 0===r?void 0:r.y));return[{x:(null==l||null===(i=l.positionAbsolute)||void 0===i?void 0:i.x)||0,y:(null==l||null===(a=l.positionAbsolute)||void 0===a?void 0:a.y)||0,width:(null==l?void 0:l.width)||0,height:(null==l?void 0:l.height)||0},c,!u]}var ia="undefined"!=typeof document?document:null,aa=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{target:ia},o=t.useState(!1),r=y(o,2),i=r[0],a=r[1],l=t.useRef(new Set([])),c=t.useMemo((function(){if(null!==e){var t=(Array.isArray(e)?e:[e]).filter((function(e){return"string"==typeof e})).map((function(e){return e.split("+")})),n=t.reduce((function(e,t){return e.concat.apply(e,u(t))}),[]);return[t,n]}return[[],[]]}),[e]),s=y(c,2),d=s[0],f=s[1];return t.useEffect((function(){if(null!==e){var t,o,r=function(e){if(ua(e))return!1;var t=ca(e.code,f);l.current.add(e[t]),la(d,l.current,!1)&&(e.preventDefault(),a(!0))},i=function(e){if(ua(e))return!1;var t=ca(e.code,f);la(d,l.current,!0)?(a(!1),l.current.clear()):l.current.delete(e[t])},c=function(){l.current.clear(),a(!1)};return null==n||null===(t=n.target)||void 0===t||t.addEventListener("keydown",r),null==n||null===(o=n.target)||void 0===o||o.addEventListener("keyup",i),window.addEventListener("blur",c),function(){var e,t;null==n||null===(e=n.target)||void 0===e||e.removeEventListener("keydown",r),null==n||null===(t=n.target)||void 0===t||t.removeEventListener("keyup",i),window.removeEventListener("blur",c)}}}),[e,a]),i};function la(e,t,n){return e.filter((function(e){return n||e.length===t.size})).some((function(e){return e.every((function(e){return t.has(e)}))}))}function ca(e,t){return t.includes(e)?"code":"key"}function ua(e){var t,n=(null===(t=e.composedPath)||void 0===t?void 0:t.call(e)[0])||e.target;return["INPUT","SELECT","TEXTAREA"].includes(null==n?void 0:n.nodeName)||(null==n?void 0:n.hasAttribute("contenteditable"))}var sa=function(e){return{onNodesChange:e.onNodesChange,onEdgesChange:e.onEdgesChange}};var da=function(e){return{x:e.x,y:e.y,zoom:e.k}},fa=function(e,t){return e.target.closest(".".concat(t))},ha=function(e){return{d3Zoom:e.d3Zoom,d3Selection:e.d3Selection,d3ZoomHandler:e.d3ZoomHandler}},pa=function(n){var r=n.onMove,i=n.onMoveStart,a=n.onMoveEnd,l=n.zoomOnScroll,c=void 0===l||l,u=n.zoomOnPinch,s=void 0===u||u,d=n.panOnScroll,f=void 0!==d&&d,h=n.panOnScrollSpeed,p=void 0===h?.5:h,g=n.panOnScrollMode,v=void 0===g?e.PanOnScrollMode.Free:g,m=n.zoomOnDoubleClick,y=void 0===m||m,b=n.selectionKeyPressed,w=n.elementsSelectable,_=n.panOnDrag,S=void 0===_||_,x=n.translateExtent,E=n.minZoom,O=n.maxZoom,P=n.defaultZoom,C=void 0===P?1:P,M=n.defaultPosition,N=void 0===M?[0,0]:M,k=n.zoomActivationKeyCode,j=n.preventScrolling,D=void 0===j||j,A=n.children,z=n.noWheelClassName,I=n.noPanClassName,B=_i(),T=t.useRef(!1),R=t.useRef(null),L=t.useRef({x:0,y:0,zoom:0}),H=wi(ha,Q),X=H.d3Zoom,Y=H.d3Selection,V=H.d3ZoomHandler,Z=aa(k);return function(e){var n=_i();t.useEffect((function(){var t,o=function(){if(e.current){var t=ee(e.current);n.setState({width:t.width||500,height:t.height||500})}};return o(),window.onresize=o,e.current&&(t=new ResizeObserver((function(){return o()}))).observe(e.current),function(){window.onresize=null,t&&e.current&&t.unobserve(e.current)}}),[])}(R),t.useEffect((function(){if(R.current){var e,t=function(){var e,t,n,o=Xr,r=Yr,i=Kr,a=Zr,l=Ur,c=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],s=250,d=Co,f=xe("start","zoom","end"),h=500,p=0,g=10;function v(e){e.property("__zoom",Vr).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",O).filter(l).on("touchstart.zoom",P).on("touchmove.zoom",C).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(c[0],Math.min(c[1],t)))===e.k?e:new Tr(t,e.x,e.y)}function y(e,t,n){var o=t[0]-n[0]*e.k,r=t[1]-n[1]*e.k;return o===e.x&&r===e.y?e:new Tr(e.k,o,r)}function b(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",(function(){_(this,arguments).event(o).start()})).on("interrupt.zoom end.zoom",(function(){_(this,arguments).event(o).end()})).tween("zoom",(function(){var e=this,i=arguments,a=_(e,i).event(o),l=r.apply(e,i),c=null==n?b(l):"function"==typeof n?n.apply(e,i):n,u=Math.max(l[1][0]-l[0][0],l[1][1]-l[0][1]),s=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=d(s.invert(c).concat(u/s.k),f.invert(c).concat(u/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=u/t[2];e=new Tr(n,c[0]-t[0]*n,c[1]-t[1]*n)}a.zoom(null,e)}}))}function _(e,t,n){return!n&&e.__zooming||new S(e,t)}function S(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function x(e,...t){if(o.apply(this,arguments)){var n=_(this,t).event(e),r=this.__zoom,l=Math.max(c[0],Math.min(c[1],r.k*Math.pow(2,a.apply(this,arguments)))),s=Ut(e);if(n.wheel)n.mouse[0][0]===s[0]&&n.mouse[0][1]===s[1]||(n.mouse[1]=r.invert(n.mouse[0]=s)),clearTimeout(n.wheel);else{if(r.k===l)return;n.mouse=[s,r.invert(s)],Jo(this),n.start()}Hr(e),n.wheel=setTimeout(d,150),n.zoom("mouse",i(y(m(r,l),n.mouse[0],n.mouse[1]),n.extent,u))}function d(){n.wheel=null,n.end()}}function E(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,a=_(this,t,!0).event(e),l=Yt(e.view).on("mousemove.zoom",f,!0).on("mouseup.zoom",h,!0),c=Ut(e,r),s=e.clientX,d=e.clientY;Gt(e.view),Lr(e),a.mouse=[c,this.__zoom.invert(c)],Jo(this),a.start()}function f(e){if(Hr(e),!a.moved){var t=e.clientX-s,n=e.clientY-d;a.moved=t*t+n*n>p}a.event(e).zoom("mouse",i(y(a.that.__zoom,a.mouse[0]=Ut(e,r),a.mouse[1]),a.extent,u))}function h(e){l.on("mousemove.zoom mouseup.zoom",null),Qt(e.view,a.moved),Hr(e),a.event(e).end()}}function O(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=Ut(e.changedTouches?e.changedTouches[0]:e,this),l=n.invert(a),c=n.k*(e.shiftKey?.5:2),d=i(y(m(n,c),a,l),r.apply(this,t),u);Hr(e),s>0?Yt(this).transition().duration(s).call(w,d,a,e):Yt(this).call(v.transform,d,a,e)}}function P(n,...r){if(o.apply(this,arguments)){var i,a,l,c,u=n.touches,s=u.length,d=_(this,r,n.changedTouches.length===s).event(n);for(Lr(n),a=0;a0}),h()},onMouseLeave:function(){r.setState({nodesSelectionActive:!1}),h()}},u.draw&&o.default.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:u.width,height:u.height,transform:"translate(".concat(u.x,"px, ").concat(u.y,"px)")}}))}));function _a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Sa(e){for(var t=1;td}c.mouse("drag",o)}function g(e){Yt(e.view).on("mousemove.drag mouseup.drag",null),Qt(e.view,n),Wt(e),c.mouse("end",e)}function v(e,t){if(r.call(this,e,t)){var n,o,a=e.changedTouches,l=i.call(this,e,t),c=a.length;for(n=0;n0&&(null==d||d(g),l)){var m=v.map((function(e){return{id:e,type:"remove"}}));l(m)}if(f.length>0&&(null==s||s(f),a)){var y=f.map((function(e){return{id:e.id,type:"remove"}}));a(y)}r.setState({nodesSelectionActive:!1})}}),[c,a,l]),t.useEffect((function(){r.setState({multiSelectionActive:s})}),[s])}({deleteKeyCode:l,multiSelectionKeyCode:h});var I=i?function(e){return i(e)}:void 0,B=a?function(e){return a(e)}:void 0;return o.default.createElement(pa,{onMove:c,onMoveStart:s,onMoveEnd:d,selectionKeyPressed:z,elementsSelectable:g,zoomOnScroll:v,zoomOnPinch:m,panOnScroll:y,panOnScrollSpeed:b,panOnScrollMode:w,zoomOnDoubleClick:_,panOnDrag:S,translateExtent:x,minZoom:E,maxZoom:O,defaultZoom:P,defaultPosition:C,zoomActivationKeyCode:p,preventScrolling:M,noWheelClassName:k,noPanClassName:j},n,o.default.createElement(wa,{selectionKeyPressed:z}),A&&o.default.createElement(Aa,{onSelectionContextMenu:N,noPanClassName:j}),o.default.createElement("div",{className:"react-flow__pane react-flow__container",onClick:function(e){null==r||r(e),D.getState().resetSelectedElements(),D.setState({nodesSelectionActive:!1})},onContextMenu:I,onWheel:B}))};Ia.displayName="FlowRenderer";var Ba=t.memo(Ia);var Ta=function(e){return{nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,elementsSelectable:e.elementsSelectable,updateNodeDimensions:e.updateNodeDimensions}},Ra=function(n){var r,i=wi(Ta,Q),a=i.nodesDraggable,l=i.nodesConnectable,c=i.elementsSelectable,u=i.updateNodeDimensions,s=(r=n.onlyRenderVisibleElements,wi(t.useCallback((function(e){return r?ni(e.nodeInternals,{x:0,y:0,width:e.width,height:e.height},e.transform,!0):Array.from(e.nodeInternals.values())}),[r]))),d=t.useRef(),f=t.useMemo((function(){if("undefined"==typeof ResizeObserver)return null;var e=new ResizeObserver((function(e){var t=e.map((function(e){return{id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0}}));u(t)}));return d.current=e,e}),[]);return t.useEffect((function(){return function(){var e;null==d||null===(e=d.current)||void 0===e||e.disconnect()}}),[]),o.default.createElement("div",{className:"react-flow__nodes react-flow__container"},s.map((function(t){var r,i,u,s,d,h,p,g=t.type||"default";n.nodeTypes[g]||(g="default");var v=n.nodeTypes[g]||n.nodeTypes.default,m=!!(t.draggable||a&&void 0===t.draggable),y=!!(t.selectable||c&&void 0===t.selectable),b=!!(t.connectable||l&&void 0===t.connectable);return o.default.createElement(v,{key:t.id,id:t.id,className:t.className,style:t.style,type:g,data:t.data,sourcePosition:t.sourcePosition||e.Position.Bottom,targetPosition:t.targetPosition||e.Position.Top,hidden:t.hidden,xPos:null!==(r=null===(i=t.positionAbsolute)||void 0===i?void 0:i.x)&&void 0!==r?r:0,yPos:null!==(u=null===(s=t.positionAbsolute)||void 0===s?void 0:s.y)&&void 0!==u?u:0,selectNodesOnDrag:n.selectNodesOnDrag,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,selected:!!t.selected,isDraggable:m,isSelectable:y,isConnectable:b,resizeObserver:f,dragHandle:t.dragHandle,zIndex:null!==(d=null===(h=t[ce])||void 0===h?void 0:h.z)&&void 0!==d?d:0,isParent:!(null===(p=t[ce])||void 0===p||!p.isParent),noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,initialized:!!t.width&&!!t.height})})))};Ra.displayName="NodeRenderer";var La,Ha=t.memo(Ra);function Xa(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ya(e){for(var t=1;t2&&void 0!==arguments[2]&&arguments[2],o=-1,r=e.reduce((function(e,r){var i,a,l,c,u=le(r.zIndex),s=u?r.zIndex:0;return n&&(s=u?r.zIndex:Math.max((null===(i=t.get(r.source))||void 0===i||null===(a=i[ce])||void 0===a?void 0:a.z)||0,(null===(l=t.get(r.target))||void 0===l||null===(c=l[ce])||void 0===c?void 0:c.z)||0)),e[s]?e[s].push(r):e[s]=[r],o=s>o?s:o,e}),{}),i=Object.entries(r).map((function(e){var t=y(e,2),n=+t[0];return{edges:t[1],level:n,isMaxLevel:n===o}}));return 0===i.length?Ja:i}(wi(t.useCallback((function(t){return e?t.edges.filter((function(e){var o=n.get(e.source),r=n.get(e.target);return(null==o?void 0:o.width)&&(null==o?void 0:o.height)&&(null==r?void 0:r.width)&&(null==r?void 0:r.height)&&function(e){var t=e.sourcePos,n=e.targetPos,o=e.sourceWidth,r=e.sourceHeight,i=e.targetWidth,a=e.targetHeight,l=e.width,c=e.height,u=e.transform,s={x:Math.min(t.x,n.x),y:Math.min(t.y,n.y),x2:Math.max(t.x+o,n.x+i),y2:Math.max(t.y+r,n.y+a)};s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);var d=ie({x:(0-u[0])/u[2],y:(0-u[1])/u[2],width:l/u[2],height:c/u[2]}),f=Math.max(0,Math.min(d.x2,s.x2)-Math.max(d.x,s.x)),h=Math.max(0,Math.min(d.y2,s.y2)-Math.max(d.y,s.y));return Math.ceil(f*h)>0}({sourcePos:o.positionAbsolute||{x:0,y:0},targetPos:r.positionAbsolute||{x:0,y:0},sourceWidth:o.width,sourceHeight:o.height,targetWidth:r.width,targetHeight:r.height,width:t.width,height:t.height,transform:t.transform})})):t.edges}),[e,n])),n,o)}var tl=function(e){return{connectionNodeId:e.connectionNodeId,connectionHandleType:e.connectionHandleType,nodesConnectable:e.nodesConnectable,elementsSelectable:e.elementsSelectable,width:e.width,height:e.height,connectionMode:e.connectionMode,nodeInternals:e.nodeInternals}},nl=function(t){var n=wi(tl,Q),r=n.connectionNodeId,i=n.connectionHandleType,l=n.nodesConnectable,c=n.elementsSelectable,u=n.width,s=n.height,d=n.connectionMode,f=n.nodeInternals,h=el(t.onlyRenderVisibleElements,f,t.elevateEdgesOnSelect);if(!u)return null;var p=t.connectionLineType,g=t.defaultMarkerColor,v=t.connectionLineStyle,m=t.connectionLineComponent,b=t.connectionLineContainerStyle,w=r&&i;return o.default.createElement(o.default.Fragment,null,h.map((function(n){var r=n.level,i=n.edges,l=n.isMaxLevel;return o.default.createElement("svg",{key:r,style:{zIndex:r},width:u,height:s,className:"react-flow__edges react-flow__container"},l&&o.default.createElement($a,{defaultColor:g,rfId:t.rfId}),o.default.createElement("g",null,i.map((function(n){var r=y(ra(f,n.source),3),i=r[0],l=r[1],u=r[2],s=y(ra(f,n.target),3),h=s[0],p=s[1],g=s[2];if(!u||!g)return null;var v=n.type||"default";t.edgeTypes[v]||(console.warn('[React Flow]: Edge type "'.concat(v,'" not found. Using fallback type "default". Help: https://reactflow.dev/error#300')),v="default");var m=t.edgeTypes[v]||t.edgeTypes.default,b=d===e.ConnectionMode.Strict?p.target:p.target||p.source,w=oa(l.source,n.sourceHandle||null),_=oa(b,n.targetHandle||null),S=(null==w?void 0:w.position)||e.Position.Bottom,x=(null==_?void 0:_.position)||e.Position.Top;if(!w)return null;if(!_)return null;var E=function(e,t,n,o,r,i){var a=na(n,e,t),l=na(i,o,r);return{sourceX:a.x,sourceY:a.y,targetX:l.x,targetY:l.y}}(i,w,S,h,_,x),O=E.sourceX,P=E.sourceY,C=E.targetX,M=E.targetY;return o.default.createElement(m,{key:n.id,id:n.id,className:a([n.className,t.noPanClassName]),type:v,data:n.data,selected:!!n.selected,animated:!!n.animated,hidden:!!n.hidden,label:n.label,labelStyle:n.labelStyle,labelShowBg:n.labelShowBg,labelBgStyle:n.labelBgStyle,labelBgPadding:n.labelBgPadding,labelBgBorderRadius:n.labelBgBorderRadius,style:n.style,source:n.source,target:n.target,sourceHandleId:n.sourceHandle,targetHandleId:n.targetHandle,markerEnd:n.markerEnd,markerStart:n.markerStart,sourceX:O,sourceY:P,targetX:C,targetY:M,sourcePosition:S,targetPosition:x,elementsSelectable:c,onEdgeUpdate:t.onEdgeUpdate,onContextMenu:t.onEdgeContextMenu,onMouseEnter:t.onEdgeMouseEnter,onMouseMove:t.onEdgeMouseMove,onMouseLeave:t.onEdgeMouseLeave,onClick:t.onEdgeClick,edgeUpdaterRadius:t.edgeUpdaterRadius,onEdgeDoubleClick:t.onEdgeDoubleClick,onEdgeUpdateStart:t.onEdgeUpdateStart,onEdgeUpdateEnd:t.onEdgeUpdateEnd,rfId:t.rfId})}))))})),w&&o.default.createElement("svg",{style:b,width:u,height:s,className:"react-flow__edges react-flow__connectionline react-flow__container"},o.default.createElement(Ua,{connectionNodeId:r,connectionHandleType:i,connectionLineStyle:v,connectionLineType:p,isConnectable:l,CustomConnectionLineComponent:m})))};nl.displayName="EdgeRenderer";var ol=t.memo(nl),rl=function(e){return"translate(".concat(e.transform[0],"px,").concat(e.transform[1],"px) scale(").concat(e.transform[2],")")};function il(e){var t=e.children,n=wi(rl);return o.default.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:n}},t)}var al={zoomIn:function(){},zoomOut:function(){},zoomTo:function(e){},getZoom:function(){return 1},setViewport:function(e){},getViewport:function(){return{x:0,y:0,zoom:1}},fitView:function(){},setCenter:function(e,t){},fitBounds:function(e){},project:function(e){return e},viewportInitialized:!1},ll=function(e){return{d3Zoom:e.d3Zoom,d3Selection:e.d3Selection}};function cl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function ul(e){for(var t=1;t0?(r=ti(x),i=S,ae(re(ie(r),ie(i)))):S,k=N.width/E,j=N.height/O,D=Math.max(k,j),A=D*E,z=D*O,I=5*D,B=N.x-(A-N.width)/2-I,T=N.y-(z-N.height)/2-I,R=A+2*I,L=z+2*I,H="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return o.default.createElement("svg",{width:E,height:O,viewBox:"".concat(B," ").concat(T," ").concat(R," ").concat(L),style:l,className:a(["react-flow__minimap",c])},x.filter((function(e){return!e.hidden&&e.width&&e.height})).map((function(e){var t,n,r,i;return o.default.createElement(Dl,{key:e.id,x:null!==(t=null===(n=e.positionAbsolute)||void 0===n?void 0:n.x)&&void 0!==t?t:0,y:null!==(r=null===(i=e.positionAbsolute)||void 0===i?void 0:i.y)&&void 0!==r?r:0,width:e.width,height:e.height,style:e.style,className:M(e),color:P(e),borderRadius:v,strokeColor:C(e),strokeWidth:y,shapeRendering:H})})),o.default.createElement("path",{className:"react-flow__minimap-mask",d:"M".concat(B-I,",").concat(T-I,"h").concat(R+2*I,"v").concat(L+2*I,"h").concat(-R-2*I,"z\n M").concat(S.x,",").concat(S.y,"h").concat(S.width,"v").concat(S.height,"h").concat(-S.width,"z"),fill:w,fillRule:"evenodd"}))};Il.displayName="MiniMap";var Bl=t.memo(Il);function Tl(){return o.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},o.default.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function Rl(){return o.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},o.default.createElement("path",{d:"M0 0h32v4.2H0z"}))}function Ll(){return o.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},o.default.createElement("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"}))}function Hl(){return o.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},o.default.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"}))}function Xl(){return o.default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},o.default.createElement("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"}))}var Yl=["children","className"];function Vl(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}var Zl=function(e){var t=e.children,n=e.className,l=i(e,Yl);return o.default.createElement("button",function(e){for(var t=1;t