sample-ui-component-library 0.0.44-dev → 0.0.46-dev
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/cjs/index.js +2 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/BehavioralGraphBuilder/BehavioralGraphBuilder.jsx +47 -40
- package/src/stories/BehavioralGraphBuilder.stories.js +9 -0
package/dist/cjs/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/function C(){if(h)return f;h=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return f=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(o,r){for(var i,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(o),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))t.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var u=0;u<a.length;u++)n.call(i,a[u])&&(s[a[u]]=i[a[u]])}}return s},f}function N(){if(g)return p;g=1;return p="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function M(){return y?m:(y=1,m=Function.call.bind(Object.prototype.hasOwnProperty))}function P(){if(b)return v;b=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=N(),n={},o=M();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function r(r,i,a,s,l){if("production"!==process.env.NODE_ENV)for(var c in r)if(o(r,c)){var u;try{if("function"!=typeof r[c]){var d=Error((s||"React class")+": "+a+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=r[c](i,c,s,a,null,t)}catch(e){u=e}if(!u||u instanceof Error||e((s||"React class")+": type specification of "+a+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in n)){n[u.message]=!0;var f=l?l():"";e("Failed "+a+" type: "+u.message+(null!=f?f:""))}}}return r.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},v=r}function j(){if(x)return w;x=1;var e=O(),t=C(),n=N(),o=M(),r=P(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),w=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",d={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:p(a),arrayOf:function(e){return p(function(t,o,r,i,a){if("function"!=typeof e)return new h("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[o];if(!Array.isArray(s))return new h("Invalid "+i+" `"+a+"` of type `"+v(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,r,i,a+"["+l+"]",n);if(c instanceof Error)return c}return null})},element:p(function(e,t,n,o,r){var i=e[t];return s(i)?null:new h("Invalid "+o+" `"+r+"` of type `"+v(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:p(function(t,n,o,r,i){var a=t[n];return e.isValidElementType(a)?null:new h("Invalid "+r+" `"+i+"` of type `"+v(a)+"` supplied to `"+o+"`, expected a single ReactElement type.")}),instanceOf:function(e){return p(function(t,n,o,r,i){if(!(t[n]instanceof e)){var a=e.name||u;return new h("Invalid "+r+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:u)+"` supplied to `")+o+"`, expected instance of `"+a+"`.")}var s;return null})},node:p(function(e,t,n,o,r){return y(e[t])?null:new h("Invalid "+o+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return p(function(t,r,i,a,s){if("function"!=typeof e)return new h("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=t[r],c=v(l);if("object"!==c)return new h("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+i+"`, expected an object.");for(var u in l)if(o(l,u)){var d=e(l,u,i,a,s+"."+u,n);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return p(function(t,n,o,r,i){for(var a=t[n],s=0;s<e.length;s++)if(f(a,e[s]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===b(t)?String(t):t});return new h("Invalid "+r+" `"+i+"` of value `"+String(a)+"` supplied to `"+o+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(r)+" at index "+t+"."),a}return p(function(t,r,i,a,s){for(var l=[],c=0;c<e.length;c++){var u=(0,e[c])(t,r,i,a,s,n);if(null==u)return null;u.data&&o(u.data,"expectedType")&&l.push(u.data.expectedType)}return new h("Invalid "+a+" `"+s+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return p(function(t,o,r,i,a){var s=t[o],l=v(s);if("object"!==l)return new h("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return m(r,i,a,c,b(u));var d=u(s,c,r,i,a+"."+c,n);if(d)return d}return null})},exact:function(e){return p(function(r,i,a,s,l){var c=r[i],u=v(c);if("object"!==u)return new h("Invalid "+s+" `"+l+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var d=t({},r[i],e);for(var f in d){var p=e[f];if(o(e,f)&&"function"!=typeof p)return m(a,s,l,f,b(p));if(!p)return new h("Invalid "+s+" `"+l+"` key `"+f+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(r[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var g=p(c,f,a,s,l+"."+f,n);if(g)return g}return null})}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function h(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function p(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function r(r,a,s,c,d,f,p){if(c=c||u,f=f||s,p!==n){if(l){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=c+":"+s;!t[m]&&o<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[m]=!0,o++)}}return null==a[s]?r?null===a[s]?new h("The "+d+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`."):new h("The "+d+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,s,c,d,f)}var a=r.bind(null,!1);return a.isRequired=r.bind(null,!0),a}function g(e){return p(function(t,n,o,r,i,a){var s=t[n];return v(s)!==e?new h("Invalid "+r+" `"+i+"` of type `"+b(s)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null})}function m(e,t,n,o,r){return new h((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||s(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,o=t.call(e);if(t!==e.entries){for(;!(n=o.next()).done;)if(!y(n.value))return!1}else for(;!(n=o.next()).done;){var r=n.value;if(r&&!y(r[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return h.prototype=Error.prototype,d.checkPropTypes=r,d.resetWarningCache=r.resetWarningCache,d.PropTypes=d,d},w}function I(){if(E)return _;E=1;var e=N();function t(){}function n(){}return n.resetWarningCache=t,_=function(){function o(t,n,o,r,i,a){if(a!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function r(){return o}o.isRequired=o;var i={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:r,element:o,elementType:o,instanceOf:r,node:o,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},_}function T(){if(k)return s.exports;if(k=1,"production"!==process.env.NODE_ENV){var e=O();s.exports=j()(e.isElement,true)}else s.exports=I()();return s.exports}var z=i(T()),R="#184b2d",D="#420b0e",A="#4b4b18",L=function(t){var n=t.index,o=t.functionName,r=t.fileName,i=t.lineNumber,a=t.selected,s=t.selectTraceItem,l=t.hasException,c={};return a&&0===n?c={backgroundColor:l?D:A}:a&&(c={backgroundColor:l?D:R}),e.jsxs("div",{className:"stackRow",style:c,onClick:function(e){return s(n)},children:[e.jsx("div",{className:"left",children:e.jsx("span",{className:"functionName",children:o})}),e.jsxs("div",{className:"right",children:[e.jsx("span",{className:"fileName",children:r}),e.jsxs("span",{className:"lineNumber",children:[i,":1"]})]})]})};L.propTypes={index:z.number,functionName:z.string,fileName:z.string,lineNumber:z.number,selected:z.bool,selectTraceItem:z.func,hasException:z.bool};var V=function(t){var n,o=t.traces,r=t.selectTraceItem;return e.jsx("div",{className:"stackContainer",children:(n=o.map(function(t,n){return e.jsx(L,{functionName:t.functionName,fileName:t.fileName,lineNumber:t.lineNumber,selected:t.selected,hasException:t.hasException,index:n,selectTraceItem:r},"".concat(t.fileName,"-").concat(t.lineNumber,"-").concat(t.functionName,"-").concat(n))}),n)})};function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function $(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function F(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,t)||q(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||q(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e,t){if(e){if("string"==typeof e)return B(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}function W(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=W(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}V.propTypes={traces:z.array,selectTraceItem:z.func};var G={value:()=>{}};function K(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new U(o)}function U(e){this._=e}function Q(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function J(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=G,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}U.prototype=K.prototype={constructor:U,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=i[a]).type)r[n]=J(r[n],e.name,t);else if(null==t)for(n in r)r[n]=J(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=i[a]).type)&&(n=Q(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new U(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var ee="http://www.w3.org/1999/xhtml",te={svg:"http://www.w3.org/2000/svg",xhtml:ee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ne(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),te.hasOwnProperty(t)?{space:te[t],local:e}:e}function oe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ee&&t.documentElement.namespaceURI===ee?t.createElement(e):t.createElementNS(n,e)}}function re(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ie(e){var t=ne(e);return(t.local?re:oe)(t)}function ae(){}function se(e){return null==e?ae:function(){return this.querySelector(e)}}function le(){return[]}function ce(e){return null==e?le:function(){return this.querySelectorAll(e)}}function ue(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function de(e){return function(){return this.matches(e)}}function fe(e){return function(t){return t.matches(e)}}var he=Array.prototype.find;function pe(){return this.firstElementChild}var ge=Array.prototype.filter;function me(){return Array.from(this.children)}function ye(e){return new Array(e.length)}function ve(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function be(e,t,n,o,r,i){for(var a,s=0,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new ve(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function we(e,t,n,o,r,i,a){var s,l,c,u=new Map,d=t.length,f=i.length,h=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(h[s]=c=a.call(l,l.__data__,s,t)+"",u.has(c)?r[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(e,i[s],s,i)+"",(l=u.get(c))?(o[s]=l,l.__data__=i[s],u.delete(c)):n[s]=new ve(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(h[s])===l&&(r[s]=l)}function xe(e){return e.__data__}function _e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Ee(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ke(e){return function(){this.removeAttribute(e)}}function Se(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Oe(e,t){return function(){this.setAttribute(e,t)}}function Ce(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ne(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Me(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 Pe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function je(e){return function(){this.style.removeProperty(e)}}function Ie(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Te(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ze(e,t){return e.style.getPropertyValue(t)||Pe(e).getComputedStyle(e,null).getPropertyValue(t)}function Re(e){return function(){delete this[e]}}function De(e,t){return function(){this[e]=t}}function Ae(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Le(e){return e.trim().split(/^|\s+/)}function Ve(e){return e.classList||new Be(e)}function Be(e){this._node=e,this._names=Le(e.getAttribute("class")||"")}function $e(e,t){for(var n=Ve(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function He(e,t){for(var n=Ve(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Fe(e){return function(){$e(this,e)}}function Ye(e){return function(){He(this,e)}}function Ze(e,t){return function(){(t.apply(this,arguments)?$e:He)(this,e)}}function Xe(){this.textContent=""}function qe(e){return function(){this.textContent=e}}function We(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Ge(){this.innerHTML=""}function Ke(e){return function(){this.innerHTML=e}}function Ue(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Qe(){this.nextSibling&&this.parentNode.appendChild(this)}function Je(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function et(){return null}function tt(){var e=this.parentNode;e&&e.removeChild(this)}function nt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ot(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rt(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function it(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function at(e,t,n){var o=Pe(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function st(e,t){return function(){return at(this,e,t)}}function lt(e,t){return function(){return at(this,e,t.apply(this,arguments))}}ve.prototype={constructor:ve,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ct=[null];function ut(e,t){this._groups=e,this._parents=t}function dt(){return new ut([[document.documentElement]],ct)}function ft(e){return"string"==typeof e?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],ct)}function ht(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}ut.prototype=dt.prototype={constructor:ut,select:function(e){"function"!=typeof e&&(e=se(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=t[r],l=s.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=s[u])&&(a=e.call(i,i.__data__,u,s))&&("__data__"in i&&(a.__data__=i.__data__),c[u]=a);return new ut(o,this._parents)},selectAll:function(e){e="function"==typeof e?ue(e):ce(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var a,s=t[i],l=s.length,c=0;c<l;++c)(a=s[c])&&(o.push(e.call(a,a.__data__,c,s)),r.push(a));return new ut(o,r)},selectChild:function(e){return this.select(null==e?pe:function(e){return function(){return he.call(this.children,e)}}("function"==typeof e?e:fe(e)))},selectChildren:function(e){return this.selectAll(null==e?me:function(e){return function(){return ge.call(this.children,e)}}("function"==typeof e?e:fe(e)))},filter:function(e){"function"!=typeof e&&(e=de(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new ut(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,xe);var n,o=t?we:be,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=i.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var d=r[u],f=i[u],h=f.length,p=_e(e.call(d,d&&d.__data__,u,r)),g=p.length,m=l[u]=new Array(g),y=s[u]=new Array(g);o(d,f,m,y,c[u]=new Array(h),p,t);for(var v,b,w=0,x=0;w<g;++w)if(v=m[w]){for(w>=x&&(x=w+1);!(b=y[x])&&++x<g;);v._next=b||null}}return(s=new ut(s,r))._enter=l,s._exit=c,s},enter:function(){return new ut(this._enter||this._groups.map(ye),this._parents)},exit:function(){return new ut(this._exit||this._groups.map(ye),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c,u=n[l],d=o[l],f=u.length,h=s[l]=new Array(f),p=0;p<f;++p)(c=u[p]||d[p])&&(h[p]=c);for(;l<r;++l)s[l]=n[l];return new ut(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,a=r[i];--i>=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=Ee);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(t)}return new ut(r,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,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],a=0,s=i.length;a<s;++a)(r=i[a])&&e.call(r,r.__data__,a,i);return this},attr:function(e,t){var n=ne(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?Se:ke:"function"==typeof t?n.local?Me:Ne:n.local?Ce:Oe)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?je:"function"==typeof t?Te:Ie)(e,t,null==n?"":n)):ze(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Re:"function"==typeof t?Ae:De)(e,t)):this.node()[e]},classed:function(e,t){var n=Le(e+"");if(arguments.length<2){for(var o=Ve(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ze:t?Fe:Ye)(n,t))},text:function(e){return arguments.length?this.each(null==e?Xe:("function"==typeof e?We:qe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Ge:("function"==typeof e?Ue:Ke)(e)):this.node().innerHTML},raise:function(){return this.each(Qe)},lower:function(){return this.each(Je)},append:function(e){var t="function"==typeof e?e:ie(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:ie(e),o=null==t?et:"function"==typeof t?t:se(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(tt)},clone:function(e){return this.select(e?ot:nt)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=i.length;if(!(arguments.length<2)){for(s=t?it:rt,o=0;o<a;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(o=0,l=s[c];o<a;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?lt:st)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const pt={passive:!1},gt={capture:!0,passive:!1};function mt(e){e.stopImmediatePropagation()}function yt(e){e.preventDefault(),e.stopImmediatePropagation()}function vt(e){var t=e.document.documentElement,n=ft(e).on("dragstart.drag",yt,gt);"onselectstart"in t?n.on("selectstart.drag",yt,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function bt(e,t){var n=e.document.documentElement,o=ft(e).on("dragstart.drag",null);t&&(o.on("click.drag",yt,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var wt=e=>()=>e;function xt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:l,dy:c,dispatch:u}){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:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function _t(e){return!e.ctrlKey&&!e.button}function Et(){return this.parentNode}function kt(e,t){return null==t?{x:e.x,y:e.y}:t}function St(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ot(){var e,t,n,o,r=_t,i=Et,a=kt,s=St,l={},c=K("start","drag","end"),u=0,d=0;function f(e){e.on("mousedown.drag",h).filter(s).on("touchstart.drag",m).on("touchmove.drag",y,pt).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!o&&r.call(this,a,s)){var l=b(this,i.call(this,a,s),a,s,"mouse");l&&(ft(a.view).on("mousemove.drag",p,gt).on("mouseup.drag",g,gt),vt(a.view),mt(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function p(o){if(yt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>d}l.mouse("drag",o)}function g(e){ft(e.view).on("mousemove.drag mouseup.drag",null),bt(e.view,n),yt(e),l.mouse("end",e)}function m(e,t){if(r.call(this,e,t)){var n,o,a=e.changedTouches,s=i.call(this,e,t),l=a.length;for(n=0;n<l;++n)(o=b(this,s,e,t,a[n].identifier,a[n]))&&(mt(e),o("start",e,a[n]))}}function y(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(yt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(mt(e),n("end",e,r[t]))}function b(e,t,n,o,r,i){var s,d,h,p=c.copy(),g=ht(i||n,t);if(null!=(h=a.call(e,new xt("beforestart",{sourceEvent:n,target:f,identifier:r,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return s=h.x-g[0]||0,d=h.y-g[1]||0,function n(i,a,c){var m,y=g;switch(i){case"start":l[r]=n,m=u++;break;case"end":delete l[r],--u;case"drag":g=ht(c||a,t),m=u}p.call(i,e,new xt(i,{sourceEvent:a,subject:h,target:f,identifier:r,active:m,x:g[0]+s,y:g[1]+d,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:wt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:wt(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:wt(e),f):a},f.touchable=function(e){return arguments.length?(s="function"==typeof e?e:wt(!!e),f):s},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Ct(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Nt(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Mt(){}xt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Pt=.7,jt=1/Pt,It="\\s*([+-]?\\d+)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rt=/^#([0-9a-f]{3,8})$/,Dt=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),At=new RegExp(`^rgb\\(${zt},${zt},${zt}\\)$`),Lt=new RegExp(`^rgba\\(${It},${It},${It},${Tt}\\)$`),Vt=new RegExp(`^rgba\\(${zt},${zt},${zt},${Tt}\\)$`),Bt=new RegExp(`^hsl\\(${Tt},${zt},${zt}\\)$`),$t=new RegExp(`^hsla\\(${Tt},${zt},${zt},${Tt}\\)$`),Ht={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 Ft(){return this.rgb().formatHex()}function Yt(){return this.rgb().formatRgb()}function Zt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Rt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?Xt(t):3===n?new Gt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?qt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?qt(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=Dt.exec(e))?new Gt(t[1],t[2],t[3],1):(t=At.exec(e))?new Gt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Lt.exec(e))?qt(t[1],t[2],t[3],t[4]):(t=Vt.exec(e))?qt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Bt.exec(e))?tn(t[1],t[2]/100,t[3]/100,1):(t=$t.exec(e))?tn(t[1],t[2]/100,t[3]/100,t[4]):Ht.hasOwnProperty(e)?Xt(Ht[e]):"transparent"===e?new Gt(NaN,NaN,NaN,0):null}function Xt(e){return new Gt(e>>16&255,e>>8&255,255&e,1)}function qt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Gt(e,t,n,o)}function Wt(e,t,n,o){return 1===arguments.length?((r=e)instanceof Mt||(r=Zt(r)),r?new Gt((r=r.rgb()).r,r.g,r.b,r.opacity):new Gt):new Gt(e,t,n,null==o?1:o);var r}function Gt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Kt(){return`#${en(this.r)}${en(this.g)}${en(this.b)}`}function Ut(){const e=Qt(this.opacity);return`${1===e?"rgb(":"rgba("}${Jt(this.r)}, ${Jt(this.g)}, ${Jt(this.b)}${1===e?")":`, ${e})`}`}function Qt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function en(e){return((e=Jt(e))<16?"0":"")+e.toString(16)}function tn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new on(e,t,n,o)}function nn(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Mt||(e=Zt(e)),!e)return new on;if(e instanceof on)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,s=i-r,l=(i+r)/2;return s?(a=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new on(a,s,l,e.opacity)}function on(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function rn(e){return(e=(e||0)%360)<0?e+360:e}function an(e){return Math.max(0,Math.min(1,e||0))}function sn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Ct(Mt,Zt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ft,formatHex:Ft,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return nn(this).formatHsl()},formatRgb:Yt,toString:Yt}),Ct(Gt,Wt,Nt(Mt,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Pt:Math.pow(Pt,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gt(Jt(this.r),Jt(this.g),Jt(this.b),Qt(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:Kt,formatHex:Kt,formatHex8:function(){return`#${en(this.r)}${en(this.g)}${en(this.b)}${en(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ut,toString:Ut})),Ct(on,function(e,t,n,o){return 1===arguments.length?nn(e):new on(e,t,n,null==o?1:o)},Nt(Mt,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Pt:Math.pow(Pt,e),new on(this.h,this.s,this.l*e,this.opacity)},rgb(){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 Gt(sn(e>=240?e-240:e+120,r,o),sn(e,r,o),sn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new on(rn(this.h),an(this.s),an(this.l),Qt(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=Qt(this.opacity);return`${1===e?"hsl(":"hsla("}${rn(this.h)}, ${100*an(this.s)}%, ${100*an(this.l)}%${1===e?")":`, ${e})`}`}}));var ln=e=>()=>e;function cn(e){return 1===(e=+e)?un: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):ln(isNaN(t)?n:t)}}function un(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):ln(isNaN(e)?t:e)}var dn=function e(t){var n=cn(t);function o(e,t){var o=n((e=Wt(e)).r,(t=Wt(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=un(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 fn(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function hn(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=wn(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=i[n](e);return a}}function pn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function gn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mn(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=wn(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vn=new RegExp(yn.source,"g");function bn(e,t){var n,o,r,i=yn.lastIndex=vn.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=yn.exec(e))&&(o=vn.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:gn(n,o)})),i=vn.lastIndex;return i<t.length&&(r=t.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function wn(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?ln(t):("number"===r?gn:"string"===r?(n=Zt(t))?(t=n,dn):bn:t instanceof Zt?dn:t instanceof Date?pn:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?hn:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?mn:gn:fn))(e,t)}var xn,_n=180/Math.PI,En={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kn(e,t,n,o,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*_n,skewX:Math.atan(l)*_n,scaleX:a,scaleY:s}}function Sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,a){var s=[],l=[];return i=e(i),a=e(a),function(e,o,r,i,a,s){if(e!==r||o!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:gn(e,r)},{i:l-2,x:gn(o,i)})}else(r||i)&&a.push("translate("+r+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:gn(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:gn(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,s,l),function(e,t,n,o,i,a){if(e!==n||t!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:gn(e,n)},{i:s-2,x:gn(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,l),i=a=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var On=Sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?En:kn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Cn=Sn(function(e){return null==e?En:(xn||(xn=document.createElementNS("http://www.w3.org/2000/svg","g")),xn.setAttribute("transform",e),(e=xn.transform.baseVal.consolidate())?kn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):En)},", ",")",")");function Nn(e){return((e=Math.exp(e))+1/e)/2}var Mn,Pn,jn=function e(t,n,o){function r(e,r){var i,a,s=e[0],l=e[1],c=e[2],u=r[0],d=r[1],f=r[2],h=u-s,p=d-l,g=h*h+p*p;if(g<1e-12)a=Math.log(f/c)/t,i=function(e){return[s+e*h,l+e*p,c*Math.exp(t*e*a)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),v=(f*f-c*c-o*g)/(2*f*n*m),b=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-b)/t,i=function(e){var o,r=e*a,i=Nn(b),u=c/(n*m)*(i*(o=t*r+b,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+u*h,l+u*p,c*i/Nn(t*r+b)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),In=0,Tn=0,zn=0,Rn=0,Dn=0,An=0,Ln="object"==typeof performance&&performance.now?performance:Date,Vn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return Dn||(Vn($n),Dn=Ln.now()+An)}function $n(){Dn=0}function Hn(){this._call=this._time=this._next=null}function Fn(e,t,n){var o=new Hn;return o.restart(e,t,n),o}function Yn(){Dn=(Rn=Ln.now())+An,In=Tn=0;try{!function(){Bn(),++In;for(var e,t=Mn;t;)(e=Dn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--In}()}finally{In=0,function(){var e,t,n=Mn,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:Mn=t);Pn=e,Xn(o)}(),Dn=0}}function Zn(){var e=Ln.now(),t=e-Rn;t>1e3&&(An-=t,Rn=e)}function Xn(e){In||(Tn&&(Tn=clearTimeout(Tn)),e-Dn>24?(e<1/0&&(Tn=setTimeout(Yn,e-Ln.now()-An)),zn&&(zn=clearInterval(zn))):(zn||(Rn=Ln.now(),zn=setInterval(Zn,1e3)),In=1,Vn(Yn)))}function qn(e,t,n){var o=new Hn;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}Hn.prototype=Fn.prototype={constructor:Hn,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Bn():+n)+(null==t?0:+t),this._next||Pn===this||(Pn?Pn._next=this:Mn=this,Pn=this),this._call=e,this._time=n,Xn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Xn())}};var Wn=K("start","end","cancel","interrupt"),Gn=[];function Kn(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 c,u,d,f;if(1!==n.state)return l();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return qn(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(qn(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=f);o.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=o.length;++i<a;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Fn(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:Wn,tween:Gn,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Un(e,t){var n=Jn(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Qn(e,t){var n=Jn(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Jn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function eo(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 to(e,t){var n,o;return function(){var r=Qn(this,e),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}r.tween=o}}function no(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Qn(this,e),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function oo(e,t,n){var o=e._id;return e.each(function(){var e=Qn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Jn(e,o).value[t]}}function ro(e,t){var n;return("number"==typeof t?gn:t instanceof Zt?dn:(n=Zt(t))?(t=n,dn):bn)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function ao(e){return function(){this.removeAttributeNS(e.space,e.local)}}function so(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function co(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(e))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){return function(){Un(this,e).delay=+t.apply(this,arguments)}}function go(e,t){return t=+t,function(){Un(this,e).delay=t}}function mo(e,t){return function(){Qn(this,e).duration=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Qn(this,e).duration=t}}var vo=dt.prototype.constructor;function bo(e){return function(){this.style.removeProperty(e)}}var wo=0;function xo(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _o(){return++wo}var Eo=dt.prototype;xo.prototype={constructor:xo,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=se(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,l,c=o[a],u=c.length,d=i[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,Kn(d[f],t,n,f,d,Jn(s,n)));return new xo(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=ce(e));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var l,c=o[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var f,h=e.call(l,l.__data__,d,c),p=Jn(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Kn(f,t,n,g,h,p);i.push(h),a.push(l)}return new xo(i,a,t,n)},selectChild:Eo.selectChild,selectChildren:Eo.selectChildren,filter:function(e){"function"!=typeof e&&(e=de(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new xo(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var l,c=t[s],u=n[s],d=c.length,f=a[s]=new Array(d),h=0;h<d;++h)(l=c[h]||u[h])&&(f[h]=l);for(;s<o;++s)a[s]=t[s];return new xo(a,this._parents,this._name,this._id)},selection:function(){return new vo(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=_o(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=Jn(a,t);Kn(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xo(o,this._parents,e,n)},call:Eo.call,nodes:Eo.nodes,node:Eo.node,size:Eo.size,empty:Eo.empty,each:Eo.each,on:function(e,t){var n=this._id;return arguments.length<2?Jn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Un:Qn;return function(){var a=i(this,e),s=a.on;s!==o&&(r=(o=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=ne(e),o="transform"===n?Cn:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,oo(this,"attr."+e,t)):null==t?(n.local?ao:io)(n):(n.local?lo:so)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=ne(e);return this.tween(n,(o.local?fo:ho)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?On:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=ze(this,e),a=(this.style.removeProperty(e),ze(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,bo(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=ze(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=ze(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,oo(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=Qn(this,e),c=l.on,u=null==l.value[a]?i||(i=bo(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(s,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var a=ze(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(oo(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Jn(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?to:no)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?po:go)(t,e)):Jn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Jn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Qn(this,e).ease=t}}(t,e)):Jn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Qn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0===--r&&i()}};n.each(function(){var n=Qn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===r&&i()})},[Symbol.iterator]:Eo[Symbol.iterator]};var ko={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function So(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}dt.prototype.interrupt=function(e){return this.each(function(){eo(this,e)})},dt.prototype.transition=function(e){var t,n;e instanceof xo?(t=e._id,e=e._name):(t=_o(),(n=ko).time=Bn(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)(a=s[c])&&Kn(a,e,t,c,s,n||So(a,t));return new xo(o,this._parents,e,t)};var Oo=e=>()=>e;function Co(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 No(e,t,n){this.k=e,this.x=t,this.y=n}No.prototype={constructor:No,scale:function(e){return 1===e?this:new No(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new No(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 Mo=new No(1,0,0);function Po(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Mo;return e.__zoom}function jo(e){e.stopImmediatePropagation()}function Io(e){e.preventDefault(),e.stopImmediatePropagation()}function To(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function zo(){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 Ro(){return this.__zoom||Mo}function Do(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ao(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lo(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 Vo(){var e,t,n,o=To,r=zo,i=Lo,a=Do,s=Ao,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=jn,f=K("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",Ro).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",k).filter(s).on("touchstart.zoom",S).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new No(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 No(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,n,o){e.on("start.zoom",function(){w(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,a=w(e,i).event(o),s=r.apply(e,i),l=null==n?v(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=d(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new No(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}})}function w(e,t,n){return!n&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function _(e,...t){if(o.apply(this,arguments)){var n=w(this,t).event(e),r=this.__zoom,s=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,a.apply(this,arguments)))),u=ht(e);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=r.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[u,r.invert(u)],eo(this),n.start()}Io(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(y(m(r,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,a=w(this,t,!0).event(e),s=ft(e.view).on("mousemove.zoom",function(e){if(Io(e),!a.moved){var t=e.clientX-u,n=e.clientY-d;a.moved=t*t+n*n>h}a.event(e).zoom("mouse",i(y(a.that.__zoom,a.mouse[0]=ht(e,r),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),bt(e.view,a.moved),Io(e),a.event(e).end()},!0),l=ht(e,r),u=e.clientX,d=e.clientY;vt(e.view),jo(e),a.mouse=[l,this.__zoom.invert(l)],eo(this),a.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=ht(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(a),l=n.k*(e.shiftKey?.5:2),d=i(y(m(n,l),a,s),r.apply(this,t),c);Io(e),u>0?ft(this).transition().duration(u).call(b,d,a,e):ft(this).call(g.transform,d,a,e)}}function S(n,...r){if(o.apply(this,arguments)){var i,a,s,l,c=n.touches,u=c.length,d=w(this,r,n.changedTouches.length===u).event(n);for(jo(n),a=0;a<u;++a)l=[l=ht(s=c[a],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),eo(this),d.start())}}function O(e,...t){if(this.__zooming){var n,o,r,a,s=w(this,t).event(e),l=e.changedTouches,u=l.length;for(Io(e),n=0;n<u;++n)r=ht(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],h=s.touch1[0],p=s.touch1[1],g=(g=h[0]-d[0])*g+(g=h[1]-d[1])*g,v=(v=p[0]-f[0])*v+(v=p[1]-f[1])*v;o=m(o,Math.sqrt(g/v)),r=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(y(o,r,a),s.extent,c))}}function C(e,...o){if(this.__zooming){var r,i,a=w(this,o).event(e),s=e.changedTouches,l=s.length;for(jo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=s[r],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=ht(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=ft(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Ro),e!==r?b(e,t,n,o):r.interrupt().each(function(){w(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,a=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(a),l="function"==typeof t?t.apply(this,arguments):t;return i(y(m(o,l),a,s),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,a){g.transform(e,function(){var e=r.apply(this,arguments),a=this.__zoom,s=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Mo.translate(s[0],s[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,a)},x.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,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=ft(this.that).datum();f.call(e,this.that,new Co(e,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Oo(+e),g):a},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Oo(!!e),g):o},g.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Oo(!!e),g):s},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Oo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(u=+e,g):u},g.interpolate=function(e){return arguments.length?(d=e,g):d},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}Po.prototype=No.prototype;const Bo=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",$o=()=>"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.",Ho=e=>`Node type "${e}" not found. Using fallback type "default".`,Fo=()=>"The React Flow parent container needs a width and a height to render the graph.",Yo=()=>"Only child nodes can use a parent extent.",Zo=()=>"Can't create edge. An edge needs a source and a target.",Xo=e=>`Marker type "${e}" doesn't exist.`,qo=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,Wo=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",Go=e=>`Edge type "${e}" not found. Using fallback type "default".`,Ko=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,Uo=(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,Qo=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",Jo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],er=["Enter"," ","Escape"],tr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var nr,or,rr;!function(e){e.Strict="strict",e.Loose="loose"}(nr||(nr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(or||(or={})),function(e){e.Partial="partial",e.Full="full"}(rr||(rr={}));const ir={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ar,sr,lr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(ar||(ar={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(sr||(sr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(lr||(lr={}));const cr={[lr.Left]:lr.Right,[lr.Right]:lr.Left,[lr.Top]:lr.Bottom,[lr.Bottom]:lr.Top};function ur(e){return null===e?null:e?"valid":"invalid"}const dr=e=>"id"in e&&"source"in e&&"target"in e,fr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hr=(e,t=[0,0])=>{const{width:n,height:o}=$r(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},pr=(e,t={})=>{if(0===e.size)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(e=>{if(void 0===t.filter||t.filter(e)){const t=Nr(e);n=kr(n,t)}}),Or(n)},gr=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Rr(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(a&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Pr(s,Cr(t)),d=(r??0)*(c??0),f=i&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&l.push(t)}return l};async function mr({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===e.size)return Promise.resolve(!0);const s=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,a),l=pr(s),c=Lr(l,t,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function yr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},u=a.origin??o;let d=a.extent||r;if("parent"!==a.extent||a.expandParent)s&&Br(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+c],[a.extent[1][0]+l,a.extent[1][1]+c]]);else if(s){const e=s.measured.width,t=s.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Yo());const f=Br(d)?wr(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",Qo()),{position:{x:f.x-l+(a.measured.width??0)*u[0],y:f.y-c+(a.measured.height??0)*u[1]},positionAbsolute:f}}async function vr({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),a=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&a.find(t=>t.id===e.parentId);(t||n)&&a.push(e)}const s=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,l),u=c;for(const e of l){s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e)}if(!r)return{edges:u,nodes:a};const d=await r({nodes:a,edges:u});return"boolean"==typeof d?d?{edges:u,nodes:a}:{edges:[],nodes:[]}:d}const br=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),wr=(e={x:0,y:0},t,n)=>({x:br(e.x,t[0][0],t[1][0]-(n?.width??0)),y:br(e.y,t[0][1],t[1][1]-(n?.height??0))});function xr(e,t,n){const{width:o,height:r}=$r(n),{x:i,y:a}=n.internals.positionAbsolute;return wr(e,[[i,a],[i+o,a+r]],t)}const _r=(e,t,n)=>e<t?br(Math.abs(e-t),1,t)/t:e>n?-br(Math.abs(e-n),1,t)/t:0,Er=(e,t,n=15,o=40)=>[_r(e.x,o,t.width-o)*n,_r(e.y,o,t.height-o)*n],kr=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Sr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Or=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Cr=(e,t=[0,0])=>{const{x:n,y:o}=fr(e)?e.internals.positionAbsolute:hr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Nr=(e,t=[0,0])=>{const{x:n,y:o}=fr(e)?e.internals.positionAbsolute:hr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Mr=(e,t)=>Or(kr(Sr(e),Sr(t))),Pr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},jr=e=>Ir(e.width)&&Ir(e.height)&&Ir(e.x)&&Ir(e.y),Ir=e=>!isNaN(e)&&isFinite(e),Tr=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Rr=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?zr(s,a):s},Dr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ar(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const Lr=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Ar(e,n),r=Ar(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Ar(e.top??e.y??0,n),r=Ar(e.bottom??e.y??0,n),i=Ar(e.left??e.x??0,t),a=Ar(e.right??e.x??0,t);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-a.x)/e.width,l=(n-a.y)/e.height,c=Math.min(s,l),u=br(c,o,r),d=t/2-(e.x+e.width/2)*u,f=n/2-(e.y+e.height/2)*u,h=function(e,t,n,o,r,i){const{x:a,y:s}=Dr(e,[t,n,o]),{x:l,y:c}=Dr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,f,u,t,n),p=Math.min(h.left-a.left,0),g=Math.min(h.top-a.top,0);return{x:d-p+Math.min(h.right-a.right,0),y:f-g+Math.min(h.bottom-a.bottom,0),zoom:u}},Vr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Br(e){return void 0!==e&&"parent"!==e}function $r(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Hr(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Fr(e,t={width:0,height:0},n,o,r){const i={...e},a=o.get(n);if(a){const e=a.origin||r;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Yr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Zr(e){return{...tr,...e||{}}}function Xr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=Qr(e),s=Rr({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?zr(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const qr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wr=e=>e?.getRootNode?.()||window?.document,Gr=["INPUT","SELECT","TEXTAREA"];function Kr(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return Gr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ur=e=>"clientX"in e,Qr=(e,t)=>{const n=Ur(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Jr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...qr(t)}}):null};function ei({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const l=.125*e+.375*r+.375*a+.125*n,c=.125*t+.375*i+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ti(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function ni({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case lr.Left:return[t-ti(t-o,i),n];case lr.Right:return[t+ti(o-t,i),n];case lr.Top:return[t,n-ti(n-r,i)];case lr.Bottom:return[t,n+ti(r-n,i)]}}function oi({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top,curvature:a=.25}){const[s,l]=ni({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=ni({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,f,h,p]=ei({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${o},${r}`,d,f,h,p]}function ri({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,a=Math.abs(o-t)/2;return[i,o<t?o+a:o-a,r,a]}function ii({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=kr(Nr(e),Nr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Pr(a,Or(i))>0}const ai=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function si({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=ri({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const li={[lr.Left]:{x:-1,y:0},[lr.Right]:{x:1,y:0},[lr.Top]:{x:0,y:-1},[lr.Bottom]:{x:0,y:1}},ci=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ui({source:e,sourcePosition:t=lr.Bottom,target:n,targetPosition:o=lr.Top,center:r,offset:i,stepPosition:a}){const s=li[t],l=li[o],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=(({source:e,sourcePosition:t=lr.Bottom,target:n})=>t===lr.Left||t===lr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:u}),f=0!==d.x?"x":"y",h=d[f];let p,g,m=[];const y={x:0,y:0},v={x:0,y:0},[,,b,w]=ri({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(u.x-c.x)*a,g=r.y??(c.y+u.y)/2):(p=r.x??(c.x+u.x)/2,g=r.y??c.y+(u.y-c.y)*a);const e=[{x:p,y:c.y},{x:p,y:u.y}],t=[{x:c.x,y:g},{x:u.x,y:g}];m=s[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:u.y}],a=[{x:u.x,y:c.y}];if(m="x"===f?s.x===h?a:r:s.y===h?r:a,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);s[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:v[f]=(u[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=s[f]===l[e],n=c[e]>u[e],o=c[e]<u[e];(1===s[f]&&(!t&&n||t&&o)||1!==s[f]&&(!t&&o||t&&n))&&(m="x"===f?r:a)}const d={x:c.x+y.x,y:c.y+y.y},b={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(b.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(b.y-m[0].y))?(p=(d.x+b.x)/2,g=m[0].y):(p=m[0].x,g=(d.y+b.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},n],p,g,b,w]}function di({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,h,p,g]=ui({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:l},offset:c,stepPosition:u});return[d.reduce((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(ci(e,t)/2,ci(t,n)/2,o),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a)return`L ${i+r*(e.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${a+r*(e.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},""),f,h,p,g]}function fi(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hi(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function pi(e,t,n=lr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??$r(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case lr.Top:return{x:r+a/2,y:i};case lr.Right:return{x:r+a,y:i+s/2};case lr.Bottom:return{x:r+a/2,y:i+s};case lr.Left:return{x:r,y:i+s/2}}}function gi(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function mi(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}const yi={nodeOrigin:[0,0],nodeExtent:Jo,elevateNodesOnSelect:!0,defaults:{}},vi={...yi,checkEquality:!0};function bi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function wi(e,t,n,o){const r=bi(vi,o);let i=e.length>0;const a=new Map(t),s=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let e=a.get(l.id);if(r.checkEquality&&l===e?.internals.userNode)t.set(l.id,e);else{const n=hr(l,r.nodeOrigin),o=Br(l.extent)?l.extent:r.nodeExtent,i=wr(n,o,$r(l));e={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:l.measured?e?.internals.handleBounds:void 0,z:_i(l,s),userNode:l}},t.set(l.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(i=!1),l.parentId&&xi(e,t,n,o)}return i}function xi(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=bi(yi,o),s=e.parentId,l=t.get(s);if(!l)return void console.warn(`Parent node ${s} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n);const c=r?1e3:0,{x:u,y:d,z:f}=function(e,t,n,o,r){const{x:i,y:a}=t.internals.positionAbsolute,s=$r(e),l=hr(e,n),c=Br(e.extent)?wr(l,e.extent,s):l;let u=wr({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=xr(u,s,t));const d=_i(e,r),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=d?f+1:d}}(e,l,i,a,c),{positionAbsolute:h}=e.internals,p=u!==h.x||d!==h.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:u,y:d}:h,z:f}})}function _i(e,t){return(Ir(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ei(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Cr(e),r=Mr(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{const s=i.internals.positionAbsolute,l=$r(i),c=i.origin??o,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(u>0||d>0||p||g)&&(r.push({id:a,type:"position",position:{x:i.position.x-u+p,y:i.position.y-d+g}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})})),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:f+(u?c[0]*u-p:0),height:h+(d?c[1]*d-g:0)}})}),r}function ki(e,t,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,t)),a=`${r}-${e}`;const l=o.get(a)||new Map;if(o.set(a,l.set(n,t)),i){a=`${r}-${e}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,t))}}function Si(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${r}-${a}`;ki("source",s,`${r}-${a}--${n}-${i}`,e,n,i),ki("target",s,l,e,r,a),t.set(o.id,o)}}function Oi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Oi(n,t))}function Ci(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Ni({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Mi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,h=!1,p=!1;return{update:function({noDragClassName:g,handleSelector:m,domNode:y,isSelectable:v,nodeId:b,nodeClickDistance:w=0}){function x({x:e,y:n},r){const{nodeLookup:a,nodeExtent:l,snapGrid:c,snapToGrid:u,nodeOrigin:d,onNodeDrag:f,onSelectionDrag:h,onError:g,updateNodePositions:m}=t();i={x:e,y:n};let y=!1,v={x:0,y:0,x2:0,y2:0};if(s.size>1&&l){const e=pr(s);v=Sr(e)}for(const[t,o]of s){if(!a.has(t))continue;let r={x:e-o.distance.x,y:n-o.distance.y};u&&(r=zr(r,c));let i=[[l[0][0],l[0][1]],[l[1][0],l[1][1]]];if(s.size>1&&l&&!o.extent){const{positionAbsolute:e}=o.internals,t=e.x-v.x+l[0][0],n=e.x+o.measured.width-v.x2+l[1][0];i=[[t,e.y-v.y+l[0][1]],[n,e.y+o.measured.height-v.y2+l[1][1]]]}const{position:f,positionAbsolute:h}=yr({nodeId:t,nextPosition:r,nodeLookup:a,nodeExtent:i,nodeOrigin:d,onError:g});y=y||o.position.x!==f.x||o.position.y!==f.y,o.position=f,o.internals.positionAbsolute=h}if(p=p||y,y&&(m(s,!0),r&&(o||f||!b&&h))){const[e,t]=Ni({nodeId:b,dragItems:s,nodeLookup:a});o?.(r,s,e,t),f?.(r,e,t),b||h?.(r,t)}}async function _(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(a);const[s,d]=Er(c,u,o);0===s&&0===d||(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-d/e[2],await n({x:s,y:d})&&x(i,null)),a=requestAnimationFrame(_)}function E(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();d=!0,p&&v||a||!b||r.get(b)?.selected||y(),v&&p&&b&&e?.(b);const w=Xr(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:u});if(i=w,s=function(e,t,n,o){const r=new Map;for(const[i,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!Oi(a,e))&&(a.draggable||t&&void 0===a.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,w,b),s.size>0&&(n||g||!b&&m)){const[e,t]=Ni({nodeId:b,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),g?.(o.sourceEvent,e,t),b||m?.(o.sourceEvent,t)}}f=ft(y);const k=Ot().clickDistance(w).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,h=!1,p=!1,0===o&&E(e);const l=Xr(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=Qr(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:f,nodeLookup:p}=t(),g=Xr(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:u});if(("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||b&&!p.has(b))&&(h=!0),!h){if(!l&&n&&d&&(l=!0,_()),!d){const t=g.xSnapped-(i.x??0),n=g.ySnapped-(i.y??0);Math.sqrt(t*t+n*n)>f&&E(e)}(i.x!==g.xSnapped||i.y!==g.ySnapped)&&s&&d&&(c=Qr(e.sourceEvent,u),x(g,e.sourceEvent))}}).on("end",e=>{if(d&&!h&&(l=!1,d=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=t();if(p&&(o(s,!1),p=!1),r||i||!b&&a){const[t,o]=Ni({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,s,t,o),i?.(e.sourceEvent,t,o),b||a?.(e.sourceEvent,o)}}}).filter(e=>{const t=e.target;return!e.button&&(!g||!Ci(t,`.${g}`,y))&&(!m||Ci(t,m,y))});f.call(k)},destroy:function(){f?.on(".drag",null)}}}function Pi(e,t,n,o){let r=[],i=1/0;const a=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Pr(r,Cr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:l}=pi(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...s,x:a,y:l}],i=c):c===i&&r.push({...s,x:a,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}function ji(e,t,n,o,r,i=!1){const a=o.get(e);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...pi(a,l,l.position,!0)}:l}function Ii(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Ti=()=>!0;function zi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=Ti,nodeLookup:u}){const d="target"===i,f=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=Qr(e),g=a.elementFromPoint(h,p),m=g?.classList.contains(`${s}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Ii(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),a=m.classList.contains("connectable"),s=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:d?t:o,sourceHandle:d?i:r,target:d?o:t,targetHandle:d?r:i};y.connection=l;const f=a&&s&&(n===nr.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=ji(t,e,i,u,n,!0)}return y}const Ri={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Ti,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:x,autoPanSpeed:_,dragThreshold:E=1}){const k=Wr(e.target);let S,O=0;const{x:C,y:N}=Qr(e),M=k?.elementFromPoint(C,N),P=Ii(i,M),j=s?.getBoundingClientRect();let I=!1;if(!j||!P)return;const T=ji(r,P,o,l,t);if(!T)return;let z=Qr(e,j),R=!1,D=null,A=!1,L=null;function V(){if(!u||!j)return;const[e,t]=Er(z,j,_);f({x:e,y:t}),O=requestAnimationFrame(V)}const B={...T,nodeId:r,type:P,position:T.position},$=l.get(r);let H={inProgress:!0,isValid:null,from:pi($,B,lr.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:$,to:z,toHandle:null,toPosition:cr[B.position],toNode:null};function F(){I=!0,b(H),p?.(e,{nodeId:r,handleId:o,handleType:P})}function Y(e){if(!I){const{x:t,y:n}=Qr(e),o=t-C,r=n-N;if(!(o*o+r*r>E*E))return;F()}if(!x()||!B)return void Z(e);const i=w();z=Qr(e,j),S=Pi(Rr(z,i,!1,[1,1]),n,l,B),R||(V(),R=!0);const s=zi(e,{handle:S,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});L=s.handleDomNode,D=s.connection,A=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!S,s.isValid);const u={...H,isValid:A,to:s.toHandle&&A?Dr({x:s.toHandle.x,y:s.toHandle.y},i):z,toHandle:s.toHandle,toPosition:A&&s.toHandle?s.toHandle.position:cr[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};A&&S&&H.toHandle&&u.toHandle&&H.toHandle.type===u.toHandle.type&&H.toHandle.nodeId===u.toHandle.nodeId&&H.toHandle.id===u.toHandle.id&&H.to.x===u.to.x&&H.to.y===u.to.y||(b(u),H=u)}function Z(e){if(I){(S||L)&&D&&A&&g?.(D);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}h(),cancelAnimationFrame(O),R=!1,A=!1,D=null,L=null,k.removeEventListener("mousemove",Y),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",Y),k.removeEventListener("touchend",Z)}0===E&&F(),k.addEventListener("mousemove",Y),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",Y),k.addEventListener("touchend",Z)},isValid:zi};const Di=e=>({x:e.x,y:e.y,zoom:e.k}),Ai=({x:e,y:t,zoom:n})=>Mo.translate(e,t).scale(n),Li=(e,t)=>e.target.closest(`.${t}`),Vi=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Bi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$i=(e,t=0,n=Bi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Hi=e=>{const t=e.ctrlKey&&Vr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Fi({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Vo().clickDistance(!Ir(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=ft(e).call(f);v({x:i.x,y:i.y,zoom:br(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),g=h.on("dblclick.zoom");function m(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).transform($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function y(){f.on("zoom",null)}async function v(e,t,n){const o=Ai(e),r=f?.constrain()(o,t,n);return r&&await m(r),new Promise(e=>e(r))}return f.wheelDelta(Hi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:i,panOnScrollMode:d,panOnScrollSpeed:m,preventScrolling:v,zoomOnPinch:b,zoomOnScroll:w,zoomOnDoubleClick:x,zoomActivationKeyPressed:_,lib:E,onTransformChange:k}){o&&!u.isZoomingOrPanning&&y();const S=r&&!_&&!o?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Li(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=ht(u),t=Hi(u),r=d*Math.pow(2,t);return void o.scaleTo(n,r,e,u)}const f=1===u.deltaMode?20:1;let h=r===or.Vertical?0:u.deltaX*f,p=r===or.Horizontal?0:u.deltaY*f;!Vr()&&u.shiftKey&&r!==or.Vertical&&(h=u.deltaY*f,p=0),o.translateBy(n,-h/d*i,-p/d*i,{internal:!0});const g=Di(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,s?.(u,g)),e.isPanScrolling&&(l?.(u,g),e.panScrollTimeout=setTimeout(()=>{c?.(u,g),e.isPanScrolling=!1},150))}}({zoomPanValues:u,noWheelClassName:e,d3Selection:h,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:m,zoomOnPinch:b,onPanZoomStart:s,onPanZoom:a,onPanZoomEnd:l}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!t&&i&&!o.ctrlKey,s=Li(o,e);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(h.on("wheel.zoom",S,{passive:!1}),!o){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Di(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});f.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Vi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Di(i.transform))}}({zoomPanValues:u,panOnDrag:i,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:k});f.on("zoom",t);const o=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{var s,l;if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Vi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&(s=e.prevViewport,l=a.transform,s.x!==l.x||s.y!==l.y||s.zoom!==l.k))){const t=Di(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(a.sourceEvent,t)},n?150:0)}}}({zoomPanValues:u,panOnDrag:i,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:l,onDraggingChange:c});f.on("end",o)}const O=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:c}){return u=>{const d=e||t,f=n&&u.ctrlKey;if(1===u.button&&"mousedown"===u.type&&(Li(u,`${c}-flow__node`)||Li(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(Li(u,s)&&"wheel"===u.type)return!1;if(Li(u,l)&&("wheel"!==u.type||r&&"wheel"===u.type&&!e))return!1;if(!n&&u.ctrlKey&&"wheel"===u.type)return!1;if(!n&&"touchstart"===u.type&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!r&&!f&&"wheel"===u.type)return!1;if(!o&&("mousedown"===u.type||"touchstart"===u.type))return!1;if(Array.isArray(o)&&!o.includes(u.button)&&"mousedown"===u.type)return!1;const h=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||"wheel"===u.type)&&h}}({zoomActivationKeyPressed:_,panOnDrag:i,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:x,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:E});f.filter(O),x?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)},destroy:y,setViewport:async function(e,t){const n=Ai(e);return await m(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){const e=h?Po(h.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).scaleTo($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).scaleBy($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){f?.scaleExtent(e)},setTranslateExtent:function(e){f?.translateExtent(e)},syncViewport:function(e){if(h){const t=Ai(e),n=h.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||f?.transform(h,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Ir(e)||e<0?0:e;f?.clickDistance(t)}}}var Yi;function Zi(e,t){return Math.max(0,t-e)}function Xi(e,t){return Math.max(0,e-t)}function qi(e,t,n){return Math.max(0,t-e,e-n)}function Wi(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(Yi||(Yi={}));const Gi={width:0,height:0,x:0,y:0},Ki={...Gi,pointerX:0,pointerY:0,aspectRatio:1};function Ui(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[o-s,r-l],[o+i-s,r+a-l]]}function Qi({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ft(e);return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:s,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:f}){let h={...Gi},p={...Ki};const g=function(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}(e);let m,y,v,b,w=null,x=[];const _=Ot().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(m=o.get(t),!m)return;w=l?.getBoundingClientRect()??null;const{xSnapped:u,ySnapped:d}=Xr(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});h={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},p={...h,pointerX:u,pointerY:d,aspectRatio:h.width/h.height},y=void 0,m.parentId&&("parent"===m.extent||m.expandParent)&&(y=o.get(m.parentId),v=y&&"parent"===m.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),x=[],b=void 0;for(const[e,n]of o)if(n.parentId===t&&(x.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=Ui(n,m,n.origin??s);b=b?[[Math.min(e[0][0],b[0][0]),Math.min(e[0][1],b[0][1])],[Math.max(e[1][0],b[1][0]),Math.max(e[1][1],b[1][1])]]:e}c?.(e,{...h})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:c}=n(),d=Xr(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),_=[];if(!m)return;const{x:E,y:k,width:S,height:O}=h,C={},N=m.origin??c,{width:M,height:P,x:j,y:I}=function(e,t,n,o,r,i,a,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:b,y:w,width:x,height:_,aspectRatio:E}=e;let k=Math.floor(u?h-e.pointerX:0),S=Math.floor(d?p-e.pointerY:0);const O=x+(l?-k:k),C=_+(c?-S:S),N=-i[0]*x,M=-i[1]*_;let P=qi(O,g,m),j=qi(C,y,v);if(a){let e=0,t=0;l&&k<0?e=Zi(b+k+N,a[0][0]):!l&&k>0&&(e=Xi(b+O+N,a[1][0])),c&&S<0?t=Zi(w+S+M,a[0][1]):!c&&S>0&&(t=Xi(w+C+M,a[1][1])),P=Math.max(P,e),j=Math.max(j,t)}if(s){let e=0,t=0;l&&k>0?e=Xi(b+k,s[0][0]):!l&&k<0&&(e=Zi(b+O,s[1][0])),c&&S>0?t=Xi(w+S,s[0][1]):!c&&S<0&&(t=Zi(w+C,s[1][1])),P=Math.max(P,e),j=Math.max(j,t)}if(r){if(u){const e=qi(O/E,y,v)*E;if(P=Math.max(P,e),a){let e=0;e=!l&&!c||l&&!c&&f?Xi(w+M+O/E,a[1][1])*E:Zi(w+M+(l?k:-k)/E,a[0][1])*E,P=Math.max(P,e)}if(s){let e=0;e=!l&&!c||l&&!c&&f?Zi(w+O/E,s[1][1])*E:Xi(w+(l?k:-k)/E,s[0][1])*E,P=Math.max(P,e)}}if(d){const e=qi(C*E,g,m)/E;if(j=Math.max(j,e),a){let e=0;e=!l&&!c||c&&!l&&f?Xi(b+C*E+N,a[1][0])/E:Zi(b+(c?S:-S)*E+N,a[0][0])/E,j=Math.max(j,e)}if(s){let e=0;e=!l&&!c||c&&!l&&f?Zi(b+C*E,s[1][0])/E:Xi(b+(c?S:-S)*E,s[0][0])/E,j=Math.max(j,e)}}}S+=S<0?j:-j,k+=k<0?P:-P,r&&(f?O>C*E?S=(Wi(l,c)?-k:k)/E:k=(Wi(l,c)?-S:S)*E:u?(S=k/E,c=l):(k=S*E,l=c));const I=l?b+k:b,T=c?w+S:w;return{width:x+(l?-k:k),height:_+(c?-S:S),x:i[0]*k*(l?-1:1)+I,y:i[1]*S*(c?-1:1)+T}}(p,g,d,a,s,N,v,b),T=M!==S,z=P!==O,R=j!==E&&T,D=I!==k&&z;if(!(R||D||T||z))return;if((R||D||1===N[0]||1===N[1])&&(C.x=R?j:h.x,C.y=D?I:h.y,h.x=C.x,h.y=C.y,x.length>0)){const e=j-E,t=I-k;for(const n of x)n.position={x:n.position.x-e+N[0]*(M-S),y:n.position.y-t+N[1]*(P-O)},_.push(n)}if((T||z)&&(C.width=!T||l&&"horizontal"!==l?h.width:M,C.height=!z||l&&"vertical"!==l?h.height:P,h.width=C.width,h.height=C.height),y&&m.expandParent){const e=N[0]*(C.width??0);C.x&&C.x<e&&(h.x=e,p.x=p.x-(C.x-e));const t=N[1]*(C.height??0);C.y&&C.y<t&&(h.y=t,p.y=p.y-(C.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=e-t,s=n-o,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:h.width,prevWidth:S,height:h.height,prevHeight:O,affectsX:g.affectsX,affectsY:g.affectsY}),L={...h,direction:A},V=f?.(e,L);!1!==V&&(u?.(e,L),o(C,_))}).on("end",e=>{d?.(e,{...h}),r?.({...h})});i.call(_)},destroy:function(){i.on(".drag",null)}}}var Ji,ea={exports:{}},ta={},na={exports:{}},oa={};var ra,ia,aa,sa={};
|
|
14
|
+
*/function C(){if(h)return f;h=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return f=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(e){o[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(o,r){for(var i,a,s=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(o),l=1;l<arguments.length;l++){for(var c in i=Object(arguments[l]))t.call(i,c)&&(s[c]=i[c]);if(e){a=e(i);for(var u=0;u<a.length;u++)n.call(i,a[u])&&(s[a[u]]=i[a[u]])}}return s},f}function N(){if(g)return p;g=1;return p="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function M(){return y?m:(y=1,m=Function.call.bind(Object.prototype.hasOwnProperty))}function P(){if(b)return v;b=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=N(),n={},o=M();e=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function r(r,i,a,s,l){if("production"!==process.env.NODE_ENV)for(var c in r)if(o(r,c)){var u;try{if("function"!=typeof r[c]){var d=Error((s||"React class")+": "+a+" type `"+c+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[c]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw d.name="Invariant Violation",d}u=r[c](i,c,s,a,null,t)}catch(e){u=e}if(!u||u instanceof Error||e((s||"React class")+": type specification of "+a+" `"+c+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof u+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),u instanceof Error&&!(u.message in n)){n[u.message]=!0;var f=l?l():"";e("Failed "+a+" type: "+u.message+(null!=f?f:""))}}}return r.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(n={})},v=r}function j(){if(x)return w;x=1;var e=O(),t=C(),n=N(),o=M(),r=P(),i=function(){};function a(){return null}return"production"!==process.env.NODE_ENV&&(i=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}),w=function(s,l){var c="function"==typeof Symbol&&Symbol.iterator;var u="<<anonymous>>",d={array:g("array"),bigint:g("bigint"),bool:g("boolean"),func:g("function"),number:g("number"),object:g("object"),string:g("string"),symbol:g("symbol"),any:p(a),arrayOf:function(e){return p(function(t,o,r,i,a){if("function"!=typeof e)return new h("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var s=t[o];if(!Array.isArray(s))return new h("Invalid "+i+" `"+a+"` of type `"+v(s)+"` supplied to `"+r+"`, expected an array.");for(var l=0;l<s.length;l++){var c=e(s,l,r,i,a+"["+l+"]",n);if(c instanceof Error)return c}return null})},element:p(function(e,t,n,o,r){var i=e[t];return s(i)?null:new h("Invalid "+o+" `"+r+"` of type `"+v(i)+"` supplied to `"+n+"`, expected a single ReactElement.")}),elementType:p(function(t,n,o,r,i){var a=t[n];return e.isValidElementType(a)?null:new h("Invalid "+r+" `"+i+"` of type `"+v(a)+"` supplied to `"+o+"`, expected a single ReactElement type.")}),instanceOf:function(e){return p(function(t,n,o,r,i){if(!(t[n]instanceof e)){var a=e.name||u;return new h("Invalid "+r+" `"+i+"` of type `"+(((s=t[n]).constructor&&s.constructor.name?s.constructor.name:u)+"` supplied to `")+o+"`, expected instance of `"+a+"`.")}var s;return null})},node:p(function(e,t,n,o,r){return y(e[t])?null:new h("Invalid "+o+" `"+r+"` supplied to `"+n+"`, expected a ReactNode.")}),objectOf:function(e){return p(function(t,r,i,a,s){if("function"!=typeof e)return new h("Property `"+s+"` of component `"+i+"` has invalid PropType notation inside objectOf.");var l=t[r],c=v(l);if("object"!==c)return new h("Invalid "+a+" `"+s+"` of type `"+c+"` supplied to `"+i+"`, expected an object.");for(var u in l)if(o(l,u)){var d=e(l,u,i,a,s+"."+u,n);if(d instanceof Error)return d}return null})},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i(arguments.length>1?"Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).":"Invalid argument supplied to oneOf, expected an array."),a;return p(function(t,n,o,r,i){for(var a=t[n],s=0;s<e.length;s++)if(f(a,e[s]))return null;var l=JSON.stringify(e,function(e,t){return"symbol"===b(t)?String(t):t});return new h("Invalid "+r+" `"+i+"` of value `"+String(a)+"` supplied to `"+o+"`, expected one of "+l+".")})},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+w(r)+" at index "+t+"."),a}return p(function(t,r,i,a,s){for(var l=[],c=0;c<e.length;c++){var u=(0,e[c])(t,r,i,a,s,n);if(null==u)return null;u.data&&o(u.data,"expectedType")&&l.push(u.data.expectedType)}return new h("Invalid "+a+" `"+s+"` supplied to `"+i+"`"+(l.length>0?", expected one of type ["+l.join(", ")+"]":"")+".")})},shape:function(e){return p(function(t,o,r,i,a){var s=t[o],l=v(s);if("object"!==l)return new h("Invalid "+i+" `"+a+"` of type `"+l+"` supplied to `"+r+"`, expected `object`.");for(var c in e){var u=e[c];if("function"!=typeof u)return m(r,i,a,c,b(u));var d=u(s,c,r,i,a+"."+c,n);if(d)return d}return null})},exact:function(e){return p(function(r,i,a,s,l){var c=r[i],u=v(c);if("object"!==u)return new h("Invalid "+s+" `"+l+"` of type `"+u+"` supplied to `"+a+"`, expected `object`.");var d=t({},r[i],e);for(var f in d){var p=e[f];if(o(e,f)&&"function"!=typeof p)return m(a,s,l,f,b(p));if(!p)return new h("Invalid "+s+" `"+l+"` key `"+f+"` supplied to `"+a+"`.\nBad object: "+JSON.stringify(r[i],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var g=p(c,f,a,s,l+"."+f,n);if(g)return g}return null})}};function f(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function h(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function p(e){if("production"!==process.env.NODE_ENV)var t={},o=0;function r(r,a,s,c,d,f,p){if(c=c||u,f=f||s,p!==n){if(l){var g=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw g.name="Invariant Violation",g}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=c+":"+s;!t[m]&&o<3&&(i("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+c+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),t[m]=!0,o++)}}return null==a[s]?r?null===a[s]?new h("The "+d+" `"+f+"` is marked as required in `"+c+"`, but its value is `null`."):new h("The "+d+" `"+f+"` is marked as required in `"+c+"`, but its value is `undefined`."):null:e(a,s,c,d,f)}var a=r.bind(null,!1);return a.isRequired=r.bind(null,!0),a}function g(e){return p(function(t,n,o,r,i,a){var s=t[n];return v(s)!==e?new h("Invalid "+r+" `"+i+"` of type `"+b(s)+"` supplied to `"+o+"`, expected `"+e+"`.",{expectedType:e}):null})}function m(e,t,n,o,r){return new h((e||"React class")+": "+t+" type `"+n+"."+o+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+r+"`.")}function y(e){switch(typeof e){case"number":case"string":case"undefined":return!0;case"boolean":return!e;case"object":if(Array.isArray(e))return e.every(y);if(null===e||s(e))return!0;var t=function(e){var t=e&&(c&&e[c]||e["@@iterator"]);if("function"==typeof t)return t}(e);if(!t)return!1;var n,o=t.call(e);if(t!==e.entries){for(;!(n=o.next()).done;)if(!y(n.value))return!1}else for(;!(n=o.next()).done;){var r=n.value;if(r&&!y(r[1]))return!1}return!0;default:return!1}}function v(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function b(e){if(null==e)return""+e;var t=v(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function w(e){var t=b(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return h.prototype=Error.prototype,d.checkPropTypes=r,d.resetWarningCache=r.resetWarningCache,d.PropTypes=d,d},w}function I(){if(E)return _;E=1;var e=N();function t(){}function n(){}return n.resetWarningCache=t,_=function(){function o(t,n,o,r,i,a){if(a!==e){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function r(){return o}o.isRequired=o;var i={array:o,bigint:o,bool:o,func:o,number:o,object:o,string:o,symbol:o,any:o,arrayOf:r,element:o,elementType:o,instanceOf:r,node:o,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return i.PropTypes=i,i},_}function T(){if(k)return s.exports;if(k=1,"production"!==process.env.NODE_ENV){var e=O();s.exports=j()(e.isElement,true)}else s.exports=I()();return s.exports}var z=i(T()),R="#184b2d",D="#420b0e",A="#4b4b18",L=function(t){var n=t.index,o=t.functionName,r=t.fileName,i=t.lineNumber,a=t.selected,s=t.selectTraceItem,l=t.hasException,c={};return a&&0===n?c={backgroundColor:l?D:A}:a&&(c={backgroundColor:l?D:R}),e.jsxs("div",{className:"stackRow",style:c,onClick:function(e){return s(n)},children:[e.jsx("div",{className:"left",children:e.jsx("span",{className:"functionName",children:o})}),e.jsxs("div",{className:"right",children:[e.jsx("span",{className:"fileName",children:r}),e.jsxs("span",{className:"lineNumber",children:[i,":1"]})]})]})};L.propTypes={index:z.number,functionName:z.string,fileName:z.string,lineNumber:z.number,selected:z.bool,selectTraceItem:z.func,hasException:z.bool};var V=function(t){var n,o=t.traces,r=t.selectTraceItem;return e.jsx("div",{className:"stackContainer",children:(n=o.map(function(t,n){return e.jsx(L,{functionName:t.functionName,fileName:t.fileName,lineNumber:t.lineNumber,selected:t.selected,hasException:t.hasException,index:n,selectTraceItem:r},"".concat(t.fileName,"-").concat(t.lineNumber,"-").concat(t.functionName,"-").concat(n))}),n)})};function B(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function $(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var o=n.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function F(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 Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?F(Object(n),!0).forEach(function(t){$(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):F(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(o=i.call(n)).done)&&(s.push(o.value),s.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw r}}return s}}(e,t)||X(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function q(e){return function(e){if(Array.isArray(e))return B(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||X(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){if(e){if("string"==typeof e)return B(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?B(e,t):void 0}}function W(e){if("string"==typeof e||"number"==typeof e)return""+e;let t="";if(Array.isArray(e))for(let n,o=0;o<e.length;o++)""!==(n=W(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}V.propTypes={traces:z.array,selectTraceItem:z.func};var G={value:()=>{}};function K(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new U(o)}function U(e){this._=e}function Q(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function J(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=G,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}U.prototype=K.prototype={constructor:U,on:function(e,t){var n,o,r=this._,i=(o=r,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,s=i.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<s;)if(n=(e=i[a]).type)r[n]=J(r[n],e.name,t);else if(null==t)for(n in r)r[n]=J(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=i[a]).type)&&(n=Q(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new U(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,r=new Array(n),i=0;i<n;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=0,n=(o=this._[e]).length;i<n;++i)o[i].value.apply(t,r)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};var ee="http://www.w3.org/1999/xhtml",te={svg:"http://www.w3.org/2000/svg",xhtml:ee,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ne(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),te.hasOwnProperty(t)?{space:te[t],local:e}:e}function oe(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===ee&&t.documentElement.namespaceURI===ee?t.createElement(e):t.createElementNS(n,e)}}function re(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function ie(e){var t=ne(e);return(t.local?re:oe)(t)}function ae(){}function se(e){return null==e?ae:function(){return this.querySelector(e)}}function le(){return[]}function ce(e){return null==e?le:function(){return this.querySelectorAll(e)}}function ue(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function de(e){return function(){return this.matches(e)}}function fe(e){return function(t){return t.matches(e)}}var he=Array.prototype.find;function pe(){return this.firstElementChild}var ge=Array.prototype.filter;function me(){return Array.from(this.children)}function ye(e){return new Array(e.length)}function ve(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function be(e,t,n,o,r,i){for(var a,s=0,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new ve(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function we(e,t,n,o,r,i,a){var s,l,c,u=new Map,d=t.length,f=i.length,h=new Array(d);for(s=0;s<d;++s)(l=t[s])&&(h[s]=c=a.call(l,l.__data__,s,t)+"",u.has(c)?r[s]=l:u.set(c,l));for(s=0;s<f;++s)c=a.call(e,i[s],s,i)+"",(l=u.get(c))?(o[s]=l,l.__data__=i[s],u.delete(c)):n[s]=new ve(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(h[s])===l&&(r[s]=l)}function xe(e){return e.__data__}function _e(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Ee(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ke(e){return function(){this.removeAttribute(e)}}function Se(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Oe(e,t){return function(){this.setAttribute(e,t)}}function Ce(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ne(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Me(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 Pe(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function je(e){return function(){this.style.removeProperty(e)}}function Ie(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Te(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ze(e,t){return e.style.getPropertyValue(t)||Pe(e).getComputedStyle(e,null).getPropertyValue(t)}function Re(e){return function(){delete this[e]}}function De(e,t){return function(){this[e]=t}}function Ae(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Le(e){return e.trim().split(/^|\s+/)}function Ve(e){return e.classList||new Be(e)}function Be(e){this._node=e,this._names=Le(e.getAttribute("class")||"")}function $e(e,t){for(var n=Ve(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function He(e,t){for(var n=Ve(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function Fe(e){return function(){$e(this,e)}}function Ye(e){return function(){He(this,e)}}function Ze(e,t){return function(){(t.apply(this,arguments)?$e:He)(this,e)}}function qe(){this.textContent=""}function Xe(e){return function(){this.textContent=e}}function We(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function Ge(){this.innerHTML=""}function Ke(e){return function(){this.innerHTML=e}}function Ue(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Qe(){this.nextSibling&&this.parentNode.appendChild(this)}function Je(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function et(){return null}function tt(){var e=this.parentNode;e&&e.removeChild(this)}function nt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function ot(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function rt(e){return function(){var t=this.__on;if(t){for(var n,o=0,r=-1,i=t.length;o<i;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++r]=n:this.removeEventListener(n.type,n.listener,n.options);++r?t.length=r:delete this.__on}}}function it(e,t,n){return function(){var o,r=this.__on,i=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(r)for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),void(o.value=t);this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function at(e,t,n){var o=Pe(e),r=o.CustomEvent;"function"==typeof r?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function st(e,t){return function(){return at(this,e,t)}}function lt(e,t){return function(){return at(this,e,t.apply(this,arguments))}}ve.prototype={constructor:ve,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}},Be.prototype={add:function(e){this._names.indexOf(e)<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};var ct=[null];function ut(e,t){this._groups=e,this._parents=t}function dt(){return new ut([[document.documentElement]],ct)}function ft(e){return"string"==typeof e?new ut([[document.querySelector(e)]],[document.documentElement]):new ut([[e]],ct)}function ht(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,[(o=o.matrixTransform(t.getScreenCTM().inverse())).x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}ut.prototype=dt.prototype={constructor:ut,select:function(e){"function"!=typeof e&&(e=se(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a,s=t[r],l=s.length,c=o[r]=new Array(l),u=0;u<l;++u)(i=s[u])&&(a=e.call(i,i.__data__,u,s))&&("__data__"in i&&(a.__data__=i.__data__),c[u]=a);return new ut(o,this._parents)},selectAll:function(e){e="function"==typeof e?ue(e):ce(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var a,s=t[i],l=s.length,c=0;c<l;++c)(a=s[c])&&(o.push(e.call(a,a.__data__,c,s)),r.push(a));return new ut(o,r)},selectChild:function(e){return this.select(null==e?pe:function(e){return function(){return he.call(this.children,e)}}("function"==typeof e?e:fe(e)))},selectChildren:function(e){return this.selectAll(null==e?me:function(e){return function(){return ge.call(this.children,e)}}("function"==typeof e?e:fe(e)))},filter:function(e){"function"!=typeof e&&(e=de(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new ut(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,xe);var n,o=t?we:be,r=this._parents,i=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=i.length,s=new Array(a),l=new Array(a),c=new Array(a),u=0;u<a;++u){var d=r[u],f=i[u],h=f.length,p=_e(e.call(d,d&&d.__data__,u,r)),g=p.length,m=l[u]=new Array(g),y=s[u]=new Array(g);o(d,f,m,y,c[u]=new Array(h),p,t);for(var v,b,w=0,x=0;w<g;++w)if(v=m[w]){for(w>=x&&(x=w+1);!(b=y[x])&&++x<g;);v._next=b||null}}return(s=new ut(s,r))._enter=l,s._exit=c,s},enter:function(){return new ut(this._enter||this._groups.map(ye),this._parents)},exit:function(){return new ut(this._exit||this._groups.map(ye),this._parents)},join:function(e,t,n){var o=this.enter(),r=this,i=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(r=t(r))&&(r=r.selection()),null==n?i.remove():n(i),o&&r?o.merge(r).order():r},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,a=Math.min(r,i),s=new Array(r),l=0;l<a;++l)for(var c,u=n[l],d=o[l],f=u.length,h=s[l]=new Array(f),p=0;p<f;++p)(c=u[p]||d[p])&&(h[p]=c);for(;l<r;++l)s[l]=n[l];return new ut(s,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,r=e[t],i=r.length-1,a=r[i];--i>=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=Ee);for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var a,s=n[i],l=s.length,c=r[i]=new Array(l),u=0;u<l;++u)(a=s[u])&&(c[u]=a);c.sort(t)}return new ut(r,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,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var a=o[r];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r,i=t[n],a=0,s=i.length;a<s;++a)(r=i[a])&&e.call(r,r.__data__,a,i);return this},attr:function(e,t){var n=ne(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?Se:ke:"function"==typeof t?n.local?Me:Ne:n.local?Ce:Oe)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?je:"function"==typeof t?Te:Ie)(e,t,null==n?"":n)):ze(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Re:"function"==typeof t?Ae:De)(e,t)):this.node()[e]},classed:function(e,t){var n=Le(e+"");if(arguments.length<2){for(var o=Ve(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?Ze:t?Fe:Ye)(n,t))},text:function(e){return arguments.length?this.each(null==e?qe:("function"==typeof e?We:Xe)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?Ge:("function"==typeof e?Ue:Ke)(e)):this.node().innerHTML},raise:function(){return this.each(Qe)},lower:function(){return this.each(Je)},append:function(e){var t="function"==typeof e?e:ie(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:ie(e),o=null==t?et:"function"==typeof t?t:se(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(tt)},clone:function(e){return this.select(e?ot:nt)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,r,i=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=i.length;if(!(arguments.length<2)){for(s=t?it:rt,o=0;o<a;++o)this.each(s(i[o],t,n));return this}var s=this.node().__on;if(s)for(var l,c=0,u=s.length;c<u;++c)for(o=0,l=s[c];o<a;++o)if((r=i[o]).type===l.type&&r.name===l.name)return l.value},dispatch:function(e,t){return this.each(("function"==typeof t?lt:st)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,r=e[t],i=0,a=r.length;i<a;++i)(o=r[i])&&(yield o)}};const pt={passive:!1},gt={capture:!0,passive:!1};function mt(e){e.stopImmediatePropagation()}function yt(e){e.preventDefault(),e.stopImmediatePropagation()}function vt(e){var t=e.document.documentElement,n=ft(e).on("dragstart.drag",yt,gt);"onselectstart"in t?n.on("selectstart.drag",yt,gt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function bt(e,t){var n=e.document.documentElement,o=ft(e).on("dragstart.drag",null);t&&(o.on("click.drag",yt,gt),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}var wt=e=>()=>e;function xt(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:a,y:s,dx:l,dy:c,dispatch:u}){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:s,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}function _t(e){return!e.ctrlKey&&!e.button}function Et(){return this.parentNode}function kt(e,t){return null==t?{x:e.x,y:e.y}:t}function St(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ot(){var e,t,n,o,r=_t,i=Et,a=kt,s=St,l={},c=K("start","drag","end"),u=0,d=0;function f(e){e.on("mousedown.drag",h).filter(s).on("touchstart.drag",m).on("touchmove.drag",y,pt).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(a,s){if(!o&&r.call(this,a,s)){var l=b(this,i.call(this,a,s),a,s,"mouse");l&&(ft(a.view).on("mousemove.drag",p,gt).on("mouseup.drag",g,gt),vt(a.view),mt(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function p(o){if(yt(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>d}l.mouse("drag",o)}function g(e){ft(e.view).on("mousemove.drag mouseup.drag",null),bt(e.view,n),yt(e),l.mouse("end",e)}function m(e,t){if(r.call(this,e,t)){var n,o,a=e.changedTouches,s=i.call(this,e,t),l=a.length;for(n=0;n<l;++n)(o=b(this,s,e,t,a[n].identifier,a[n]))&&(mt(e),o("start",e,a[n]))}}function y(e){var t,n,o=e.changedTouches,r=o.length;for(t=0;t<r;++t)(n=l[o[t].identifier])&&(yt(e),n("drag",e,o[t]))}function v(e){var t,n,r=e.changedTouches,i=r.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<i;++t)(n=l[r[t].identifier])&&(mt(e),n("end",e,r[t]))}function b(e,t,n,o,r,i){var s,d,h,p=c.copy(),g=ht(i||n,t);if(null!=(h=a.call(e,new xt("beforestart",{sourceEvent:n,target:f,identifier:r,active:u,x:g[0],y:g[1],dx:0,dy:0,dispatch:p}),o)))return s=h.x-g[0]||0,d=h.y-g[1]||0,function n(i,a,c){var m,y=g;switch(i){case"start":l[r]=n,m=u++;break;case"end":delete l[r],--u;case"drag":g=ht(c||a,t),m=u}p.call(i,e,new xt(i,{sourceEvent:a,subject:h,target:f,identifier:r,active:m,x:g[0]+s,y:g[1]+d,dx:g[0]-y[0],dy:g[1]-y[1],dispatch:p}),o)}}return f.filter=function(e){return arguments.length?(r="function"==typeof e?e:wt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:wt(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:wt(e),f):a},f.touchable=function(e){return arguments.length?(s="function"==typeof e?e:wt(!!e),f):s},f.on=function(){var e=c.on.apply(c,arguments);return e===c?f:e},f.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,f):Math.sqrt(d)},f}function Ct(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Nt(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Mt(){}xt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Pt=.7,jt=1/Pt,It="\\s*([+-]?\\d+)\\s*",Tt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Rt=/^#([0-9a-f]{3,8})$/,Dt=new RegExp(`^rgb\\(${It},${It},${It}\\)$`),At=new RegExp(`^rgb\\(${zt},${zt},${zt}\\)$`),Lt=new RegExp(`^rgba\\(${It},${It},${It},${Tt}\\)$`),Vt=new RegExp(`^rgba\\(${zt},${zt},${zt},${Tt}\\)$`),Bt=new RegExp(`^hsl\\(${Tt},${zt},${zt}\\)$`),$t=new RegExp(`^hsla\\(${Tt},${zt},${zt},${Tt}\\)$`),Ht={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 Ft(){return this.rgb().formatHex()}function Yt(){return this.rgb().formatRgb()}function Zt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Rt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?qt(t):3===n?new Gt(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?Xt(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?Xt(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=Dt.exec(e))?new Gt(t[1],t[2],t[3],1):(t=At.exec(e))?new Gt(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Lt.exec(e))?Xt(t[1],t[2],t[3],t[4]):(t=Vt.exec(e))?Xt(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Bt.exec(e))?tn(t[1],t[2]/100,t[3]/100,1):(t=$t.exec(e))?tn(t[1],t[2]/100,t[3]/100,t[4]):Ht.hasOwnProperty(e)?qt(Ht[e]):"transparent"===e?new Gt(NaN,NaN,NaN,0):null}function qt(e){return new Gt(e>>16&255,e>>8&255,255&e,1)}function Xt(e,t,n,o){return o<=0&&(e=t=n=NaN),new Gt(e,t,n,o)}function Wt(e,t,n,o){return 1===arguments.length?((r=e)instanceof Mt||(r=Zt(r)),r?new Gt((r=r.rgb()).r,r.g,r.b,r.opacity):new Gt):new Gt(e,t,n,null==o?1:o);var r}function Gt(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function Kt(){return`#${en(this.r)}${en(this.g)}${en(this.b)}`}function Ut(){const e=Qt(this.opacity);return`${1===e?"rgb(":"rgba("}${Jt(this.r)}, ${Jt(this.g)}, ${Jt(this.b)}${1===e?")":`, ${e})`}`}function Qt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Jt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function en(e){return((e=Jt(e))<16?"0":"")+e.toString(16)}function tn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new on(e,t,n,o)}function nn(e){if(e instanceof on)return new on(e.h,e.s,e.l,e.opacity);if(e instanceof Mt||(e=Zt(e)),!e)return new on;if(e instanceof on)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,s=i-r,l=(i+r)/2;return s?(a=t===i?(n-o)/s+6*(n<o):n===i?(o-t)/s+2:(t-n)/s+4,s/=l<.5?i+r:2-i-r,a*=60):s=l>0&&l<1?0:a,new on(a,s,l,e.opacity)}function on(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function rn(e){return(e=(e||0)%360)<0?e+360:e}function an(e){return Math.max(0,Math.min(1,e||0))}function sn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Ct(Mt,Zt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ft,formatHex:Ft,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return nn(this).formatHsl()},formatRgb:Yt,toString:Yt}),Ct(Gt,Wt,Nt(Mt,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Pt:Math.pow(Pt,e),new Gt(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Gt(Jt(this.r),Jt(this.g),Jt(this.b),Qt(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:Kt,formatHex:Kt,formatHex8:function(){return`#${en(this.r)}${en(this.g)}${en(this.b)}${en(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:Ut,toString:Ut})),Ct(on,function(e,t,n,o){return 1===arguments.length?nn(e):new on(e,t,n,null==o?1:o)},Nt(Mt,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new on(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Pt:Math.pow(Pt,e),new on(this.h,this.s,this.l*e,this.opacity)},rgb(){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 Gt(sn(e>=240?e-240:e+120,r,o),sn(e,r,o),sn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new on(rn(this.h),an(this.s),an(this.l),Qt(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=Qt(this.opacity);return`${1===e?"hsl(":"hsla("}${rn(this.h)}, ${100*an(this.s)}%, ${100*an(this.l)}%${1===e?")":`, ${e})`}`}}));var ln=e=>()=>e;function cn(e){return 1===(e=+e)?un: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):ln(isNaN(t)?n:t)}}function un(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):ln(isNaN(e)?t:e)}var dn=function e(t){var n=cn(t);function o(e,t){var o=n((e=Wt(e)).r,(t=Wt(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=un(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 fn(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,r=t.slice();return function(i){for(n=0;n<o;++n)r[n]=e[n]*(1-i)+t[n]*i;return r}}function hn(e,t){var n,o=t?t.length:0,r=e?Math.min(o,e.length):0,i=new Array(r),a=new Array(o);for(n=0;n<r;++n)i[n]=wn(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<r;++n)a[n]=i[n](e);return a}}function pn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function gn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function mn(e,t){var n,o={},r={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=wn(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var yn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vn=new RegExp(yn.source,"g");function bn(e,t){var n,o,r,i=yn.lastIndex=vn.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=yn.exec(e))&&(o=vn.exec(t));)(r=o.index)>i&&(r=t.slice(i,r),s[a]?s[a]+=r:s[++a]=r),(n=n[0])===(o=o[0])?s[a]?s[a]+=o:s[++a]=o:(s[++a]=null,l.push({i:a,x:gn(n,o)})),i=vn.lastIndex;return i<t.length&&(r=t.slice(i),s[a]?s[a]+=r:s[++a]=r),s.length<2?l[0]?function(e){return function(t){return e(t)+""}}(l[0].x):function(e){return function(){return e}}(t):(t=l.length,function(e){for(var n,o=0;o<t;++o)s[(n=l[o]).i]=n.x(e);return s.join("")})}function wn(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?ln(t):("number"===r?gn:"string"===r?(n=Zt(t))?(t=n,dn):bn:t instanceof Zt?dn:t instanceof Date?pn:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?hn:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?mn:gn:fn))(e,t)}var xn,_n=180/Math.PI,En={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function kn(e,t,n,o,r,i){var a,s,l;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(s=Math.sqrt(n*n+o*o))&&(n/=s,o/=s,l/=s),e*o<t*n&&(e=-e,t=-t,l=-l,a=-a),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*_n,skewX:Math.atan(l)*_n,scaleX:a,scaleY:s}}function Sn(e,t,n,o){function r(e){return e.length?e.pop()+" ":""}return function(i,a){var s=[],l=[];return i=e(i),a=e(a),function(e,o,r,i,a,s){if(e!==r||o!==i){var l=a.push("translate(",null,t,null,n);s.push({i:l-4,x:gn(e,r)},{i:l-2,x:gn(o,i)})}else(r||i)&&a.push("translate("+r+t+i+n)}(i.translateX,i.translateY,a.translateX,a.translateY,s,l),function(e,t,n,i){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),i.push({i:n.push(r(n)+"rotate(",null,o)-2,x:gn(e,t)})):t&&n.push(r(n)+"rotate("+t+o)}(i.rotate,a.rotate,s,l),function(e,t,n,i){e!==t?i.push({i:n.push(r(n)+"skewX(",null,o)-2,x:gn(e,t)}):t&&n.push(r(n)+"skewX("+t+o)}(i.skewX,a.skewX,s,l),function(e,t,n,o,i,a){if(e!==n||t!==o){var s=i.push(r(i)+"scale(",null,",",null,")");a.push({i:s-4,x:gn(e,n)},{i:s-2,x:gn(t,o)})}else 1===n&&1===o||i.push(r(i)+"scale("+n+","+o+")")}(i.scaleX,i.scaleY,a.scaleX,a.scaleY,s,l),i=a=null,function(e){for(var t,n=-1,o=l.length;++n<o;)s[(t=l[n]).i]=t.x(e);return s.join("")}}}var On=Sn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?En:kn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Cn=Sn(function(e){return null==e?En:(xn||(xn=document.createElementNS("http://www.w3.org/2000/svg","g")),xn.setAttribute("transform",e),(e=xn.transform.baseVal.consolidate())?kn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):En)},", ",")",")");function Nn(e){return((e=Math.exp(e))+1/e)/2}var Mn,Pn,jn=function e(t,n,o){function r(e,r){var i,a,s=e[0],l=e[1],c=e[2],u=r[0],d=r[1],f=r[2],h=u-s,p=d-l,g=h*h+p*p;if(g<1e-12)a=Math.log(f/c)/t,i=function(e){return[s+e*h,l+e*p,c*Math.exp(t*e*a)]};else{var m=Math.sqrt(g),y=(f*f-c*c+o*g)/(2*c*n*m),v=(f*f-c*c-o*g)/(2*f*n*m),b=Math.log(Math.sqrt(y*y+1)-y),w=Math.log(Math.sqrt(v*v+1)-v);a=(w-b)/t,i=function(e){var o,r=e*a,i=Nn(b),u=c/(n*m)*(i*(o=t*r+b,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(b));return[s+u*h,l+u*p,c*i/Nn(t*r+b)]}}return i.duration=1e3*a*t/Math.SQRT2,i}return r.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},r}(Math.SQRT2,2,4),In=0,Tn=0,zn=0,Rn=0,Dn=0,An=0,Ln="object"==typeof performance&&performance.now?performance:Date,Vn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Bn(){return Dn||(Vn($n),Dn=Ln.now()+An)}function $n(){Dn=0}function Hn(){this._call=this._time=this._next=null}function Fn(e,t,n){var o=new Hn;return o.restart(e,t,n),o}function Yn(){Dn=(Rn=Ln.now())+An,In=Tn=0;try{!function(){Bn(),++In;for(var e,t=Mn;t;)(e=Dn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--In}()}finally{In=0,function(){var e,t,n=Mn,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:Mn=t);Pn=e,qn(o)}(),Dn=0}}function Zn(){var e=Ln.now(),t=e-Rn;t>1e3&&(An-=t,Rn=e)}function qn(e){In||(Tn&&(Tn=clearTimeout(Tn)),e-Dn>24?(e<1/0&&(Tn=setTimeout(Yn,e-Ln.now()-An)),zn&&(zn=clearInterval(zn))):(zn||(Rn=Ln.now(),zn=setInterval(Zn,1e3)),In=1,Vn(Yn)))}function Xn(e,t,n){var o=new Hn;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}Hn.prototype=Fn.prototype={constructor:Hn,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Bn():+n)+(null==t?0:+t),this._next||Pn===this||(Pn?Pn._next=this:Mn=this,Pn=this),this._call=e,this._time=n,qn()},stop:function(){this._call&&(this._call=null,this._time=1/0,qn())}};var Wn=K("start","end","cancel","interrupt"),Gn=[];function Kn(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 c,u,d,f;if(1!==n.state)return l();for(c in r)if((f=r[c]).name===n.name){if(3===f.state)return Xn(a);4===f.state?(f.state=6,f.timer.stop(),f.on.call("interrupt",e,e.__data__,f.index,f.group),delete r[c]):+c<t&&(f.state=6,f.timer.stop(),f.on.call("cancel",e,e.__data__,f.index,f.group),delete r[c])}if(Xn(function(){3===n.state&&(n.state=4,n.timer.restart(s,n.delay,n.time),s(i))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),c=0,u=-1;c<d;++c)(f=n.tween[c].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=f);o.length=u+1}}function s(t){for(var r=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(l),n.state=5,1),i=-1,a=o.length;++i<a;)o[i].call(e,r);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){for(var o in n.state=6,n.timer.stop(),delete r[t],r)return;delete e.__transition}r[t]=n,n.timer=Fn(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:Wn,tween:Gn,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function Un(e,t){var n=Jn(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function Qn(e,t){var n=Jn(e,t);if(n.state>3)throw new Error("too late; already running");return n}function Jn(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function eo(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 to(e,t){var n,o;return function(){var r=Qn(this,e),i=r.tween;if(i!==n)for(var a=0,s=(o=n=i).length;a<s;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}r.tween=o}}function no(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=Qn(this,e),a=i.tween;if(a!==o){r=(o=a).slice();for(var s={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=s;break}l===c&&r.push(s)}i.tween=r}}function oo(e,t,n){var o=e._id;return e.each(function(){var e=Qn(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return Jn(e,o).value[t]}}function ro(e,t){var n;return("number"==typeof t?gn:t instanceof Zt?dn:(n=Zt(t))?(t=n,dn):bn)(e,t)}function io(e){return function(){this.removeAttribute(e)}}function ao(e){return function(){this.removeAttributeNS(e.space,e.local)}}function so(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttribute(e);return a===i?null:a===o?r:r=t(o=a,n)}}function lo(e,t,n){var o,r,i=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===i?null:a===o?r:r=t(o=a,n)}}function co(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttribute(e))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttribute(e)}}function uo(e,t,n){var o,r,i;return function(){var a,s,l=n(this);if(null!=l)return(a=this.getAttributeNS(e.space,e.local))===(s=l+"")?null:a===o&&s===r?i:(r=s,i=t(o=a,l));this.removeAttributeNS(e.space,e.local)}}function fo(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,r)),n}return r._value=t,r}function ho(e,t){var n,o;function r(){var r=t.apply(this,arguments);return r!==o&&(n=(o=r)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,r)),n}return r._value=t,r}function po(e,t){return function(){Un(this,e).delay=+t.apply(this,arguments)}}function go(e,t){return t=+t,function(){Un(this,e).delay=t}}function mo(e,t){return function(){Qn(this,e).duration=+t.apply(this,arguments)}}function yo(e,t){return t=+t,function(){Qn(this,e).duration=t}}var vo=dt.prototype.constructor;function bo(e){return function(){this.style.removeProperty(e)}}var wo=0;function xo(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function _o(){return++wo}var Eo=dt.prototype;xo.prototype={constructor:xo,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=se(e));for(var o=this._groups,r=o.length,i=new Array(r),a=0;a<r;++a)for(var s,l,c=o[a],u=c.length,d=i[a]=new Array(u),f=0;f<u;++f)(s=c[f])&&(l=e.call(s,s.__data__,f,c))&&("__data__"in s&&(l.__data__=s.__data__),d[f]=l,Kn(d[f],t,n,f,d,Jn(s,n)));return new xo(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=ce(e));for(var o=this._groups,r=o.length,i=[],a=[],s=0;s<r;++s)for(var l,c=o[s],u=c.length,d=0;d<u;++d)if(l=c[d]){for(var f,h=e.call(l,l.__data__,d,c),p=Jn(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&Kn(f,t,n,g,h,p);i.push(h),a.push(l)}return new xo(i,a,t,n)},selectChild:Eo.selectChild,selectChildren:Eo.selectChildren,filter:function(e){"function"!=typeof e&&(e=de(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i,a=t[r],s=a.length,l=o[r]=[],c=0;c<s;++c)(i=a[c])&&e.call(i,i.__data__,c,a)&&l.push(i);return new xo(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),a=new Array(o),s=0;s<i;++s)for(var l,c=t[s],u=n[s],d=c.length,f=a[s]=new Array(d),h=0;h<d;++h)(l=c[h]||u[h])&&(f[h]=l);for(;s<o;++s)a[s]=t[s];return new xo(a,this._parents,this._name,this._id)},selection:function(){return new vo(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=_o(),o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)if(a=s[c]){var u=Jn(a,t);Kn(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new xo(o,this._parents,e,n)},call:Eo.call,nodes:Eo.nodes,node:Eo.node,size:Eo.size,empty:Eo.empty,each:Eo.each,on:function(e,t){var n=this._id;return arguments.length<2?Jn(this.node(),n).on.on(e):this.each(function(e,t,n){var o,r,i=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?Un:Qn;return function(){var a=i(this,e),s=a.on;s!==o&&(r=(o=s).copy()).on(t,n),a.on=r}}(n,e,t))},attr:function(e,t){var n=ne(e),o="transform"===n?Cn:ro;return this.attrTween(e,"function"==typeof t?(n.local?uo:co)(n,o,oo(this,"attr."+e,t)):null==t?(n.local?ao:io)(n):(n.local?lo:so)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=ne(e);return this.tween(n,(o.local?fo:ho)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?On:ro;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=ze(this,e),a=(this.style.removeProperty(e),ze(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,bo(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=ze(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=ze(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,oo(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=Qn(this,e),c=l.on,u=null==l.value[a]?i||(i=bo(t)):void 0;c===n&&r===u||(o=(n=c).copy()).on(s,r=u),l.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,r,i=n+"";return function(){var a=ze(this,e);return a===i?null:a===o?r:r=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,r;function i(){var i=t.apply(this,arguments);return i!==r&&(o=(r=i)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,i,n)),o}return i._value=t,i}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(oo(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",function(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}(this._id))},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,r=Jn(this.node(),n).tween,i=0,a=r.length;i<a;++i)if((o=r[i]).name===e)return o.value;return null}return this.each((null==t?to:no)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?po:go)(t,e)):Jn(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?mo:yo)(t,e)):Jn(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){Qn(this,e).ease=t}}(t,e)):Jn(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;Qn(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,a){var s={value:a},l={value:function(){0===--r&&i()}};n.each(function(){var n=Qn(this,o),r=n.on;r!==e&&((t=(e=r).copy())._.cancel.push(s),t._.interrupt.push(s),t._.end.push(l)),n.on=t}),0===r&&i()})},[Symbol.iterator]:Eo[Symbol.iterator]};var ko={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function So(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}dt.prototype.interrupt=function(e){return this.each(function(){eo(this,e)})},dt.prototype.transition=function(e){var t,n;e instanceof xo?(t=e._id,e=e._name):(t=_o(),(n=ko).time=Bn(),e=null==e?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var a,s=o[i],l=s.length,c=0;c<l;++c)(a=s[c])&&Kn(a,e,t,c,s,n||So(a,t));return new xo(o,this._parents,e,t)};var Oo=e=>()=>e;function Co(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 No(e,t,n){this.k=e,this.x=t,this.y=n}No.prototype={constructor:No,scale:function(e){return 1===e?this:new No(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new No(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 Mo=new No(1,0,0);function Po(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Mo;return e.__zoom}function jo(e){e.stopImmediatePropagation()}function Io(e){e.preventDefault(),e.stopImmediatePropagation()}function To(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function zo(){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 Ro(){return this.__zoom||Mo}function Do(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ao(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lo(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 Vo(){var e,t,n,o=To,r=zo,i=Lo,a=Do,s=Ao,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=jn,f=K("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",Ro).on("wheel.zoom",_,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",k).filter(s).on("touchstart.zoom",S).on("touchmove.zoom",O).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function m(e,t){return(t=Math.max(l[0],Math.min(l[1],t)))===e.k?e:new No(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 No(e.k,o,r)}function v(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function b(e,t,n,o){e.on("start.zoom",function(){w(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){w(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,i=arguments,a=w(e,i).event(o),s=r.apply(e,i),l=null==n?v(s):"function"==typeof n?n.apply(e,i):n,c=Math.max(s[1][0]-s[0][0],s[1][1]-s[0][1]),u=e.__zoom,f="function"==typeof t?t.apply(e,i):t,h=d(u.invert(l).concat(c/u.k),f.invert(l).concat(c/f.k));return function(e){if(1===e)e=f;else{var t=h(e),n=c/t[2];e=new No(n,l[0]-t[0]*n,l[1]-t[1]*n)}a.zoom(null,e)}})}function w(e,t,n){return!n&&e.__zooming||new x(e,t)}function x(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=r.apply(e,t),this.taps=0}function _(e,...t){if(o.apply(this,arguments)){var n=w(this,t).event(e),r=this.__zoom,s=Math.max(l[0],Math.min(l[1],r.k*Math.pow(2,a.apply(this,arguments)))),u=ht(e);if(n.wheel)n.mouse[0][0]===u[0]&&n.mouse[0][1]===u[1]||(n.mouse[1]=r.invert(n.mouse[0]=u)),clearTimeout(n.wheel);else{if(r.k===s)return;n.mouse=[u,r.invert(u)],eo(this),n.start()}Io(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",i(y(m(r,s),n.mouse[0],n.mouse[1]),n.extent,c))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var r=e.currentTarget,a=w(this,t,!0).event(e),s=ft(e.view).on("mousemove.zoom",function(e){if(Io(e),!a.moved){var t=e.clientX-u,n=e.clientY-d;a.moved=t*t+n*n>h}a.event(e).zoom("mouse",i(y(a.that.__zoom,a.mouse[0]=ht(e,r),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),bt(e.view,a.moved),Io(e),a.event(e).end()},!0),l=ht(e,r),u=e.clientX,d=e.clientY;vt(e.view),jo(e),a.mouse=[l,this.__zoom.invert(l)],eo(this),a.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=ht(e.changedTouches?e.changedTouches[0]:e,this),s=n.invert(a),l=n.k*(e.shiftKey?.5:2),d=i(y(m(n,l),a,s),r.apply(this,t),c);Io(e),u>0?ft(this).transition().duration(u).call(b,d,a,e):ft(this).call(g.transform,d,a,e)}}function S(n,...r){if(o.apply(this,arguments)){var i,a,s,l,c=n.touches,u=c.length,d=w(this,r,n.changedTouches.length===u).event(n);for(jo(n),a=0;a<u;++a)l=[l=ht(s=c[a],this),this.__zoom.invert(l),s.identifier],d.touch0?d.touch1||d.touch0[2]===l[2]||(d.touch1=l,d.taps=0):(d.touch0=l,i=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),i&&(d.taps<2&&(t=l[0],e=setTimeout(function(){e=null},500)),eo(this),d.start())}}function O(e,...t){if(this.__zooming){var n,o,r,a,s=w(this,t).event(e),l=e.changedTouches,u=l.length;for(Io(e),n=0;n<u;++n)r=ht(o=l[n],this),s.touch0&&s.touch0[2]===o.identifier?s.touch0[0]=r:s.touch1&&s.touch1[2]===o.identifier&&(s.touch1[0]=r);if(o=s.that.__zoom,s.touch1){var d=s.touch0[0],f=s.touch0[1],h=s.touch1[0],p=s.touch1[1],g=(g=h[0]-d[0])*g+(g=h[1]-d[1])*g,v=(v=p[0]-f[0])*v+(v=p[1]-f[1])*v;o=m(o,Math.sqrt(g/v)),r=[(d[0]+h[0])/2,(d[1]+h[1])/2],a=[(f[0]+p[0])/2,(f[1]+p[1])/2]}else{if(!s.touch0)return;r=s.touch0[0],a=s.touch0[1]}s.zoom("touch",i(y(o,r,a),s.extent,c))}}function C(e,...o){if(this.__zooming){var r,i,a=w(this,o).event(e),s=e.changedTouches,l=s.length;for(jo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),r=0;r<l;++r)i=s[r],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=ht(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=ft(this).on("dblclick.zoom");c&&c.apply(this,arguments)}}}return g.transform=function(e,t,n,o){var r=e.selection?e.selection():e;r.property("__zoom",Ro),e!==r?b(e,t,n,o):r.interrupt().each(function(){w(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},g.scaleBy=function(e,t,n,o){g.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},g.scaleTo=function(e,t,n,o){g.transform(e,function(){var e=r.apply(this,arguments),o=this.__zoom,a=null==n?v(e):"function"==typeof n?n.apply(this,arguments):n,s=o.invert(a),l="function"==typeof t?t.apply(this,arguments):t;return i(y(m(o,l),a,s),e,c)},n,o)},g.translateBy=function(e,t,n,o){g.transform(e,function(){return i(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),r.apply(this,arguments),c)},null,o)},g.translateTo=function(e,t,n,o,a){g.transform(e,function(){var e=r.apply(this,arguments),a=this.__zoom,s=null==o?v(e):"function"==typeof o?o.apply(this,arguments):o;return i(Mo.translate(s[0],s[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,c)},o,a)},x.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,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=ft(this.that).datum();f.call(e,this.that,new Co(e,{sourceEvent:this.sourceEvent,target:g,transform:this.that.__zoom,dispatch:f}),t)}},g.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Oo(+e),g):a},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Oo(!!e),g):o},g.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Oo(!!e),g):s},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Oo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),g):r},g.scaleExtent=function(e){return arguments.length?(l[0]=+e[0],l[1]=+e[1],g):[l[0],l[1]]},g.translateExtent=function(e){return arguments.length?(c[0][0]=+e[0][0],c[1][0]=+e[1][0],c[0][1]=+e[0][1],c[1][1]=+e[1][1],g):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},g.constrain=function(e){return arguments.length?(i=e,g):i},g.duration=function(e){return arguments.length?(u=+e,g):u},g.interpolate=function(e){return arguments.length?(d=e,g):d},g.on=function(){var e=f.on.apply(f,arguments);return e===f?g:e},g.clickDistance=function(e){return arguments.length?(h=(e=+e)*e,g):Math.sqrt(h)},g.tapDistance=function(e){return arguments.length?(p=+e,g):p},g}Po.prototype=No.prototype;const Bo=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",$o=()=>"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.",Ho=e=>`Node type "${e}" not found. Using fallback type "default".`,Fo=()=>"The React Flow parent container needs a width and a height to render the graph.",Yo=()=>"Only child nodes can use a parent extent.",Zo=()=>"Can't create edge. An edge needs a source and a target.",qo=e=>`Marker type "${e}" doesn't exist.`,Xo=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,Wo=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",Go=e=>`Edge type "${e}" not found. Using fallback type "default".`,Ko=e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,Uo=(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,Qo=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",Jo=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],er=["Enter"," ","Escape"],tr={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var nr,or,rr;!function(e){e.Strict="strict",e.Loose="loose"}(nr||(nr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(or||(or={})),function(e){e.Partial="partial",e.Full="full"}(rr||(rr={}));const ir={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var ar,sr,lr;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(ar||(ar={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(sr||(sr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(lr||(lr={}));const cr={[lr.Left]:lr.Right,[lr.Right]:lr.Left,[lr.Top]:lr.Bottom,[lr.Bottom]:lr.Top};function ur(e){return null===e?null:e?"valid":"invalid"}const dr=e=>"id"in e&&"source"in e&&"target"in e,fr=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),hr=(e,t=[0,0])=>{const{width:n,height:o}=$r(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},pr=(e,t={})=>{if(0===e.size)return{x:0,y:0,width:0,height:0};let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0};return e.forEach(e=>{if(void 0===t.filter||t.filter(e)){const t=Nr(e);n=kr(n,t)}}),Or(n)},gr=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Rr(t,[n,o,r]),width:t.width/r,height:t.height/r},l=[];for(const t of e.values()){const{measured:e,selectable:n=!0,hidden:o=!1}=t;if(a&&!n||o)continue;const r=e.width??t.width??t.initialWidth??null,c=e.height??t.height??t.initialHeight??null,u=Pr(s,Cr(t)),d=(r??0)*(c??0),f=i&&u>0;(!t.internals.handleBounds||f||u>=d||t.dragging)&&l.push(t)}return l};async function mr({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},a){if(0===e.size)return Promise.resolve(!0);const s=function(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(e=>e.id)):null;return e.forEach(e=>{!e.measured.width||!e.measured.height||!t?.includeHiddenNodes&&e.hidden||o&&!o.has(e.id)||n.set(e.id,e)}),n}(e,a),l=pr(s),c=Lr(l,t,n,a?.minZoom??r,a?.maxZoom??i,a?.padding??.1);return await o.setViewport(c,{duration:a?.duration,ease:a?.ease,interpolate:a?.interpolate}),Promise.resolve(!0)}function yr({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const a=n.get(e),s=a.parentId?n.get(a.parentId):void 0,{x:l,y:c}=s?s.internals.positionAbsolute:{x:0,y:0},u=a.origin??o;let d=a.extent||r;if("parent"!==a.extent||a.expandParent)s&&Br(a.extent)&&(d=[[a.extent[0][0]+l,a.extent[0][1]+c],[a.extent[1][0]+l,a.extent[1][1]+c]]);else if(s){const e=s.measured.width,t=s.measured.height;e&&t&&(d=[[l,c],[l+e,c+t]])}else i?.("005",Yo());const f=Br(d)?wr(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",Qo()),{position:{x:f.x-l+(a.measured.width??0)*u[0],y:f.y-c+(a.measured.height??0)*u[1]},positionAbsolute:f}}async function vr({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(e=>e.id)),a=[];for(const e of n){if(!1===e.deletable)continue;const t=i.has(e.id),n=!t&&e.parentId&&a.find(t=>t.id===e.parentId);(t||n)&&a.push(e)}const s=new Set(t.map(e=>e.id)),l=o.filter(e=>!1!==e.deletable),c=((e,t)=>{const n=new Set;return e.forEach(e=>{n.add(e.id)}),t.filter(e=>n.has(e.source)||n.has(e.target))})(a,l),u=c;for(const e of l){s.has(e.id)&&!u.find(t=>t.id===e.id)&&u.push(e)}if(!r)return{edges:u,nodes:a};const d=await r({nodes:a,edges:u});return"boolean"==typeof d?d?{edges:u,nodes:a}:{edges:[],nodes:[]}:d}const br=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),wr=(e={x:0,y:0},t,n)=>({x:br(e.x,t[0][0],t[1][0]-(n?.width??0)),y:br(e.y,t[0][1],t[1][1]-(n?.height??0))});function xr(e,t,n){const{width:o,height:r}=$r(n),{x:i,y:a}=n.internals.positionAbsolute;return wr(e,[[i,a],[i+o,a+r]],t)}const _r=(e,t,n)=>e<t?br(Math.abs(e-t),1,t)/t:e>n?-br(Math.abs(e-n),1,t)/t:0,Er=(e,t,n=15,o=40)=>[_r(e.x,o,t.width-o)*n,_r(e.y,o,t.height-o)*n],kr=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Sr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Or=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Cr=(e,t=[0,0])=>{const{x:n,y:o}=fr(e)?e.internals.positionAbsolute:hr(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Nr=(e,t=[0,0])=>{const{x:n,y:o}=fr(e)?e.internals.positionAbsolute:hr(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},Mr=(e,t)=>Or(kr(Sr(e),Sr(t))),Pr=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},jr=e=>Ir(e.width)&&Ir(e.height)&&Ir(e.x)&&Ir(e.y),Ir=e=>!isNaN(e)&&isFinite(e),Tr=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},zr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Rr=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?zr(s,a):s},Dr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ar(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}const Lr=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Ar(e,n),r=Ar(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Ar(e.top??e.y??0,n),r=Ar(e.bottom??e.y??0,n),i=Ar(e.left??e.x??0,t),a=Ar(e.right??e.x??0,t);return{top:o,right:a,bottom:r,left:i,x:i+a,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(i,t,n),s=(t-a.x)/e.width,l=(n-a.y)/e.height,c=Math.min(s,l),u=br(c,o,r),d=t/2-(e.x+e.width/2)*u,f=n/2-(e.y+e.height/2)*u,h=function(e,t,n,o,r,i){const{x:a,y:s}=Dr(e,[t,n,o]),{x:l,y:c}=Dr({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,d=i-c;return{left:Math.floor(a),top:Math.floor(s),right:Math.floor(u),bottom:Math.floor(d)}}(e,d,f,u,t,n),p=Math.min(h.left-a.left,0),g=Math.min(h.top-a.top,0);return{x:d-p+Math.min(h.right-a.right,0),y:f-g+Math.min(h.bottom-a.bottom,0),zoom:u}},Vr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function Br(e){return void 0!==e&&"parent"!==e}function $r(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Hr(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function Fr(e,t={width:0,height:0},n,o,r){const i={...e},a=o.get(n);if(a){const e=a.origin||r;i.x+=a.internals.positionAbsolute.x-(t.width??0)*e[0],i.y+=a.internals.positionAbsolute.y-(t.height??0)*e[1]}return i}function Yr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Zr(e){return{...tr,...e||{}}}function qr(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=Qr(e),s=Rr({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?zr(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const Xr=e=>({width:e.offsetWidth,height:e.offsetHeight}),Wr=e=>e?.getRootNode?.()||window?.document,Gr=["INPUT","SELECT","TEXTAREA"];function Kr(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return Gr.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const Ur=e=>"clientX"in e,Qr=(e,t)=>{const n=Ur(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},Jr=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return i&&i.length?Array.from(i).map(t=>{const i=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:r,position:t.getAttribute("data-handlepos"),x:(i.left-n.left)/o,y:(i.top-n.top)/o,...Xr(t)}}):null};function ei({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:a,targetControlY:s}){const l=.125*e+.375*r+.375*a+.125*n,c=.125*t+.375*i+.375*s+.125*o;return[l,c,Math.abs(l-e),Math.abs(c-t)]}function ti(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function ni({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case lr.Left:return[t-ti(t-o,i),n];case lr.Right:return[t+ti(o-t,i),n];case lr.Top:return[t,n-ti(n-r,i)];case lr.Bottom:return[t,n+ti(r-n,i)]}}function oi({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top,curvature:a=.25}){const[s,l]=ni({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=ni({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,f,h,p]=ei({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${s},${l} ${c},${u} ${o},${r}`,d,f,h,p]}function ri({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,a=Math.abs(o-t)/2;return[i,o<t?o+a:o-a,r,a]}function ii({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=kr(Nr(e),Nr(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const a={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return Pr(a,Or(i))>0}const ai=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function si({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=ri({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const li={[lr.Left]:{x:-1,y:0},[lr.Right]:{x:1,y:0},[lr.Top]:{x:0,y:-1},[lr.Bottom]:{x:0,y:1}},ci=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ui({source:e,sourcePosition:t=lr.Bottom,target:n,targetPosition:o=lr.Top,center:r,offset:i,stepPosition:a}){const s=li[t],l=li[o],c={x:e.x+s.x*i,y:e.y+s.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},d=(({source:e,sourcePosition:t=lr.Bottom,target:n})=>t===lr.Left||t===lr.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1})({source:c,sourcePosition:t,target:u}),f=0!==d.x?"x":"y",h=d[f];let p,g,m=[];const y={x:0,y:0},v={x:0,y:0},[,,b,w]=ri({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(s[f]*l[f]===-1){"x"===f?(p=r.x??c.x+(u.x-c.x)*a,g=r.y??(c.y+u.y)/2):(p=r.x??(c.x+u.x)/2,g=r.y??c.y+(u.y-c.y)*a);const e=[{x:p,y:c.y},{x:p,y:u.y}],t=[{x:c.x,y:g},{x:u.x,y:g}];m=s[f]===h?"x"===f?e:t:"x"===f?t:e}else{const r=[{x:c.x,y:u.y}],a=[{x:u.x,y:c.y}];if(m="x"===f?s.x===h?a:r:s.y===h?r:a,t===o){const t=Math.abs(e[f]-n[f]);if(t<=i){const o=Math.min(i-1,i-t);s[f]===h?y[f]=(c[f]>e[f]?-1:1)*o:v[f]=(u[f]>n[f]?-1:1)*o}}if(t!==o){const e="x"===f?"y":"x",t=s[f]===l[e],n=c[e]>u[e],o=c[e]<u[e];(1===s[f]&&(!t&&n||t&&o)||1!==s[f]&&(!t&&o||t&&n))&&(m="x"===f?r:a)}const d={x:c.x+y.x,y:c.y+y.y},b={x:u.x+v.x,y:u.y+v.y};Math.max(Math.abs(d.x-m[0].x),Math.abs(b.x-m[0].x))>=Math.max(Math.abs(d.y-m[0].y),Math.abs(b.y-m[0].y))?(p=(d.x+b.x)/2,g=m[0].y):(p=m[0].x,g=(d.y+b.y)/2)}return[[e,{x:c.x+y.x,y:c.y+y.y},...m,{x:u.x+v.x,y:u.y+v.y},n],p,g,b,w]}function di({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,h,p,g]=ui({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:s,y:l},offset:c,stepPosition:u});return[d.reduce((e,t,n)=>{let o="";return o=n>0&&n<d.length-1?function(e,t,n,o){const r=Math.min(ci(e,t)/2,ci(t,n)/2,o),{x:i,y:a}=t;if(e.x===i&&i===n.x||e.y===a&&a===n.y)return`L${i} ${a}`;if(e.y===a)return`L ${i+r*(e.x<n.x?-1:1)},${a}Q ${i},${a} ${i},${a+r*(e.y<n.y?1:-1)}`;const s=e.x<n.x?1:-1;return`L ${i},${a+r*(e.y<n.y?-1:1)}Q ${i},${a} ${i+r*s},${a}`}(d[n-1],t,d[n+1],a):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},""),f,h,p,g]}function fi(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function hi(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,"source"===o.type?t.push(o):"target"===o.type&&n.push(o);return{source:t,target:n}}function pi(e,t,n=lr.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:a,height:s}=t??$r(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case lr.Top:return{x:r+a/2,y:i};case lr.Right:return{x:r+a,y:i+s/2};case lr.Bottom:return{x:r+a/2,y:i+s};case lr.Left:return{x:r,y:i+s/2}}}function gi(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function mi(e,t){if(!e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}const yi={nodeOrigin:[0,0],nodeExtent:Jo,elevateNodesOnSelect:!0,defaults:{}},vi={...yi,checkEquality:!0};function bi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function wi(e,t,n,o){const r=bi(vi,o);let i=e.length>0;const a=new Map(t),s=r?.elevateNodesOnSelect?1e3:0;t.clear(),n.clear();for(const l of e){let e=a.get(l.id);if(r.checkEquality&&l===e?.internals.userNode)t.set(l.id,e);else{const n=hr(l,r.nodeOrigin),o=Br(l.extent)?l.extent:r.nodeExtent,i=wr(n,o,$r(l));e={...r.defaults,...l,measured:{width:l.measured?.width,height:l.measured?.height},internals:{positionAbsolute:i,handleBounds:l.measured?e?.internals.handleBounds:void 0,z:_i(l,s),userNode:l}},t.set(l.id,e)}void 0!==e.measured&&void 0!==e.measured.width&&void 0!==e.measured.height||e.hidden||(i=!1),l.parentId&&xi(e,t,n,o)}return i}function xi(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=bi(yi,o),s=e.parentId,l=t.get(s);if(!l)return void console.warn(`Parent node ${s} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);!function(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}(e,n);const c=r?1e3:0,{x:u,y:d,z:f}=function(e,t,n,o,r){const{x:i,y:a}=t.internals.positionAbsolute,s=$r(e),l=hr(e,n),c=Br(e.extent)?wr(l,e.extent,s):l;let u=wr({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=xr(u,s,t));const d=_i(e,r),f=t.internals.z??0;return{x:u.x,y:u.y,z:f>=d?f+1:d}}(e,l,i,a,c),{positionAbsolute:h}=e.internals,p=u!==h.x||d!==h.y;(p||f!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:p?{x:u,y:d}:h,z:f}})}function _i(e,t){return(Ir(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ei(e,t,n,o=[0,0]){const r=[],i=new Map;for(const n of e){const e=t.get(n.parentId);if(!e)continue;const o=i.get(n.parentId)?.expandedRect??Cr(e),r=Mr(o,n.rect);i.set(n.parentId,{expandedRect:r,parent:e})}return i.size>0&&i.forEach(({expandedRect:t,parent:i},a)=>{const s=i.internals.positionAbsolute,l=$r(i),c=i.origin??o,u=t.x<s.x?Math.round(Math.abs(s.x-t.x)):0,d=t.y<s.y?Math.round(Math.abs(s.y-t.y)):0,f=Math.max(l.width,Math.round(t.width)),h=Math.max(l.height,Math.round(t.height)),p=(f-l.width)*c[0],g=(h-l.height)*c[1];(u>0||d>0||p||g)&&(r.push({id:a,type:"position",position:{x:i.position.x-u+p,y:i.position.y-d+g}}),n.get(a)?.forEach(t=>{e.some(e=>e.id===t.id)||r.push({id:t.id,type:"position",position:{x:t.position.x+u,y:t.position.y+d}})})),(l.width<t.width||l.height<t.height||u||d)&&r.push({id:a,type:"dimensions",setAttributes:!0,dimensions:{width:f+(u?c[0]*u-p:0),height:h+(d?c[1]*d-g:0)}})}),r}function ki(e,t,n,o,r,i){let a=r;const s=o.get(a)||new Map;o.set(a,s.set(n,t)),a=`${r}-${e}`;const l=o.get(a)||new Map;if(o.set(a,l.set(n,t)),i){a=`${r}-${e}-${i}`;const s=o.get(a)||new Map;o.set(a,s.set(n,t))}}function Si(e,t,n){e.clear(),t.clear();for(const o of n){const{source:n,target:r,sourceHandle:i=null,targetHandle:a=null}=o,s={edgeId:o.id,source:n,target:r,sourceHandle:i,targetHandle:a},l=`${n}-${i}--${r}-${a}`;ki("source",s,`${r}-${a}--${n}-${i}`,e,n,i),ki("target",s,l,e,r,a),t.set(o.id,o)}}function Oi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Oi(n,t))}function Ci(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Ni({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[e,i]of t){const t=n.get(e)?.internals.userNode;t&&r.push({...t,position:i.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Mi({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},a=0,s=new Map,l=!1,c={x:0,y:0},u=null,d=!1,f=null,h=!1,p=!1;return{update:function({noDragClassName:g,handleSelector:m,domNode:y,isSelectable:v,nodeId:b,nodeClickDistance:w=0}){function x({x:e,y:n},r){const{nodeLookup:a,nodeExtent:l,snapGrid:c,snapToGrid:u,nodeOrigin:d,onNodeDrag:f,onSelectionDrag:h,onError:g,updateNodePositions:m}=t();i={x:e,y:n};let y=!1,v={x:0,y:0,x2:0,y2:0};if(s.size>1&&l){const e=pr(s);v=Sr(e)}for(const[t,o]of s){if(!a.has(t))continue;let r={x:e-o.distance.x,y:n-o.distance.y};u&&(r=zr(r,c));let i=[[l[0][0],l[0][1]],[l[1][0],l[1][1]]];if(s.size>1&&l&&!o.extent){const{positionAbsolute:e}=o.internals,t=e.x-v.x+l[0][0],n=e.x+o.measured.width-v.x2+l[1][0];i=[[t,e.y-v.y+l[0][1]],[n,e.y+o.measured.height-v.y2+l[1][1]]]}const{position:f,positionAbsolute:h}=yr({nodeId:t,nextPosition:r,nodeLookup:a,nodeExtent:i,nodeOrigin:d,onError:g});y=y||o.position.x!==f.x||o.position.y!==f.y,o.position=f,o.internals.positionAbsolute=h}if(p=p||y,y&&(m(s,!0),r&&(o||f||!b&&h))){const[e,t]=Ni({nodeId:b,dragItems:s,nodeLookup:a});o?.(r,s,e,t),f?.(r,e,t),b||h?.(r,t)}}async function _(){if(!u)return;const{transform:e,panBy:n,autoPanSpeed:o,autoPanOnNodeDrag:r}=t();if(!r)return l=!1,void cancelAnimationFrame(a);const[s,d]=Er(c,u,o);0===s&&0===d||(i.x=(i.x??0)-s/e[2],i.y=(i.y??0)-d/e[2],await n({x:s,y:d})&&x(i,null)),a=requestAnimationFrame(_)}function E(o){const{nodeLookup:r,multiSelectionActive:a,nodesDraggable:l,transform:c,snapGrid:f,snapToGrid:h,selectNodesOnDrag:p,onNodeDragStart:g,onSelectionDragStart:m,unselectNodesAndEdges:y}=t();d=!0,p&&v||a||!b||r.get(b)?.selected||y(),v&&p&&b&&e?.(b);const w=qr(o.sourceEvent,{transform:c,snapGrid:f,snapToGrid:h,containerBounds:u});if(i=w,s=function(e,t,n,o){const r=new Map;for(const[i,a]of e)if((a.selected||a.id===o)&&(!a.parentId||!Oi(a,e))&&(a.draggable||t&&void 0===a.draggable)){const t=e.get(i);t&&r.set(i,{id:i,position:t.position||{x:0,y:0},distance:{x:n.x-t.internals.positionAbsolute.x,y:n.y-t.internals.positionAbsolute.y},extent:t.extent,parentId:t.parentId,origin:t.origin,expandParent:t.expandParent,internals:{positionAbsolute:t.internals.positionAbsolute||{x:0,y:0}},measured:{width:t.measured.width??0,height:t.measured.height??0}})}return r}(r,l,w,b),s.size>0&&(n||g||!b&&m)){const[e,t]=Ni({nodeId:b,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),g?.(o.sourceEvent,e,t),b||m?.(o.sourceEvent,t)}}f=ft(y);const k=Ot().clickDistance(w).on("start",e=>{const{domNode:n,nodeDragThreshold:o,transform:r,snapGrid:a,snapToGrid:s}=t();u=n?.getBoundingClientRect()||null,h=!1,p=!1,0===o&&E(e);const l=qr(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=Qr(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:f,nodeLookup:p}=t(),g=qr(e.sourceEvent,{transform:o,snapGrid:r,snapToGrid:a,containerBounds:u});if(("touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||b&&!p.has(b))&&(h=!0),!h){if(!l&&n&&d&&(l=!0,_()),!d){const t=g.xSnapped-(i.x??0),n=g.ySnapped-(i.y??0);Math.sqrt(t*t+n*n)>f&&E(e)}(i.x!==g.xSnapped||i.y!==g.ySnapped)&&s&&d&&(c=Qr(e.sourceEvent,u),x(g,e.sourceEvent))}}).on("end",e=>{if(d&&!h&&(l=!1,d=!1,cancelAnimationFrame(a),s.size>0)){const{nodeLookup:n,updateNodePositions:o,onNodeDragStop:i,onSelectionDragStop:a}=t();if(p&&(o(s,!1),p=!1),r||i||!b&&a){const[t,o]=Ni({nodeId:b,dragItems:s,nodeLookup:n,dragging:!1});r?.(e.sourceEvent,s,t,o),i?.(e.sourceEvent,t,o),b||a?.(e.sourceEvent,o)}}}).filter(e=>{const t=e.target;return!e.button&&(!g||!Ci(t,`.${g}`,y))&&(!m||Ci(t,m,y))});f.call(k)},destroy:function(){f?.on(".drag",null)}}}function Pi(e,t,n,o){let r=[],i=1/0;const a=function(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const e of t.values())Pr(r,Cr(e))>0&&o.push(e);return o}(e,n,t+250);for(const n of a){const a=[...n.internals.handleBounds?.source??[],...n.internals.handleBounds?.target??[]];for(const s of a){if(o.nodeId===s.nodeId&&o.type===s.type&&o.id===s.id)continue;const{x:a,y:l}=pi(n,s,s.position,!0),c=Math.sqrt(Math.pow(a-e.x,2)+Math.pow(l-e.y,2));c>t||(c<i?(r=[{...s,x:a,y:l}],i=c):c===i&&r.push({...s,x:a,y:l}))}}if(!r.length)return null;if(r.length>1){const e="source"===o.type?"target":"source";return r.find(t=>t.type===e)??r[0]}return r[0]}function ji(e,t,n,o,r,i=!1){const a=o.get(e);if(!a)return null;const s="strict"===r?a.internals.handleBounds?.[t]:[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]],l=(n?s?.find(e=>e.id===n):s?.[0])??null;return l&&i?{...l,...pi(a,l,l.position,!0)}:l}function Ii(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const Ti=()=>!0;function zi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=Ti,nodeLookup:u}){const d="target"===i,f=t?a.querySelector(`.${s}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:p}=Qr(e),g=a.elementFromPoint(h,p),m=g?.classList.contains(`${s}-flow__handle`)?g:f,y={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const e=Ii(void 0,m),t=m.getAttribute("data-nodeid"),i=m.getAttribute("data-handleid"),a=m.classList.contains("connectable"),s=m.classList.contains("connectableend");if(!t||!e)return y;const l={source:d?t:o,sourceHandle:d?i:r,target:d?o:t,targetHandle:d?r:i};y.connection=l;const f=a&&s&&(n===nr.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=ji(t,e,i,u,n,!0)}return y}const Ri={onPointerDown:function(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:a,domNode:s,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:p,onConnect:g,onConnectEnd:m,isValidConnection:y=Ti,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:x,autoPanSpeed:_,dragThreshold:E=1}){const k=Wr(e.target);let S,O=0;const{x:C,y:N}=Qr(e),M=k?.elementFromPoint(C,N),P=Ii(i,M),j=s?.getBoundingClientRect();let I=!1;if(!j||!P)return;const T=ji(r,P,o,l,t);if(!T)return;let z=Qr(e,j),R=!1,D=null,A=!1,L=null;function V(){if(!u||!j)return;const[e,t]=Er(z,j,_);f({x:e,y:t}),O=requestAnimationFrame(V)}const B={...T,nodeId:r,type:P,position:T.position},$=l.get(r);let H={inProgress:!0,isValid:null,from:pi($,B,lr.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:$,to:z,toHandle:null,toPosition:cr[B.position],toNode:null};function F(){I=!0,b(H),p?.(e,{nodeId:r,handleId:o,handleType:P})}function Y(e){if(!I){const{x:t,y:n}=Qr(e),o=t-C,r=n-N;if(!(o*o+r*r>E*E))return;F()}if(!x()||!B)return void Z(e);const i=w();z=Qr(e,j),S=Pi(Rr(z,i,!1,[1,1]),n,l,B),R||(V(),R=!0);const s=zi(e,{handle:S,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});L=s.handleDomNode,D=s.connection,A=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!S,s.isValid);const u={...H,isValid:A,to:s.toHandle&&A?Dr({x:s.toHandle.x,y:s.toHandle.y},i):z,toHandle:s.toHandle,toPosition:A&&s.toHandle?s.toHandle.position:cr[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};A&&S&&H.toHandle&&u.toHandle&&H.toHandle.type===u.toHandle.type&&H.toHandle.nodeId===u.toHandle.nodeId&&H.toHandle.id===u.toHandle.id&&H.to.x===u.to.x&&H.to.y===u.to.y||(b(u),H=u)}function Z(e){if(I){(S||L)&&D&&A&&g?.(D);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}h(),cancelAnimationFrame(O),R=!1,A=!1,D=null,L=null,k.removeEventListener("mousemove",Y),k.removeEventListener("mouseup",Z),k.removeEventListener("touchmove",Y),k.removeEventListener("touchend",Z)}0===E&&F(),k.addEventListener("mousemove",Y),k.addEventListener("mouseup",Z),k.addEventListener("touchmove",Y),k.addEventListener("touchend",Z)},isValid:zi};const Di=e=>({x:e.x,y:e.y,zoom:e.k}),Ai=({x:e,y:t,zoom:n})=>Mo.translate(e,t).scale(n),Li=(e,t)=>e.target.closest(`.${t}`),Vi=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),Bi=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,$i=(e,t=0,n=Bi,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Hi=e=>{const t=e.ctrlKey&&Vr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function Fi({domNode:e,minZoom:t,maxZoom:n,paneClickDistance:o,translateExtent:r,viewport:i,onPanZoom:a,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:c}){const u={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{x:0,y:0,zoom:0},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),f=Vo().clickDistance(!Ir(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=ft(e).call(f);v({x:i.x,y:i.y,zoom:br(i.zoom,t,n)},[[0,0],[d.width,d.height]],r);const p=h.on("wheel.zoom"),g=h.on("dblclick.zoom");function m(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).transform($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)}function y(){f.on("zoom",null)}async function v(e,t,n){const o=Ai(e),r=f?.constrain()(o,t,n);return r&&await m(r),new Promise(e=>e(r))}return f.wheelDelta(Hi),{update:function({noWheelClassName:e,noPanClassName:t,onPaneContextMenu:n,userSelectionActive:o,panOnScroll:r,panOnDrag:i,panOnScrollMode:d,panOnScrollSpeed:m,preventScrolling:v,zoomOnPinch:b,zoomOnScroll:w,zoomOnDoubleClick:x,zoomActivationKeyPressed:_,lib:E,onTransformChange:k}){o&&!u.isZoomingOrPanning&&y();const S=r&&!_&&!o?function({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:a,onPanZoomStart:s,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Li(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=ht(u),t=Hi(u),r=d*Math.pow(2,t);return void o.scaleTo(n,r,e,u)}const f=1===u.deltaMode?20:1;let h=r===or.Vertical?0:u.deltaX*f,p=r===or.Horizontal?0:u.deltaY*f;!Vr()&&u.shiftKey&&r!==or.Vertical&&(h=u.deltaY*f,p=0),o.translateBy(n,-h/d*i,-p/d*i,{internal:!0});const g=Di(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling||(e.isPanScrolling=!0,s?.(u,g)),e.isPanScrolling&&(l?.(u,g),e.panScrollTimeout=setTimeout(()=>{c?.(u,g),e.isPanScrolling=!1},150))}}({zoomPanValues:u,noWheelClassName:e,d3Selection:h,d3Zoom:f,panOnScrollMode:d,panOnScrollSpeed:m,zoomOnPinch:b,onPanZoomStart:s,onPanZoom:a,onPanZoomEnd:l}):function({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i="wheel"===o.type,a=!t&&i&&!o.ctrlKey,s=Li(o,e);if(o.ctrlKey&&i&&s&&o.preventDefault(),a||s)return null;o.preventDefault(),n.call(this,o,r)}}({noWheelClassName:e,preventScrolling:v,d3ZoomHandler:p});if(h.on("wheel.zoom",S,{passive:!1}),!o){const e=function({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Di(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,"mousedown"===o.sourceEvent?.type&&t(!0),n&&n?.(o.sourceEvent,r)}}({zoomPanValues:u,onDraggingChange:c,onPanZoomStart:s});f.on("start",e);const t=function({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!(!n||!Vi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Di(i.transform))}}({zoomPanValues:u,panOnDrag:i,onPaneContextMenu:!!n,onPanZoom:a,onTransformChange:k});f.on("zoom",t);const o=function({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return a=>{var s,l;if(!a.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Vi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&a.sourceEvent&&i(a.sourceEvent),e.usedRightMouseButton=!1,o(!1),r&&(s=e.prevViewport,l=a.transform,s.x!==l.x||s.y!==l.y||s.zoom!==l.k))){const t=Di(a.transform);e.prevViewport=t,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(a.sourceEvent,t)},n?150:0)}}}({zoomPanValues:u,panOnDrag:i,panOnScroll:r,onPaneContextMenu:n,onPanZoomEnd:l,onDraggingChange:c});f.on("end",o)}const O=function({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:a,noWheelClassName:s,noPanClassName:l,lib:c}){return u=>{const d=e||t,f=n&&u.ctrlKey;if(1===u.button&&"mousedown"===u.type&&(Li(u,`${c}-flow__node`)||Li(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(Li(u,s)&&"wheel"===u.type)return!1;if(Li(u,l)&&("wheel"!==u.type||r&&"wheel"===u.type&&!e))return!1;if(!n&&u.ctrlKey&&"wheel"===u.type)return!1;if(!n&&"touchstart"===u.type&&u.touches?.length>1)return u.preventDefault(),!1;if(!d&&!r&&!f&&"wheel"===u.type)return!1;if(!o&&("mousedown"===u.type||"touchstart"===u.type))return!1;if(Array.isArray(o)&&!o.includes(u.button)&&"mousedown"===u.type)return!1;const h=Array.isArray(o)&&o.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||"wheel"===u.type)&&h}}({zoomActivationKeyPressed:_,panOnDrag:i,zoomOnScroll:w,panOnScroll:r,zoomOnDoubleClick:x,zoomOnPinch:b,userSelectionActive:o,noPanClassName:t,noWheelClassName:e,lib:E});f.filter(O),x?h.on("dblclick.zoom",g):h.on("dblclick.zoom",null)},destroy:y,setViewport:async function(e,t){const n=Ai(e);return await m(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){const e=h?Po(h.node()):{x:0,y:0,k:1};return{x:e.x,y:e.y,zoom:e.k}},scaleTo:function(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).scaleTo($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},scaleBy:function(e,t){return h?new Promise(n=>{f?.interpolate("linear"===t?.interpolate?wn:jn).scaleBy($i(h,t?.duration,t?.ease,()=>n(!0)),e)}):Promise.resolve(!1)},setScaleExtent:function(e){f?.scaleExtent(e)},setTranslateExtent:function(e){f?.translateExtent(e)},syncViewport:function(e){if(h){const t=Ai(e),n=h.property("__zoom");n.k===e.zoom&&n.x===e.x&&n.y===e.y||f?.transform(h,t,null,{sync:!0})}},setClickDistance:function(e){const t=!Ir(e)||e<0?0:e;f?.clickDistance(t)}}}var Yi;function Zi(e,t){return Math.max(0,t-e)}function qi(e,t){return Math.max(0,e-t)}function Xi(e,t,n){return Math.max(0,t-e,e-n)}function Wi(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(Yi||(Yi={}));const Gi={width:0,height:0,x:0,y:0},Ki={...Gi,pointerX:0,pointerY:0,aspectRatio:1};function Ui(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,a=e.measured.height??0,s=n[0]*i,l=n[1]*a;return[[o-s,r-l],[o+i-s,r+a-l]]}function Qi({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ft(e);return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:s,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:f}){let h={...Gi},p={...Ki};const g=function(e){return{isHorizontal:e.includes("right")||e.includes("left"),isVertical:e.includes("bottom")||e.includes("top"),affectsX:e.includes("left"),affectsY:e.includes("top")}}(e);let m,y,v,b,w=null,x=[];const _=Ot().on("start",e=>{const{nodeLookup:o,transform:r,snapGrid:i,snapToGrid:a,nodeOrigin:s,paneDomNode:l}=n();if(m=o.get(t),!m)return;w=l?.getBoundingClientRect()??null;const{xSnapped:u,ySnapped:d}=qr(e.sourceEvent,{transform:r,snapGrid:i,snapToGrid:a,containerBounds:w});h={width:m.measured.width??0,height:m.measured.height??0,x:m.position.x??0,y:m.position.y??0},p={...h,pointerX:u,pointerY:d,aspectRatio:h.width/h.height},y=void 0,m.parentId&&("parent"===m.extent||m.expandParent)&&(y=o.get(m.parentId),v=y&&"parent"===m.extent?function(e){return[[0,0],[e.measured.width,e.measured.height]]}(y):void 0),x=[],b=void 0;for(const[e,n]of o)if(n.parentId===t&&(x.push({id:e,position:{...n.position},extent:n.extent}),"parent"===n.extent||n.expandParent)){const e=Ui(n,m,n.origin??s);b=b?[[Math.min(e[0][0],b[0][0]),Math.min(e[0][1],b[0][1])],[Math.max(e[1][0],b[1][0]),Math.max(e[1][1],b[1][1])]]:e}c?.(e,{...h})}).on("drag",e=>{const{transform:t,snapGrid:r,snapToGrid:i,nodeOrigin:c}=n(),d=qr(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),_=[];if(!m)return;const{x:E,y:k,width:S,height:O}=h,C={},N=m.origin??c,{width:M,height:P,x:j,y:I}=function(e,t,n,o,r,i,a,s){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:p}=n,{minWidth:g,maxWidth:m,minHeight:y,maxHeight:v}=o,{x:b,y:w,width:x,height:_,aspectRatio:E}=e;let k=Math.floor(u?h-e.pointerX:0),S=Math.floor(d?p-e.pointerY:0);const O=x+(l?-k:k),C=_+(c?-S:S),N=-i[0]*x,M=-i[1]*_;let P=Xi(O,g,m),j=Xi(C,y,v);if(a){let e=0,t=0;l&&k<0?e=Zi(b+k+N,a[0][0]):!l&&k>0&&(e=qi(b+O+N,a[1][0])),c&&S<0?t=Zi(w+S+M,a[0][1]):!c&&S>0&&(t=qi(w+C+M,a[1][1])),P=Math.max(P,e),j=Math.max(j,t)}if(s){let e=0,t=0;l&&k>0?e=qi(b+k,s[0][0]):!l&&k<0&&(e=Zi(b+O,s[1][0])),c&&S>0?t=qi(w+S,s[0][1]):!c&&S<0&&(t=Zi(w+C,s[1][1])),P=Math.max(P,e),j=Math.max(j,t)}if(r){if(u){const e=Xi(O/E,y,v)*E;if(P=Math.max(P,e),a){let e=0;e=!l&&!c||l&&!c&&f?qi(w+M+O/E,a[1][1])*E:Zi(w+M+(l?k:-k)/E,a[0][1])*E,P=Math.max(P,e)}if(s){let e=0;e=!l&&!c||l&&!c&&f?Zi(w+O/E,s[1][1])*E:qi(w+(l?k:-k)/E,s[0][1])*E,P=Math.max(P,e)}}if(d){const e=Xi(C*E,g,m)/E;if(j=Math.max(j,e),a){let e=0;e=!l&&!c||c&&!l&&f?qi(b+C*E+N,a[1][0])/E:Zi(b+(c?S:-S)*E+N,a[0][0])/E,j=Math.max(j,e)}if(s){let e=0;e=!l&&!c||c&&!l&&f?Zi(b+C*E,s[1][0])/E:qi(b+(c?S:-S)*E,s[0][0])/E,j=Math.max(j,e)}}}S+=S<0?j:-j,k+=k<0?P:-P,r&&(f?O>C*E?S=(Wi(l,c)?-k:k)/E:k=(Wi(l,c)?-S:S)*E:u?(S=k/E,c=l):(k=S*E,l=c));const I=l?b+k:b,T=c?w+S:w;return{width:x+(l?-k:k),height:_+(c?-S:S),x:i[0]*k*(l?-1:1)+I,y:i[1]*S*(c?-1:1)+T}}(p,g,d,a,s,N,v,b),T=M!==S,z=P!==O,R=j!==E&&T,D=I!==k&&z;if(!(R||D||T||z))return;if((R||D||1===N[0]||1===N[1])&&(C.x=R?j:h.x,C.y=D?I:h.y,h.x=C.x,h.y=C.y,x.length>0)){const e=j-E,t=I-k;for(const n of x)n.position={x:n.position.x-e+N[0]*(M-S),y:n.position.y-t+N[1]*(P-O)},_.push(n)}if((T||z)&&(C.width=!T||l&&"horizontal"!==l?h.width:M,C.height=!z||l&&"vertical"!==l?h.height:P,h.width=C.width,h.height=C.height),y&&m.expandParent){const e=N[0]*(C.width??0);C.x&&C.x<e&&(h.x=e,p.x=p.x-(C.x-e));const t=N[1]*(C.height??0);C.y&&C.y<t&&(h.y=t,p.y=p.y-(C.y-t))}const A=function({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const a=e-t,s=n-o,l=[a>0?1:a<0?-1:0,s>0?1:s<0?-1:0];return a&&r&&(l[0]=-1*l[0]),s&&i&&(l[1]=-1*l[1]),l}({width:h.width,prevWidth:S,height:h.height,prevHeight:O,affectsX:g.affectsX,affectsY:g.affectsY}),L={...h,direction:A},V=f?.(e,L);!1!==V&&(u?.(e,L),o(C,_))}).on("end",e=>{d?.(e,{...h}),r?.({...h})});i.call(_)},destroy:function(){i.on(".drag",null)}}}var Ji,ea={exports:{}},ta={},na={exports:{}},oa={};var ra,ia,aa,sa={};
|
|
15
15
|
/**
|
|
16
16
|
* @license React
|
|
17
17
|
* use-sync-external-store-shim.development.js
|
|
@@ -38,5 +38,5 @@ object-assign
|
|
|
38
38
|
*
|
|
39
39
|
* This source code is licensed under the MIT license found in the
|
|
40
40
|
* LICENSE file in the root directory of this source tree.
|
|
41
|
-
*/var fa=(ua||(ua=1,"production"===process.env.NODE_ENV?ea.exports=function(){if(aa)return ta;aa=1;var e=t,n=la(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return ta.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},ta}():ea.exports=(ca||(ca=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=t,n=la(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;da.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),da)),ea.exports),ha=i(fa);const pa=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},{useDebugValue:ga}=t,{useSyncExternalStoreWithSelector:ma}=ha,ya=e=>e;function va(e,t=ya,n){const o=ma(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ga(o),o}const ba=(e,t)=>{const n=(e=>e?pa(e):pa)(e),o=(e,o=t)=>va(n,e,o);return Object.assign(o,n),o};function wa(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const xa=t.createContext(null),_a=xa.Provider,Ea=Bo();function ka(e,n){const o=t.useContext(xa);if(null===o)throw new Error(Ea);return va(o,e,n)}function Sa(){const e=t.useContext(xa);if(null===e)throw new Error(Ea);return t.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Oa={display:"none"},Ca={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Na="react-flow__node-desc",Ma="react-flow__edge-desc",Pa=e=>e.ariaLiveMessage,ja=e=>e.ariaLabelConfig;function Ia({rfId:t}){const n=ka(Pa);return e.jsx("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Ca,children:n})}function Ta({rfId:t,disableKeyboardA11y:n}){const o=ka(ja);return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:`${Na}-${t}`,style:Oa,children:n?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),e.jsx("div",{id:`${Ma}-${t}`,style:Oa,children:o["edge.a11yDescription.default"]}),!n&&e.jsx(Ia,{rfId:t})]})}const za=t.forwardRef(({position:t="top-left",children:n,className:o,style:r,...i},a)=>{const s=`${t}`.split("-");return e.jsx("div",{className:W(["react-flow__panel",o,...s]),style:r,ref:a,...i,children:n})});function Ra({proOptions:t,position:n="bottom-right"}){return t?.hideAttribution?null:e.jsx(za,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:e.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}za.displayName="Panel";const Da=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Aa=e=>e.id;function La(e,t){return wa(e.selectedNodes.map(Aa),t.selectedNodes.map(Aa))&&wa(e.selectedEdges.map(Aa),t.selectedEdges.map(Aa))}function Va({onSelectionChange:e}){const n=Sa(),{selectedNodes:o,selectedEdges:r}=ka(Da,La);return t.useEffect(()=>{const t={nodes:o,edges:r};e?.(t),n.getState().onSelectionChangeHandlers.forEach(e=>e(t))},[o,r,e]),null}const Ba=e=>!!e.onSelectionChangeHandlers;function $a({onSelectionChange:t}){const n=ka(Ba);return t||n?e.jsx(Va,{onSelectionChange:t}):null}const Ha=[0,0],Fa={x:0,y:0,zoom:1},Ya=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","ariaLabelConfig","rfId"],Za=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),Xa={translateExtent:Jo,nodeOrigin:Ha,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function qa(e){const{setNodes:n,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=ka(Za,wa),d=Sa();t.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=Xa,l()}),[]);const f=t.useRef(Xa);return t.useEffect(()=>{for(const t of Ya){const l=e[t];l!==f.current[t]&&(void 0!==e[t]&&("nodes"===t?n(l):"edges"===t?o(l):"minZoom"===t?r(l):"maxZoom"===t?i(l):"translateExtent"===t?a(l):"nodeExtent"===t?s(l):"paneClickDistance"===t?u(l):"ariaLabelConfig"===t?d.setState({ariaLabelConfig:Zr(l)}):"fitView"===t?d.setState({fitViewQueued:l}):"fitViewOptions"===t?d.setState({fitViewOptions:l}):d.setState({[t]:l})))}f.current=e},Ya.map(t=>e[t])),null}function Wa(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ga="undefined"!=typeof document?document:null;function Ka(e=null,n={target:Ga,actInsideInputWithModifier:!0}){const[o,r]=t.useState(!1),i=t.useRef(!1),a=t.useRef(new Set([])),[s,l]=t.useMemo(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return t.useEffect(()=>{const t=n?.target??Ga,o=n?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!o)&&Kr(e))return!1;const t=Qa(e.code,l);if(a.current.add(e[t]),Ua(s,a.current,!1)){const t=e.composedPath?.()?.[0]||e.target,o="BUTTON"===t?.nodeName||"A"===t?.nodeName;!1===n.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},c=e=>{const t=Qa(e.code,l);Ua(s,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return t?.addEventListener("keydown",e),t?.addEventListener("keyup",c),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{t?.removeEventListener("keydown",e),t?.removeEventListener("keyup",c),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,r]),o}function Ua(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Qa(e,t){return t.includes(e)?"code":"key"}function Ja(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)es(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function es(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function ts(e,t){return Ja(e,t)}function ns(e,t){return Ja(e,t)}function os(e,t){return{id:e,type:"select",selected:t}}function rs(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(os(i.id,e)))}return o}function is({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function as(e){return{id:e.id,type:"remove"}}const ss=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function ls(e){return t.forwardRef(e)}const cs="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function us(e){const[n,o]=t.useState(BigInt(0)),[r]=t.useState(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>o(e=>e+BigInt(1))));return cs(()=>{const t=r.get();t.length&&(e(t),r.reset())},[n]),r}const ds=t.createContext(null);function fs({children:n}){const o=Sa(),r=us(t.useCallback(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=is({items:l,lookup:a});r&&n(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)})},[])),i=us(t.useCallback(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=o.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?n(s):i&&i(is({items:s,lookup:a}))},[])),a=t.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return e.jsx(ds.Provider,{value:a,children:n})}const hs=e=>!!e.panZoom;function ps(){const e=(()=>{const e=Sa();return t.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:a,panZoom:s}=e.getState(),l=Lr(t,o,r,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:s,y:l}=a.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Rr(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),a=Dr(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),n=Sa(),o=function(){const e=t.useContext(ds);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=ka(hs),i=t.useMemo(()=>{const e=e=>n.getState().nodeLookup.get(e),t=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState(),r=ss(e)?e:t.get(e.id),i=r.parentId?Fr(r.position,r.measured,r.parentId,t,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Cr(a)},a=(e,n,o={replace:!1})=>{t(t=>t.map(t=>{if(t.id===e){const e="function"==typeof n?n(t):n;return o.replace&&ss(e)?e:{...t,...e}}return t}))},s=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&dr(e)?e:{...o,...e}}return o}))};return{getNodes:()=>n.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=n.getState();return e.map(e=>({...e}))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:t=[],transform:o}=n.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:t=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=n.getState(),{nodes:d,edges:f}=await vr({nodesToRemove:e,edgesToRemove:t,nodes:o,edges:r,onBeforeDelete:u}),h=f.length>0,p=d.length>0;if(h){const e=f.map(as);a?.(f),l(e)}if(p){const e=d.map(as);i?.(d),s(e)}return(p||h)&&c?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,t=!0,o)=>{const r=jr(e),a=r?e:i(e),s=void 0!==o;return a?(o||n.getState().nodes).filter(o=>{const i=n.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Cr(s?o:i),c=Pr(l,a);return t&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=jr(e)?e:i(e);if(!o)return!1;const r=Pr(o,t);return n&&r>0||r>=o.width*o.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState();return((e,t={nodeOrigin:[0,0]})=>{if("development"!==process.env.NODE_ENV||t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):fr(n)?n:t.nodeLookup.get(n.id));const i=r?Nr(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return kr(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Or(n)})(e,{nodeLookup:t,nodeOrigin:o})},getHandleConnections:({type:e,id:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}-${e}${t?`-${t}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}${e?t?`-${e}-${t}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const t=n.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:t}),o.nodeQueue.push(e=>[...e]),t.promise}}},[]);return t.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const gs=e=>e.selected,ms="undefined"!=typeof window?window:void 0;const ys={position:"absolute",width:"100%",height:"100%",top:0,left:0},vs=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function bs({onPaneContextMenu:n,zoomOnScroll:o=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=or.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:f,maxZoom:h,zoomActivationKeyCode:p,preventScrolling:g=!0,children:m,noWheelClassName:y,noPanClassName:v,onViewportChange:b,isControlledViewport:w,paneClickDistance:x}){const _=Sa(),E=t.useRef(null),{userSelectionActive:k,lib:S}=ka(vs,wa),O=Ka(p),C=t.useRef();!function(e){const n=Sa();t.useEffect(()=>{const t=()=>{if(!e.current)return!1;const t=qr(e.current);0!==t.height&&0!==t.width||n.getState().onError?.("004",Fo()),n.setState({width:t.width||500,height:t.height||500})};if(e.current){t(),window.addEventListener("resize",t);const n=new ResizeObserver(()=>t());return n.observe(e.current),()=>{window.removeEventListener("resize",t),n&&e.current&&n.unobserve(e.current)}}},[])}(E);const N=t.useCallback(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),w||_.setState({transform:e})},[b,w]);return t.useEffect(()=>{if(E.current){C.current=Fi({domNode:E.current,minZoom:f,maxZoom:h,translateExtent:d,viewport:u,paneClickDistance:x,onDraggingChange:e=>_.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=_.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=_.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=_.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=C.current.getViewport();return _.setState({panZoom:C.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{C.current?.destroy()}}},[]),t.useEffect(()=>{C.current?.update({onPaneContextMenu:n,zoomOnScroll:o,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:g,noPanClassName:v,userSelectionActive:k,noWheelClassName:y,lib:S,onTransformChange:N})},[n,o,r,i,a,s,l,c,O,g,v,k,y,S,N]),e.jsx("div",{className:"react-flow__renderer",ref:E,style:ys,children:m})}const ws=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function xs(){const{userSelectionActive:t,userSelectionRect:n}=ka(ws,wa);return t&&n?e.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const _s=(e,t)=>n=>{n.target===t.current&&e?.(n)},Es=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ks({isSelecting:n,selectionKeyPressed:o,selectionMode:r=rr.Full,panOnDrag:i,selectionOnDrag:a,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:g}){const m=Sa(),{userSelectionActive:y,elementsSelectable:v,dragging:b,connectionInProgress:w}=ka(Es,wa),x=v&&(n||y),_=t.useRef(null),E=t.useRef(),k=t.useRef(new Set),S=t.useRef(new Set),O=t.useRef(!1),C=t.useRef(!1),N=e=>{O.current||w?O.current=!1:(c?.(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1}))},M=d?e=>d(e):void 0,P=!0===i||Array.isArray(i)&&i.includes(0);return e.jsxs("div",{className:W(["react-flow__pane",{draggable:P,dragging:b,selection:n}]),onClick:x?void 0:_s(N,_),onContextMenu:_s(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():u?.(e)},_),onWheel:_s(M,_),onPointerEnter:x?void 0:f,onPointerDown:x?e=>{const{resetSelectedElements:t,domNode:o}=m.getState();if(E.current=o?.getBoundingClientRect(),!v||!n||0!==e.button||e.target!==_.current||!E.current)return;e.target?.setPointerCapture?.(e.pointerId),C.current=!0,O.current=!1;const{x:r,y:i}=Qr(e.nativeEvent,E.current);t(),m.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),s?.(e)}:h,onPointerMove:x?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:i,connectionLookup:a,triggerNodeChanges:s,triggerEdgeChanges:l,defaultEdgeOptions:c}=m.getState();if(!E.current||!t)return;O.current=!0;const{x:u,y:d}=Qr(e.nativeEvent,E.current),{startX:f,startY:h}=t,p={startX:f,startY:h,x:u<f?u:f,y:d<h?d:h,width:Math.abs(u-f),height:Math.abs(d-h)},g=k.current,y=S.current;k.current=new Set(gr(o,p,n,r===rr.Partial,!0).map(e=>e.id)),S.current=new Set;const v=c?.selectable??!0;for(const e of k.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??v)&&S.current.add(e)}}if(!Yr(g,k.current)){s(rs(o,k.current,!0))}if(!Yr(y,S.current)){l(rs(i,S.current))}m.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:h,onPointerUp:x?e=>{if(0!==e.button||!C.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=m.getState();!y&&t&&e.target===_.current&&N?.(e),m.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:k.current.size>0}),l?.(e),(o||a)&&(O.current=!1),C.current=!1}:void 0,onPointerLeave:p,ref:_,style:ys,children:[g,e.jsx(xs,{})]})}function Ss({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&a)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",Ko(e))}function Os({nodeRef:e,disabled:n=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Sa(),[c,u]=t.useState(!1),d=t.useRef();return t.useEffect(()=>{d.current=Mi({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Ss({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),t.useEffect(()=>{if(n)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[o,r,n,a,e,i]),c}function Cs(){const e=Sa();return t.useCallback(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=zr(t,r));const{position:i,positionAbsolute:s}=yr({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:a});e.position=i,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}const Ns=t.createContext(null),Ms=Ns.Provider;Ns.Consumer;const Ps=()=>t.useContext(Ns),js=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Is=t.memo(ls(function({type:t="source",position:n=lr.Top,isValidConnection:o,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:s,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){const g=s||null,m="target"===t,y=Sa(),v=Ps(),{connectOnClick:b,noPanClassName:w,rfId:x}=ka(js,wa),{connectingFrom:_,connectingTo:E,clickConnecting:k,isPossibleEndHandle:S,connectionInProcess:O,clickConnectionInProcess:C,valid:N}=ka(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:a}=o,{fromHandle:s,toHandle:l,isValid:c}=a,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===nr.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(v,g,t),wa);v||y.getState().onError?.("010",Wo());const M=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=y.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=y.getState();t(((e,t)=>{if(!e.source||!e.target)return Tr("006",Zo()),t;let n;return n=dr(e)?{...e}:{...e,id:ai(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))})(r,e))}n?.(r),l?.(r)},P=e=>{if(!v)return;const t=Ur(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=y.getState();Ri.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:m,handleId:g,nodeId:v,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:M,isValidConnection:o||t.isValidConnection,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?d?.(e):f?.(e)};return e.jsx("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":n,"data-id":`${x}-${v}-${g}-${t}`,className:W(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",w,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:a,clickconnecting:k,connectingfrom:_,connectingto:E,valid:N,connectionindicator:r&&(!O||S)&&(O||C?a:i)}]),onMouseDown:P,onTouchStart:P,onClick:b?e=>{const{onClickConnectStart:n,onClickConnectEnd:r,connectionClickStartHandle:a,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:f}=y.getState();if(!v||!a&&!i)return;if(!a)return n?.(e.nativeEvent,{nodeId:v,handleId:g,handleType:t}),void y.setState({connectionClickStartHandle:{nodeId:v,type:t,id:g}});const h=Wr(e.target),p=o||l,{connection:m,isValid:b}=Ri.isValid(e.nativeEvent,{handle:{nodeId:v,id:g,type:t},connectionMode:s,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:p,flowId:u,doc:h,lib:c,nodeLookup:d});b&&m&&M(m);const w=structuredClone(f);delete w.inProgress,w.toPosition=w.toHandle?w.toHandle.position:null,r?.(e,w),y.setState({connectionClickStartHandle:null})}:void 0,ref:p,...h,children:c})}));const Ts={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zs={input:function({data:t,isConnectable:n,sourcePosition:o=lr.Bottom}){return e.jsxs(e.Fragment,{children:[t?.label,e.jsx(Is,{type:"source",position:o,isConnectable:n})]})},default:function({data:t,isConnectable:n,targetPosition:o=lr.Top,sourcePosition:r=lr.Bottom}){return e.jsxs(e.Fragment,{children:[e.jsx(Is,{type:"target",position:o,isConnectable:n}),t?.label,e.jsx(Is,{type:"source",position:r,isConnectable:n})]})},output:function({data:t,isConnectable:n,targetPosition:o=lr.Top}){return e.jsxs(e.Fragment,{children:[e.jsx(Is,{type:"target",position:o,isConnectable:n}),t?.label]})},group:function(){return null}};const Rs=e=>{const{width:t,height:n,x:o,y:r}=pr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Ir(t)?t:null,height:Ir(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Ds({onSelectionContextMenu:n,noPanClassName:o,disableKeyboardA11y:r}){const i=Sa(),{width:a,height:s,transformString:l,userSelectionActive:c}=ka(Rs,wa),u=Cs(),d=t.useRef(null);if(t.useEffect(()=>{r||d.current?.focus({preventScroll:!0})},[r]),Os({nodeRef:d}),c||!a||!s)return null;const f=n?e=>{const t=i.getState().nodes.filter(e=>e.selected);n(e,t)}:void 0;return e.jsx("div",{className:W(["react-flow__nodesselection","react-flow__container",o]),style:{transform:l},children:e.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:r?void 0:-1,onKeyDown:r?void 0:e=>{Object.prototype.hasOwnProperty.call(Ts,e.key)&&(e.preventDefault(),u({direction:Ts[e.key],factor:e.shiftKey?4:1}))},style:{width:a,height:s}})})}const As="undefined"!=typeof window?window:void 0,Ls=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Vs({children:n,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:_,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:O,defaultViewport:C,translateExtent:N,minZoom:M,maxZoom:P,preventScrolling:j,onSelectionContextMenu:I,noWheelClassName:T,noPanClassName:z,disableKeyboardA11y:R,onViewportChange:D,isControlledViewport:A}){const{nodesSelectionActive:L,userSelectionActive:V}=ka(Ls),B=Ka(d,{target:As}),$=Ka(y,{target:As}),H=$||O,F=$||_,Y=f&&!0!==H,Z=B||V||Y;return function({deleteKeyCode:e,multiSelectionKeyCode:n}){const o=Sa(),{deleteElements:r}=ps(),i=Ka(e,{actInsideInputWithModifier:!1}),a=Ka(n,{target:ms});t.useEffect(()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(gs),edges:e.filter(gs)}),o.setState({nodesSelectionActive:!1})}},[i]),t.useEffect(()=>{o.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:m}),e.jsx(bs,{onPaneContextMenu:s,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:F,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!B&&H,defaultViewport:C,translateExtent:N,minZoom:M,maxZoom:P,zoomActivationKeyCode:v,preventScrolling:j,noWheelClassName:T,noPanClassName:z,onViewportChange:D,isControlledViewport:A,paneClickDistance:c,children:e.jsxs(ks,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:H,isSelecting:!!Z,selectionMode:h,selectionKeyPressed:B,selectionOnDrag:Y,children:[n,L&&e.jsx(Ds,{onSelectionContextMenu:I,noPanClassName:z,disableKeyboardA11y:R})]})})}Vs.displayName="FlowRenderer";const Bs=t.memo(Vs);function $s(e){return ka(t.useCallback((e=>t=>e?gr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),wa)}const Hs=e=>e.updateNodeInternals;function Fs({id:n,onClick:o,onMouseEnter:r,onMouseMove:i,onMouseLeave:a,onContextMenu:s,onDoubleClick:l,nodesDraggable:c,elementsSelectable:u,nodesConnectable:d,nodesFocusable:f,resizeObserver:h,noDragClassName:p,noPanClassName:g,disableKeyboardA11y:m,rfId:y,nodeTypes:v,nodeClickDistance:b,onError:w}){const{node:x,internals:_,isParent:E}=ka(e=>{const t=e.nodeLookup.get(n),o=e.parentLookup.has(n);return{node:t,internals:t.internals,isParent:o}},wa);let k=x.type||"default",S=v?.[k]||zs[k];void 0===S&&(w?.("003",Ho(k)),k="default",S=v?.default||zs.default);const O=!!(x.draggable||c&&void 0===x.draggable),C=!!(x.selectable||u&&void 0===x.selectable),N=!!(x.connectable||d&&void 0===x.connectable),M=!!(x.focusable||f&&void 0===x.focusable),P=Sa(),j=Hr(x),I=function({node:e,nodeType:n,hasDimensions:o,resizeObserver:r}){const i=Sa(),a=t.useRef(null),s=t.useRef(null),l=t.useRef(e.sourcePosition),c=t.useRef(e.targetPosition),u=t.useRef(n),d=o&&!!e.internals.handleBounds;return t.useEffect(()=>{!a.current||e.hidden||d&&s.current===a.current||(s.current&&r?.unobserve(s.current),r?.observe(a.current),s.current=a.current)},[d,e.hidden]),t.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),t.useEffect(()=>{if(a.current){const t=u.current!==n,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(t||o||r)&&(u.current=n,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),a}({node:x,nodeType:k,hasDimensions:j,resizeObserver:h}),T=Os({nodeRef:I,disabled:x.hidden||!O,noDragClassName:p,handleSelector:x.dragHandle,nodeId:n,isSelectable:C,nodeClickDistance:b}),z=Cs();if(x.hidden)return null;const R=$r(x),D=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(x),A=C||O||o||r||i||a,L=r?e=>r(e,{..._.userNode}):void 0,V=i?e=>i(e,{..._.userNode}):void 0,B=a?e=>a(e,{..._.userNode}):void 0,$=s?e=>s(e,{..._.userNode}):void 0,H=l?e=>l(e,{..._.userNode}):void 0;return e.jsx("div",{className:W(["react-flow__node",`react-flow__node-${k}`,{[g]:O},x.className,{selected:x.selected,selectable:C,parent:E,draggable:O,dragging:T}]),ref:I,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:A?"all":"none",visibility:j?"visible":"hidden",...x.style,...D},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:L,onMouseMove:V,onMouseLeave:B,onContextMenu:$,onClick:e=>{const{selectNodesOnDrag:t,nodeDragThreshold:r}=P.getState();C&&(!t||!O||r>0)&&Ss({id:n,store:P,nodeRef:I}),o&&o(e,{..._.userNode})},onDoubleClick:H,onKeyDown:M?e=>{if(!Kr(e.nativeEvent)&&!m)if(er.includes(e.key)&&C){const t="Escape"===e.key;Ss({id:n,store:P,unselect:t,nodeRef:I})}else if(O&&x.selected&&Object.prototype.hasOwnProperty.call(Ts,e.key)){e.preventDefault();const{ariaLabelConfig:t}=P.getState();P.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),z({direction:Ts[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:M?0:void 0,onFocus:M?()=>{if(m||!I.current?.matches(":focus-visible"))return;const{transform:e,width:t,height:o,autoPanOnNodeFocus:r,setCenter:i}=P.getState();if(!r)return;gr(new Map([[n,x]]),{x:0,y:0,width:t,height:o},e,!0).length>0||i(x.position.x+R.width/2,x.position.y+R.height/2,{zoom:e[2]})}:void 0,role:x.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${Na}-${y}`,"aria-label":x.ariaLabel,...x.domAttributes,children:e.jsx(Ms,{value:n,children:e.jsx(S,{id:n,data:x.data,type:k,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:x.selected??!1,selectable:C,draggable:O,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:T,dragHandle:x.dragHandle,zIndex:_.z,parentId:x.parentId,...R})})})}const Ys=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Zs(n){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:s}=ka(Ys,wa),l=$s(n.onlyRenderVisibleElements),c=function(){const e=ka(Hs),[n]=t.useState(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return t.useEffect(()=>()=>{n?.disconnect()},[n]),n}();return e.jsx("div",{className:"react-flow__nodes",style:ys,children:l.map(t=>e.jsx(Fs,{id:t,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:c,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:n.nodeClickDistance,onError:s},t))})}Zs.displayName="NodeRenderer";const Xs=t.memo(Zs);const qs={[sr.Arrow]:({color:t="none",strokeWidth:n=1})=>e.jsx("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[sr.ArrowClosed]:({color:t="none",strokeWidth:n=1})=>e.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const Ws=({id:n,type:o,color:r,width:i=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const n=Sa();return t.useMemo(()=>Object.prototype.hasOwnProperty.call(qs,e)?qs[e]:(n.getState().onError?.("009",Xo(e)),null),[e])}(o);return u?e.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:e.jsx(u,{color:r,strokeWidth:l})}):null},Gs=({defaultColor:n,rfId:o})=>{const r=ka(e=>e.edges),i=ka(e=>e.defaultEdgeOptions),a=t.useMemo(()=>{const e=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,a)=>([a.markerStart||o,a.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=mi(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(r,{id:o,defaultColor:n,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return e},[r,i,o,n]);return a.length?e.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:e.jsx("defs",{children:a.map(t=>e.jsx(Ws,{id:t.id,type:t.type,color:t.color,width:t.width,height:t.height,markerUnits:t.markerUnits,strokeWidth:t.strokeWidth,orient:t.orient},t.id))})}):null};Gs.displayName="MarkerDefinitions";var Ks=t.memo(Gs);function Us({x:n,y:o,label:r,labelStyle:i,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:u,className:d,...f}){const[h,p]=t.useState({x:1,y:0,width:0,height:0}),g=W(["react-flow__edge-textwrapper",d]),m=t.useRef(null);return t.useEffect(()=>{if(m.current){const e=m.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[r]),r?e.jsxs("g",{transform:`translate(${n-h.width/2} ${o-h.height/2})`,className:g,visibility:h.width?"visible":"hidden",...f,children:[a&&e.jsx("rect",{width:h.width+2*l[0],x:-l[0],y:-l[1],height:h.height+2*l[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),e.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:m,style:i,children:r}),u]}):null}Us.displayName="EdgeText";const Qs=t.memo(Us);function Js({path:t,labelX:n,labelY:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return e.jsxs(e.Fragment,{children:[e.jsx("path",{...d,d:t,fill:"none",className:W(["react-flow__edge-path",d.className])}),u&&e.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}),r&&Ir(n)&&Ir(o)?e.jsx(Qs,{x:n,y:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===lr.Left||e===lr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top}){const[a,s]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,h]=ei({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${a},${s} ${l},${c} ${o},${r}`,u,d,f,h]}function nl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[b,w,x]=tl({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),_=n.isInternal?void 0:t;return e.jsx(Js,{id:_,path:b,labelX:w,labelY:x,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=lr.Bottom,targetPosition:g=lr.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=di({sourceX:o,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:g,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),E=n.isInternal?void 0:t;return e.jsx(Js,{id:E,path:w,labelX:x,labelY:_,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:b})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const al=il({isInternal:!1}),sl=il({isInternal:!0});function ll(n){return t.memo(({id:o,...r})=>{const i=n.isInternal?void 0:o;return e.jsx(al,{...r,id:i,pathOptions:t.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}al.displayName="SmoothStepEdge",sl.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),ul=ll({isInternal:!0});function dl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,v,b]=si({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=n.isInternal?void 0:t;return e.jsx(Js,{id:w,path:y,labelX:v,labelY:b,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",ul.displayName="StepEdgeInternal";const fl=dl({isInternal:!1}),hl=dl({isInternal:!0});function pl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=lr.Bottom,targetPosition:l=lr.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=oi({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),E=n.isInternal?void 0:t;return e.jsx(Js,{id:E,path:w,labelX:x,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:b})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:ul,smoothstep:sl,simplebezier:rl},vl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},bl=(e,t,n)=>n===lr.Left?e-t:n===lr.Right?e+t:e,wl=(e,t,n)=>n===lr.Top?e-t:n===lr.Bottom?e+t:e,xl="react-flow__edgeupdater";function _l({position:t,centerX:n,centerY:o,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:s,type:l}){return e.jsx("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:s,className:W([xl,`${xl}-${l}`]),cx:bl(n,r,t),cy:wl(o,r,t),r:r,stroke:"transparent",fill:"transparent"})}function El({isReconnectable:t,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:a,targetY:s,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=Sa(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:p,cancelConnection:m,nodeLookup:y,rfId:v,panBy:b,updateConnection:w}=g.getState(),x="target"===t.type;Ri.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:x,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:b,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:(n,r)=>{h(!0),d?.(e,o,t.type),c?.(n,r)},onConnectEnd:p,onReconnectEnd:(e,n)=>{h(!1),f?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold})},y=()=>p(!0),v=()=>p(!1);return e.jsxs(e.Fragment,{children:[(!0===t||"source"===t)&&e.jsx(_l,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===t||"target"===t)&&e.jsx(_l,{position:c,centerX:a,centerY:s,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}function kl({id:n,edgesFocusable:o,edgesReconnectable:r,elementsSelectable:i,onClick:a,onDoubleClick:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,reconnectRadius:f,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,rfId:m,edgeTypes:y,noPanClassName:v,onError:b,disableKeyboardA11y:w}){let x=ka(e=>e.edgeLookup.get(n));const _=ka(e=>e.defaultEdgeOptions);x=_?{..._,...x}:x;let E=x.type||"default",k=y?.[E]||yl[E];void 0===k&&(b?.("011",Go(E)),E="default",k=y?.default||yl.default);const S=!!(x.focusable||o&&void 0===x.focusable),O=void 0!==h&&(x.reconnectable||r&&void 0===x.reconnectable),C=!!(x.selectable||i&&void 0===x.selectable),N=t.useRef(null),[M,P]=t.useState(!1),[j,I]=t.useState(!1),T=Sa(),{zIndex:z,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B}=ka(t.useCallback(e=>{const t=e.nodeLookup.get(x.source),o=e.nodeLookup.get(x.target);if(!t||!o)return{zIndex:x.zIndex,...vl};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!fi(t)||!fi(n))return null;const o=t.internals.handleBounds||hi(t.handles),r=n.internals.handleBounds||hi(n.handles),i=gi(o?.source??[],e.sourceHandle),a=gi(e.connectionMode===nr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",qo(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||lr.Bottom,l=a?.position||lr.Top,c=pi(t,i,s),u=pi(n,a,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:l}}({id:n,sourceNode:t,targetNode:o,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:e.connectionMode,onError:b}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){return void 0!==o?o:(r&&n?1e3:0)+Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0)}({selected:x.selected,zIndex:x.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return{zIndex:i,...r||vl}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),wa),$=t.useMemo(()=>x.markerStart?`url('#${mi(x.markerStart,m)}')`:void 0,[x.markerStart,m]),H=t.useMemo(()=>x.markerEnd?`url('#${mi(x.markerEnd,m)}')`:void 0,[x.markerEnd,m]);if(x.hidden||null===R||null===D||null===A||null===L)return null;const F=s?e=>{s(e,{...x})}:void 0,Y=l?e=>{l(e,{...x})}:void 0,Z=c?e=>{c(e,{...x})}:void 0,X=u?e=>{u(e,{...x})}:void 0,q=d?e=>{d(e,{...x})}:void 0;return e.jsx("svg",{style:{zIndex:z},children:e.jsxs("g",{className:W(["react-flow__edge",`react-flow__edge-${E}`,x.className,v,{selected:x.selected,animated:x.animated,inactive:!C&&!a,updating:M,selectable:C}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=T.getState();C&&(T.setState({nodesSelectionActive:!1}),x.selected&&r?(o({nodes:[],edges:[x]}),N.current?.blur()):t([n])),a&&a(e,x)},onDoubleClick:F,onContextMenu:Y,onMouseEnter:Z,onMouseMove:X,onMouseLeave:q,onKeyDown:S?e=>{if(!w&&er.includes(e.key)&&C){const{unselectNodesAndEdges:t,addSelectedEdges:o}=T.getState();"Escape"===e.key?(N.current?.blur(),t({edges:[x]})):o([n])}}:void 0,tabIndex:S?0:void 0,role:x.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":null===x.ariaLabel?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":S?`${Ma}-${m}`:void 0,ref:N,...x.domAttributes,children:[!j&&e.jsx(k,{id:n,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:C,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:$,markerEnd:H,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),O&&e.jsx(El,{edge:x,isReconnectable:O,reconnectRadius:f,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B,setUpdateHover:P,setReconnecting:I})]})})}const Sl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ol({defaultMarkerColor:n,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,onError:x}=ka(Sl,wa),_=(E=o,ka(t.useCallback(e=>{if(!E)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&ii({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[E]),wa));var E;return e.jsxs("div",{className:"react-flow__edges",children:[e.jsx(Ks,{defaultColor:n,rfId:r}),_.map(t=>e.jsx(kl,{id:t,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:r,onError:x,edgeTypes:i,disableKeyboardA11y:y},t))]})}Ol.displayName="EdgeRenderer";const Cl=t.memo(Ol),Nl=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ml({children:t}){const n=ka(Nl);return e.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}const Pl=e=>e.panZoom?.syncViewport;function jl(e){return e.connection.inProgress?{...e.connection,to:Rr(e.connection.to,e.transform)}:{...e.connection}}function Il(e){return ka(jl,wa)}const Tl=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zl({containerStyle:t,style:n,type:o,component:r}){const{nodesConnectable:i,width:a,height:s,isValid:l,inProgress:c}=ka(Tl,wa);return!!(a&&i&&c)?e.jsx("svg",{style:t,width:a,height:s,className:"react-flow__connectionline react-flow__container",children:e.jsx("g",{className:W(["react-flow__connection",ur(l)]),children:e.jsx(Rl,{style:n,type:o,CustomComponent:r,isValid:l})})}):null}const Rl=({style:t,type:n=ar.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h}=Il();if(!i)return;if(o)return e.jsx(o,{connectionLineType:n,connectionLineStyle:t,fromNode:s,fromHandle:l,fromX:a.x,fromY:a.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:ur(r),toNode:d,toHandle:f});let p="";const g={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(n){case ar.Bezier:[p]=oi(g);break;case ar.SimpleBezier:[p]=tl(g);break;case ar.Step:[p]=di({...g,borderRadius:0});break;case ar.SmoothStep:[p]=di(g);break;default:[p]=si(g)}return e.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:t})};Rl.displayName="ConnectionLine";const Dl={};function Al(e=Dl){const n=t.useRef(e),o=Sa();t.useEffect(()=>{if("development"===process.env.NODE_ENV){const t=new Set([...Object.keys(n.current),...Object.keys(e)]);for(const r of t)if(n.current[r]!==e[r]){o.getState().onError?.("002",$o());break}n.current=e}},[e])}function Ll({nodeTypes:n,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:w,selectionOnDrag:x,selectionMode:_,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:O,onlyRenderVisibleElements:C,elementsSelectable:N,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:I,preventScrolling:T,defaultMarkerColor:z,zoomOnScroll:R,zoomOnPinch:D,panOnScroll:A,panOnScrollSpeed:L,panOnScrollMode:V,zoomOnDoubleClick:B,panOnDrag:$,onPaneClick:H,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneScroll:X,onPaneContextMenu:q,paneClickDistance:W,nodeClickDistance:G,onEdgeContextMenu:K,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return Al(n),Al(o),function(){const e=Sa(),n=t.useRef(!1);t.useEffect(()=>{if("development"===process.env.NODE_ENV&&!n.current){const t=document.querySelector(".react-flow__pane");t&&"1"!==window.getComputedStyle(t).zIndex&&e.getState().onError?.("013",Uo("react")),n.current=!0}},[])}(),function(e){const n=ps(),o=t.useRef(!1);t.useEffect(()=>{!o.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),o.current=!0)},[e,n.viewportInitialized])}(r),function(e){const n=ka(Pl),o=Sa();t.useEffect(()=>{e&&(n?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))},[e,n])}(ue),e.jsx(Bs,{onPaneClick:H,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneContextMenu:q,onPaneScroll:X,paneClickDistance:W,deleteKeyCode:O,selectionKeyCode:w,selectionOnDrag:x,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:N,zoomOnScroll:R,zoomOnPinch:D,zoomOnDoubleClick:B,panOnScroll:A,panOnScrollSpeed:L,panOnScrollMode:V,panOnDrag:$,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:I,onSelectionContextMenu:h,preventScrolling:T,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,onViewportChange:de,isControlledViewport:!!ue,children:e.jsxs(Ml,{children:[e.jsx(Cl,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:C,onEdgeContextMenu:K,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:se,rfId:ce}),e.jsx(zl,{style:y,type:m,component:v,containerStyle:b}),e.jsx("div",{className:"react-flow__edgelabel-renderer"}),e.jsx(Xs,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:C,noPanClassName:ae,noDragClassName:re,disableKeyboardA11y:se,nodeExtent:le,rfId:ce}),e.jsx("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Vl=t.memo(Ll),Bl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d}={})=>{const f=new Map,h=new Map,p=new Map,g=new Map,m=o??t??[],y=n??e??[],v=u??[0,0],b=d??Jo;Si(p,g,m);const w=wi(y,f,h,{nodeOrigin:v,nodeExtent:b,elevateNodesOnSelect:!1});let x=[0,0,1];if(a&&r&&i){const e=pr(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Lr(e,r,i,l,c,s?.padding??.1);x=[t,n,o]}return{rfId:"1",width:0,height:0,transform:x,nodes:y,nodesInitialized:w,nodeLookup:f,parentLookup:h,edges:m,edgeLookup:g,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Jo,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:nr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...ir},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tr,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:tr}},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return f=(f,h)=>{async function p(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:a,maxZoom:s}=h();t&&(await mr({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),f({fitViewResolver:null}))}return{...Bl({nodes:e,edges:t,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=h(),a=wi(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&a?(p(),f({nodes:e,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:e,nodesInitialized:a})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=h();Si(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=h();t(e),f({hasDefaultNodes:!0})}if(t){const{setEdges:e}=h();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l}=h(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const a=o?.querySelector(".xyflow__viewport");let s=!1;if(!a)return{changes:[],updatedInternals:s};const l=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}const a=qr(o.nodeElement),c=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(c||!e.internals.handleBounds||o.force)){const f=o.nodeElement.getBoundingClientRect(),h=Br(e.extent)?e.extent:i;let{positionAbsolute:p}=e.internals;e.parentId&&"parent"===e.extent?p=xr(p,a,t.get(e.parentId)):h&&(p=wr(p,h,a));const g={...e,measured:a,internals:{...e.internals,positionAbsolute:p,handleBounds:{source:Jr("source",o.nodeElement,f,u,e.id),target:Jr("target",o.nodeElement,f,u,e.id)}}};t.set(e.id,g),e.parentId&&xi(g,t,n,{nodeOrigin:r}),s=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Cr(g,r)}))}}if(d.length>0){const e=Ei(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:s}}(e,n,o,r,i,a);u&&(function(e,t,n){const o=bi(yi,n);for(const n of e.values())if(n.parentId)xi(n,e,t,o);else{const e=hr(n,o.nodeOrigin),t=Br(n.extent)?n.extent:o.nodeExtent,r=wr(e,t,$r(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:a}),l?(p(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),c?.length>0&&(s&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=h();for(const[i,a]of e){const e=r.get(i),s=!!(e?.expandParent&&e?.parentId&&a?.position),l={id:i,type:"position",position:s?{x:Math.max(0,a.position.x),y:Math.max(0,a.position.y)}:a.position,dragging:t};s&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...a.internals.positionAbsolute,width:a.measured.width??0,height:a.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=h(),i=Ei(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=h();e?.length&&(r&&n(ts(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=h();e?.length&&(r&&n(ns(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?r(e.map(e=>os(e,!0))):(r(rs(o,new Set([...e]),!0)),i(rs(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?i(e.map(e=>os(e,!0))):(i(rs(n,new Set([...e]))),r(rs(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=h(),s=t||n,l=(e||o).map(e=>{const t=r.get(e.id);return t&&(t.selected=!1),os(e.id,!1)}),c=s.map(e=>os(e.id,!1));i(l),a(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=h();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=h();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{h().panZoom?.setTranslateExtent(e),f({translateExtent:e})},setPaneClickDistance:e=>{h().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=h();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]);n(i),o(a)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:a}=h();e[0][0]===a[0][0]&&e[0][1]===a[0][1]&&e[1][0]===a[1][0]&&e[1][1]===a[1][1]||(wi(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),f({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=h();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:a}=h();if(!a)return Promise.resolve(!1);const s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:o/2-e*s,y:r/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...ir}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...Bl()})}},h=Object.is,f?ba(f,h):ba;var f,h};function Hl({initialNodes:n,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:h,children:p}){const[g]=t.useState(()=>$l({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:f,nodeExtent:h}));return e.jsx(_a,{value:g,children:e.jsx(fs,{children:p})})}function Fl({children:n,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:h,nodeExtent:p}){return t.useContext(xa)?e.jsx(e.Fragment,{children:n}):e.jsx(Hl,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,children:n})}const Yl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Zl,Xl=ls(function({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,className:a,nodeTypes:s,edgeTypes:l,onNodeClick:c,onEdgeClick:u,onInit:d,onMove:f,onMoveStart:h,onMoveEnd:p,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:k,onNodeDragStart:S,onNodeDrag:O,onNodeDragStop:C,onNodesDelete:N,onEdgesDelete:M,onDelete:P,onSelectionChange:j,onSelectionDragStart:I,onSelectionDrag:T,onSelectionDragStop:z,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:A,onBeforeDelete:L,connectionMode:V,connectionLineType:B=ar.Bezier,connectionLineStyle:$,connectionLineComponent:H,connectionLineContainerStyle:F,deleteKeyCode:Y="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:X=!1,selectionMode:q=rr.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:K=(Vr()?"Meta":"Control"),zoomActivationKeyCode:U=(Vr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:ae=Ha,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Fa,minZoom:de=.5,maxZoom:fe=2,translateExtent:he=Jo,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:be=!1,panOnScrollSpeed:we=.5,panOnScrollMode:xe=or.Free,zoomOnDoubleClick:_e=!0,panOnDrag:Ee=!0,onPaneClick:ke,onPaneMouseEnter:Se,onPaneMouseMove:Oe,onPaneMouseLeave:Ce,onPaneScroll:Ne,onPaneContextMenu:Me,paneClickDistance:Pe=0,nodeClickDistance:je=0,children:Ie,onReconnect:Te,onReconnectStart:ze,onReconnectEnd:Re,onEdgeContextMenu:De,onEdgeDoubleClick:Ae,onEdgeMouseEnter:Le,onEdgeMouseMove:Ve,onEdgeMouseLeave:Be,reconnectRadius:$e=10,onNodesChange:He,onEdgesChange:Fe,noDragClassName:Ye="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:Xe="nopan",fitView:qe,fitViewOptions:We,connectOnClick:Ge,attributionPosition:Ke,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:at,onError:st,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ft,onViewportChange:ht,width:pt,height:gt,colorMode:mt="light",debug:yt,onScroll:vt,ariaLabelConfig:bt,...wt},xt){const _t=ct||"1",Et=function(e){const[n,o]=t.useState("system"===e?null:e);return t.useEffect(()=>{if("system"!==e)return void o(e);const t=Wa(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}},[e]),null!==n?n:Wa()?.matches?"dark":"light"}(mt),kt=t.useCallback(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return e.jsx("div",{"data-testid":"rf__wrapper",...wt,onScroll:kt,style:{...lt,...Yl},ref:xt,className:W(["react-flow",a,Et]),id:ct,role:"application",children:e.jsxs(Fl,{nodes:n,edges:o,width:pt,height:gt,fitView:qe,fitViewOptions:We,minZoom:de,maxZoom:fe,nodeOrigin:ae,nodeExtent:ge,children:[e.jsx(Vl,{onInit:d,onNodeClick:c,onEdgeClick:u,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:l,connectionLineType:B,connectionLineStyle:$,connectionLineComponent:H,connectionLineContainerStyle:F,selectionKeyCode:Z,selectionOnDrag:X,selectionMode:q,deleteKeyCode:Y,multiSelectionKeyCode:K,panActivationKeyCode:G,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:he,minZoom:de,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:_e,panOnScroll:be,panOnScrollSpeed:we,panOnScrollMode:xe,panOnDrag:Ee,onPaneClick:ke,onPaneMouseEnter:Se,onPaneMouseMove:Oe,onPaneMouseLeave:Ce,onPaneScroll:Ne,onPaneContextMenu:Me,paneClickDistance:Pe,nodeClickDistance:je,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:A,onReconnect:Te,onReconnectStart:ze,onReconnectEnd:Re,onEdgeContextMenu:De,onEdgeDoubleClick:Ae,onEdgeMouseEnter:Le,onEdgeMouseMove:Ve,onEdgeMouseLeave:Be,reconnectRadius:$e,defaultMarkerColor:me,noDragClassName:Ye,noWheelClassName:Ze,noPanClassName:Xe,rfId:_t,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ft,onViewportChange:ht}),e.jsx(qa,{nodes:n,edges:o,defaultNodes:r,defaultEdges:i,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Fe,snapToGrid:Q,snapGrid:J,connectionMode:V,translateExtent:he,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:qe,fitViewOptions:We,onNodesDelete:N,onEdgesDelete:M,onDelete:P,onNodeDragStart:S,onNodeDrag:O,onNodeDragStop:C,onSelectionDrag:T,onSelectionDragStart:I,onSelectionDragStop:z,onMove:f,onMoveStart:h,onMoveEnd:p,noPanClassName:Xe,nodeOrigin:ae,rfId:_t,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:st,connectionRadius:it,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:L,paneClickDistance:Pe,debug:yt,ariaLabelConfig:bt}),e.jsx($a,{onSelectionChange:j}),Ie,e.jsx(Ra,{proOptions:Ue,position:Ke}),e.jsx(Ta,{rfId:_t,disableKeyboardA11y:tt})]})})});function ql({dimensions:t,lineWidth:n,variant:o,className:r}){return e.jsx("path",{strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:W(["react-flow__background-pattern",o,r])})}function Wl({radius:t,className:n}){return e.jsx("circle",{cx:t,cy:t,r:t,className:W(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Zl||(Zl={}));const Gl={[Zl.Dots]:1,[Zl.Lines]:1,[Zl.Cross]:6},Kl=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ul({id:n,variant:o=Zl.Dots,gap:r=20,size:i,lineWidth:a=1,offset:s=0,color:l,bgColor:c,style:u,className:d,patternClassName:f}){const h=t.useRef(null),{transform:p,patternId:g}=ka(Kl,wa),m=i||Gl[o],y=o===Zl.Dots,v=o===Zl.Cross,b=Array.isArray(r)?r:[r,r],w=[b[0]*p[2]||1,b[1]*p[2]||1],x=m*p[2],_=Array.isArray(s)?s:[s,s],E=v?[x,x]:w,k=[_[0]*p[2]||1+E[0]/2,_[1]*p[2]||1+E[1]/2],S=`${g}${n||""}`;return e.jsxs("svg",{className:W(["react-flow__background",d]),style:{...u,...ys,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:h,"data-testid":"rf__background",children:[e.jsx("pattern",{id:S,x:p[0]%w[0],y:p[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:y?e.jsx(Wl,{radius:x/2,className:f}):e.jsx(ql,{dimensions:E,lineWidth:a,variant:o,className:f})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}function Ql(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:e.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Jl(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:e.jsx("path",{d:"M0 0h32v4.2H0z"})})}function ec(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:e.jsx("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 tc(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e.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 nc(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e.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 oc({children:t,className:n,...o}){return e.jsx("button",{type:"button",className:W(["react-flow__controls-button",n]),...o,children:t})}Ul.displayName="Background",t.memo(Ul);const rc=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ic({style:t,showZoom:n=!0,showFitView:o=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:s,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=Sa(),{isInteractive:m,minZoomReached:y,maxZoomReached:v,ariaLabelConfig:b}=ka(rc,wa),{zoomIn:w,zoomOut:x,fitView:_}=ps(),E="horizontal"===h?"horizontal":"vertical";return e.jsxs(za,{className:W(["react-flow__controls",E,u]),position:f,style:t,"data-testid":"rf__controls","aria-label":p??b["controls.ariaLabel"],children:[n&&e.jsxs(e.Fragment,{children:[e.jsx(oc,{onClick:()=>{w(),a?.()},className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:v,children:e.jsx(Ql,{})}),e.jsx(oc,{onClick:()=>{x(),s?.()},className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:y,children:e.jsx(Jl,{})})]}),o&&e.jsx(oc,{className:"react-flow__controls-fitview",onClick:()=>{_(i),l?.()},title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:e.jsx(ec,{})}),r&&e.jsx(oc,{className:"react-flow__controls-interactive",onClick:()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c?.(!m)},title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:m?e.jsx(nc,{}):e.jsx(tc,{})}),d]})}ic.displayName="Controls";const ac=t.memo(ic);const sc=t.memo(function({id:t,x:n,y:o,width:r,height:i,style:a,color:s,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:m}=a||{},y=s||g||m;return e.jsx("rect",{className:W(["react-flow__minimap-node",{selected:h},u]),x:n,y:o,rx:d,ry:d,width:r,height:i,style:{fill:y,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?e=>p(e,t):void 0})}),lc=e=>e.nodes.map(e=>e.id),cc=e=>e instanceof Function?e:()=>e;const uc=t.memo(function({id:t,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:s,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=ka(e=>{const{internals:n}=e.nodeLookup.get(t),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=$r(o);return{node:o,x:r,y:i,width:a,height:s}},wa);return u&&!u.hidden&&Hr(u)?e.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:a,shapeRendering:s,onClick:c,id:u.id}):null});var dc=t.memo(function({nodeStrokeColor:t,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=sc,onClick:s}){const l=ka(lc,wa),c=cc(n),u=cc(t),d=cc(o),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return e.jsx(e.Fragment,{children:l.map(t=>e.jsx(uc,{id:t,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:s,shapeRendering:f},t))})});const fc=e=>!e.hidden,hc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Mr(pr(e.nodeLookup,{filter:fc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function pc({style:n,className:o,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:u,maskColor:d,maskStrokeColor:f,maskStrokeWidth:h,position:p="bottom-right",onClick:g,onNodeClick:m,pannable:y=!1,zoomable:v=!1,ariaLabel:b,inversePan:w,zoomStep:x=10,offsetScale:_=5}){const E=Sa(),k=t.useRef(null),{boundingRect:S,viewBB:O,rfId:C,panZoom:N,translateExtent:M,flowWidth:P,flowHeight:j,ariaLabelConfig:I}=ka(hc,wa),T=n?.width??200,z=n?.height??150,R=S.width/T,D=S.height/z,A=Math.max(R,D),L=A*T,V=A*z,B=_*A,$=S.x-(L-S.width)/2-B,H=S.y-(V-S.height)/2-B,F=L+2*B,Y=V+2*B,Z=`react-flow__minimap-desc-${C}`,X=t.useRef(0),q=t.useRef();X.current=A,t.useEffect(()=>{if(k.current&&N)return q.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ft(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=10,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const f=Vo().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const f=o()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),h={x:s[0]-c[0]*f,y:s[1]-c[1]*f},p=[[0,0],[i,a]];t.setViewportConstrained({x:h.x,y:h.y,zoom:s[2]},p,e)}:null).on("zoom.wheel",c?e=>{const o=n();if("wheel"!==e.sourceEvent.type||!t)return;const r=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,i=o[2]*Math.pow(2,r);t.scaleTo(i)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ht}}({domNode:k.current,panZoom:N,getTransform:()=>E.getState().transform,getViewScale:()=>X.current}),()=>{q.current?.destroy()}},[N]),t.useEffect(()=>{q.current?.update({translateExtent:M,width:P,height:j,inversePan:w,pannable:y,zoomStep:x,zoomable:v})},[y,v,w,x,M,P,j]);const G=g?e=>{const[t,n]=q.current?.pointer(e)||[0,0];g(e,{x:t,y:n})}:void 0,K=m?t.useCallback((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,U=b??I["minimap.ariaLabel"];return e.jsx(za,{position:p,style:{...n,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof h?h*A:void 0,"--xy-minimap-node-background-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof l?l:void 0},className:W(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:e.jsxs("svg",{width:T,height:z,viewBox:`${$} ${H} ${F} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:k,onClick:G,children:[U&&e.jsx("title",{id:Z,children:U}),e.jsx(dc,{onClick:K,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:c}),e.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-B},${H-B}h${F+2*B}v${Y+2*B}h${-F-2*B}z\n M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}pc.displayName="MiniMap",t.memo(pc);const gc={[Yi.Line]:"right",[Yi.Handle]:"bottom-right"};t.memo(function({nodeId:n,position:o,variant:r=Yi.Handle,className:i,style:a,children:s,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:p,autoScale:g=!0,shouldResize:m,onResizeStart:y,onResize:v,onResizeEnd:b}){const w=Ps(),x="string"==typeof n?n:w,_=Sa(),E=t.useRef(null),k=r===Yi.Handle,S=ka(t.useCallback((O=k&&g,e=>O?`${Math.max(1/e.transform[2],1)}`:void 0),[k,g]),wa);var O;const C=t.useRef(null),N=o??gc[r];t.useEffect(()=>{if(E.current&&x)return C.current||(C.current=Qi({domNode:E.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=_.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=_.getState(),a=[],s={x:e.x,y:e.y},l=o.get(x);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Ei([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Fr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);a.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:x,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:x,type:"dimensions",resizing:!0,setAttributes:!p||("horizontal"===p?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(const e of t){const t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{const n={id:x,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};_.getState().triggerNodeChanges([n])}})),C.current.update({controlPosition:N,boundaries:{minWidth:c,minHeight:u,maxWidth:d,maxHeight:f},keepAspectRatio:h,resizeDirection:p,onResizeStart:y,onResize:v,onResizeEnd:b,shouldResize:m}),()=>{C.current?.destroy()}},[N,c,u,d,f,h,y,v,b,m]);const M=N.split("-");return e.jsx("div",{className:W(["react-flow__resize-control","nodrag",...M,r,i]),ref:E,style:{...a,scale:S,...l&&{[k?"backgroundColor":"borderColor"]:l}},children:s})});var mc,yc,vc,bc,wc,xc,_c,Ec,kc,Sc,Oc,Cc,Nc,Mc,Pc,jc,Ic,Tc,zc,Rc,Dc,Ac,Lc,Vc,Bc,$c,Hc,Fc,Yc,Zc,Xc,qc,Wc,Gc,Kc,Uc,Qc,Jc,eu,tu,nu,ou,ru,iu,au,su,lu,cu,uu,du,fu,hu,pu,gu,mu,yu,vu,bu,wu,xu,_u,Eu,ku,Su,Ou,Cu,Nu,Mu,Pu,ju,Iu,Tu,zu,Ru,Du,Au,Lu,Vu,Bu,$u,Hu,Fu,Yu,Zu,Xu,qu,Wu,Gu,Ku,Uu,Qu,Ju,ed,td;function nd(){if(yc)return mc;yc=1;var e="\0";function t(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function o(e,t,n,o){var r=""+t,i=""+n;if(!e&&r>i){var a=r;r=i,i=a}return r+""+i+""+(void 0===o?"\0":o)}function r(e,t){return o(e,t.v,t.w,t.name)}return mc=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[e]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var n=arguments,o=this;return e.forEach(function(e){n.length>1?o.setNode(e,t):o.setNode(e)}),this}setNode(t,n){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=e,this._children[t]={},this._children[e][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===n)n=e;else{for(var o=n+="";void 0!==o;o=this.parent(o))if(o===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(t){if(this._isCompound){var n=this._parent[t];if(n!==e)return n}}children(t=e){if(this._isCompound){var n=this._children[t];if(n)return Object.keys(n)}else{if(t===e)return this.nodes();if(this.hasNode(t))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){const o=new Set(t);for(var n of this.successors(e))o.add(n);return Array.from(o.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,o]){e(n)&&t.setNode(n,o)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var o={};function r(e){var i=n.parent(e);return void 0===i||t.hasNode(i)?(o[e]=i,i):i in o?o[i]:r(i)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,o=arguments;return e.reduce(function(e,r){return o.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r}),this}setEdge(){var e,n,r,i,a=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,n=s.w,r=s.name,2===arguments.length&&(i=arguments[1],a=!0)):(e=s,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,n=""+n,void 0!==r&&(r=""+r);var l=o(this._isDirected,e,n,r);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(void 0!==r&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,n,r);var c=function(e,t,n,o){var r=""+t,i=""+n;if(!e&&r>i){var a=r;r=i,i=a}var s={v:r,w:i};o&&(s.name=o);return s}(this._isDirected,e,n,r);return e=c.v,n=c.w,Object.freeze(c),this._edgeObjs[l]=c,t(this._preds[n],e),t(this._sucs[e],n),this._in[n][l]=c,this._out[e][l]=c,this._edgeCount++,this}edge(e,t,n){var i=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[i]}edgeAsObj(){const e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,n){var i=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,i)}removeEdge(e,t,i){var a=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,i),s=this._edgeObjs[a];return s&&(e=s.v,t=s.w,delete this._edgeLabels[a],delete this._edgeObjs[a],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][a],delete this._out[e][a],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var o=Object.values(n);return t?o.filter(e=>e.v===t):o}}outEdges(e,t){var n=this._out[e];if(n){var o=Object.values(n);return t?o.filter(e=>e.w===t):o}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},mc}function od(){return xc?wc:(xc=1,wc={Graph:nd(),version:bc?vc:(bc=1,vc="2.2.4")})}function rd(){if(Ec)return _c;Ec=1;var e=nd();function t(e){return e.nodes().map(function(t){var n=e.node(t),o=e.parent(t),r={v:t};return void 0!==n&&(r.value=n),void 0!==o&&(r.parent=o),r})}function n(e){return e.edges().map(function(t){var n=e.edge(t),o={v:t.v,w:t.w};return void 0!==t.name&&(o.name=t.name),void 0!==n&&(o.value=n),o})}return _c={write:function(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:t(e),edges:n(e)};void 0!==e.graph()&&(o.value=structuredClone(e.graph()));return o},read:function(t){var n=new e(t.options).setGraph(t.value);return t.nodes.forEach(function(e){n.setNode(e.v,e.value),e.parent&&n.setParent(e.v,e.parent)}),t.edges.forEach(function(e){n.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),n}}}function id(){if(Sc)return kc;return Sc=1,kc=function(e){var t,n={},o=[];function r(o){Object.hasOwn(n,o)||(n[o]=!0,t.push(o),e.successors(o).forEach(r),e.predecessors(o).forEach(r))}return e.nodes().forEach(function(e){t=[],r(e),t.length&&o.push(t)}),o},kc}function ad(){if(Cc)return Oc;Cc=1;return Oc=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var o=this._arr,r=o.length;return n[e]=r,o.push({key:e,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){for(var t,n=this._arr,o=n[e].priority;0!==e&&!(n[t=e>>1].priority<o);)this._swap(e,t),e=t}_swap(e,t){var n=this._arr,o=this._keyIndices,r=n[e],i=n[t];n[e]=i,n[t]=r,o[i.key]=e,o[r.key]=t}},Oc}function sd(){if(Mc)return Nc;Mc=1;var e=ad();Nc=function(n,o,r,i){return function(t,n,o,r){var i,a,s={},l=new e,c=function(e){var t=e.v!==i?e.v:e.w,n=s[t],r=o(e),c=a.distance+r;if(r<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+r);c<n.distance&&(n.distance=c,n.predecessor=i,l.decrease(t,c))};t.nodes().forEach(function(e){var t=e===n?0:Number.POSITIVE_INFINITY;s[e]={distance:t},l.add(e,t)});for(;l.size()>0&&(i=l.removeMin(),(a=s[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(c);return s}(n,String(o),r||t,i||function(e){return n.outEdges(e)})};var t=()=>1;return Nc}function ld(){if(jc)return Pc;jc=1;var e=sd();return Pc=function(t,n,o){return t.nodes().reduce(function(r,i){return r[i]=e(t,i,n,o),r},{})},Pc}function cd(){if(Tc)return Ic;return Tc=1,Ic=function(e){var t=0,n=[],o={},r=[];function i(a){var s=o[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(e){Object.hasOwn(o,e)?o[e].onStack&&(s.lowlink=Math.min(s.lowlink,o[e].index)):(i(e),s.lowlink=Math.min(s.lowlink,o[e].lowlink))}),s.lowlink===s.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(a!==l);r.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(o,e)||i(e)}),r},Ic}function ud(){if(Rc)return zc;Rc=1;var e=cd();return zc=function(t){return e(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}}function dd(){if(Ac)return Dc;Ac=1,Dc=function(t,n,o){return function(e,t,n){var o={},r=e.nodes();return r.forEach(function(e){o[e]={},o[e][e]={distance:0},r.forEach(function(t){e!==t&&(o[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var r=n.v===e?n.w:n.v,i=t(n);o[e][r]={distance:i,predecessor:e}})}),r.forEach(function(e){var t=o[e];r.forEach(function(n){var i=o[n];r.forEach(function(n){var o=i[e],r=t[n],a=i[n],s=o.distance+r.distance;s<a.distance&&(a.distance=s,a.predecessor=r.predecessor)})})}),o}(t,n||e,o||function(e){return t.outEdges(e)})};var e=()=>1;return Dc}function fd(){if(Vc)return Lc;function e(e){var n={},o={},r=[];if(e.sinks().forEach(function i(a){if(Object.hasOwn(o,a))throw new t;Object.hasOwn(n,a)||(o[a]=!0,n[a]=!0,e.predecessors(a).forEach(i),delete o[a],r.push(a))}),Object.keys(n).length!==e.nodeCount())throw new t;return r}Vc=1;class t extends Error{constructor(){super(...arguments)}}return Lc=e,e.CycleException=t,Lc}function hd(){if($c)return Bc;$c=1;var e=fd();return Bc=function(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}}function pd(){if(Fc)return Hc;function e(e,t,o,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(o,a[0])||(o[a[0]]=!0,i.push([a[0],!0]),n(t(a[0]),e=>i.push([e,!1])))}}function t(e,t,o,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(o,a)||(o[a]=!0,r.push(a),n(t(a),e=>i.push(e)))}}function n(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}return Fc=1,Hc=function(n,o,r){Array.isArray(o)||(o=[o]);var i=n.isDirected()?e=>n.successors(e):e=>n.neighbors(e),a="post"===r?e:t,s=[],l={};return o.forEach(e=>{if(!n.hasNode(e))throw new Error("Graph does not have node: "+e);a(e,i,l,s)}),s},Hc}function gd(){if(Zc)return Yc;Zc=1;var e=pd();return Yc=function(t,n){return e(t,n,"post")}}function md(){if(qc)return Xc;qc=1;var e=pd();return Xc=function(t,n){return e(t,n,"pre")}}function yd(){if(Gc)return Wc;Gc=1;var e=nd(),t=ad();return Wc=function(n,o){var r,i=new e,a={},s=new t;function l(e){var t=e.v===r?e.w:e.v,n=s.priority(t);if(void 0!==n){var i=o(e);i<n&&(a[t]=r,s.decrease(t,i))}}if(0===n.nodeCount())return i;n.nodes().forEach(function(e){s.add(e,Number.POSITIVE_INFINITY),i.setNode(e)}),s.decrease(n.nodes()[0],0);var c=!1;for(;s.size()>0;){if(r=s.removeMin(),Object.hasOwn(a,r))i.setEdge(r,a[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return i},Wc}function vd(){if(Jc)return Qc;Jc=1;var e=od();return Qc={Graph:e.Graph,json:rd(),alg:Uc?Kc:(Uc=1,Kc={components:id(),dijkstra:sd(),dijkstraAll:ld(),findCycles:ud(),floydWarshall:dd(),isAcyclic:hd(),postorder:gd(),preorder:md(),prim:yd(),tarjan:cd(),topsort:fd()}),version:e.version}}function bd(){if(ou)return nu;ou=1;let e=vd().Graph,t=function(){if(tu)return eu;function e(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function t(e,t){if("_next"!==e&&"_prev"!==e)return t}return tu=1,eu=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let t=this._sentinel,n=t._prev;if(n!==t)return e(n),n}enqueue(t){let n=this._sentinel;t._prev&&t._next&&e(t),t._next=n._next,n._next._prev=t,n._next=t,t._prev=n}toString(){let e=[],n=this._sentinel,o=n._prev;for(;o!==n;)e.push(JSON.stringify(o,t)),o=o._prev;return"["+e.join(", ")+"]"}}}();nu=function(i,a){if(i.nodeCount()<=1)return[];let s=function(n,o){let i=new e,a=0,s=0;n.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),n.edges().forEach(e=>{let t=i.edge(e.v,e.w)||0,n=o(e),r=t+n;i.setEdge(e.v,e.w,r),s=Math.max(s,i.node(e.v).out+=n),a=Math.max(a,i.node(e.w).in+=n)});let l=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(s+a+3).map(()=>new t),c=a+1;return i.nodes().forEach(e=>{r(l,c,i.node(e))}),{graph:i,buckets:l,zeroIdx:c}}(i,a||n);return function(e,t,n){let r,i=[],a=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;r=s.dequeue();)o(e,t,n,r);for(;r=a.dequeue();)o(e,t,n,r);if(e.nodeCount())for(let a=t.length-2;a>0;--a)if(r=t[a].dequeue(),r){i=i.concat(o(e,t,n,r,!0));break}}return i}(s.graph,s.buckets,s.zeroIdx).flatMap(e=>i.outEdges(e.v,e.w))};let n=()=>1;function o(e,t,n,o,i){let a=i?[]:void 0;return e.inEdges(o.v).forEach(o=>{let s=e.edge(o),l=e.node(o.v);i&&a.push({v:o.v,w:o.w}),l.out-=s,r(t,n,l)}),e.outEdges(o.v).forEach(o=>{let i=e.edge(o),a=o.w,s=e.node(a);s.in-=i,r(t,n,s)}),e.removeNode(o.v),a}function r(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}return nu}function wd(){if(iu)return ru;iu=1;let e=vd().Graph;function t(e,t,n,o){for(var r=o;e.hasNode(r);)r=a(o);return n.dummy=t,e.setNode(r,n),r}ru={addBorderNode:function(e,n,o,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=o,i.order=r);return t(e,"border",i,n)},addDummyNode:t,applyWithChunking:o,asNonCompoundGraph:function(t){let n=new e({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(e=>{t.children(e).length||n.setNode(e,t.node(e))}),t.edges().forEach(e=>{n.setEdge(e,t.edge(e))}),n},buildLayerMatrix:function(e){let t=s(r(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let o=e.node(n),r=o.rank;void 0!==r&&(t[r][o.order]=n)}),t},intersectRect:function(e,t){let n,o,r=e.x,i=e.y,a=t.x-r,s=t.y-i,l=e.width/2,c=e.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,o=c):(a<0&&(l=-l),n=l,o=l*s/a);return{x:r+n,y:i+o}},mapValues:function(e,t){let n=t;"string"==typeof t&&(n=e=>e[t]);return Object.entries(e).reduce((e,[t,o])=>(e[t]=n(o,t),e),{})},maxRank:r,normalizeRanks:function(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n}),n=o(Math.min,t);e.nodes().forEach(t=>{let o=e.node(t);Object.hasOwn(o,"rank")&&(o.rank-=n)})},notime:function(e,t){return t()},partition:function(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n},pick:function(e,t){const n={};for(const o of t)void 0!==e[o]&&(n[o]=e[o]);return n},predecessorWeights:function(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return l(e.nodes(),t)},range:s,removeEmptyRanks:function(e){let t=e.nodes().map(t=>e.node(t).rank),n=o(Math.min,t),r=[];e.nodes().forEach(t=>{let o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{void 0===t&&n%a!==0?--i:void 0!==t&&i&&t.forEach(t=>e.node(t).rank+=i)})},simplify:function(t){let n=(new e).setGraph(t.graph());return t.nodes().forEach(e=>n.setNode(e,t.node(e))),t.edges().forEach(e=>{let o=n.edge(e.v,e.w)||{weight:0,minlen:1},r=t.edge(e);n.setEdge(e.v,e.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})}),n},successorWeights:function(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return l(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(e,t){if(t.length>n){const o=function(e,t=n){const o=[];for(let n=0;n<e.length;n+=t){const r=e.slice(n,n+t);o.push(r)}return o}(t);return e.apply(null,o.map(t=>e.apply(null,t)))}return e.apply(null,t)}function r(e){const t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n});return o(Math.max,t)}let i=0;function a(e){return e+""+ ++i}function s(e,t,n=1){null==t&&(t=e,e=0);let o=e=>e<t;n<0&&(o=e=>t<e);const r=[];for(let t=e;o(t);t+=n)r.push(t);return r}function l(e,t){return e.reduce((e,n,o)=>(e[n]=t[o],e),{})}return ru}function xd(){if(su)return au;su=1;let e=bd(),t=wd().uniqueId;return au={run:function(n){("greedy"===n.graph().acyclicer?e(n,function(e){return t=>e.edge(t).weight}(n)):function(e){let t=[],n={},o={};function r(i){Object.hasOwn(o,i)||(o[i]=!0,n[i]=!0,e.outEdges(i).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):r(e.w)}),delete n[i])}return e.nodes().forEach(r),t}(n)).forEach(e=>{let o=n.edge(e);n.removeEdge(e),o.forwardName=e.name,o.reversed=!0,n.setEdge(e.w,e.v,o,t("rev"))})},undo:function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}})}},au}function _d(){if(cu)return lu;cu=1;let e=wd();return lu={run:function(t){t.graph().dummyChains=[],t.edges().forEach(n=>function(t,n){let o,r,i,a=n.v,s=t.node(a).rank,l=n.w,c=t.node(l).rank,u=n.name,d=t.edge(n),f=d.labelRank;if(c===s+1)return;for(t.removeEdge(n),i=0,++s;s<c;++i,++s)d.points=[],r={width:0,height:0,edgeLabel:d,edgeObj:n,rank:s},o=e.addDummyNode(t,"edge",r,"_d"),s===f&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),t.setEdge(a,o,{weight:d.weight},u),0===i&&t.graph().dummyChains.push(o),a=o;t.setEdge(a,l,{weight:d.weight},u)}(t,n))},undo:function(e){e.graph().dummyChains.forEach(t=>{let n,o=e.node(t),r=o.edgeLabel;for(e.setEdge(o.edgeObj,r);o.dummy;)n=e.successors(t)[0],e.removeNode(t),r.points.push({x:o.x,y:o.y}),"edge-label"===o.dummy&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),t=n,o=e.node(t)})}},lu}function Ed(){if(du)return uu;du=1;const{applyWithChunking:e}=wd();return uu={longestPath:function(t){var n={};t.sources().forEach(function o(r){var i=t.node(r);if(Object.hasOwn(n,r))return i.rank;n[r]=!0;let a=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:o(e.w)-t.edge(e).minlen);var s=e(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),i.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}},uu}function kd(){if(hu)return fu;hu=1;var e=vd().Graph,t=Ed().slack;function n(e,n){return e.nodes().forEach(function o(r){n.nodeEdges(r).forEach(i=>{var a=i.v,s=r===a?i.w:a;e.hasNode(s)||t(n,i)||(e.setNode(s,{}),e.setEdge(r,s,{}),o(s))})}),e.nodeCount()}function o(e,n){return n.edges().reduce((o,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=t(n,r)),i<o[0]?[i,r]:o},[Number.POSITIVE_INFINITY,null])[1]}function r(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}return fu=function(i){var a,s,l=new e({directed:!1}),c=i.nodes()[0],u=i.nodeCount();l.setNode(c,{});for(;n(l,i)<u;)a=o(l,i),s=l.hasNode(a.v)?t(i,a):-t(i,a),r(l,i,s);return l},fu}function Sd(){if(gu)return pu;gu=1;var e=kd(),t=Ed().slack,n=Ed().longestPath,o=vd().alg.preorder,r=vd().alg.postorder,i=wd().simplify;function a(t){t=i(t),n(t);var o,r=e(t);for(c(r),s(r,t);o=d(r);)h(r,t,o,f(r,t,o))}function s(e,t){var n=r(e,e.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(e,t,n){var o=e.node(n),r=o.parent;e.edge(n,r).cutvalue=l(e,t,n)}(e,t,n))}function l(e,t,n){var o=e.node(n).parent,r=!0,i=t.edge(n,o),a=0;return i||(r=!1,i=t.edge(o,n)),a=i.weight,t.nodeEdges(n).forEach(i=>{var s=i.v===n,l=s?i.w:i.v;if(l!==o){var c=s===r,u=t.edge(i).weight;if(a+=c?u:-u,function(e,t,n){return e.hasEdge(t,n)}(e,n,l)){var d=e.edge(n,l).cutvalue;a+=c?-d:d}}}),a}function c(e,t){arguments.length<2&&(t=e.nodes()[0]),u(e,{},1,t)}function u(e,t,n,o,r){var i=n,a=e.node(o);return t[o]=!0,e.neighbors(o).forEach(r=>{Object.hasOwn(t,r)||(n=u(e,t,n,r,o))}),a.low=i,a.lim=n++,r?a.parent=r:delete a.parent,n}function d(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function f(e,n,o){var r=o.v,i=o.w;n.hasEdge(r,i)||(r=o.w,i=o.v);var a=e.node(r),s=e.node(i),l=a,c=!1;a.lim>s.lim&&(l=s,c=!0);var u=n.edges().filter(t=>c===p(e,e.node(t.v),l)&&c!==p(e,e.node(t.w),l));return u.reduce((e,o)=>t(n,o)<t(n,e)?o:e)}function h(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),c(e),s(e,t),function(e,t){var n=e.nodes().find(e=>!t.node(e).parent),r=o(e,n);(r=r.slice(1)).forEach(n=>{var o=e.node(n).parent,r=t.edge(n,o),i=!1;r||(r=t.edge(o,n),i=!0),t.node(n).rank=t.node(o).rank+(i?r.minlen:-r.minlen)})}(e,t)}function p(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}return pu=a,a.initLowLimValues=c,a.initCutValues=s,a.calcCutValue=l,a.leaveEdge=d,a.enterEdge=f,a.exchangeEdges=h,pu}function Od(){if(yu)return mu;yu=1;var e=Ed().longestPath,t=kd(),n=Sd();mu=function(n){var i=n.graph().ranker;if(i instanceof Function)return i(n);switch(n.graph().ranker){case"network-simplex":default:r(n);break;case"tight-tree":!function(n){e(n),t(n)}(n);break;case"longest-path":o(n);case"none":}};var o=e;function r(e){n(e)}return mu}function Cd(){if(bu)return vu;return bu=1,vu=function(e){let t=function(e){let t={},n=0;function o(r){let i=n;e.children(r).forEach(o),t[r]={low:i,lim:n++}}return e.children().forEach(o),t}(e);e.graph().dummyChains.forEach(n=>{let o=e.node(n),r=o.edgeObj,i=function(e,t,n,o){let r,i,a=[],s=[],l=Math.min(t[n].low,t[o].low),c=Math.max(t[n].lim,t[o].lim);r=n;do{r=e.parent(r),a.push(r)}while(r&&(t[r].low>l||c>t[r].lim));i=r,r=o;for(;(r=e.parent(r))!==i;)s.push(r);return{path:a.concat(s.reverse()),lca:i}}(e,t,r.v,r.w),a=i.path,s=i.lca,l=0,c=a[l],u=!0;for(;n!==r.w;){if(o=e.node(n),u){for(;(c=a[l])!==s&&e.node(c).maxRank<o.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&e.node(c=a[l+1]).minRank<=o.rank;)l++;c=a[l]}e.setParent(n,c),n=e.successors(n)[0]}})},vu}function Nd(){if(xu)return wu;xu=1;let e=wd();function t(n,o,r,i,a,s,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=e.addBorderNode(n,"_bt"),d=e.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(d,l),f.borderBottom=d,c.forEach(e=>{t(n,o,r,i,a,s,e);let c=n.node(e),f=c.borderTop?c.borderTop:e,h=c.borderBottom?c.borderBottom:e,p=c.borderTop?i:2*i,g=f!==h?1:a-s[l]+1;n.setEdge(u,f,{weight:p,minlen:g,nestingEdge:!0}),n.setEdge(h,d,{weight:p,minlen:g,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+s[l]})}return wu={run:function(n){let o=e.addDummyNode(n,"root",{},"_root"),r=function(e){var t={};function n(o,r){var i=e.children(o);i&&i.length&&i.forEach(e=>n(e,r+1)),t[o]=r}return e.children().forEach(e=>n(e,1)),t}(n),i=Object.values(r),a=e.applyWithChunking(Math.max,i)-1,s=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(e=>n.edge(e).minlen*=s);let l=function(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}(n)+1;n.children().forEach(e=>t(n,o,s,l,a,r,e)),n.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}},wu}function Md(){if(Su)return ku;function e(e){e.nodes().forEach(n=>t(e.node(n))),e.edges().forEach(n=>t(e.edge(n)))}function t(e){let t=e.width;e.width=e.height,e.height=t}function n(e){e.y=-e.y}function o(e){let t=e.x;e.x=e.y,e.y=t}return Su=1,ku={adjust:function(t){let n=t.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||e(t)},undo:function(t){let r=t.graph().rankdir.toLowerCase();"bt"!==r&&"rl"!==r||function(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>{let o=e.edge(t);o.points.forEach(n),Object.hasOwn(o,"y")&&n(o)})}(t);"lr"!==r&&"rl"!==r||(!function(e){e.nodes().forEach(t=>o(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(o),Object.hasOwn(n,"x")&&o(n)})}(t),e(t))}},ku}function Pd(){if(Tu)return Iu;Tu=1;let e=wd();return Iu=function(t,n){let o={};return t.forEach((e,t)=>{let n=o[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(n.barycenter=e.barycenter,n.weight=e.weight)}),n.edges().forEach(e=>{let t=o[e.v],n=o[e.w];void 0!==t&&void 0!==n&&(n.indegree++,t.out.push(o[e.w]))}),function(t){let n=[];function o(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight);t.weight&&(n+=t.barycenter*t.weight,o+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let e=t.pop();n.push(e),e.in.reverse().forEach(o(e)),e.out.forEach(r(e))}return n.filter(e=>!e.merged).map(t=>e.pick(t,["vs","i","barycenter","weight"]))}(Object.values(o).filter(e=>!e.indegree))}}function jd(){if(Au)return Du;Au=1;let e=(ju||(ju=1,Pu=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let o=n.reduce((t,n)=>{let o=e.edge(n),r=e.node(n.v);return{sum:t.sum+o.weight*r.order,weight:t.weight+o.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}return{v:t}})}),Pu),t=Pd(),n=function(){if(Ru)return zu;Ru=1;let e=wd();function t(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}return zu=function(n,o){let r=e.partition(n,e=>Object.hasOwn(e,"barycenter")),i=r.lhs,a=r.rhs.sort((e,t)=>t.i-e.i),s=[],l=0,c=0,u=0;var d;i.sort((d=!!o,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:d?t.i-e.i:e.i-t.i)),u=t(s,a,u),i.forEach(e=>{u+=e.vs.length,s.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=t(s,a,u)});let f={vs:s.flat(!0)};return c&&(f.barycenter=l/c,f.weight=c),f}}();return Du=function o(r,i,a,s){let l=r.children(i),c=r.node(i),u=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,f={};u&&(l=l.filter(e=>e!==u&&e!==d));let h=e(r,l);h.forEach(e=>{if(r.children(e.v).length){let i=o(r,e.v,a,s);f[e.v]=i,Object.hasOwn(i,"barycenter")&&(n=i,void 0!==(t=e).barycenter?(t.barycenter=(t.barycenter*t.weight+n.barycenter*n.weight)/(t.weight+n.weight),t.weight+=n.weight):(t.barycenter=n.barycenter,t.weight=n.weight))}var t,n});let p=t(h,a);!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(p,f);let g=n(p,s);if(u&&(g.vs=[u,g.vs,d].flat(!0),r.predecessors(u).length)){let e=r.node(r.predecessors(u)[0]),t=r.node(r.predecessors(d)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+e.order+t.order)/(g.weight+2),g.weight+=2}return g},Du}function Id(){if(Vu)return Lu;Vu=1;let e=vd().Graph,t=wd();return Lu=function(n,o,r){let i=function(e){var n;for(;e.hasNode(n=t.uniqueId("_root")););return n}(n),a=new e({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>n.node(e));return n.nodes().forEach(e=>{let t=n.node(e),s=n.parent(e);(t.rank===o||t.minRank<=o&&o<=t.maxRank)&&(a.setNode(e),a.setParent(e,s||i),n[r](e).forEach(t=>{let o=t.v===e?t.w:t.v,r=a.edge(o,e),i=void 0!==r?r.weight:0;a.setEdge(o,e,{weight:n.edge(t).weight+i})}),Object.hasOwn(t,"minRank")&&a.setNode(e,{borderLeft:t.borderLeft[o],borderRight:t.borderRight[o]}))}),a},Lu}function Td(){if(Fu)return Hu;Fu=1;let e=function(){if(Cu)return Ou;Cu=1;let e=wd();return Ou=function(t){let n={},o=t.nodes().filter(e=>!t.children(e).length),r=o.map(e=>t.node(e).rank),i=e.applyWithChunking(Math.max,r),a=e.range(i+1).map(()=>[]);return o.sort((e,n)=>t.node(e).rank-t.node(n).rank).forEach(function e(o){if(n[o])return;n[o]=!0;let r=t.node(o);a[r.rank].push(o),t.successors(o).forEach(e)}),a},Ou}(),t=function(){if(Mu)return Nu;Mu=1;let e=wd().zipObject;function t(t,n,o){let r=e(o,o.map((e,t)=>t)),i=n.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((e,t)=>e.pos-t.pos)),a=1;for(;a<o.length;)a<<=1;let s=2*a-1;a-=1;let l=new Array(s).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;l[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=l[t+1]),t=t-1>>1,l[t]+=e.weight;c+=e.weight*n}),c}return Nu=function(e,n){let o=0;for(let r=1;r<n.length;++r)o+=t(e,n[r-1],n[r]);return o},Nu}(),n=jd(),o=Id(),r=($u||($u=1,Bu=function(e,t,n){let o,r={};n.forEach(n=>{let i,a,s=e.parent(n);for(;s;){if(i=e.parent(s),i?(a=r[i],r[i]=s):(a=o,o=s),a&&a!==s)return void t.setEdge(a,s);s=i}})}),Bu),i=vd().Graph,a=wd();function s(e,t,n){return t.map(function(t){return o(e,t,n)})}function l(e,t){let o=new i;e.forEach(function(e){let i=e.graph().root,a=n(e,i,o,t);a.vs.forEach((t,n)=>e.node(t).order=n),r(e,o,a.vs)})}function c(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}return Hu=function n(o,r){if(r&&"function"==typeof r.customOrder)return void r.customOrder(o,n);let i=a.maxRank(o),u=s(o,a.range(1,i+1),"inEdges"),d=s(o,a.range(i-1,-1,-1),"outEdges"),f=e(o);if(c(o,f),r&&r.disableOptimalOrderHeuristic)return;let h,p=Number.POSITIVE_INFINITY;for(let e=0,n=0;n<4;++e,++n){l(e%2?u:d,e%4>=2),f=a.buildLayerMatrix(o);let r=t(o,f);r<p&&(n=0,h=Object.assign({},f),p=r)}c(o,h)},Hu}function zd(){if(Zu)return Yu;Zu=1;let e=vd().Graph,t=wd();function n(e,t){let n={};return t.length&&t.reduce(function(t,o){let i=0,a=0,s=t.length,l=o[o.length-1];return o.forEach((t,c)=>{let u=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),d=u?e.node(u).order:s;(u||t===l)&&(o.slice(a,c+1).forEach(t=>{e.predecessors(t).forEach(o=>{let a=e.node(o),s=a.order;!(s<i||d<s)||a.dummy&&e.node(t).dummy||r(n,o,t)})}),a=c+1,i=d)}),o}),n}function o(e,n){let o={};function i(n,i,a,s,l){let c;t.range(i,a).forEach(t=>{c=n[t],e.node(c).dummy&&e.predecessors(c).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>l)&&r(o,t,c)})})}return n.length&&n.reduce(function(t,n){let o,r=-1,a=0;return n.forEach((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(o=e.node(t[0]).order,i(n,a,l,r,o),a=l,r=o)}i(n,a,n.length,o,t.length)}),n}),o}function r(e,t,n){if(t>n){let e=t;t=n,n=e}let o=e[t];o||(e[t]=o={}),o[n]=!0}function i(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function a(e,t,n,o){let r={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{r[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let l=o(e);if(l.length){l=l.sort((e,t)=>s[e]-s[t]);let o=(l.length-1)/2;for(let c=Math.floor(o),u=Math.ceil(o);c<=u;++c){let o=l[c];a[e]===e&&t<s[o]&&!i(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=s[o])}}})}),{root:r,align:a}}function s(t,n,o,r,i){let a={},s=function(t,n,o,r){let i=new e,a=t.graph(),s=function(e,t,n){return(o,r,i)=>{let a,s=o.node(r),l=o.node(i),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(a.nodesep,a.edgesep,r);return n.forEach(e=>{let n;e.forEach(e=>{let r=o[e];if(i.setNode(r),n){var a=o[n],l=i.edge(a,r);i.setEdge(a,r,Math.max(s(t,e,n),l||0))}n=e})}),i}(t,n,o,i),l=i?"borderLeft":"borderRight";function c(e,t){let n=s.nodes(),o=n.pop(),r={};for(;o;)r[o]?e(o):(r[o]=!0,n.push(o),n=n.concat(t(o))),o=n.pop()}return c(function(e){a[e]=s.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+s.edge(t)),0)},s.predecessors.bind(s)),c(function(e){let n=s.outEdges(e).reduce((e,t)=>Math.min(e,a[t.w]-s.edge(t)),Number.POSITIVE_INFINITY),o=t.node(e);n!==Number.POSITIVE_INFINITY&&o.borderType!==l&&(a[e]=Math.max(a[e],n))},s.successors.bind(s)),Object.keys(r).forEach(e=>a[e]=a[o[e]]),a}function l(e,t){return Object.values(t).reduce((t,n)=>{let o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([t,n])=>{let i=function(e,t){return e.node(t).width}(e,t)/2;o=Math.max(n+i,o),r=Math.min(n-i,r)});const i=o-r;return i<t[0]&&(t=[i,n]),t},[Number.POSITIVE_INFINITY,null])[1]}function c(e,n){let o=Object.values(n),r=t.applyWithChunking(Math.min,o),i=t.applyWithChunking(Math.max,o);["u","d"].forEach(o=>{["l","r"].forEach(a=>{let s=o+a,l=e[s];if(l===n)return;let c=Object.values(l),u=r-t.applyWithChunking(Math.min,c);"l"!==a&&(u=i-t.applyWithChunking(Math.max,c)),u&&(e[s]=t.mapValues(l,e=>e+u))})})}function u(e,n){return t.mapValues(e.ul,(t,o)=>{if(n)return e[n.toLowerCase()][o];{let t=Object.values(e).map(e=>e[o]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}return Yu={positionX:function(e){let r,i=t.buildLayerMatrix(e),d=Object.assign(n(e,i),o(e,i)),f={};["u","d"].forEach(n=>{r="u"===n?i:Object.values(i).reverse(),["l","r"].forEach(o=>{"r"===o&&(r=r.map(e=>Object.values(e).reverse()));let i=("u"===n?e.predecessors:e.successors).bind(e),l=a(e,r,d,i),c=s(e,r,l.root,l.align,"r"===o);"r"===o&&(c=t.mapValues(c,e=>-e)),f[n+o]=c})});let h=l(e,f);return c(f,h),u(f,e.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:i,verticalAlignment:a,horizontalCompaction:s,alignCoordinates:c,findSmallestWidthAlignment:l,balance:u}}function Rd(){if(qu)return Xu;qu=1;let e=wd(),t=zd().positionX;return Xu=function(n){(function(t){let n=e.buildLayerMatrix(t),o=t.graph().ranksep,r=0;n.forEach(e=>{const n=e.reduce((e,n)=>{const o=t.node(n).height;return e>o?e:o},0);e.forEach(e=>t.node(e).y=r+n/2),r+=n+o})})(n=e.asNonCompoundGraph(n)),Object.entries(t(n)).forEach(([e,t])=>n.node(e).x=t)},Xu}function Dd(){if(Gu)return Wu;Gu=1;let e=xd(),t=_d(),n=Od(),o=wd().normalizeRanks,r=Cd(),i=wd().removeEmptyRanks,a=Nd(),s=function(){if(Eu)return _u;Eu=1;let e=wd();function t(t,n,o,r,i,a){let s={width:0,height:0,rank:a,borderType:n},l=i[n][a-1],c=e.addDummyNode(t,"border",s,o);i[n][a]=c,t.setParent(c,r),l&&t.setEdge(l,c,{weight:1})}return _u=function(e){e.children().forEach(function n(o){let r=e.children(o),i=e.node(o);if(r.length&&r.forEach(n),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let n=i.minRank,r=i.maxRank+1;n<r;++n)t(e,"borderLeft","_bl",o,i,n),t(e,"borderRight","_br",o,i,n)}})},_u}(),l=Md(),c=Td(),u=Rd(),d=wd(),f=vd().Graph;Wu=function(E,k){let S=k&&k.debugTiming?d.time:d.notime;S("layout",()=>{let O=S(" buildLayoutGraph",()=>function(e){let t=new f({multigraph:!0,compound:!0}),n=_(e.graph());return t.setGraph(Object.assign({},p,x(n,h),d.pick(n,g))),e.nodes().forEach(n=>{const o=x(_(e.node(n)),m);Object.keys(y).forEach(e=>{void 0===o[e]&&(o[e]=y[e])}),t.setNode(n,o),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let o=_(e.edge(n));t.setEdge(n,Object.assign({},b,x(o,v),d.pick(o,w)))}),t}(E));S(" runLayout",()=>function(f,h,p){h(" makeSpaceForEdgeLabels",()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let o=e.edge(n);o.minlen*=2,"c"!==o.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)})}(f)),h(" removeSelfEdges",()=>function(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(f)),h(" acyclic",()=>e.run(f)),h(" nestingGraph.run",()=>a.run(f)),h(" rank",()=>n(d.asNonCompoundGraph(f))),h(" injectEdgeLabelProxies",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};d.addDummyNode(e,"edge-proxy",o,"_ep")}})}(f)),h(" removeEmptyRanks",()=>i(f)),h(" nestingGraph.cleanup",()=>a.cleanup(f)),h(" normalizeRanks",()=>o(f)),h(" assignRankMinMax",()=>function(e){let t=0;e.nodes().forEach(n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))}),e.graph().maxRank=t}(f)),h(" removeEdgeLabelProxies",()=>function(e){e.nodes().forEach(t=>{let n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}(f)),h(" normalize.run",()=>t.run(f)),h(" parentDummyChains",()=>r(f)),h(" addBorderSegments",()=>s(f)),h(" order",()=>c(f,p)),h(" insertSelfEdges",()=>function(e){var t=d.buildLayerMatrix(e);t.forEach(t=>{var n=0;t.forEach((t,o)=>{var r=e.node(t);r.order=o+n,(r.selfEdges||[]).forEach(t=>{d.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:r.rank,order:o+ ++n,e:t.e,label:t.label},"_se")}),delete r.selfEdges})})}(f)),h(" adjustCoordinateSystem",()=>l.adjust(f)),h(" position",()=>u(f)),h(" positionSelfEdges",()=>function(e){e.nodes().forEach(t=>{var n=e.node(t);if("selfedge"===n.dummy){var o=e.node(n.e.v),r=o.x+o.width/2,i=o.y,a=n.x-r,s=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*a/3,y:i-s},{x:r+5*a/6,y:i-s},{x:r+a,y:i},{x:r+5*a/6,y:i+s},{x:r+2*a/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}(f)),h(" removeBorderNodes",()=>function(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(r.y-o.y),n.x=i.x+n.width/2,n.y=o.y+n.height/2}}),e.nodes().forEach(t=>{"border"===e.node(t).dummy&&e.removeNode(t)})}(f)),h(" normalize.undo",()=>t.undo(f)),h(" fixupEdgeLabelCoords",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(f)),h(" undoCoordinateSystem",()=>l.undo(f)),h(" translateGraph",()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,i=e.graph(),a=i.marginx||0,s=i.marginy||0;function l(e){let i=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,i-s/2),n=Math.max(n,i+s/2),o=Math.min(o,a-l/2),r=Math.max(r,a+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)}),t-=a,o-=s,e.nodes().forEach(n=>{let r=e.node(n);r.x-=t,r.y-=o}),e.edges().forEach(n=>{let r=e.edge(n);r.points.forEach(e=>{e.x-=t,e.y-=o}),Object.hasOwn(r,"x")&&(r.x-=t),Object.hasOwn(r,"y")&&(r.y-=o)}),i.width=n-t+a,i.height=r-o+s}(f)),h(" assignNodeIntersects",()=>function(e){e.edges().forEach(t=>{let n,o,r=e.edge(t),i=e.node(t.v),a=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=a,o=i),r.points.unshift(d.intersectRect(i,n)),r.points.push(d.intersectRect(a,o))})}(f)),h(" reversePoints",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}(f)),h(" acyclic.undo",()=>e.undo(f))}(O,S,k)),S(" updateInputGraph",()=>function(e,t){e.nodes().forEach(n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))}),e.edges().forEach(n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(E,O))})};let h=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height","rank"],y={width:0,height:0},v=["minlen","weight","width","height","labeloffset"],b={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function x(e,t){return d.mapValues(d.pick(e,t),Number)}function _(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}return Wu}function Ad(){if(Uu)return Ku;Uu=1;let e=wd(),t=vd().Graph;return Ku={debugOrdering:function(n){let o=e.buildLayerMatrix(n),r=new t({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(e=>{r.setNode(e,{label:e}),r.setParent(e,"layer"+n.node(e).rank)}),n.edges().forEach(e=>r.setEdge(e.v,e.w,{},e.name)),o.forEach((e,t)=>{let n="layer"+t;r.setNode(n,{rank:"same"}),e.reduce((e,t)=>(r.setEdge(e,t,{style:"invis"}),t))}),r}},Ku}r("/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #777;\n --xy-background-pattern-lines-color-default: #777;\n --xy-background-pattern-cross-color-default: #777;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n");var Ld=i(td?ed:(td=1,ed={graphlib:vd(),layout:Dd(),debug:Ad(),util:{time:wd().time,notime:wd().notime},version:Ju?Qu:(Ju=1,Qu="1.1.5")})),Vd={type:sr.ArrowClosed,width:20,height:20,color:"#FF0072"},Bd={strokeWidth:2,stroke:"#FF0072"},$d=function(n){var o=n.tree,r=ps().fitView,i=function(e){const[n,o]=t.useState(e),r=t.useCallback(e=>o(t=>ts(e,t)),[]);return[n,o,r]}([]),a=Z(i,3),s=a[0],l=a[1],c=a[2],u=function(e){const[n,o]=t.useState(e),r=t.useCallback(e=>o(t=>ns(e,t)),[]);return[n,o,r]}([]),d=Z(u,3),f=d[0],h=d[1],p=d[2];return t.useEffect(function(){if(o){var e,t=function(e,t){var n=[],o=[];return Object.keys(e).forEach(function(r,i){e[r].forEach(function(e,i){var a={id:e,flowId:e,position:{x:250,y:200*i},data:{label:String(e)}};if(0==i&&(a.type="input"),i>0){var s=o[o.length-1],l={id:s.flowId+"-"+r+"-"+i+"-"+a.flowId,source:s.flowId,target:a.flowId,animated:t,markerEnd:Vd,style:Bd};n.push(l)}o.push(a)})}),{nodes:o,edges:n}}(o.data,null!==(e=o.animated)&&void 0!==e&&e),n=function(e,t,n){var o=(new Ld.graphlib.Graph).setDefaultEdgeLabel(function(){return{}});return o.setGraph({rankdir:n.direction,ranksep:100,nodesep:170}),t.forEach(function(e){return o.setEdge(e.source,e.target)}),e.forEach(function(e){var t,n,r,i;return o.setNode(e.id,Y(Y({},e),{},{width:null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:0,height:null!==(r=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==r?r:0}))}),Ld.layout(o),{nodes:e.map(function(e){var t,n,r,i,a=o.node(e.id),s=a.x-(null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:0)/2,l=a.y-(null!==(r=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==r?r:0)/2;return Y(Y({},e),{},{position:{x:s,y:l}})}),edges:t}}(t.nodes,t.edges,{direction:o.orientation});l(X(n.nodes)),h(X(n.edges)),r()}},[o]),e.jsx(Xl,{nodes:s,edges:f,onNodesChange:c,onEdgesChange:p,colorMode:"dark",fitView:!0,children:e.jsx(ac,{})})};r(".file-browser {\n width: 100%;\n height: 100%;\n color: white;\n overflow-y: auto;\n scrollbar-gutter: stable;\n scrollbar-color: rgba(71, 71, 71, 0.4) #252526;\n scrollbar-width: thin;\n background-color: #1e1e1e;\n}");var Hd=["color","size","title","className"];function Fd(){return Fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Fd.apply(null,arguments)}var Yd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Hd);return t.createElement("svg",Fd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-braces",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M2.114 8.063V7.9c1.005-.102 1.497-.615 1.497-1.6V4.503c0-1.094.39-1.538 1.354-1.538h.273V2h-.376C3.25 2 2.49 2.759 2.49 4.352v1.524c0 1.094-.376 1.456-1.49 1.456v1.299c1.114 0 1.49.362 1.49 1.456v1.524c0 1.593.759 2.352 2.372 2.352h.376v-.964h-.273c-.964 0-1.354-.444-1.354-1.538V9.663c0-.984-.492-1.497-1.497-1.6M13.886 7.9v.163c-1.005.103-1.497.616-1.497 1.6v1.798c0 1.094-.39 1.538-1.354 1.538h-.273v.964h.376c1.613 0 2.372-.759 2.372-2.352v-1.524c0-1.094.376-1.456 1.49-1.456V7.332c-1.114 0-1.49-.362-1.49-1.456V4.352C13.51 2.759 12.75 2 11.138 2h-.376v.964h.273c.964 0 1.354.444 1.354 1.538V6.3c0 .984.492 1.497 1.497 1.6"}))});Yd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Zd=["color","size","title","className"];function Xd(){return Xd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Xd.apply(null,arguments)}var qd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Zd);return t.createElement("svg",Xd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-chevron-down",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"}))});qd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Wd=["color","size","title","className"];function Gd(){return Gd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Gd.apply(null,arguments)}var Kd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Wd);return t.createElement("svg",Gd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-chevron-right",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"}))});Kd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Ud=["color","size","title","className"];function Qd(){return Qd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Qd.apply(null,arguments)}var Jd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Ud);return t.createElement("svg",Qd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-file-code",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M6.646 5.646a.5.5 0 1 1 .708.708L5.707 8l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708zm2.708 0a.5.5 0 1 0-.708.708L10.293 8 8.646 9.646a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708z"}),t.createElement("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1"}))});Jd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var ef=["color","size","title","className"];function tf(){return tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},tf.apply(null,arguments)}var nf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,ef);return t.createElement("svg",tf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-file-earmark",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z"}))});nf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var of=["color","size","title","className"];function rf(){return rf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},rf.apply(null,arguments)}var af=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,of);return t.createElement("svg",rf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-js",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2H8v-1h4a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.186 15.29a1.2 1.2 0 0 1-.111-.449h.765a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.153-.326q-.151-.12-.462-.193l-.619-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.457 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.513.152a.47.47 0 0 0-.184.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.327.075.566.211.24.136.375.358t.135.56q0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m-3.104-.033A1.3 1.3 0 0 1 0 14.791h.765a.6.6 0 0 0 .073.27.5.5 0 0 0 .454.246q.285 0 .422-.164.138-.165.138-.466v-2.745h.79v2.725q0 .66-.357 1.005-.354.345-.984.345a1.6 1.6 0 0 1-.569-.094 1.15 1.15 0 0 1-.407-.266 1.1 1.1 0 0 1-.243-.39"}))});af.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var sf=["color","size","title","className"];function lf(){return lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},lf.apply(null,arguments)}var cf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,sf);return t.createElement("svg",lf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-py",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2H7v-1h5a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM0 11.85h1.6q.434 0 .732.179.302.175.46.477t.158.677-.16.677q-.158.299-.464.474a1.45 1.45 0 0 1-.732.173H.79v1.342H0zm2.06 1.714a.8.8 0 0 0 .085-.381q0-.34-.185-.521-.185-.182-.513-.182H.788v1.406h.66a.8.8 0 0 0 .374-.082.57.57 0 0 0 .238-.24m2.963.75v1.535H4.23v-1.52L2.89 11.85h.876l.853 1.696h.032l.856-1.696h.855z"}))});cf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var uf=["color","size","title","className"];function df(){return df=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},df.apply(null,arguments)}var ff=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,uf);return t.createElement("svg",df({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-scss",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.356 15.29a1.2 1.2 0 0 1-.111-.449h.765a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.153-.326q-.151-.12-.462-.193l-.619-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.457 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.513.152a.47.47 0 0 0-.184.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.326.075.566.211t.375.358.135.56q0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m4.274-2.23a1.7 1.7 0 0 0-.103.633v.495q0 .369.103.627a.83.83 0 0 0 .298.392.85.85 0 0 0 .478.132.9.9 0 0 0 .401-.088.7.7 0 0 0 .273-.249.8.8 0 0 0 .117-.363h.765v.076a1.27 1.27 0 0 1-.226.674 1.4 1.4 0 0 1-.55.454 1.8 1.8 0 0 1-.786.164q-.54 0-.914-.217a1.4 1.4 0 0 1-.571-.626q-.195-.408-.194-.976v-.498q0-.569.197-.979a1.44 1.44 0 0 1 .57-.633q.38-.222.912-.222.328 0 .607.097.28.093.489.272a1.32 1.32 0 0 1 .466.964v.073h-.765a.85.85 0 0 0-.12-.38.7.7 0 0 0-.273-.261.8.8 0 0 0-.398-.097.8.8 0 0 0-.475.138.87.87 0 0 0-.301.398m2.609 1.781a1.13 1.13 0 0 0 .401.823q.193.162.478.252.284.091.665.091.507 0 .858-.158.354-.158.54-.44a1.17 1.17 0 0 0 .187-.656q0-.336-.135-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.566-.21l-.62-.144a1 1 0 0 1-.405-.176.37.37 0 0 1-.143-.299q0-.234.184-.384.188-.152.513-.152.213 0 .369.068a.6.6 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.438 0-.776.15-.336.149-.527.421-.19.273-.19.639 0 .302.123.524t.351.367q.228.143.54.213l.617.144q.311.073.463.193a.39.39 0 0 1 .153.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193 1.1 1.1 0 0 1-.413.07q-.177 0-.32-.04a.8.8 0 0 1-.249-.115.58.58 0 0 1-.255-.384zm3.502.449a1.2 1.2 0 0 1-.11-.449h.764a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.152-.326q-.153-.12-.463-.193l-.618-.143a1.7 1.7 0 0 1-.54-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.458 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.512.152a.47.47 0 0 0-.185.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.326.075.566.211t.375.358.135.56q0 .37-.187.656a1.2 1.2 0 0 1-.54.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375"}))});ff.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var hf=["color","size","title","className"];function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},pf.apply(null,arguments)}var gf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,hf);return t.createElement("svg",pf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-x-lg",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"}))});gf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};r('.file-node-row {\n width: 100%;\n min-width: 200px;\n display: flex;\n font-size: 13px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n cursor: pointer;\n height: 28px;\n}\n\n.indent {\n height: 100%;\n margin-left: 10px;\n}\n\n.folder-icon {\n display: flex;\n margin-right: 5px;\n align-items: center;\n}\n\n.file-icon {\n display: flex;\n margin-right: 5px;\n align-items: center;\n}\n\n.file-name {\n color: #DDD;\n display: flex;\n align-items: center;\n}');var mf=function(o){var r=o.id,i=o.parentId,a=o.node,s=n.useDraggable({id:r,data:{type:"FileTreeNode",parentId:i,node:a,preview:e.jsx(yf,{node:a})}}),l=s.attributes,c=s.listeners,u=s.setNodeRef;s.transform;var d=Sf().selectNode,f=t.useCallback(function(){d(a)},[d]);return e.jsxs("div",Y(Y(Y({className:"file-node-row",ref:u},c),l),{},{style:function(){var e={};return a.selected&&(e.backgroundColor="#00426b"),e}(),onClick:f,children:[e.jsx("div",{className:"indent",style:{width:20*a.level+"px"}}),"folder"===a.type?e.jsx("span",{className:"folder-icon",children:a.collapsed?e.jsx(Kd,{}):e.jsx(qd,{})}):e.jsx("span",{className:"file-icon",children:function(){switch(a.name.split(".").pop()){case"js":return e.jsx(af,{color:"#f1e05a"});case"json":return e.jsx(Yd,{color:"#fffb00"});case"scss":return e.jsx(ff,{color:"#f12727"});case"py":return e.jsx(cf,{color:"#686affbd"});default:return e.jsx(Jd,{color:"#ffffff"})}}()}),e.jsx("span",{className:"file-name",children:a.name})]}))},yf=function(t){var n=t.node;return e.jsx("div",{className:"file-node-row",children:e.jsx("span",{className:"file-name",children:n.name})})};r("");var vf=function(n){H(n);var o=Z(t.useState([]),2),r=o[0],i=o[1],a=Sf().state;t.useEffect(function(){var e;s(null!==(e=a.collapsedTree)&&void 0!==e?e:[])},[a.collapsedTree]);var s=function(t,n){var o=[];t.forEach(function(t){o.push(e.jsx(mf,{parentId:n,node:t,id:"tree-node-"+t.uid},n+"-"+t.uid))}),i(o)};return e.jsx(e.Fragment,{children:r})},bf=t.createContext(),wf=function(e,t){t||(t=0);for(var n=[],o=0;o<e.length;o++){var r=e[o];r.level=t,n.push(r),null!=r&&r.children&&(n=n.concat(wf(r.children,t+1)))}return n},xf=function(e){for(var t,n,o=[],r=0;r<e.length;r++){if(t){if(!(e[r].level<=n))continue;t=!1}e[r].collapsed&&(t=!0,n=e[r].level),o.push(e[r])}return o},_f={uid:crypto.randomUUID(),tree:{},flattenedTree:[],selectedNode:null,collapsedTree:[]},Ef=function(e,t){switch(t.type){case"ADD_FILE_TREE":var n=function(e){return e.forEach(function(e){e.collapsed=!1}),e}(wf(X(t.payload))),o=xf(n);return Y(Y({},e),{},{tree:t.payload,flattenedTree:n,collapsedTree:o});case"SELECT_NODE":var r=e.flattenedTree.map(function(e){return e.uid===t.payload.uid?Y(Y({},e),{},{selected:!0,collapsed:!e.collapsed}):Y(Y({},e),{},{selected:!1})});return Y(Y({},e),{},{flattenedTree:r,collapsedTree:xf(r),selectedNode:t.payload});case"RESET_STATE":return _f;default:return e}},kf=t.forwardRef(function(n,o){var r=n.onSelectFile,i=Z(t.useReducer(Ef,_f),2),a=i[0],s=i[1],l=t.useCallback(function(e){s({type:"RESET_STATE"}),s({type:"ADD_FILE_TREE",payload:e})},[]);t.useEffect(function(){a.selectedNode&&"file"===a.selectedNode.type&&r(a.selectedNode)},[a.selectedNode]);var c=t.useCallback(function(e){s({type:"SELECT_NODE",payload:e})},[]),u=t.useMemo(function(){return{state:a,addFileTree:l,selectNode:c}},[a,l,c]);return t.useImperativeHandle(o,function(){return u},[u]),e.jsx(bf.Provider,{value:u,children:e.jsx("div",{className:"file-browser",children:e.jsx(vf,{})})})});function Sf(){var e=t.useContext(bf);if(!e)throw new Error("useFileBrowser must be used inside <FileBrowser>");return e}kf.displayName="FileBrowser";function Of(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cf(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 Nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cf(Object(n),!0).forEach(function(t){Of(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mf(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<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Pf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function jf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function If(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 Tf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?If(Object(n),!0).forEach(function(t){jf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):If(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zf(e){return function t(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=e.length?e.apply(this,r):function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return t.apply(n,[].concat(r,o))}}}function Rf(e){return{}.toString.call(e).includes("Object")}function Df(e){return"function"==typeof e}r('.editorContainer {\n position: relative;\n width: 100%;\n height: 100%;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n}\n\n.tabContainer {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 35px;\n right: 0;\n}\n\n.monacoContainer {\n position: absolute;\n top: 35px;\n left: 0;\n bottom: 0;\n right: 0;\n}');var Af=zf(function(e,t){throw new Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),Lf={changes:function(e,t){return Rf(t)||Af("changeType"),Object.keys(t).some(function(t){return!function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)})&&Af("changeField"),t},selector:function(e){Df(e)||Af("selectorType")},handler:function(e){Df(e)||Rf(e)||Af("handlerType"),Rf(e)&&Object.values(e).some(function(e){return!Df(e)})&&Af("handlersType")},initial:function(e){var t;e||Af("initialIsRequired"),Rf(e)||Af("initialType"),t=e,Object.keys(t).length||Af("initialContent")}};function Vf(e,t){return Df(t)?t(e.current):t}function Bf(e,t){return e.current=Tf(Tf({},e.current),t),t}function $f(e,t,n){return Df(t)?t(e.current):Object.keys(n).forEach(function(n){var o;return null===(o=t[n])||void 0===o?void 0:o.call(t,e.current[n])}),n}var Hf={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Lf.initial(e),Lf.handler(t);var n={current:e},o=zf($f)(n,t),r=zf(Bf)(n),i=zf(Lf.changes)(e),a=zf(Vf)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return Lf.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(o,r,i,a)(e)}]}};var Ff,Yf={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},Zf=(Ff=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return o.length>=Ff.length?Ff.apply(this,o):function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.apply(t,[].concat(o,r))}})(Yf),Xf={config:function(e){var t;return e||Zf("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||Zf("configType"),e.urls?(console.warn(Yf.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function qf(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],qf(e[n],t[n]))}),Nf(Nf({},e),t)}var Wf={type:"cancelation",msg:"operation is manually canceled"};function Gf(e){var t=!1,n=new Promise(function(n,o){e.then(function(e){return t?o(Wf):n(e)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var Kf,Uf,Qf=Hf.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),Jf=(Uf=2,function(e){if(Array.isArray(e))return e}(Kf=Qf)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(r)throw i}}return n}}(Kf,Uf)||function(e,t){if(e){if("string"==typeof e)return Pf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pf(e,t):void 0}}(Kf,Uf)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),eh=Jf[0],th=Jf[1];function nh(e){return document.body.appendChild(e)}function oh(e){var t,n,o=eh(function(e){return{config:e.config,reject:e.reject}}),r=(t="".concat(o.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return r.onload=function(){return e()},r.onerror=o.reject,r}function rh(){var e=eh(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){ih(t),e.resolve(t)},function(t){e.reject(t)})}function ih(e){eh().monaco||th({monaco:e})}var ah=new Promise(function(e,t){return th({resolve:e,reject:t})}),sh={config:function(e){var t=Xf.config(e),n=t.monaco,o=Mf(t,["monaco"]);th(function(e){return{config:qf(e.config,o),monaco:n}})},init:function(){var e=eh(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(th({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Gf(ah);if(window.monaco&&window.monaco.editor)return ih(window.monaco),e.resolve(window.monaco),Gf(ah);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(nh,oh)(rh)}return Gf(ah)},__getMonacoInstance:function(){return eh(function(e){return e.monaco})}},lh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ch={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var uh=function({children:e}){return t.createElement("div",{style:ch.container},e)};var dh=function({width:e,height:n,isEditorReady:o,loading:r,_ref:i,className:a,wrapperProps:s}){return t.createElement("section",{style:{...lh.wrapper,width:e,height:n},...s},!o&&t.createElement(uh,null,r),t.createElement("div",{ref:i,style:{...lh.fullWidth,...!o&&lh.hide},className:a}))},fh=t.memo(dh);var hh=function(e){t.useEffect(e,[])};var ph=function(e,n,o=!0){let r=t.useRef(!0);t.useEffect(r.current||!o?()=>{r.current=!1}:e,n)};function gh(){}function mh(e,t,n,o){return function(e,t){return e.editor.getModel(yh(e,t))}(e,o)||function(e,t,n,o){return e.editor.createModel(t,n,o?yh(e,o):void 0)}(e,t,n,o)}function yh(e,t){return e.Uri.parse(t)}var vh=function({original:e,modified:n,language:o,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:g,wrapperProps:m={},beforeMount:y=gh,onMount:v=gh}){let[b,w]=t.useState(!1),[x,_]=t.useState(!0),E=t.useRef(null),k=t.useRef(null),S=t.useRef(null),O=t.useRef(v),C=t.useRef(y),N=t.useRef(!1);hh(()=>{let e=sh.init();return e.then(e=>(k.current=e)&&_(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>E.current?function(){let e=E.current?.getModel();l||e?.original?.dispose(),c||e?.modified?.dispose(),E.current?.dispose()}():e.cancel()}),ph(()=>{if(E.current&&k.current){let t=E.current.getOriginalEditor(),n=mh(k.current,e||"",r||o||"text",a||"");n!==t.getModel()&&t.setModel(n)}},[a],b),ph(()=>{if(E.current&&k.current){let e=E.current.getModifiedEditor(),t=mh(k.current,n||"",i||o||"text",s||"");t!==e.getModel()&&e.setModel(t)}},[s],b),ph(()=>{let e=E.current.getModifiedEditor();e.getOption(k.current.editor.EditorOption.readOnly)?e.setValue(n||""):n!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[n],b),ph(()=>{E.current?.getModel()?.original.setValue(e||"")},[e],b),ph(()=>{let{original:e,modified:t}=E.current.getModel();k.current.editor.setModelLanguage(e,r||o||"text"),k.current.editor.setModelLanguage(t,i||o||"text")},[o,r,i],b),ph(()=>{k.current?.editor.setTheme(u)},[u],b),ph(()=>{E.current?.updateOptions(f)},[f],b);let M=t.useCallback(()=>{if(!k.current)return;C.current(k.current);let t=mh(k.current,e||"",r||o||"text",a||""),l=mh(k.current,n||"",i||o||"text",s||"");E.current?.setModel({original:t,modified:l})},[o,n,i,e,r,a,s]),P=t.useCallback(()=>{!N.current&&S.current&&(E.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...f}),M(),k.current?.editor.setTheme(u),w(!0),N.current=!0)},[f,u,M]);return t.useEffect(()=>{b&&O.current(E.current,k.current)},[b]),t.useEffect(()=>{!x&&!b&&P()},[x,b,P]),t.createElement(fh,{width:p,height:h,isEditorReady:b,loading:d,_ref:S,className:g,wrapperProps:m})};t.memo(vh);var bh=function(e){let n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},wh=new Map;var xh=function({defaultValue:e,defaultLanguage:n,defaultPath:o,value:r,language:i,path:a,theme:s="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:g="100%",className:m,wrapperProps:y={},beforeMount:v=gh,onMount:b=gh,onChange:w,onValidate:x=gh}){let[_,E]=t.useState(!1),[k,S]=t.useState(!0),O=t.useRef(null),C=t.useRef(null),N=t.useRef(null),M=t.useRef(b),P=t.useRef(v),j=t.useRef(),I=t.useRef(r),T=bh(a),z=t.useRef(!1),R=t.useRef(!1);hh(()=>{let e=sh.init();return e.then(e=>(O.current=e)&&S(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>C.current?(j.current?.dispose(),h?f&&wh.set(a,C.current.saveViewState()):C.current.getModel()?.dispose(),void C.current.dispose()):e.cancel()}),ph(()=>{let t=mh(O.current,e||r||"",n||i||"",a||o||"");t!==C.current?.getModel()&&(f&&wh.set(T,C.current?.saveViewState()),C.current?.setModel(t),f&&C.current?.restoreViewState(wh.get(a)))},[a],_),ph(()=>{C.current?.updateOptions(u)},[u],_),ph(()=>{!C.current||void 0===r||(C.current.getOption(O.current.editor.EditorOption.readOnly)?C.current.setValue(r):r!==C.current.getValue()&&(R.current=!0,C.current.executeEdits("",[{range:C.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),C.current.pushUndoStop(),R.current=!1))},[r],_),ph(()=>{let e=C.current?.getModel();e&&i&&O.current?.editor.setModelLanguage(e,i)},[i],_),ph(()=>{void 0!==l&&C.current?.revealLine(l)},[l],_),ph(()=>{O.current?.editor.setTheme(s)},[s],_);let D=t.useCallback(()=>{if(N.current&&O.current&&!z.current){P.current(O.current);let t=a||o,c=mh(O.current,r||e||"",n||i||"",t||"");C.current=O.current?.editor.create(N.current,{model:c,automaticLayout:!0,...u},d),f&&C.current.restoreViewState(wh.get(t)),O.current.editor.setTheme(s),void 0!==l&&C.current.revealLine(l),E(!0),z.current=!0}},[e,n,o,r,i,a,u,d,f,s,l]);return t.useEffect(()=>{_&&M.current(C.current,O.current)},[_]),t.useEffect(()=>{!k&&!_&&D()},[k,_,D]),I.current=r,t.useEffect(()=>{_&&w&&(j.current?.dispose(),j.current=C.current?.onDidChangeModelContent(e=>{R.current||w(C.current.getValue(),e)}))},[_,w]),t.useEffect(()=>{if(_){let e=O.current.editor.onDidChangeMarkers(e=>{let t=C.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=O.current.editor.getModelMarkers({resource:t});x?.(e)}});return()=>{e?.dispose()}}return()=>{}},[_,x]),t.createElement(fh,{width:p,height:g,isEditorReady:_,loading:c,_ref:N,className:m,wrapperProps:y})},_h=t.memo(xh);r(".no-tab {\n background-color: #1e1e1e;\n color: #6b6b6b;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.editor-container {\n position: relative;\n width: 100%;\n height: 100%;\n}");var Eh=function(n){H(n);var o=zh().state,r=Z(t.useState("Loading content..."),2),i=r[0],a=r[1],s=Z(t.useState(!1),2),l=s[0],c=s[1],u=t.useRef(null),d=t.useRef(),f=t.useRef(null),h=t.useRef(0);t.useEffect(function(){o.activeTab?(a(o.activeTab.content),c(!0)):c(!1)},[o.activeTab]),t.useEffect(function(){d.current=i,null!=u&&u.current&&void 0!==d.current&&null!==d.current&&u.current.setValue(d.current)},[i]);var p=function(e,t){u.current=e,null!=d&&d.current&&u.current.setValue(d.current),u.current.layout()},g={fontSize:"13px",minimap:{enabled:!1},padding:{top:10},renderWhitespace:"none",wordWrap:"on",scrollBeyondLastLine:!1,readOnly:!0,automaticLayout:!1};t.useEffect(function(){if(f.current){var e=new ResizeObserver(function(){cancelAnimationFrame(h.current),h.current=requestAnimationFrame(function(){var e;null===(e=u.current)||void 0===e||e.layout()})});return e.observe(f.current),function(){cancelAnimationFrame(h.current),e.disconnect()}}},[]);return e.jsx("div",{className:"editor-container",ref:f,children:l?e.jsx(_h,{defaultLanguage:"python",defaultValue:i,onMount:p,theme:"vs-dark",options:g}):e.jsx("div",{className:"no-tab",children:"Select file or drag and drop to view."})})};Eh.propTypes={editorContent:z.string};r(".gutter {\n min-width: 2px;\n height: 35px;\n width: 2px;\n}");var kh=function(t){var o=t.id,r=t.index,i=t.parentId,a=n.useDroppable({id:o,data:{type:"EditorTabGutter",parentId:i,index:r}}),s=a.setNodeRef,l={backgroundColor:a.isOver?"#FFFFFF":"#222425"};return e.jsx("div",{className:"gutter",ref:s,style:l})};kh.propTypes={id:z.string.isRequired,parentId:z.string.isRequired,index:z.number.isRequired};r(".tab {\n padding: 0px 18px;\n cursor: default !important;\n height: 35px;\n width: auto;\n}\n\n.tab-content {\n width: auto;\n height: 31px;\n display: flex;\n align-items: center;\n vertical-align: middle;\n overflow-y: hidden;\n}\n\n.tab > .tab-content > .icon {\n padding-right: 2px;\n display: flex;\n align-items: center;\n width: 20px;\n}\n\n.tab > .tab-content > .tab-name {\n display: flex;\n align-items: center;\n width: auto;\n font-size: 13px;\n}\n\n.tab > .tab-content > .close-icon {\n display: flex;\n margin-left: 7px;\n padding-top: 3px;\n align-items: center;\n vertical-align: middle;\n width: 10px;\n cursor: pointer;\n}");var Sh="#1e1e1e",Oh="#FFFFFF",Ch=function(o){var r=o.id,i=o.parentId,a=o.node,s=Z(t.useState(),2),l=s[0],c=s[1],u=zh(),d=u.selectTab,f=u.closeTab,h=u.state,p=n.useDraggable({id:r,data:{type:"EditorTab",parentId:i,node:a,preview:e.jsx(Nh,{node:a})}}),g=p.attributes,m=p.listeners,y=p.setNodeRef;p.transform,t.useEffect(function(){v(h.activeTab&&h.activeTab.uid===a.uid)},[h.activeTab]);var v=function(e){c({backgroundColor:e?Sh:"#2d2d2d",color:e?Oh:"#969690"})};return e.jsx("div",Y(Y(Y({ref:y,style:l,id:r,onMouseDown:function(e){e.stopPropagation(),1===e.button?f(a.uid):d(a.uid)},className:"tab"},m),g),{},{children:e.jsxs("div",{className:"tab-content",children:[e.jsx("div",{className:"icon",children:e.jsx(nf,{size:14,style:{pointerEvents:"none"}})}),e.jsx("div",{className:"tab-name",children:e.jsx("span",{children:a.name})}),e.jsx("div",{className:"close-icon",onMouseDown:function(e){e.stopPropagation(),f(a.uid)},children:e.jsx(gf,{size:18})})]})}))};Ch.propTypes={id:z.string.isRequired,parentId:z.string.isRequired,node:z.shape({name:z.string.isRequired}).isRequired};var Nh=function(t){var n=t.node;return e.jsx("div",{className:"tab",style:{backgroundColor:Sh,color:Oh,opacity:.5},children:e.jsxs("div",{className:"tab-content",children:[e.jsx("div",{className:"icon",children:e.jsx(nf,{size:14,style:{pointerEvents:"none"}})}),e.jsx("div",{className:"tab-name",children:e.jsx("span",{children:n.name})}),e.jsx("div",{className:"close-icon",children:e.jsx(gf,{size:18})})]})})};r(".tabs-container {\n display: flex;\n flex-direction: row;\n height: 35px;\n width: 100%;\n position: relative;\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n scrollbar-width: thin;\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent;\n}\n\n.tabs-container::-webkit-scrollbar {\n height: 4px;\n}\n\n.tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.tabs-container::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.2);\n border-radius: 4px;\n}");var Mh=function(){var n=zh().state,o=Z(t.useState(),2),r=o[0],i=o[1];t.useEffect(function(){var e;(null===(e=n.tabs)||void 0===e?void 0:e.length)>=0&&null!=n.parentTabGroupId&&a(n.tabs,n.parentTabGroupId)},[n.tabs,n.parentTabGroupId]);var a=function(t,n){var o=[];t.forEach(function(t,r){o.push(e.jsx(kh,{id:n+"-"+r,index:r,parentId:n},t.uid+"-gutter")),o.push(e.jsx(Ch,{id:n+"-"+t.uid,parentId:n,node:t},t.uid))}),o.push(e.jsx(kh,{id:n+"-"+t.length,index:t.length,parentId:n},"last-gutter")),i(o)};return e.jsx("div",{className:"tabs-container",style:{background:"#222425"},children:r})},Ph=t.createContext(),jh={uid:crypto.randomUUID(),tabs:[],activeTab:null,parentTabGroupId:null},Ih=function(e,t){switch(t.type){case"ADD_TAB":var n=t.payload,o=n.tab,r=n.index,i=e.tabs.find(function(e){return e.uid===o.uid});if(i)return console.warn("Tab with id ".concat(i.uid," already exists")),Y(Y({},e),{},{activeTab:i});var a=X(e.tabs);return void 0!==r&&r<e.tabs.length?a.splice(r,0,o):a.push(o),Y(Y({},e),{},{tabs:a,activeTab:o});case"SET_PARENT_TAB_GROUP_ID":return Y(Y({},e),{},{parentTabGroupId:t.payload});case"SELECT_TAB":var s=e.tabs.find(function(e){return e.uid===t.payload});return s?Y(Y({},e),{},{activeTab:s}):(console.error("Tab with id ".concat(t.payload," not found.")),e);case"CLOSE_TAB":var l=e.tabs.findIndex(function(e){return e.uid===t.payload});if(-1===l)return console.warn("Tab with id ".concat(t.payload," not found.")),e;var c=X(e.tabs);c.splice(l,1);var u=e.activeTab,d=e.activeTab&&e.activeTab.uid===t.payload;return d&&l<c.length?u=c[Math.max(0,l)]:d&&l>=c.length&&(u=c.length>0?c[c.length-1]:null),Y(Y({},e),{},{tabs:c,activeTab:u});case"MOVE_TAB":var f=X(e.tabs),h=t.payload,p=h.tabId,g=h.newIndex,m=f.findIndex(function(e){return e.uid===p});if(-1===m)return console.warn("Tab with id ".concat(p," not found.")),e;if(g-1===m||g===m)return e;var y=Z(f.splice(m,1),1)[0],v=m<g?g-1:g;return f.splice(v,0,y),Y(Y({},e),{},{tabs:f});case"RESET_STATE":return jh;default:return e}},Th=t.forwardRef(function(n,o){H(n);var r=Z(t.useReducer(Ih,jh),2),i=r[0],a=r[1],s=t.useCallback(function(e){a({type:"SELECT_TAB",payload:e})},[]),l=t.useCallback(function(e){a({type:"CLOSE_TAB",payload:e})},[]),c=t.useCallback(function(e,t){a({type:"MOVE_TAB",payload:{tabId:e,newIndex:t}})},[]),u=t.useCallback(function(e,t){a({type:"ADD_TAB",payload:{tab:e,index:t}})},[]),d=t.useCallback(function(e){a({type:"RESET_STATE"}),a({type:"SET_PARENT_TAB_GROUP_ID",payload:e})},[]),f=t.useMemo(function(){return{state:i,addTab:u,setTabGroupId:d,selectTab:s,closeTab:l,moveTab:c}},[i,u,s,l,c,d]);return t.useImperativeHandle(o,function(){return f},[f]),e.jsx(Ph.Provider,{value:f,children:e.jsxs("div",{className:"editorContainer",children:[e.jsx("div",{className:"tabContainer",children:e.jsx(Mh,{})}),e.jsx("div",{className:"monacoContainer",children:e.jsx(Eh,{})})]})})});function zh(){var e=t.useContext(Ph);if(!e)throw new Error("useEditor must be used inside <Editor>");return e}Th.displayName="Editor";r(".canvas-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n background-color: #1b1c1d;\n overflow: hidden;\n}\n\ncanvas {\n overflow: hidden;\n}");var Rh=t.forwardRef(function(n,r){var i=n.connectBehaviors,a=n.deleteTransition,s=n.deleteBehavior,l=t.useRef(),c=t.useRef(),u=Z(t.useState({width:0,height:0}),2),d=u[0],f=u[1];t.useEffect(function(){var e=new ResizeObserver(function(e){var t=Z(e,1)[0].contentRect,n=t.width,o=t.height;f({width:n,height:o})});return c.current&&e.observe(c.current),function(){return e.disconnect()}},[]);var h=Z(t.useState([]),2),p=h[0],g=h[1],m=Z(t.useState([]),2),y=m[0],v=m[1],b=Z(t.useState([]),2),w=b[0],x=b[1],_=t.useCallback(function(e){if(e){var t=function(e){for(var t=[],n=[],o=0;o<e.graph.nodes.length;o++){var r=e.graph.nodes[o];n.push({id:r.getBehavior().name,text:r.getBehavior().name})}for(var i=function(){var n=e.graph.nodes[a];if(null==n||!n.getGoToBehaviors())return 1;n.getGoToBehaviors().forEach(function(e){t.push({id:"".concat(n.getBehavior().name,"->").concat(e),from:n.getBehavior().name,to:e})})},a=0;a<e.graph.nodes.length;a++)i();return{nodes:n,edges:t}}(e),n=t.nodes,o=t.edges;v(n),g(o)}},[v,g]),E=t.useMemo(function(){return{updateEngine:_}},[_]);t.useImperativeHandle(r,function(){return E},[E]);var k=t.useCallback(function(e){e.deltaY<0?l.current.zoomIn():l.current.zoomOut()},[l]);return e.jsx("div",{onWheel:k,ref:c,className:"canvas-wrapper",children:e.jsx(o.Canvas,{ref:l,nodes:y,edges:p,width:d.width,height:d.height,onNodeLink:function(e,t,n){i(t,n)},panType:"drag",selections:w,node:e.jsx(o.Node,{onClick:function(e,t){x([t.id])},onRemove:function(e,t){s(t),x([])}}),edge:e.jsx(o.Edge,{onClick:function(e,t){x([t.id])},onRemove:function(e,t){a(t),x([])}}),onCanvasClick:function(e){x([])},fit:!0,center:!0})})});Rh.propTypes={connectBehaviors:z.func.isRequired,deleteBehavior:z.func.isRequired},exports.BehavioralGraphBuilder=Rh,exports.Editor=Th,exports.FileBrowser=kf,exports.FlowDiagram=function(n){var o=n.treeInfo,r=Z(t.useState(),2),i=r[0],a=r[1];return t.useEffect(function(){a(o)},[o]),e.jsx(Hl,{children:e.jsx($d,{tree:i})})},exports.StackList=V,exports.useEditor=zh,exports.useFileBrowser=Sf;
|
|
41
|
+
*/var fa=(ua||(ua=1,"production"===process.env.NODE_ENV?ea.exports=function(){if(aa)return ta;aa=1;var e=t,n=la(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return ta.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},ta}():ea.exports=(ca||(ca=1,"production"!==process.env.NODE_ENV&&function(){"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var e=t,n=la(),o="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=n.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;da.useSyncExternalStoreWithSelector=function(e,t,n,c,u){var d=i(null);if(null===d.current){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=s(function(){function e(e){if(!a){if(a=!0,r=e,e=c(e),void 0!==u&&f.hasValue){var t=f.value;if(u(t,e))return i=t}return i=e}if(t=i,o(r,e))return t;var n=c(e);return void 0!==u&&u(t,n)?(r=e,t):(r=e,i=n)}var r,i,a=!1,s=void 0===n?null:n;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,n,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},"undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),da)),ea.exports),ha=i(fa);const pa=e=>{let t;const n=new Set,o=(e,o)=>{const r="function"==typeof e?e(t):e;if(!Object.is(r,t)){const e=t;t=(null!=o?o:"object"!=typeof r||null===r)?r:Object.assign({},t,r),n.forEach(n=>n(t,e))}},r=()=>t,i={setState:o,getState:r,getInitialState:()=>a,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},{useDebugValue:ga}=t,{useSyncExternalStoreWithSelector:ma}=ha,ya=e=>e;function va(e,t=ya,n){const o=ma(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ga(o),o}const ba=(e,t)=>{const n=(e=>e?pa(e):pa)(e),o=(e,o=t)=>va(n,e,o);return Object.assign(o,n),o};function wa(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[n,o]of e)if(!Object.is(o,t.get(n)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const xa=t.createContext(null),_a=xa.Provider,Ea=Bo();function ka(e,n){const o=t.useContext(xa);if(null===o)throw new Error(Ea);return va(o,e,n)}function Sa(){const e=t.useContext(xa);if(null===e)throw new Error(Ea);return t.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Oa={display:"none"},Ca={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Na="react-flow__node-desc",Ma="react-flow__edge-desc",Pa=e=>e.ariaLiveMessage,ja=e=>e.ariaLabelConfig;function Ia({rfId:t}){const n=ka(Pa);return e.jsx("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Ca,children:n})}function Ta({rfId:t,disableKeyboardA11y:n}){const o=ka(ja);return e.jsxs(e.Fragment,{children:[e.jsx("div",{id:`${Na}-${t}`,style:Oa,children:n?o["node.a11yDescription.default"]:o["node.a11yDescription.keyboardDisabled"]}),e.jsx("div",{id:`${Ma}-${t}`,style:Oa,children:o["edge.a11yDescription.default"]}),!n&&e.jsx(Ia,{rfId:t})]})}const za=t.forwardRef(({position:t="top-left",children:n,className:o,style:r,...i},a)=>{const s=`${t}`.split("-");return e.jsx("div",{className:W(["react-flow__panel",o,...s]),style:r,ref:a,...i,children:n})});function Ra({proOptions:t,position:n="bottom-right"}){return t?.hideAttribution?null:e.jsx(za,{position:n,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:e.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}za.displayName="Panel";const Da=e=>{const t=[],n=[];for(const[,n]of e.nodeLookup)n.selected&&t.push(n.internals.userNode);for(const[,t]of e.edgeLookup)t.selected&&n.push(t);return{selectedNodes:t,selectedEdges:n}},Aa=e=>e.id;function La(e,t){return wa(e.selectedNodes.map(Aa),t.selectedNodes.map(Aa))&&wa(e.selectedEdges.map(Aa),t.selectedEdges.map(Aa))}function Va({onSelectionChange:e}){const n=Sa(),{selectedNodes:o,selectedEdges:r}=ka(Da,La);return t.useEffect(()=>{const t={nodes:o,edges:r};e?.(t),n.getState().onSelectionChangeHandlers.forEach(e=>e(t))},[o,r,e]),null}const Ba=e=>!!e.onSelectionChangeHandlers;function $a({onSelectionChange:t}){const n=ka(Ba);return t||n?e.jsx(Va,{onSelectionChange:t}):null}const Ha=[0,0],Fa={x:0,y:0,zoom:1},Ya=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","paneClickDistance","ariaLabelConfig","rfId"],Za=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges,setPaneClickDistance:e.setPaneClickDistance}),qa={translateExtent:Jo,nodeOrigin:Ha,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function Xa(e){const{setNodes:n,setEdges:o,setMinZoom:r,setMaxZoom:i,setTranslateExtent:a,setNodeExtent:s,reset:l,setDefaultNodesAndEdges:c,setPaneClickDistance:u}=ka(Za,wa),d=Sa();t.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{f.current=qa,l()}),[]);const f=t.useRef(qa);return t.useEffect(()=>{for(const t of Ya){const l=e[t];l!==f.current[t]&&(void 0!==e[t]&&("nodes"===t?n(l):"edges"===t?o(l):"minZoom"===t?r(l):"maxZoom"===t?i(l):"translateExtent"===t?a(l):"nodeExtent"===t?s(l):"paneClickDistance"===t?u(l):"ariaLabelConfig"===t?d.setState({ariaLabelConfig:Zr(l)}):"fitView"===t?d.setState({fitViewQueued:l}):"fitViewOptions"===t?d.setState({fitViewOptions:l}):d.setState({[t]:l})))}f.current=e},Ya.map(t=>e[t])),null}function Wa(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const Ga="undefined"!=typeof document?document:null;function Ka(e=null,n={target:Ga,actInsideInputWithModifier:!0}){const[o,r]=t.useState(!1),i=t.useRef(!1),a=t.useRef(new Set([])),[s,l]=t.useMemo(()=>{if(null!==e){const t=(Array.isArray(e)?e:[e]).filter(e=>"string"==typeof e).map(e=>e.replace("+","\n").replace("\n\n","\n+").split("\n")),n=t.reduce((e,t)=>e.concat(...t),[]);return[t,n]}return[[],[]]},[e]);return t.useEffect(()=>{const t=n?.target??Ga,o=n?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!o)&&Kr(e))return!1;const t=Qa(e.code,l);if(a.current.add(e[t]),Ua(s,a.current,!1)){const t=e.composedPath?.()?.[0]||e.target,o="BUTTON"===t?.nodeName||"A"===t?.nodeName;!1===n.preventDefault||!i.current&&o||e.preventDefault(),r(!0)}},c=e=>{const t=Qa(e.code,l);Ua(s,a.current,!0)?(r(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),r(!1)};return t?.addEventListener("keydown",e),t?.addEventListener("keyup",c),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{t?.removeEventListener("keydown",e),t?.removeEventListener("keyup",c),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,r]),o}function Ua(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function Qa(e,t){return t.includes(e)?"code":"key"}function Ja(e,t){const n=[],o=new Map,r=[];for(const t of e)if("add"!==t.type)if("remove"===t.type||"replace"===t.type)o.set(t.id,[t]);else{const e=o.get(t.id);e?e.push(t):o.set(t.id,[t])}else r.push(t);for(const e of t){const t=o.get(e.id);if(!t){n.push(e);continue}if("remove"===t[0].type)continue;if("replace"===t[0].type){n.push({...t[0].item});continue}const r={...e};for(const e of t)es(e,r);n.push(r)}return r.length&&r.forEach(e=>{void 0!==e.index?n.splice(e.index,0,{...e.item}):n.push({...e.item})}),n}function es(e,t){switch(e.type){case"select":t.selected=e.selected;break;case"position":void 0!==e.position&&(t.position=e.position),void 0!==e.dragging&&(t.dragging=e.dragging);break;case"dimensions":void 0!==e.dimensions&&(t.measured??={},t.measured.width=e.dimensions.width,t.measured.height=e.dimensions.height,e.setAttributes&&(!0!==e.setAttributes&&"width"!==e.setAttributes||(t.width=e.dimensions.width),!0!==e.setAttributes&&"height"!==e.setAttributes||(t.height=e.dimensions.height))),"boolean"==typeof e.resizing&&(t.resizing=e.resizing)}}function ts(e,t){return Ja(e,t)}function ns(e,t){return Ja(e,t)}function os(e,t){return{id:e,type:"select",selected:t}}function rs(e,t=new Set,n=!1){const o=[];for(const[r,i]of e){const e=t.has(r);void 0===i.selected&&!e||i.selected===e||(n&&(i.selected=e),o.push(os(i.id,e)))}return o}function is({items:e=[],lookup:t}){const n=[],o=new Map(e.map(e=>[e.id,e]));for(const[o,r]of e.entries()){const e=t.get(r.id),i=e?.internals?.userNode??e;void 0!==i&&i!==r&&n.push({id:r.id,item:r,type:"replace"}),void 0===i&&n.push({item:r,type:"add",index:o})}for(const[e]of t){void 0===o.get(e)&&n.push({id:e,type:"remove"})}return n}function as(e){return{id:e.id,type:"remove"}}const ss=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function ls(e){return t.forwardRef(e)}const cs="undefined"!=typeof window?t.useLayoutEffect:t.useEffect;function us(e){const[n,o]=t.useState(BigInt(0)),[r]=t.useState(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>o(e=>e+BigInt(1))));return cs(()=>{const t=r.get();t.length&&(e(t),r.reset())},[n]),r}const ds=t.createContext(null);function fs({children:n}){const o=Sa(),r=us(t.useCallback(e=>{const{nodes:t=[],setNodes:n,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=o.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=is({items:l,lookup:a});r&&n(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:n}=o.getState();e&&n(t)})},[])),i=us(t.useCallback(e=>{const{edges:t=[],setEdges:n,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=o.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?n(s):i&&i(is({items:s,lookup:a}))},[])),a=t.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return e.jsx(ds.Provider,{value:a,children:n})}const hs=e=>!!e.panZoom;function ps(){const e=(()=>{const e=Sa();return t.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:o}=e.getState();return o?o.scaleTo(t,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[o,r,i],panZoom:a}=e.getState();return a?(await a.setViewport({x:t.x??o,y:t.y??r,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,o]=e.getState().transform;return{x:t,y:n,zoom:o}},setCenter:async(t,n,o)=>e.getState().setCenter(t,n,o),fitBounds:async(t,n)=>{const{width:o,height:r,minZoom:i,maxZoom:a,panZoom:s}=e.getState(),l=Lr(t,o,r,i,a,n?.padding??.1);return s?(await s.setViewport(l,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:o,snapGrid:r,snapToGrid:i,domNode:a}=e.getState();if(!a)return t;const{x:s,y:l}=a.getBoundingClientRect(),c={x:t.x-s,y:t.y-l},u=n.snapGrid??r,d=n.snapToGrid??i;return Rr(c,o,d,u)},flowToScreenPosition:t=>{const{transform:n,domNode:o}=e.getState();if(!o)return t;const{x:r,y:i}=o.getBoundingClientRect(),a=Dr(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),n=Sa(),o=function(){const e=t.useContext(ds);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),r=ka(hs),i=t.useMemo(()=>{const e=e=>n.getState().nodeLookup.get(e),t=e=>{o.nodeQueue.push(e)},r=e=>{o.edgeQueue.push(e)},i=e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState(),r=ss(e)?e:t.get(e.id),i=r.parentId?Fr(r.position,r.measured,r.parentId,t,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Cr(a)},a=(e,n,o={replace:!1})=>{t(t=>t.map(t=>{if(t.id===e){const e="function"==typeof n?n(t):n;return o.replace&&ss(e)?e:{...t,...e}}return t}))},s=(e,t,n={replace:!1})=>{r(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&dr(e)?e:{...o,...e}}return o}))};return{getNodes:()=>n.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=n.getState();return e.map(e=>({...e}))},getEdge:e=>n.getState().edgeLookup.get(e),setNodes:t,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];o.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];o.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:t=[],transform:o}=n.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:t.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:t=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=n.getState(),{nodes:d,edges:f}=await vr({nodesToRemove:e,edgesToRemove:t,nodes:o,edges:r,onBeforeDelete:u}),h=f.length>0,p=d.length>0;if(h){const e=f.map(as);a?.(f),l(e)}if(p){const e=d.map(as);i?.(d),s(e)}return(p||h)&&c?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,t=!0,o)=>{const r=jr(e),a=r?e:i(e),s=void 0!==o;return a?(o||n.getState().nodes).filter(o=>{const i=n.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Cr(s?o:i),c=Pr(l,a);return t&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=jr(e)?e:i(e);if(!o)return!1;const r=Pr(o,t);return n&&r>0||r>=o.width*o.height},updateNode:a,updateNodeData:(e,t,n={replace:!1})=>{a(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},updateEdge:s,updateEdgeData:(e,t,n={replace:!1})=>{s(e,e=>{const o="function"==typeof t?t(e):t;return n.replace?{...e,data:o}:{...e,data:{...e.data,...o}}},n)},getNodesBounds:e=>{const{nodeLookup:t,nodeOrigin:o}=n.getState();return((e,t={nodeOrigin:[0,0]})=>{if("development"!==process.env.NODE_ENV||t.nodeLookup||console.warn("Please use `getNodesBounds` from `useReactFlow`/`useSvelteFlow` hook to ensure correct values for sub flows. If not possible, you have to provide a nodeLookup to support sub flows."),0===e.length)return{x:0,y:0,width:0,height:0};const n=e.reduce((e,n)=>{const o="string"==typeof n;let r=t.nodeLookup||o?void 0:n;t.nodeLookup&&(r=o?t.nodeLookup.get(n):fr(n)?n:t.nodeLookup.get(n.id));const i=r?Nr(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return kr(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Or(n)})(e,{nodeLookup:t,nodeOrigin:o})},getHandleConnections:({type:e,id:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}-${e}${t?`-${t}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:t,nodeId:o})=>Array.from(n.getState().connectionLookup.get(`${o}${e?t?`-${e}-${t}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const t=n.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return n.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:t}),o.nodeQueue.push(e=>[...e]),t.promise}}},[]);return t.useMemo(()=>({...i,...e,viewportInitialized:r}),[r])}const gs=e=>e.selected,ms="undefined"!=typeof window?window:void 0;const ys={position:"absolute",width:"100%",height:"100%",top:0,left:0},vs=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function bs({onPaneContextMenu:n,zoomOnScroll:o=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:s=or.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:f,maxZoom:h,zoomActivationKeyCode:p,preventScrolling:g=!0,children:m,noWheelClassName:y,noPanClassName:v,onViewportChange:b,isControlledViewport:w,paneClickDistance:x}){const _=Sa(),E=t.useRef(null),{userSelectionActive:k,lib:S}=ka(vs,wa),O=Ka(p),C=t.useRef();!function(e){const n=Sa();t.useEffect(()=>{const t=()=>{if(!e.current)return!1;const t=Xr(e.current);0!==t.height&&0!==t.width||n.getState().onError?.("004",Fo()),n.setState({width:t.width||500,height:t.height||500})};if(e.current){t(),window.addEventListener("resize",t);const n=new ResizeObserver(()=>t());return n.observe(e.current),()=>{window.removeEventListener("resize",t),n&&e.current&&n.unobserve(e.current)}}},[])}(E);const N=t.useCallback(e=>{b?.({x:e[0],y:e[1],zoom:e[2]}),w||_.setState({transform:e})},[b,w]);return t.useEffect(()=>{if(E.current){C.current=Fi({domNode:E.current,minZoom:f,maxZoom:h,translateExtent:d,viewport:u,paneClickDistance:x,onDraggingChange:e=>_.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=_.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=_.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=_.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=C.current.getViewport();return _.setState({panZoom:C.current,transform:[e,t,n],domNode:E.current.closest(".react-flow")}),()=>{C.current?.destroy()}}},[]),t.useEffect(()=>{C.current?.update({onPaneContextMenu:n,zoomOnScroll:o,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:s,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:O,preventScrolling:g,noPanClassName:v,userSelectionActive:k,noWheelClassName:y,lib:S,onTransformChange:N})},[n,o,r,i,a,s,l,c,O,g,v,k,y,S,N]),e.jsx("div",{className:"react-flow__renderer",ref:E,style:ys,children:m})}const ws=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function xs(){const{userSelectionActive:t,userSelectionRect:n}=ka(ws,wa);return t&&n?e.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:n.width,height:n.height,transform:`translate(${n.x}px, ${n.y}px)`}}):null}const _s=(e,t)=>n=>{n.target===t.current&&e?.(n)},Es=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function ks({isSelecting:n,selectionKeyPressed:o,selectionMode:r=rr.Full,panOnDrag:i,selectionOnDrag:a,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:h,onPaneMouseLeave:p,children:g}){const m=Sa(),{userSelectionActive:y,elementsSelectable:v,dragging:b,connectionInProgress:w}=ka(Es,wa),x=v&&(n||y),_=t.useRef(null),E=t.useRef(),k=t.useRef(new Set),S=t.useRef(new Set),O=t.useRef(!1),C=t.useRef(!1),N=e=>{O.current||w?O.current=!1:(c?.(e),m.getState().resetSelectedElements(),m.setState({nodesSelectionActive:!1}))},M=d?e=>d(e):void 0,P=!0===i||Array.isArray(i)&&i.includes(0);return e.jsxs("div",{className:W(["react-flow__pane",{draggable:P,dragging:b,selection:n}]),onClick:x?void 0:_s(N,_),onContextMenu:_s(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():u?.(e)},_),onWheel:_s(M,_),onPointerEnter:x?void 0:f,onPointerDown:x?e=>{const{resetSelectedElements:t,domNode:o}=m.getState();if(E.current=o?.getBoundingClientRect(),!v||!n||0!==e.button||e.target!==_.current||!E.current)return;e.target?.setPointerCapture?.(e.pointerId),C.current=!0,O.current=!1;const{x:r,y:i}=Qr(e.nativeEvent,E.current);t(),m.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),s?.(e)}:h,onPointerMove:x?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:i,connectionLookup:a,triggerNodeChanges:s,triggerEdgeChanges:l,defaultEdgeOptions:c}=m.getState();if(!E.current||!t)return;O.current=!0;const{x:u,y:d}=Qr(e.nativeEvent,E.current),{startX:f,startY:h}=t,p={startX:f,startY:h,x:u<f?u:f,y:d<h?d:h,width:Math.abs(u-f),height:Math.abs(d-h)},g=k.current,y=S.current;k.current=new Set(gr(o,p,n,r===rr.Partial,!0).map(e=>e.id)),S.current=new Set;const v=c?.selectable??!0;for(const e of k.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??v)&&S.current.add(e)}}if(!Yr(g,k.current)){s(rs(o,k.current,!0))}if(!Yr(y,S.current)){l(rs(i,S.current))}m.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:h,onPointerUp:x?e=>{if(0!==e.button||!C.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=m.getState();!y&&t&&e.target===_.current&&N?.(e),m.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:k.current.size>0}),l?.(e),(o||a)&&(O.current=!1),C.current=!1}:void 0,onPointerLeave:p,ref:_,style:ys,children:[g,e.jsx(xs,{})]})}function Ss({id:e,store:t,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:r,unselectNodesAndEdges:i,multiSelectionActive:a,nodeLookup:s,onError:l}=t.getState(),c=s.get(e);c?(t.setState({nodesSelectionActive:!1}),c.selected?(n||c.selected&&a)&&(i({nodes:[c],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):r([e])):l?.("012",Ko(e))}function Os({nodeRef:e,disabled:n=!1,noDragClassName:o,handleSelector:r,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Sa(),[c,u]=t.useState(!1),d=t.useRef();return t.useEffect(()=>{d.current=Mi({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Ss({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),t.useEffect(()=>{if(n)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:o,handleSelector:r,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[o,r,n,a,e,i]),c}function Cs(){const e=Sa();return t.useCallback(t=>{const{nodeExtent:n,snapToGrid:o,snapGrid:r,nodesDraggable:i,onError:a,updateNodePositions:s,nodeLookup:l,nodeOrigin:c}=e.getState(),u=new Map,d=(e=>t=>t.selected&&(t.draggable||e&&void 0===t.draggable))(i),f=o?r[0]:5,h=o?r[1]:5,p=t.direction.x*f*t.factor,g=t.direction.y*h*t.factor;for(const[,e]of l){if(!d(e))continue;let t={x:e.internals.positionAbsolute.x+p,y:e.internals.positionAbsolute.y+g};o&&(t=zr(t,r));const{position:i,positionAbsolute:s}=yr({nodeId:e.id,nextPosition:t,nodeLookup:l,nodeExtent:n,nodeOrigin:c,onError:a});e.position=i,e.internals.positionAbsolute=s,u.set(e.id,e)}s(u)},[])}const Ns=t.createContext(null),Ms=Ns.Provider;Ns.Consumer;const Ps=()=>t.useContext(Ns),js=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Is=t.memo(ls(function({type:t="source",position:n=lr.Top,isValidConnection:o,isConnectable:r=!0,isConnectableStart:i=!0,isConnectableEnd:a=!0,id:s,onConnect:l,children:c,className:u,onMouseDown:d,onTouchStart:f,...h},p){const g=s||null,m="target"===t,y=Sa(),v=Ps(),{connectOnClick:b,noPanClassName:w,rfId:x}=ka(js,wa),{connectingFrom:_,connectingTo:E,clickConnecting:k,isPossibleEndHandle:S,connectionInProcess:O,clickConnectionInProcess:C,valid:N}=ka(((e,t,n)=>o=>{const{connectionClickStartHandle:r,connectionMode:i,connection:a}=o,{fromHandle:s,toHandle:l,isValid:c}=a,u=l?.nodeId===e&&l?.id===t&&l?.type===n;return{connectingFrom:s?.nodeId===e&&s?.id===t&&s?.type===n,connectingTo:u,clickConnecting:r?.nodeId===e&&r?.id===t&&r?.type===n,isPossibleEndHandle:i===nr.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(v,g,t),wa);v||y.getState().onError?.("010",Wo());const M=e=>{const{defaultEdgeOptions:t,onConnect:n,hasDefaultEdges:o}=y.getState(),r={...t,...e};if(o){const{edges:e,setEdges:t}=y.getState();t(((e,t)=>{if(!e.source||!e.target)return Tr("006",Zo()),t;let n;return n=dr(e)?{...e}:{...e,id:ai(e)},((e,t)=>t.some(t=>!(t.source!==e.source||t.target!==e.target||t.sourceHandle!==e.sourceHandle&&(t.sourceHandle||e.sourceHandle)||t.targetHandle!==e.targetHandle&&(t.targetHandle||e.targetHandle))))(n,t)?t:(null===n.sourceHandle&&delete n.sourceHandle,null===n.targetHandle&&delete n.targetHandle,t.concat(n))})(r,e))}n?.(r),l?.(r)},P=e=>{if(!v)return;const t=Ur(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=y.getState();Ri.onPointerDown(e.nativeEvent,{autoPanOnConnect:t.autoPanOnConnect,connectionMode:t.connectionMode,connectionRadius:t.connectionRadius,domNode:t.domNode,nodeLookup:t.nodeLookup,lib:t.lib,isTarget:m,handleId:g,nodeId:v,flowId:t.rfId,panBy:t.panBy,cancelConnection:t.cancelConnection,onConnectStart:t.onConnectStart,onConnectEnd:t.onConnectEnd,updateConnection:t.updateConnection,onConnect:M,isValidConnection:o||t.isValidConnection,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,autoPanSpeed:t.autoPanSpeed,dragThreshold:t.connectionDragThreshold})}t?d?.(e):f?.(e)};return e.jsx("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":n,"data-id":`${x}-${v}-${g}-${t}`,className:W(["react-flow__handle",`react-flow__handle-${n}`,"nodrag",w,u,{source:!m,target:m,connectable:r,connectablestart:i,connectableend:a,clickconnecting:k,connectingfrom:_,connectingto:E,valid:N,connectionindicator:r&&(!O||S)&&(O||C?a:i)}]),onMouseDown:P,onTouchStart:P,onClick:b?e=>{const{onClickConnectStart:n,onClickConnectEnd:r,connectionClickStartHandle:a,connectionMode:s,isValidConnection:l,lib:c,rfId:u,nodeLookup:d,connection:f}=y.getState();if(!v||!a&&!i)return;if(!a)return n?.(e.nativeEvent,{nodeId:v,handleId:g,handleType:t}),void y.setState({connectionClickStartHandle:{nodeId:v,type:t,id:g}});const h=Wr(e.target),p=o||l,{connection:m,isValid:b}=Ri.isValid(e.nativeEvent,{handle:{nodeId:v,id:g,type:t},connectionMode:s,fromNodeId:a.nodeId,fromHandleId:a.id||null,fromType:a.type,isValidConnection:p,flowId:u,doc:h,lib:c,nodeLookup:d});b&&m&&M(m);const w=structuredClone(f);delete w.inProgress,w.toPosition=w.toHandle?w.toHandle.position:null,r?.(e,w),y.setState({connectionClickStartHandle:null})}:void 0,ref:p,...h,children:c})}));const Ts={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},zs={input:function({data:t,isConnectable:n,sourcePosition:o=lr.Bottom}){return e.jsxs(e.Fragment,{children:[t?.label,e.jsx(Is,{type:"source",position:o,isConnectable:n})]})},default:function({data:t,isConnectable:n,targetPosition:o=lr.Top,sourcePosition:r=lr.Bottom}){return e.jsxs(e.Fragment,{children:[e.jsx(Is,{type:"target",position:o,isConnectable:n}),t?.label,e.jsx(Is,{type:"source",position:r,isConnectable:n})]})},output:function({data:t,isConnectable:n,targetPosition:o=lr.Top}){return e.jsxs(e.Fragment,{children:[e.jsx(Is,{type:"target",position:o,isConnectable:n}),t?.label]})},group:function(){return null}};const Rs=e=>{const{width:t,height:n,x:o,y:r}=pr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Ir(t)?t:null,height:Ir(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${o}px,${r}px)`}};function Ds({onSelectionContextMenu:n,noPanClassName:o,disableKeyboardA11y:r}){const i=Sa(),{width:a,height:s,transformString:l,userSelectionActive:c}=ka(Rs,wa),u=Cs(),d=t.useRef(null);if(t.useEffect(()=>{r||d.current?.focus({preventScroll:!0})},[r]),Os({nodeRef:d}),c||!a||!s)return null;const f=n?e=>{const t=i.getState().nodes.filter(e=>e.selected);n(e,t)}:void 0;return e.jsx("div",{className:W(["react-flow__nodesselection","react-flow__container",o]),style:{transform:l},children:e.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:f,tabIndex:r?void 0:-1,onKeyDown:r?void 0:e=>{Object.prototype.hasOwnProperty.call(Ts,e.key)&&(e.preventDefault(),u({direction:Ts[e.key],factor:e.shiftKey?4:1}))},style:{width:a,height:s}})})}const As="undefined"!=typeof window?window:void 0,Ls=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Vs({children:n,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:f,selectionMode:h,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:m,panActivationKeyCode:y,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:_,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:O,defaultViewport:C,translateExtent:N,minZoom:M,maxZoom:P,preventScrolling:j,onSelectionContextMenu:I,noWheelClassName:T,noPanClassName:z,disableKeyboardA11y:R,onViewportChange:D,isControlledViewport:A}){const{nodesSelectionActive:L,userSelectionActive:V}=ka(Ls),B=Ka(d,{target:As}),$=Ka(y,{target:As}),H=$||O,F=$||_,Y=f&&!0!==H,Z=B||V||Y;return function({deleteKeyCode:e,multiSelectionKeyCode:n}){const o=Sa(),{deleteElements:r}=ps(),i=Ka(e,{actInsideInputWithModifier:!1}),a=Ka(n,{target:ms});t.useEffect(()=>{if(i){const{edges:e,nodes:t}=o.getState();r({nodes:t.filter(gs),edges:e.filter(gs)}),o.setState({nodesSelectionActive:!1})}},[i]),t.useEffect(()=>{o.setState({multiSelectionActive:a})},[a])}({deleteKeyCode:u,multiSelectionKeyCode:m}),e.jsx(bs,{onPaneContextMenu:s,elementsSelectable:b,zoomOnScroll:w,zoomOnPinch:x,panOnScroll:F,panOnScrollSpeed:E,panOnScrollMode:k,zoomOnDoubleClick:S,panOnDrag:!B&&H,defaultViewport:C,translateExtent:N,minZoom:M,maxZoom:P,zoomActivationKeyCode:v,preventScrolling:j,noWheelClassName:T,noPanClassName:z,onViewportChange:D,isControlledViewport:A,paneClickDistance:c,children:e.jsxs(ks,{onSelectionStart:p,onSelectionEnd:g,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:H,isSelecting:!!Z,selectionMode:h,selectionKeyPressed:B,selectionOnDrag:Y,children:[n,L&&e.jsx(Ds,{onSelectionContextMenu:I,noPanClassName:z,disableKeyboardA11y:R})]})})}Vs.displayName="FlowRenderer";const Bs=t.memo(Vs);function $s(e){return ka(t.useCallback((e=>t=>e?gr(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(e=>e.id):Array.from(t.nodeLookup.keys()))(e),[e]),wa)}const Hs=e=>e.updateNodeInternals;function Fs({id:n,onClick:o,onMouseEnter:r,onMouseMove:i,onMouseLeave:a,onContextMenu:s,onDoubleClick:l,nodesDraggable:c,elementsSelectable:u,nodesConnectable:d,nodesFocusable:f,resizeObserver:h,noDragClassName:p,noPanClassName:g,disableKeyboardA11y:m,rfId:y,nodeTypes:v,nodeClickDistance:b,onError:w}){const{node:x,internals:_,isParent:E}=ka(e=>{const t=e.nodeLookup.get(n),o=e.parentLookup.has(n);return{node:t,internals:t.internals,isParent:o}},wa);let k=x.type||"default",S=v?.[k]||zs[k];void 0===S&&(w?.("003",Ho(k)),k="default",S=v?.default||zs.default);const O=!!(x.draggable||c&&void 0===x.draggable),C=!!(x.selectable||u&&void 0===x.selectable),N=!!(x.connectable||d&&void 0===x.connectable),M=!!(x.focusable||f&&void 0===x.focusable),P=Sa(),j=Hr(x),I=function({node:e,nodeType:n,hasDimensions:o,resizeObserver:r}){const i=Sa(),a=t.useRef(null),s=t.useRef(null),l=t.useRef(e.sourcePosition),c=t.useRef(e.targetPosition),u=t.useRef(n),d=o&&!!e.internals.handleBounds;return t.useEffect(()=>{!a.current||e.hidden||d&&s.current===a.current||(s.current&&r?.unobserve(s.current),r?.observe(a.current),s.current=a.current)},[d,e.hidden]),t.useEffect(()=>()=>{s.current&&(r?.unobserve(s.current),s.current=null)},[]),t.useEffect(()=>{if(a.current){const t=u.current!==n,o=l.current!==e.sourcePosition,r=c.current!==e.targetPosition;(t||o||r)&&(u.current=n,l.current=e.sourcePosition,c.current=e.targetPosition,i.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:a.current,force:!0}]])))}},[e.id,n,e.sourcePosition,e.targetPosition]),a}({node:x,nodeType:k,hasDimensions:j,resizeObserver:h}),T=Os({nodeRef:I,disabled:x.hidden||!O,noDragClassName:p,handleSelector:x.dragHandle,nodeId:n,isSelectable:C,nodeClickDistance:b}),z=Cs();if(x.hidden)return null;const R=$r(x),D=function(e){return void 0===e.internals.handleBounds?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}(x),A=C||O||o||r||i||a,L=r?e=>r(e,{..._.userNode}):void 0,V=i?e=>i(e,{..._.userNode}):void 0,B=a?e=>a(e,{..._.userNode}):void 0,$=s?e=>s(e,{..._.userNode}):void 0,H=l?e=>l(e,{..._.userNode}):void 0;return e.jsx("div",{className:W(["react-flow__node",`react-flow__node-${k}`,{[g]:O},x.className,{selected:x.selected,selectable:C,parent:E,draggable:O,dragging:T}]),ref:I,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:A?"all":"none",visibility:j?"visible":"hidden",...x.style,...D},"data-id":n,"data-testid":`rf__node-${n}`,onMouseEnter:L,onMouseMove:V,onMouseLeave:B,onContextMenu:$,onClick:e=>{const{selectNodesOnDrag:t,nodeDragThreshold:r}=P.getState();C&&(!t||!O||r>0)&&Ss({id:n,store:P,nodeRef:I}),o&&o(e,{..._.userNode})},onDoubleClick:H,onKeyDown:M?e=>{if(!Kr(e.nativeEvent)&&!m)if(er.includes(e.key)&&C){const t="Escape"===e.key;Ss({id:n,store:P,unselect:t,nodeRef:I})}else if(O&&x.selected&&Object.prototype.hasOwnProperty.call(Ts,e.key)){e.preventDefault();const{ariaLabelConfig:t}=P.getState();P.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),z({direction:Ts[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:M?0:void 0,onFocus:M?()=>{if(m||!I.current?.matches(":focus-visible"))return;const{transform:e,width:t,height:o,autoPanOnNodeFocus:r,setCenter:i}=P.getState();if(!r)return;gr(new Map([[n,x]]),{x:0,y:0,width:t,height:o},e,!0).length>0||i(x.position.x+R.width/2,x.position.y+R.height/2,{zoom:e[2]})}:void 0,role:x.ariaRole??(M?"group":void 0),"aria-roledescription":"node","aria-describedby":m?void 0:`${Na}-${y}`,"aria-label":x.ariaLabel,...x.domAttributes,children:e.jsx(Ms,{value:n,children:e.jsx(S,{id:n,data:x.data,type:k,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:x.selected??!1,selectable:C,draggable:O,deletable:x.deletable??!0,isConnectable:N,sourcePosition:x.sourcePosition,targetPosition:x.targetPosition,dragging:T,dragHandle:x.dragHandle,zIndex:_.z,parentId:x.parentId,...R})})})}const Ys=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Zs(n){const{nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:s}=ka(Ys,wa),l=$s(n.onlyRenderVisibleElements),c=function(){const e=ka(Hs),[n]=t.useState(()=>"undefined"==typeof ResizeObserver?null:new ResizeObserver(t=>{const n=new Map;t.forEach(e=>{const t=e.target.getAttribute("data-id");n.set(t,{id:t,nodeElement:e.target,force:!0})}),e(n)}));return t.useEffect(()=>()=>{n?.disconnect()},[n]),n}();return e.jsx("div",{className:"react-flow__nodes",style:ys,children:l.map(t=>e.jsx(Fs,{id:t,nodeTypes:n.nodeTypes,nodeExtent:n.nodeExtent,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,resizeObserver:c,nodesDraggable:o,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:n.nodeClickDistance,onError:s},t))})}Zs.displayName="NodeRenderer";const qs=t.memo(Zs);const Xs={[sr.Arrow]:({color:t="none",strokeWidth:n=1})=>e.jsx("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[sr.ArrowClosed]:({color:t="none",strokeWidth:n=1})=>e.jsx("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const Ws=({id:n,type:o,color:r,width:i=12.5,height:a=12.5,markerUnits:s="strokeWidth",strokeWidth:l,orient:c="auto-start-reverse"})=>{const u=function(e){const n=Sa();return t.useMemo(()=>Object.prototype.hasOwnProperty.call(Xs,e)?Xs[e]:(n.getState().onError?.("009",qo(e)),null),[e])}(o);return u?e.jsx("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:s,orient:c,refX:"0",refY:"0",children:e.jsx(u,{color:r,strokeWidth:l})}):null},Gs=({defaultColor:n,rfId:o})=>{const r=ka(e=>e.edges),i=ka(e=>e.defaultEdgeOptions),a=t.useMemo(()=>{const e=function(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((e,a)=>([a.markerStart||o,a.markerEnd||r].forEach(o=>{if(o&&"object"==typeof o){const r=mi(o,t);i.has(r)||(e.push({id:r,color:o.color||n,...o}),i.add(r))}}),e),[]).sort((e,t)=>e.id.localeCompare(t.id))}(r,{id:o,defaultColor:n,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd});return e},[r,i,o,n]);return a.length?e.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:e.jsx("defs",{children:a.map(t=>e.jsx(Ws,{id:t.id,type:t.type,color:t.color,width:t.width,height:t.height,markerUnits:t.markerUnits,strokeWidth:t.strokeWidth,orient:t.orient},t.id))})}):null};Gs.displayName="MarkerDefinitions";var Ks=t.memo(Gs);function Us({x:n,y:o,label:r,labelStyle:i,labelShowBg:a=!0,labelBgStyle:s,labelBgPadding:l=[2,4],labelBgBorderRadius:c=2,children:u,className:d,...f}){const[h,p]=t.useState({x:1,y:0,width:0,height:0}),g=W(["react-flow__edge-textwrapper",d]),m=t.useRef(null);return t.useEffect(()=>{if(m.current){const e=m.current.getBBox();p({x:e.x,y:e.y,width:e.width,height:e.height})}},[r]),r?e.jsxs("g",{transform:`translate(${n-h.width/2} ${o-h.height/2})`,className:g,visibility:h.width?"visible":"hidden",...f,children:[a&&e.jsx("rect",{width:h.width+2*l[0],x:-l[0],y:-l[1],height:h.height+2*l[1],className:"react-flow__edge-textbg",style:s,rx:c,ry:c}),e.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:m,style:i,children:r}),u]}):null}Us.displayName="EdgeText";const Qs=t.memo(Us);function Js({path:t,labelX:n,labelY:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:u=20,...d}){return e.jsxs(e.Fragment,{children:[e.jsx("path",{...d,d:t,fill:"none",className:W(["react-flow__edge-path",d.className])}),u&&e.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:u,className:"react-flow__edge-interaction"}),r&&Ir(n)&&Ir(o)?e.jsx(Qs,{x:n,y:o,label:r,labelStyle:i,labelShowBg:a,labelBgStyle:s,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function el({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===lr.Left||e===lr.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function tl({sourceX:e,sourceY:t,sourcePosition:n=lr.Bottom,targetX:o,targetY:r,targetPosition:i=lr.Top}){const[a,s]=el({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=el({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,h]=ei({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:s,targetControlX:l,targetControlY:c});return[`M${e},${t} C${a},${s} ${l},${c} ${o},${r}`,u,d,f,h]}function nl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s,targetPosition:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})=>{const[b,w,x]=tl({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),_=n.isInternal?void 0:t;return e.jsx(Js,{id:_,path:b,labelX:w,labelY:x,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:v})})}const ol=nl({isInternal:!1}),rl=nl({isInternal:!0});function il(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=lr.Bottom,targetPosition:g=lr.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=di({sourceX:o,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:g,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),E=n.isInternal?void 0:t;return e.jsx(Js,{id:E,path:w,labelX:x,labelY:_,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:m,markerStart:y,interactionWidth:b})})}ol.displayName="SimpleBezierEdge",rl.displayName="SimpleBezierEdgeInternal";const al=il({isInternal:!1}),sl=il({isInternal:!0});function ll(n){return t.memo(({id:o,...r})=>{const i=n.isInternal?void 0:o;return e.jsx(al,{...r,id:i,pathOptions:t.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}al.displayName="SmoothStepEdge",sl.displayName="SmoothStepEdgeInternal";const cl=ll({isInternal:!1}),ul=ll({isInternal:!0});function dl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})=>{const[y,v,b]=si({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=n.isInternal?void 0:t;return e.jsx(Js,{id:w,path:y,labelX:v,labelY:b,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,markerEnd:p,markerStart:g,interactionWidth:m})})}cl.displayName="StepEdge",ul.displayName="StepEdgeInternal";const fl=dl({isInternal:!1}),hl=dl({isInternal:!0});function pl(n){return t.memo(({id:t,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=lr.Bottom,targetPosition:l=lr.Top,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=oi({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),E=n.isInternal?void 0:t;return e.jsx(Js,{id:E,path:w,labelX:x,labelY:_,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:f,labelBgPadding:h,labelBgBorderRadius:p,style:g,markerEnd:m,markerStart:y,interactionWidth:b})})}fl.displayName="StraightEdge",hl.displayName="StraightEdgeInternal";const gl=pl({isInternal:!1}),ml=pl({isInternal:!0});gl.displayName="BezierEdge",ml.displayName="BezierEdgeInternal";const yl={default:ml,straight:hl,step:ul,smoothstep:sl,simplebezier:rl},vl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},bl=(e,t,n)=>n===lr.Left?e-t:n===lr.Right?e+t:e,wl=(e,t,n)=>n===lr.Top?e-t:n===lr.Bottom?e+t:e,xl="react-flow__edgeupdater";function _l({position:t,centerX:n,centerY:o,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:s,type:l}){return e.jsx("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:s,className:W([xl,`${xl}-${l}`]),cx:bl(n,r,t),cy:wl(o,r,t),r:r,stroke:"transparent",fill:"transparent"})}function El({isReconnectable:t,reconnectRadius:n,edge:o,sourceX:r,sourceY:i,targetX:a,targetY:s,sourcePosition:l,targetPosition:c,onReconnect:u,onReconnectStart:d,onReconnectEnd:f,setReconnecting:h,setUpdateHover:p}){const g=Sa(),m=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:r,isValidConnection:i,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:p,cancelConnection:m,nodeLookup:y,rfId:v,panBy:b,updateConnection:w}=g.getState(),x="target"===t.type;Ri.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:r,handleId:t.id,nodeId:t.nodeId,nodeLookup:y,isTarget:x,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:m,panBy:b,isValidConnection:i,onConnect:e=>u?.(o,e),onConnectStart:(n,r)=>{h(!0),d?.(e,o,t.type),c?.(n,r)},onConnectEnd:p,onReconnectEnd:(e,n)=>{h(!1),f?.(e,o,t.type,n)},updateConnection:w,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold})},y=()=>p(!0),v=()=>p(!1);return e.jsxs(e.Fragment,{children:[(!0===t||"source"===t)&&e.jsx(_l,{position:l,centerX:r,centerY:i,radius:n,onMouseDown:e=>m(e,{nodeId:o.target,id:o.targetHandle??null,type:"target"}),onMouseEnter:y,onMouseOut:v,type:"source"}),(!0===t||"target"===t)&&e.jsx(_l,{position:c,centerX:a,centerY:s,radius:n,onMouseDown:e=>m(e,{nodeId:o.source,id:o.sourceHandle??null,type:"source"}),onMouseEnter:y,onMouseOut:v,type:"target"})]})}function kl({id:n,edgesFocusable:o,edgesReconnectable:r,elementsSelectable:i,onClick:a,onDoubleClick:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,reconnectRadius:f,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,rfId:m,edgeTypes:y,noPanClassName:v,onError:b,disableKeyboardA11y:w}){let x=ka(e=>e.edgeLookup.get(n));const _=ka(e=>e.defaultEdgeOptions);x=_?{..._,...x}:x;let E=x.type||"default",k=y?.[E]||yl[E];void 0===k&&(b?.("011",Go(E)),E="default",k=y?.default||yl.default);const S=!!(x.focusable||o&&void 0===x.focusable),O=void 0!==h&&(x.reconnectable||r&&void 0===x.reconnectable),C=!!(x.selectable||i&&void 0===x.selectable),N=t.useRef(null),[M,P]=t.useState(!1),[j,I]=t.useState(!1),T=Sa(),{zIndex:z,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B}=ka(t.useCallback(e=>{const t=e.nodeLookup.get(x.source),o=e.nodeLookup.get(x.target);if(!t||!o)return{zIndex:x.zIndex,...vl};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!fi(t)||!fi(n))return null;const o=t.internals.handleBounds||hi(t.handles),r=n.internals.handleBounds||hi(n.handles),i=gi(o?.source??[],e.sourceHandle),a=gi(e.connectionMode===nr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",Xo(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||lr.Bottom,l=a?.position||lr.Top,c=pi(t,i,s),u=pi(n,a,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:s,targetPosition:l}}({id:n,sourceNode:t,targetNode:o,sourceHandle:x.sourceHandle||null,targetHandle:x.targetHandle||null,connectionMode:e.connectionMode,onError:b}),i=function({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o,elevateOnSelect:r=!1}){return void 0!==o?o:(r&&n?1e3:0)+Math.max(e.parentId?e.internals.z:0,t.parentId?t.internals.z:0)}({selected:x.selected,zIndex:x.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return{zIndex:i,...r||vl}},[x.source,x.target,x.sourceHandle,x.targetHandle,x.selected,x.zIndex]),wa),$=t.useMemo(()=>x.markerStart?`url('#${mi(x.markerStart,m)}')`:void 0,[x.markerStart,m]),H=t.useMemo(()=>x.markerEnd?`url('#${mi(x.markerEnd,m)}')`:void 0,[x.markerEnd,m]);if(x.hidden||null===R||null===D||null===A||null===L)return null;const F=s?e=>{s(e,{...x})}:void 0,Y=l?e=>{l(e,{...x})}:void 0,Z=c?e=>{c(e,{...x})}:void 0,q=u?e=>{u(e,{...x})}:void 0,X=d?e=>{d(e,{...x})}:void 0;return e.jsx("svg",{style:{zIndex:z},children:e.jsxs("g",{className:W(["react-flow__edge",`react-flow__edge-${E}`,x.className,v,{selected:x.selected,animated:x.animated,inactive:!C&&!a,updating:M,selectable:C}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=T.getState();C&&(T.setState({nodesSelectionActive:!1}),x.selected&&r?(o({nodes:[],edges:[x]}),N.current?.blur()):t([n])),a&&a(e,x)},onDoubleClick:F,onContextMenu:Y,onMouseEnter:Z,onMouseMove:q,onMouseLeave:X,onKeyDown:S?e=>{if(!w&&er.includes(e.key)&&C){const{unselectNodesAndEdges:t,addSelectedEdges:o}=T.getState();"Escape"===e.key?(N.current?.blur(),t({edges:[x]})):o([n])}}:void 0,tabIndex:S?0:void 0,role:x.ariaRole??(S?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":null===x.ariaLabel?void 0:x.ariaLabel||`Edge from ${x.source} to ${x.target}`,"aria-describedby":S?`${Ma}-${m}`:void 0,ref:N,...x.domAttributes,children:[!j&&e.jsx(k,{id:n,source:x.source,target:x.target,type:x.type,selected:x.selected,animated:x.animated,selectable:C,deletable:x.deletable??!0,label:x.label,labelStyle:x.labelStyle,labelShowBg:x.labelShowBg,labelBgStyle:x.labelBgStyle,labelBgPadding:x.labelBgPadding,labelBgBorderRadius:x.labelBgBorderRadius,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B,data:x.data,style:x.style,sourceHandleId:x.sourceHandle,targetHandleId:x.targetHandle,markerStart:$,markerEnd:H,pathOptions:"pathOptions"in x?x.pathOptions:void 0,interactionWidth:x.interactionWidth}),O&&e.jsx(El,{edge:x,isReconnectable:O,reconnectRadius:f,onReconnect:h,onReconnectStart:p,onReconnectEnd:g,sourceX:R,sourceY:D,targetX:A,targetY:L,sourcePosition:V,targetPosition:B,setUpdateHover:P,setReconnecting:I})]})})}const Sl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ol({defaultMarkerColor:n,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:s,onEdgeContextMenu:l,onEdgeMouseEnter:c,onEdgeMouseMove:u,onEdgeMouseLeave:d,onEdgeClick:f,reconnectRadius:h,onEdgeDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,disableKeyboardA11y:y}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,onError:x}=ka(Sl,wa),_=(E=o,ka(t.useCallback(e=>{if(!E)return e.edges.map(e=>e.id);const t=[];if(e.width&&e.height)for(const n of e.edges){const o=e.nodeLookup.get(n.source),r=e.nodeLookup.get(n.target);o&&r&&ii({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[E]),wa));var E;return e.jsxs("div",{className:"react-flow__edges",children:[e.jsx(Ks,{defaultColor:n,rfId:r}),_.map(t=>e.jsx(kl,{id:t,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:w,noPanClassName:a,onReconnect:s,onContextMenu:l,onMouseEnter:c,onMouseMove:u,onMouseLeave:d,onClick:f,reconnectRadius:h,onDoubleClick:p,onReconnectStart:g,onReconnectEnd:m,rfId:r,onError:x,edgeTypes:i,disableKeyboardA11y:y},t))]})}Ol.displayName="EdgeRenderer";const Cl=t.memo(Ol),Nl=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ml({children:t}){const n=ka(Nl);return e.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}const Pl=e=>e.panZoom?.syncViewport;function jl(e){return e.connection.inProgress?{...e.connection,to:Rr(e.connection.to,e.transform)}:{...e.connection}}function Il(e){return ka(jl,wa)}const Tl=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function zl({containerStyle:t,style:n,type:o,component:r}){const{nodesConnectable:i,width:a,height:s,isValid:l,inProgress:c}=ka(Tl,wa);return!!(a&&i&&c)?e.jsx("svg",{style:t,width:a,height:s,className:"react-flow__connectionline react-flow__container",children:e.jsx("g",{className:W(["react-flow__connection",ur(l)]),children:e.jsx(Rl,{style:n,type:o,CustomComponent:r,isValid:l})})}):null}const Rl=({style:t,type:n=ar.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h}=Il();if(!i)return;if(o)return e.jsx(o,{connectionLineType:n,connectionLineStyle:t,fromNode:s,fromHandle:l,fromX:a.x,fromY:a.y,toX:u.x,toY:u.y,fromPosition:c,toPosition:h,connectionStatus:ur(r),toNode:d,toHandle:f});let p="";const g={sourceX:a.x,sourceY:a.y,sourcePosition:c,targetX:u.x,targetY:u.y,targetPosition:h};switch(n){case ar.Bezier:[p]=oi(g);break;case ar.SimpleBezier:[p]=tl(g);break;case ar.Step:[p]=di({...g,borderRadius:0});break;case ar.SmoothStep:[p]=di(g);break;default:[p]=si(g)}return e.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:t})};Rl.displayName="ConnectionLine";const Dl={};function Al(e=Dl){const n=t.useRef(e),o=Sa();t.useEffect(()=>{if("development"===process.env.NODE_ENV){const t=new Set([...Object.keys(n.current),...Object.keys(e)]);for(const r of t)if(n.current[r]!==e[r]){o.getState().onError?.("002",$o());break}n.current=e}},[e])}function Ll({nodeTypes:n,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,onSelectionContextMenu:h,onSelectionStart:p,onSelectionEnd:g,connectionLineType:m,connectionLineStyle:y,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:w,selectionOnDrag:x,selectionMode:_,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,deleteKeyCode:O,onlyRenderVisibleElements:C,elementsSelectable:N,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:I,preventScrolling:T,defaultMarkerColor:z,zoomOnScroll:R,zoomOnPinch:D,panOnScroll:A,panOnScrollSpeed:L,panOnScrollMode:V,zoomOnDoubleClick:B,panOnDrag:$,onPaneClick:H,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneScroll:q,onPaneContextMenu:X,paneClickDistance:W,nodeClickDistance:G,onEdgeContextMenu:K,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,nodeExtent:le,rfId:ce,viewport:ue,onViewportChange:de}){return Al(n),Al(o),function(){const e=Sa(),n=t.useRef(!1);t.useEffect(()=>{if("development"===process.env.NODE_ENV&&!n.current){const t=document.querySelector(".react-flow__pane");t&&"1"!==window.getComputedStyle(t).zIndex&&e.getState().onError?.("013",Uo("react")),n.current=!0}},[])}(),function(e){const n=ps(),o=t.useRef(!1);t.useEffect(()=>{!o.current&&n.viewportInitialized&&e&&(setTimeout(()=>e(n),1),o.current=!0)},[e,n.viewportInitialized])}(r),function(e){const n=ka(Pl),o=Sa();t.useEffect(()=>{e&&(n?.(e),o.setState({transform:[e.x,e.y,e.zoom]}))},[e,n])}(ue),e.jsx(Bs,{onPaneClick:H,onPaneMouseEnter:F,onPaneMouseMove:Y,onPaneMouseLeave:Z,onPaneContextMenu:X,onPaneScroll:q,paneClickDistance:W,deleteKeyCode:O,selectionKeyCode:w,selectionOnDrag:x,selectionMode:_,onSelectionStart:p,onSelectionEnd:g,multiSelectionKeyCode:E,panActivationKeyCode:k,zoomActivationKeyCode:S,elementsSelectable:N,zoomOnScroll:R,zoomOnPinch:D,zoomOnDoubleClick:B,panOnScroll:A,panOnScrollSpeed:L,panOnScrollMode:V,panOnDrag:$,defaultViewport:M,translateExtent:P,minZoom:j,maxZoom:I,onSelectionContextMenu:h,preventScrolling:T,noDragClassName:re,noWheelClassName:ie,noPanClassName:ae,disableKeyboardA11y:se,onViewportChange:de,isControlledViewport:!!ue,children:e.jsxs(Ml,{children:[e.jsx(Cl,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:te,onReconnectStart:ne,onReconnectEnd:oe,onlyRenderVisibleElements:C,onEdgeContextMenu:K,onEdgeMouseEnter:U,onEdgeMouseMove:Q,onEdgeMouseLeave:J,reconnectRadius:ee,defaultMarkerColor:z,noPanClassName:ae,disableKeyboardA11y:se,rfId:ce}),e.jsx(zl,{style:y,type:m,component:v,containerStyle:b}),e.jsx("div",{className:"react-flow__edgelabel-renderer"}),e.jsx(qs,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:f,nodeClickDistance:G,onlyRenderVisibleElements:C,noPanClassName:ae,noDragClassName:re,disableKeyboardA11y:se,nodeExtent:le,rfId:ce}),e.jsx("div",{className:"react-flow__viewport-portal"})]})})}Ll.displayName="GraphView";const Vl=t.memo(Ll),Bl=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l=.5,maxZoom:c=2,nodeOrigin:u,nodeExtent:d}={})=>{const f=new Map,h=new Map,p=new Map,g=new Map,m=o??t??[],y=n??e??[],v=u??[0,0],b=d??Jo;Si(p,g,m);const w=wi(y,f,h,{nodeOrigin:v,nodeExtent:b,elevateNodesOnSelect:!1});let x=[0,0,1];if(a&&r&&i){const e=pr(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Lr(e,r,i,l,c,s?.padding??.1);x=[t,n,o]}return{rfId:"1",width:0,height:0,transform:x,nodes:y,nodesInitialized:w,nodeLookup:f,parentLookup:h,edges:m,edgeLookup:g,connectionLookup:p,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:void 0!==n,hasDefaultEdges:void 0!==o,panZoom:null,minZoom:l,maxZoom:c,translateExtent:Jo,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:nr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:v,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!1,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:a??!1,fitViewOptions:s,fitViewResolver:null,connection:{...ir},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Tr,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:tr}},$l=({nodes:e,edges:t,defaultNodes:n,defaultEdges:o,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d})=>{return f=(f,h)=>{async function p(){const{nodeLookup:e,panZoom:t,fitViewOptions:n,fitViewResolver:o,width:r,height:i,minZoom:a,maxZoom:s}=h();t&&(await mr({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),f({fitViewResolver:null}))}return{...Bl({nodes:e,edges:t,width:r,height:i,fitView:a,fitViewOptions:s,minZoom:l,maxZoom:c,nodeOrigin:u,nodeExtent:d,defaultNodes:n,defaultEdges:o}),setNodes:e=>{const{nodeLookup:t,parentLookup:n,nodeOrigin:o,elevateNodesOnSelect:r,fitViewQueued:i}=h(),a=wi(e,t,n,{nodeOrigin:o,nodeExtent:d,elevateNodesOnSelect:r,checkEquality:!0});i&&a?(p(),f({nodes:e,nodesInitialized:a,fitViewQueued:!1,fitViewOptions:void 0})):f({nodes:e,nodesInitialized:a})},setEdges:e=>{const{connectionLookup:t,edgeLookup:n}=h();Si(t,n,e),f({edges:e})},setDefaultNodesAndEdges:(e,t)=>{if(e){const{setNodes:t}=h();t(e),f({hasDefaultNodes:!0})}if(t){const{setEdges:e}=h();e(t),f({hasDefaultEdges:!0})}},updateNodeInternals:e=>{const{triggerNodeChanges:t,nodeLookup:n,parentLookup:o,domNode:r,nodeOrigin:i,nodeExtent:a,debug:s,fitViewQueued:l}=h(),{changes:c,updatedInternals:u}=function(e,t,n,o,r,i){const a=o?.querySelector(".xyflow__viewport");let s=!1;if(!a)return{changes:[],updatedInternals:s};const l=[],c=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(c.transform),d=[];for(const o of e.values()){const e=t.get(o.id);if(!e)continue;if(e.hidden){t.set(e.id,{...e,internals:{...e.internals,handleBounds:void 0}}),s=!0;continue}const a=Xr(o.nodeElement),c=e.measured.width!==a.width||e.measured.height!==a.height;if(a.width&&a.height&&(c||!e.internals.handleBounds||o.force)){const f=o.nodeElement.getBoundingClientRect(),h=Br(e.extent)?e.extent:i;let{positionAbsolute:p}=e.internals;e.parentId&&"parent"===e.extent?p=xr(p,a,t.get(e.parentId)):h&&(p=wr(p,h,a));const g={...e,measured:a,internals:{...e.internals,positionAbsolute:p,handleBounds:{source:Jr("source",o.nodeElement,f,u,e.id),target:Jr("target",o.nodeElement,f,u,e.id)}}};t.set(e.id,g),e.parentId&&xi(g,t,n,{nodeOrigin:r}),s=!0,c&&(l.push({id:e.id,type:"dimensions",dimensions:a}),e.expandParent&&e.parentId&&d.push({id:e.id,parentId:e.parentId,rect:Cr(g,r)}))}}if(d.length>0){const e=Ei(d,t,n,r);l.push(...e)}return{changes:l,updatedInternals:s}}(e,n,o,r,i,a);u&&(function(e,t,n){const o=bi(yi,n);for(const n of e.values())if(n.parentId)xi(n,e,t,o);else{const e=hr(n,o.nodeOrigin),t=Br(n.extent)?n.extent:o.nodeExtent,r=wr(e,t,$r(n));n.internals.positionAbsolute=r}}(n,o,{nodeOrigin:i,nodeExtent:a}),l?(p(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),c?.length>0&&(s&&console.log("React Flow: trigger node changes",c),t?.(c)))},updateNodePositions:(e,t=!1)=>{const n=[],o=[],{nodeLookup:r,triggerNodeChanges:i}=h();for(const[i,a]of e){const e=r.get(i),s=!!(e?.expandParent&&e?.parentId&&a?.position),l={id:i,type:"position",position:s?{x:Math.max(0,a.position.x),y:Math.max(0,a.position.y)}:a.position,dragging:t};s&&e.parentId&&n.push({id:i,parentId:e.parentId,rect:{...a.internals.positionAbsolute,width:a.measured.width??0,height:a.measured.height??0}}),o.push(l)}if(n.length>0){const{parentLookup:e,nodeOrigin:t}=h(),i=Ei(n,r,e,t);o.push(...i)}i(o)},triggerNodeChanges:e=>{const{onNodesChange:t,setNodes:n,nodes:o,hasDefaultNodes:r,debug:i}=h();e?.length&&(r&&n(ts(e,o)),i&&console.log("React Flow: trigger node changes",e),t?.(e))},triggerEdgeChanges:e=>{const{onEdgesChange:t,setEdges:n,edges:o,hasDefaultEdges:r,debug:i}=h();e?.length&&(r&&n(ns(e,o)),i&&console.log("React Flow: trigger edge changes",e),t?.(e))},addSelectedNodes:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?r(e.map(e=>os(e,!0))):(r(rs(o,new Set([...e]),!0)),i(rs(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?i(e.map(e=>os(e,!0))):(i(rs(n,new Set([...e]))),r(rs(o,new Set,!0)))},unselectNodesAndEdges:({nodes:e,edges:t}={})=>{const{edges:n,nodes:o,nodeLookup:r,triggerNodeChanges:i,triggerEdgeChanges:a}=h(),s=t||n,l=(e||o).map(e=>{const t=r.get(e.id);return t&&(t.selected=!1),os(e.id,!1)}),c=s.map(e=>os(e.id,!1));i(l),a(c)},setMinZoom:e=>{const{panZoom:t,maxZoom:n}=h();t?.setScaleExtent([e,n]),f({minZoom:e})},setMaxZoom:e=>{const{panZoom:t,minZoom:n}=h();t?.setScaleExtent([n,e]),f({maxZoom:e})},setTranslateExtent:e=>{h().panZoom?.setTranslateExtent(e),f({translateExtent:e})},setPaneClickDistance:e=>{h().panZoom?.setClickDistance(e)},resetSelectedElements:()=>{const{edges:e,nodes:t,triggerNodeChanges:n,triggerEdgeChanges:o,elementsSelectable:r}=h();if(!r)return;const i=t.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,os(t.id,!1)]:e,[]);n(i),o(a)},setNodeExtent:e=>{const{nodes:t,nodeLookup:n,parentLookup:o,nodeOrigin:r,elevateNodesOnSelect:i,nodeExtent:a}=h();e[0][0]===a[0][0]&&e[0][1]===a[0][1]&&e[1][0]===a[1][0]&&e[1][1]===a[1][1]||(wi(t,n,o,{nodeOrigin:r,nodeExtent:e,elevateNodesOnSelect:i,checkEquality:!1}),f({nodeExtent:e}))},panBy:e=>{const{transform:t,width:n,height:o,panZoom:r,translateExtent:i}=h();return async function({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const a=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),s=!!a&&(a.x!==n[0]||a.y!==n[1]||a.k!==n[2]);return Promise.resolve(s)}({delta:e,panZoom:r,transform:t,translateExtent:i,width:n,height:o})},setCenter:async(e,t,n)=>{const{width:o,height:r,maxZoom:i,panZoom:a}=h();if(!a)return Promise.resolve(!1);const s=void 0!==n?.zoom?n.zoom:i;return await a.setViewport({x:o/2-e*s,y:r/2-t*s,zoom:s},{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{f({connection:{...ir}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...Bl()})}},h=Object.is,f?ba(f,h):ba;var f,h};function Hl({initialNodes:n,initialEdges:o,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:h,children:p}){const[g]=t.useState(()=>$l({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:f,nodeExtent:h}));return e.jsx(_a,{value:g,children:e.jsx(fs,{children:p})})}function Fl({children:n,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:f,nodeOrigin:h,nodeExtent:p}){return t.useContext(xa)?e.jsx(e.Fragment,{children:n}):e.jsx(Hl,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:u,initialMinZoom:d,initialMaxZoom:f,nodeOrigin:h,nodeExtent:p,children:n})}const Yl={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var Zl,ql=ls(function({nodes:n,edges:o,defaultNodes:r,defaultEdges:i,className:a,nodeTypes:s,edgeTypes:l,onNodeClick:c,onEdgeClick:u,onInit:d,onMove:f,onMoveStart:h,onMoveEnd:p,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:k,onNodeDragStart:S,onNodeDrag:O,onNodeDragStop:C,onNodesDelete:N,onEdgesDelete:M,onDelete:P,onSelectionChange:j,onSelectionDragStart:I,onSelectionDrag:T,onSelectionDragStop:z,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:A,onBeforeDelete:L,connectionMode:V,connectionLineType:B=ar.Bezier,connectionLineStyle:$,connectionLineComponent:H,connectionLineContainerStyle:F,deleteKeyCode:Y="Backspace",selectionKeyCode:Z="Shift",selectionOnDrag:q=!1,selectionMode:X=rr.Full,panActivationKeyCode:G="Space",multiSelectionKeyCode:K=(Vr()?"Meta":"Control"),zoomActivationKeyCode:U=(Vr()?"Meta":"Control"),snapToGrid:Q,snapGrid:J,onlyRenderVisibleElements:ee=!1,selectNodesOnDrag:te,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,nodeOrigin:ae=Ha,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce=!0,defaultViewport:ue=Fa,minZoom:de=.5,maxZoom:fe=2,translateExtent:he=Jo,preventScrolling:pe=!0,nodeExtent:ge,defaultMarkerColor:me="#b1b1b7",zoomOnScroll:ye=!0,zoomOnPinch:ve=!0,panOnScroll:be=!1,panOnScrollSpeed:we=.5,panOnScrollMode:xe=or.Free,zoomOnDoubleClick:_e=!0,panOnDrag:Ee=!0,onPaneClick:ke,onPaneMouseEnter:Se,onPaneMouseMove:Oe,onPaneMouseLeave:Ce,onPaneScroll:Ne,onPaneContextMenu:Me,paneClickDistance:Pe=0,nodeClickDistance:je=0,children:Ie,onReconnect:Te,onReconnectStart:ze,onReconnectEnd:Re,onEdgeContextMenu:De,onEdgeDoubleClick:Ae,onEdgeMouseEnter:Le,onEdgeMouseMove:Ve,onEdgeMouseLeave:Be,reconnectRadius:$e=10,onNodesChange:He,onEdgesChange:Fe,noDragClassName:Ye="nodrag",noWheelClassName:Ze="nowheel",noPanClassName:qe="nopan",fitView:Xe,fitViewOptions:We,connectOnClick:Ge,attributionPosition:Ke,proOptions:Ue,defaultEdgeOptions:Qe,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,disableKeyboardA11y:tt=!1,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,connectionRadius:it,isValidConnection:at,onError:st,style:lt,id:ct,nodeDragThreshold:ut,connectionDragThreshold:dt,viewport:ft,onViewportChange:ht,width:pt,height:gt,colorMode:mt="light",debug:yt,onScroll:vt,ariaLabelConfig:bt,...wt},xt){const _t=ct||"1",Et=function(e){const[n,o]=t.useState("system"===e?null:e);return t.useEffect(()=>{if("system"!==e)return void o(e);const t=Wa(),n=()=>o(t?.matches?"dark":"light");return n(),t?.addEventListener("change",n),()=>{t?.removeEventListener("change",n)}},[e]),null!==n?n:Wa()?.matches?"dark":"light"}(mt),kt=t.useCallback(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),vt?.(e)},[vt]);return e.jsx("div",{"data-testid":"rf__wrapper",...wt,onScroll:kt,style:{...lt,...Yl},ref:xt,className:W(["react-flow",a,Et]),id:ct,role:"application",children:e.jsxs(Fl,{nodes:n,edges:o,width:pt,height:gt,fitView:Xe,fitViewOptions:We,minZoom:de,maxZoom:fe,nodeOrigin:ae,nodeExtent:ge,children:[e.jsx(Vl,{onInit:d,onNodeClick:c,onEdgeClick:u,onNodeMouseEnter:w,onNodeMouseMove:x,onNodeMouseLeave:_,onNodeContextMenu:E,onNodeDoubleClick:k,nodeTypes:s,edgeTypes:l,connectionLineType:B,connectionLineStyle:$,connectionLineComponent:H,connectionLineContainerStyle:F,selectionKeyCode:Z,selectionOnDrag:q,selectionMode:X,deleteKeyCode:Y,multiSelectionKeyCode:K,panActivationKeyCode:G,zoomActivationKeyCode:U,onlyRenderVisibleElements:ee,defaultViewport:ue,translateExtent:he,minZoom:de,maxZoom:fe,preventScrolling:pe,zoomOnScroll:ye,zoomOnPinch:ve,zoomOnDoubleClick:_e,panOnScroll:be,panOnScrollSpeed:we,panOnScrollMode:xe,panOnDrag:Ee,onPaneClick:ke,onPaneMouseEnter:Se,onPaneMouseMove:Oe,onPaneMouseLeave:Ce,onPaneScroll:Ne,onPaneContextMenu:Me,paneClickDistance:Pe,nodeClickDistance:je,onSelectionContextMenu:R,onSelectionStart:D,onSelectionEnd:A,onReconnect:Te,onReconnectStart:ze,onReconnectEnd:Re,onEdgeContextMenu:De,onEdgeDoubleClick:Ae,onEdgeMouseEnter:Le,onEdgeMouseMove:Ve,onEdgeMouseLeave:Be,reconnectRadius:$e,defaultMarkerColor:me,noDragClassName:Ye,noWheelClassName:Ze,noPanClassName:qe,rfId:_t,disableKeyboardA11y:tt,nodeExtent:ge,viewport:ft,onViewportChange:ht}),e.jsx(Xa,{nodes:n,edges:o,defaultNodes:r,defaultEdges:i,onConnect:g,onConnectStart:m,onConnectEnd:y,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:ne,autoPanOnNodeFocus:oe,nodesConnectable:re,nodesFocusable:ie,edgesFocusable:se,edgesReconnectable:le,elementsSelectable:ce,elevateNodesOnSelect:Je,elevateEdgesOnSelect:et,minZoom:de,maxZoom:fe,nodeExtent:ge,onNodesChange:He,onEdgesChange:Fe,snapToGrid:Q,snapGrid:J,connectionMode:V,translateExtent:he,connectOnClick:Ge,defaultEdgeOptions:Qe,fitView:Xe,fitViewOptions:We,onNodesDelete:N,onEdgesDelete:M,onDelete:P,onNodeDragStart:S,onNodeDrag:O,onNodeDragStop:C,onSelectionDrag:T,onSelectionDragStart:I,onSelectionDragStop:z,onMove:f,onMoveStart:h,onMoveEnd:p,noPanClassName:qe,nodeOrigin:ae,rfId:_t,autoPanOnConnect:nt,autoPanOnNodeDrag:ot,autoPanSpeed:rt,onError:st,connectionRadius:it,isValidConnection:at,selectNodesOnDrag:te,nodeDragThreshold:ut,connectionDragThreshold:dt,onBeforeDelete:L,paneClickDistance:Pe,debug:yt,ariaLabelConfig:bt}),e.jsx($a,{onSelectionChange:j}),Ie,e.jsx(Ra,{proOptions:Ue,position:Ke}),e.jsx(Ta,{rfId:_t,disableKeyboardA11y:tt})]})})});function Xl({dimensions:t,lineWidth:n,variant:o,className:r}){return e.jsx("path",{strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:W(["react-flow__background-pattern",o,r])})}function Wl({radius:t,className:n}){return e.jsx("circle",{cx:t,cy:t,r:t,className:W(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(Zl||(Zl={}));const Gl={[Zl.Dots]:1,[Zl.Lines]:1,[Zl.Cross]:6},Kl=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Ul({id:n,variant:o=Zl.Dots,gap:r=20,size:i,lineWidth:a=1,offset:s=0,color:l,bgColor:c,style:u,className:d,patternClassName:f}){const h=t.useRef(null),{transform:p,patternId:g}=ka(Kl,wa),m=i||Gl[o],y=o===Zl.Dots,v=o===Zl.Cross,b=Array.isArray(r)?r:[r,r],w=[b[0]*p[2]||1,b[1]*p[2]||1],x=m*p[2],_=Array.isArray(s)?s:[s,s],E=v?[x,x]:w,k=[_[0]*p[2]||1+E[0]/2,_[1]*p[2]||1+E[1]/2],S=`${g}${n||""}`;return e.jsxs("svg",{className:W(["react-flow__background",d]),style:{...u,...ys,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:h,"data-testid":"rf__background",children:[e.jsx("pattern",{id:S,x:p[0]%w[0],y:p[1]%w[1],width:w[0],height:w[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${k[0]},-${k[1]})`,children:y?e.jsx(Wl,{radius:x/2,className:f}):e.jsx(Xl,{dimensions:E,lineWidth:a,variant:o,className:f})}),e.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${S})`})]})}function Ql(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:e.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Jl(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:e.jsx("path",{d:"M0 0h32v4.2H0z"})})}function ec(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:e.jsx("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 tc(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e.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 nc(){return e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e.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 oc({children:t,className:n,...o}){return e.jsx("button",{type:"button",className:W(["react-flow__controls-button",n]),...o,children:t})}Ul.displayName="Background",t.memo(Ul);const rc=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function ic({style:t,showZoom:n=!0,showFitView:o=!0,showInteractive:r=!0,fitViewOptions:i,onZoomIn:a,onZoomOut:s,onFitView:l,onInteractiveChange:c,className:u,children:d,position:f="bottom-left",orientation:h="vertical","aria-label":p}){const g=Sa(),{isInteractive:m,minZoomReached:y,maxZoomReached:v,ariaLabelConfig:b}=ka(rc,wa),{zoomIn:w,zoomOut:x,fitView:_}=ps(),E="horizontal"===h?"horizontal":"vertical";return e.jsxs(za,{className:W(["react-flow__controls",E,u]),position:f,style:t,"data-testid":"rf__controls","aria-label":p??b["controls.ariaLabel"],children:[n&&e.jsxs(e.Fragment,{children:[e.jsx(oc,{onClick:()=>{w(),a?.()},className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:v,children:e.jsx(Ql,{})}),e.jsx(oc,{onClick:()=>{x(),s?.()},className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:y,children:e.jsx(Jl,{})})]}),o&&e.jsx(oc,{className:"react-flow__controls-fitview",onClick:()=>{_(i),l?.()},title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:e.jsx(ec,{})}),r&&e.jsx(oc,{className:"react-flow__controls-interactive",onClick:()=>{g.setState({nodesDraggable:!m,nodesConnectable:!m,elementsSelectable:!m}),c?.(!m)},title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:m?e.jsx(nc,{}):e.jsx(tc,{})}),d]})}ic.displayName="Controls";const ac=t.memo(ic);const sc=t.memo(function({id:t,x:n,y:o,width:r,height:i,style:a,color:s,strokeColor:l,strokeWidth:c,className:u,borderRadius:d,shapeRendering:f,selected:h,onClick:p}){const{background:g,backgroundColor:m}=a||{},y=s||g||m;return e.jsx("rect",{className:W(["react-flow__minimap-node",{selected:h},u]),x:n,y:o,rx:d,ry:d,width:r,height:i,style:{fill:y,stroke:l,strokeWidth:c},shapeRendering:f,onClick:p?e=>p(e,t):void 0})}),lc=e=>e.nodes.map(e=>e.id),cc=e=>e instanceof Function?e:()=>e;const uc=t.memo(function({id:t,nodeColorFunc:n,nodeStrokeColorFunc:o,nodeClassNameFunc:r,nodeBorderRadius:i,nodeStrokeWidth:a,shapeRendering:s,NodeComponent:l,onClick:c}){const{node:u,x:d,y:f,width:h,height:p}=ka(e=>{const{internals:n}=e.nodeLookup.get(t),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=$r(o);return{node:o,x:r,y:i,width:a,height:s}},wa);return u&&!u.hidden&&Hr(u)?e.jsx(l,{x:d,y:f,width:h,height:p,style:u.style,selected:!!u.selected,className:r(u),color:n(u),borderRadius:i,strokeColor:o(u),strokeWidth:a,shapeRendering:s,onClick:c,id:u.id}):null});var dc=t.memo(function({nodeStrokeColor:t,nodeColor:n,nodeClassName:o="",nodeBorderRadius:r=5,nodeStrokeWidth:i,nodeComponent:a=sc,onClick:s}){const l=ka(lc,wa),c=cc(n),u=cc(t),d=cc(o),f="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return e.jsx(e.Fragment,{children:l.map(t=>e.jsx(uc,{id:t,nodeColorFunc:c,nodeStrokeColorFunc:u,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:i,NodeComponent:a,onClick:s,shapeRendering:f},t))})});const fc=e=>!e.hidden,hc=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Mr(pr(e.nodeLookup,{filter:fc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function pc({style:n,className:o,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:s=5,nodeStrokeWidth:l,nodeComponent:c,bgColor:u,maskColor:d,maskStrokeColor:f,maskStrokeWidth:h,position:p="bottom-right",onClick:g,onNodeClick:m,pannable:y=!1,zoomable:v=!1,ariaLabel:b,inversePan:w,zoomStep:x=10,offsetScale:_=5}){const E=Sa(),k=t.useRef(null),{boundingRect:S,viewBB:O,rfId:C,panZoom:N,translateExtent:M,flowWidth:P,flowHeight:j,ariaLabelConfig:I}=ka(hc,wa),T=n?.width??200,z=n?.height??150,R=S.width/T,D=S.height/z,A=Math.max(R,D),L=A*T,V=A*z,B=_*A,$=S.x-(L-S.width)/2-B,H=S.y-(V-S.height)/2-B,F=L+2*B,Y=V+2*B,Z=`react-flow__minimap-desc-${C}`,q=t.useRef(0),X=t.useRef();q.current=A,t.useEffect(()=>{if(k.current&&N)return X.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ft(e);return{update:function({translateExtent:e,width:i,height:a,zoomStep:s=10,pannable:l=!0,zoomable:c=!0,inversePan:u=!1}){let d=[0,0];const f=Vo().on("start",e=>{"mousedown"!==e.sourceEvent.type&&"touchstart"!==e.sourceEvent.type||(d=[e.sourceEvent.clientX??e.sourceEvent.touches[0].clientX,e.sourceEvent.clientY??e.sourceEvent.touches[0].clientY])}).on("zoom",l?r=>{const s=n();if("mousemove"!==r.sourceEvent.type&&"touchmove"!==r.sourceEvent.type||!t)return;const l=[r.sourceEvent.clientX??r.sourceEvent.touches[0].clientX,r.sourceEvent.clientY??r.sourceEvent.touches[0].clientY],c=[l[0]-d[0],l[1]-d[1]];d=l;const f=o()*Math.max(s[2],Math.log(s[2]))*(u?-1:1),h={x:s[0]-c[0]*f,y:s[1]-c[1]*f},p=[[0,0],[i,a]];t.setViewportConstrained({x:h.x,y:h.y,zoom:s[2]},p,e)}:null).on("zoom.wheel",c?e=>{const o=n();if("wheel"!==e.sourceEvent.type||!t)return;const r=-e.sourceEvent.deltaY*(1===e.sourceEvent.deltaMode?.05:e.sourceEvent.deltaMode?1:.002)*s,i=o[2]*Math.pow(2,r);t.scaleTo(i)}:null);r.call(f,{})},destroy:function(){r.on("zoom",null)},pointer:ht}}({domNode:k.current,panZoom:N,getTransform:()=>E.getState().transform,getViewScale:()=>q.current}),()=>{X.current?.destroy()}},[N]),t.useEffect(()=>{X.current?.update({translateExtent:M,width:P,height:j,inversePan:w,pannable:y,zoomStep:x,zoomable:v})},[y,v,w,x,M,P,j]);const G=g?e=>{const[t,n]=X.current?.pointer(e)||[0,0];g(e,{x:t,y:n})}:void 0,K=m?t.useCallback((e,t)=>{const n=E.getState().nodeLookup.get(t).internals.userNode;m(e,n)},[]):void 0,U=b??I["minimap.ariaLabel"];return e.jsx(za,{position:p,style:{...n,"--xy-minimap-background-color-props":"string"==typeof u?u:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof f?f:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof h?h*A:void 0,"--xy-minimap-node-background-color-props":"string"==typeof i?i:void 0,"--xy-minimap-node-stroke-color-props":"string"==typeof r?r:void 0,"--xy-minimap-node-stroke-width-props":"number"==typeof l?l:void 0},className:W(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:e.jsxs("svg",{width:T,height:z,viewBox:`${$} ${H} ${F} ${Y}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":Z,ref:k,onClick:G,children:[U&&e.jsx("title",{id:Z,children:U}),e.jsx(dc,{onClick:K,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:s,nodeClassName:a,nodeStrokeWidth:l,nodeComponent:c}),e.jsx("path",{className:"react-flow__minimap-mask",d:`M${$-B},${H-B}h${F+2*B}v${Y+2*B}h${-F-2*B}z\n M${O.x},${O.y}h${O.width}v${O.height}h${-O.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}pc.displayName="MiniMap",t.memo(pc);const gc={[Yi.Line]:"right",[Yi.Handle]:"bottom-right"};t.memo(function({nodeId:n,position:o,variant:r=Yi.Handle,className:i,style:a,children:s,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:f=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:p,autoScale:g=!0,shouldResize:m,onResizeStart:y,onResize:v,onResizeEnd:b}){const w=Ps(),x="string"==typeof n?n:w,_=Sa(),E=t.useRef(null),k=r===Yi.Handle,S=ka(t.useCallback((O=k&&g,e=>O?`${Math.max(1/e.transform[2],1)}`:void 0),[k,g]),wa);var O;const C=t.useRef(null),N=o??gc[r];t.useEffect(()=>{if(E.current&&x)return C.current||(C.current=Qi({domNode:E.current,nodeId:x,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=_.getState();return{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,paneDomNode:i}},onChange:(e,t)=>{const{triggerNodeChanges:n,nodeLookup:o,parentLookup:r,nodeOrigin:i}=_.getState(),a=[],s={x:e.x,y:e.y},l=o.get(x);if(l&&l.expandParent&&l.parentId){const t=l.origin??i,n=e.width??l.measured.width??0,c=e.height??l.measured.height??0,u=Ei([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...Fr({x:e.x??l.position.x,y:e.y??l.position.y},{width:n,height:c},l.parentId,o,t)}}],o,r,i);a.push(...u),s.x=e.x?Math.max(t[0]*n,e.x):void 0,s.y=e.y?Math.max(t[1]*c,e.y):void 0}if(void 0!==s.x&&void 0!==s.y){const e={id:x,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:x,type:"dimensions",resizing:!0,setAttributes:!p||("horizontal"===p?"width":"height"),dimensions:{width:e.width,height:e.height}};a.push(t)}for(const e of t){const t={...e,type:"position"};a.push(t)}n(a)},onEnd:({width:e,height:t})=>{const n={id:x,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};_.getState().triggerNodeChanges([n])}})),C.current.update({controlPosition:N,boundaries:{minWidth:c,minHeight:u,maxWidth:d,maxHeight:f},keepAspectRatio:h,resizeDirection:p,onResizeStart:y,onResize:v,onResizeEnd:b,shouldResize:m}),()=>{C.current?.destroy()}},[N,c,u,d,f,h,y,v,b,m]);const M=N.split("-");return e.jsx("div",{className:W(["react-flow__resize-control","nodrag",...M,r,i]),ref:E,style:{...a,scale:S,...l&&{[k?"backgroundColor":"borderColor"]:l}},children:s})});var mc,yc,vc,bc,wc,xc,_c,Ec,kc,Sc,Oc,Cc,Nc,Mc,Pc,jc,Ic,Tc,zc,Rc,Dc,Ac,Lc,Vc,Bc,$c,Hc,Fc,Yc,Zc,qc,Xc,Wc,Gc,Kc,Uc,Qc,Jc,eu,tu,nu,ou,ru,iu,au,su,lu,cu,uu,du,fu,hu,pu,gu,mu,yu,vu,bu,wu,xu,_u,Eu,ku,Su,Ou,Cu,Nu,Mu,Pu,ju,Iu,Tu,zu,Ru,Du,Au,Lu,Vu,Bu,$u,Hu,Fu,Yu,Zu,qu,Xu,Wu,Gu,Ku,Uu,Qu,Ju,ed,td;function nd(){if(yc)return mc;yc=1;var e="\0";function t(e,t){e[t]?e[t]++:e[t]=1}function n(e,t){--e[t]||delete e[t]}function o(e,t,n,o){var r=""+t,i=""+n;if(!e&&r>i){var a=r;r=i,i=a}return r+""+i+""+(void 0===o?"\0":o)}function r(e,t){return o(e,t.v,t.w,t.name)}return mc=class{_isDirected=!0;_isMultigraph=!1;_isCompound=!1;_label;_defaultNodeLabelFn=()=>{};_defaultEdgeLabelFn=()=>{};_nodes={};_in={};_preds={};_out={};_sucs={};_edgeObjs={};_edgeLabels={};_nodeCount=0;_edgeCount=0;_parent;_children;constructor(t){t&&(this._isDirected=!Object.hasOwn(t,"directed")||t.directed,this._isMultigraph=!!Object.hasOwn(t,"multigraph")&&t.multigraph,this._isCompound=!!Object.hasOwn(t,"compound")&&t.compound),this._isCompound&&(this._parent={},this._children={},this._children[e]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(e){return this._label=e,this}graph(){return this._label}setDefaultNodeLabel(e){return this._defaultNodeLabelFn=e,"function"!=typeof e&&(this._defaultNodeLabelFn=()=>e),this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._in[t]).length)}sinks(){var e=this;return this.nodes().filter(t=>0===Object.keys(e._out[t]).length)}setNodes(e,t){var n=arguments,o=this;return e.forEach(function(e){n.length>1?o.setNode(e,t):o.setNode(e)}),this}setNode(t,n){return Object.hasOwn(this._nodes,t)?(arguments.length>1&&(this._nodes[t]=n),this):(this._nodes[t]=arguments.length>1?n:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]=e,this._children[t]={},this._children[e][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(e){return this._nodes[e]}hasNode(e){return Object.hasOwn(this._nodes,e)}removeNode(e){var t=this;if(Object.hasOwn(this._nodes,e)){var n=e=>t.removeEdge(t._edgeObjs[e]);delete this._nodes[e],this._isCompound&&(this._removeFromParentsChildList(e),delete this._parent[e],this.children(e).forEach(function(e){t.setParent(e)}),delete this._children[e]),Object.keys(this._in[e]).forEach(n),delete this._in[e],delete this._preds[e],Object.keys(this._out[e]).forEach(n),delete this._out[e],delete this._sucs[e],--this._nodeCount}return this}setParent(t,n){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(void 0===n)n=e;else{for(var o=n+="";void 0!==o;o=this.parent(o))if(o===t)throw new Error("Setting "+n+" as parent of "+t+" would create a cycle");this.setNode(n)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=n,this._children[n][t]=!0,this}_removeFromParentsChildList(e){delete this._children[this._parent[e]][e]}parent(t){if(this._isCompound){var n=this._parent[t];if(n!==e)return n}}children(t=e){if(this._isCompound){var n=this._children[t];if(n)return Object.keys(n)}else{if(t===e)return this.nodes();if(this.hasNode(t))return[]}}predecessors(e){var t=this._preds[e];if(t)return Object.keys(t)}successors(e){var t=this._sucs[e];if(t)return Object.keys(t)}neighbors(e){var t=this.predecessors(e);if(t){const o=new Set(t);for(var n of this.successors(e))o.add(n);return Array.from(o.values())}}isLeaf(e){return 0===(this.isDirected()?this.successors(e):this.neighbors(e)).length}filterNodes(e){var t=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});t.setGraph(this.graph());var n=this;Object.entries(this._nodes).forEach(function([n,o]){e(n)&&t.setNode(n,o)}),Object.values(this._edgeObjs).forEach(function(e){t.hasNode(e.v)&&t.hasNode(e.w)&&t.setEdge(e,n.edge(e))});var o={};function r(e){var i=n.parent(e);return void 0===i||t.hasNode(i)?(o[e]=i,i):i in o?o[i]:r(i)}return this._isCompound&&t.nodes().forEach(e=>t.setParent(e,r(e))),t}setDefaultEdgeLabel(e){return this._defaultEdgeLabelFn=e,"function"!=typeof e&&(this._defaultEdgeLabelFn=()=>e),this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(e,t){var n=this,o=arguments;return e.reduce(function(e,r){return o.length>1?n.setEdge(e,r,t):n.setEdge(e,r),r}),this}setEdge(){var e,n,r,i,a=!1,s=arguments[0];"object"==typeof s&&null!==s&&"v"in s?(e=s.v,n=s.w,r=s.name,2===arguments.length&&(i=arguments[1],a=!0)):(e=s,n=arguments[1],r=arguments[3],arguments.length>2&&(i=arguments[2],a=!0)),e=""+e,n=""+n,void 0!==r&&(r=""+r);var l=o(this._isDirected,e,n,r);if(Object.hasOwn(this._edgeLabels,l))return a&&(this._edgeLabels[l]=i),this;if(void 0!==r&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(e),this.setNode(n),this._edgeLabels[l]=a?i:this._defaultEdgeLabelFn(e,n,r);var c=function(e,t,n,o){var r=""+t,i=""+n;if(!e&&r>i){var a=r;r=i,i=a}var s={v:r,w:i};o&&(s.name=o);return s}(this._isDirected,e,n,r);return e=c.v,n=c.w,Object.freeze(c),this._edgeObjs[l]=c,t(this._preds[n],e),t(this._sucs[e],n),this._in[n][l]=c,this._out[e][l]=c,this._edgeCount++,this}edge(e,t,n){var i=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return this._edgeLabels[i]}edgeAsObj(){const e=this.edge(...arguments);return"object"!=typeof e?{label:e}:e}hasEdge(e,t,n){var i=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,n);return Object.hasOwn(this._edgeLabels,i)}removeEdge(e,t,i){var a=1===arguments.length?r(this._isDirected,arguments[0]):o(this._isDirected,e,t,i),s=this._edgeObjs[a];return s&&(e=s.v,t=s.w,delete this._edgeLabels[a],delete this._edgeObjs[a],n(this._preds[t],e),n(this._sucs[e],t),delete this._in[t][a],delete this._out[e][a],this._edgeCount--),this}inEdges(e,t){var n=this._in[e];if(n){var o=Object.values(n);return t?o.filter(e=>e.v===t):o}}outEdges(e,t){var n=this._out[e];if(n){var o=Object.values(n);return t?o.filter(e=>e.w===t):o}}nodeEdges(e,t){var n=this.inEdges(e,t);if(n)return n.concat(this.outEdges(e,t))}},mc}function od(){return xc?wc:(xc=1,wc={Graph:nd(),version:bc?vc:(bc=1,vc="2.2.4")})}function rd(){if(Ec)return _c;Ec=1;var e=nd();function t(e){return e.nodes().map(function(t){var n=e.node(t),o=e.parent(t),r={v:t};return void 0!==n&&(r.value=n),void 0!==o&&(r.parent=o),r})}function n(e){return e.edges().map(function(t){var n=e.edge(t),o={v:t.v,w:t.w};return void 0!==t.name&&(o.name=t.name),void 0!==n&&(o.value=n),o})}return _c={write:function(e){var o={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:t(e),edges:n(e)};void 0!==e.graph()&&(o.value=structuredClone(e.graph()));return o},read:function(t){var n=new e(t.options).setGraph(t.value);return t.nodes.forEach(function(e){n.setNode(e.v,e.value),e.parent&&n.setParent(e.v,e.parent)}),t.edges.forEach(function(e){n.setEdge({v:e.v,w:e.w,name:e.name},e.value)}),n}}}function id(){if(Sc)return kc;return Sc=1,kc=function(e){var t,n={},o=[];function r(o){Object.hasOwn(n,o)||(n[o]=!0,t.push(o),e.successors(o).forEach(r),e.predecessors(o).forEach(r))}return e.nodes().forEach(function(e){t=[],r(e),t.length&&o.push(t)}),o},kc}function ad(){if(Cc)return Oc;Cc=1;return Oc=class{_arr=[];_keyIndices={};size(){return this._arr.length}keys(){return this._arr.map(function(e){return e.key})}has(e){return Object.hasOwn(this._keyIndices,e)}priority(e){var t=this._keyIndices[e];if(void 0!==t)return this._arr[t].priority}min(){if(0===this.size())throw new Error("Queue underflow");return this._arr[0].key}add(e,t){var n=this._keyIndices;if(e=String(e),!Object.hasOwn(n,e)){var o=this._arr,r=o.length;return n[e]=r,o.push({key:e,priority:t}),this._decrease(r),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);var e=this._arr.pop();return delete this._keyIndices[e.key],this._heapify(0),e.key}decrease(e,t){var n=this._keyIndices[e];if(t>this._arr[n].priority)throw new Error("New priority is greater than current priority. Key: "+e+" Old: "+this._arr[n].priority+" New: "+t);this._arr[n].priority=t,this._decrease(n)}_heapify(e){var t=this._arr,n=2*e,o=n+1,r=e;n<t.length&&(r=t[n].priority<t[r].priority?n:r,o<t.length&&(r=t[o].priority<t[r].priority?o:r),r!==e&&(this._swap(e,r),this._heapify(r)))}_decrease(e){for(var t,n=this._arr,o=n[e].priority;0!==e&&!(n[t=e>>1].priority<o);)this._swap(e,t),e=t}_swap(e,t){var n=this._arr,o=this._keyIndices,r=n[e],i=n[t];n[e]=i,n[t]=r,o[i.key]=e,o[r.key]=t}},Oc}function sd(){if(Mc)return Nc;Mc=1;var e=ad();Nc=function(n,o,r,i){return function(t,n,o,r){var i,a,s={},l=new e,c=function(e){var t=e.v!==i?e.v:e.w,n=s[t],r=o(e),c=a.distance+r;if(r<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+e+" Weight: "+r);c<n.distance&&(n.distance=c,n.predecessor=i,l.decrease(t,c))};t.nodes().forEach(function(e){var t=e===n?0:Number.POSITIVE_INFINITY;s[e]={distance:t},l.add(e,t)});for(;l.size()>0&&(i=l.removeMin(),(a=s[i]).distance!==Number.POSITIVE_INFINITY);)r(i).forEach(c);return s}(n,String(o),r||t,i||function(e){return n.outEdges(e)})};var t=()=>1;return Nc}function ld(){if(jc)return Pc;jc=1;var e=sd();return Pc=function(t,n,o){return t.nodes().reduce(function(r,i){return r[i]=e(t,i,n,o),r},{})},Pc}function cd(){if(Tc)return Ic;return Tc=1,Ic=function(e){var t=0,n=[],o={},r=[];function i(a){var s=o[a]={onStack:!0,lowlink:t,index:t++};if(n.push(a),e.successors(a).forEach(function(e){Object.hasOwn(o,e)?o[e].onStack&&(s.lowlink=Math.min(s.lowlink,o[e].index)):(i(e),s.lowlink=Math.min(s.lowlink,o[e].lowlink))}),s.lowlink===s.index){var l,c=[];do{l=n.pop(),o[l].onStack=!1,c.push(l)}while(a!==l);r.push(c)}}return e.nodes().forEach(function(e){Object.hasOwn(o,e)||i(e)}),r},Ic}function ud(){if(Rc)return zc;Rc=1;var e=cd();return zc=function(t){return e(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}}function dd(){if(Ac)return Dc;Ac=1,Dc=function(t,n,o){return function(e,t,n){var o={},r=e.nodes();return r.forEach(function(e){o[e]={},o[e][e]={distance:0},r.forEach(function(t){e!==t&&(o[e][t]={distance:Number.POSITIVE_INFINITY})}),n(e).forEach(function(n){var r=n.v===e?n.w:n.v,i=t(n);o[e][r]={distance:i,predecessor:e}})}),r.forEach(function(e){var t=o[e];r.forEach(function(n){var i=o[n];r.forEach(function(n){var o=i[e],r=t[n],a=i[n],s=o.distance+r.distance;s<a.distance&&(a.distance=s,a.predecessor=r.predecessor)})})}),o}(t,n||e,o||function(e){return t.outEdges(e)})};var e=()=>1;return Dc}function fd(){if(Vc)return Lc;function e(e){var n={},o={},r=[];if(e.sinks().forEach(function i(a){if(Object.hasOwn(o,a))throw new t;Object.hasOwn(n,a)||(o[a]=!0,n[a]=!0,e.predecessors(a).forEach(i),delete o[a],r.push(a))}),Object.keys(n).length!==e.nodeCount())throw new t;return r}Vc=1;class t extends Error{constructor(){super(...arguments)}}return Lc=e,e.CycleException=t,Lc}function hd(){if($c)return Bc;$c=1;var e=fd();return Bc=function(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}}function pd(){if(Fc)return Hc;function e(e,t,o,r){for(var i=[[e,!1]];i.length>0;){var a=i.pop();a[1]?r.push(a[0]):Object.hasOwn(o,a[0])||(o[a[0]]=!0,i.push([a[0],!0]),n(t(a[0]),e=>i.push([e,!1])))}}function t(e,t,o,r){for(var i=[e];i.length>0;){var a=i.pop();Object.hasOwn(o,a)||(o[a]=!0,r.push(a),n(t(a),e=>i.push(e)))}}function n(e,t){for(var n=e.length;n--;)t(e[n],n,e);return e}return Fc=1,Hc=function(n,o,r){Array.isArray(o)||(o=[o]);var i=n.isDirected()?e=>n.successors(e):e=>n.neighbors(e),a="post"===r?e:t,s=[],l={};return o.forEach(e=>{if(!n.hasNode(e))throw new Error("Graph does not have node: "+e);a(e,i,l,s)}),s},Hc}function gd(){if(Zc)return Yc;Zc=1;var e=pd();return Yc=function(t,n){return e(t,n,"post")}}function md(){if(Xc)return qc;Xc=1;var e=pd();return qc=function(t,n){return e(t,n,"pre")}}function yd(){if(Gc)return Wc;Gc=1;var e=nd(),t=ad();return Wc=function(n,o){var r,i=new e,a={},s=new t;function l(e){var t=e.v===r?e.w:e.v,n=s.priority(t);if(void 0!==n){var i=o(e);i<n&&(a[t]=r,s.decrease(t,i))}}if(0===n.nodeCount())return i;n.nodes().forEach(function(e){s.add(e,Number.POSITIVE_INFINITY),i.setNode(e)}),s.decrease(n.nodes()[0],0);var c=!1;for(;s.size()>0;){if(r=s.removeMin(),Object.hasOwn(a,r))i.setEdge(r,a[r]);else{if(c)throw new Error("Input graph is not connected: "+n);c=!0}n.nodeEdges(r).forEach(l)}return i},Wc}function vd(){if(Jc)return Qc;Jc=1;var e=od();return Qc={Graph:e.Graph,json:rd(),alg:Uc?Kc:(Uc=1,Kc={components:id(),dijkstra:sd(),dijkstraAll:ld(),findCycles:ud(),floydWarshall:dd(),isAcyclic:hd(),postorder:gd(),preorder:md(),prim:yd(),tarjan:cd(),topsort:fd()}),version:e.version}}function bd(){if(ou)return nu;ou=1;let e=vd().Graph,t=function(){if(tu)return eu;function e(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function t(e,t){if("_next"!==e&&"_prev"!==e)return t}return tu=1,eu=class{constructor(){let e={};e._next=e._prev=e,this._sentinel=e}dequeue(){let t=this._sentinel,n=t._prev;if(n!==t)return e(n),n}enqueue(t){let n=this._sentinel;t._prev&&t._next&&e(t),t._next=n._next,n._next._prev=t,n._next=t,t._prev=n}toString(){let e=[],n=this._sentinel,o=n._prev;for(;o!==n;)e.push(JSON.stringify(o,t)),o=o._prev;return"["+e.join(", ")+"]"}}}();nu=function(i,a){if(i.nodeCount()<=1)return[];let s=function(n,o){let i=new e,a=0,s=0;n.nodes().forEach(e=>{i.setNode(e,{v:e,in:0,out:0})}),n.edges().forEach(e=>{let t=i.edge(e.v,e.w)||0,n=o(e),r=t+n;i.setEdge(e.v,e.w,r),s=Math.max(s,i.node(e.v).out+=n),a=Math.max(a,i.node(e.w).in+=n)});let l=function(e){const t=[];for(let n=0;n<e;n++)t.push(n);return t}(s+a+3).map(()=>new t),c=a+1;return i.nodes().forEach(e=>{r(l,c,i.node(e))}),{graph:i,buckets:l,zeroIdx:c}}(i,a||n);return function(e,t,n){let r,i=[],a=t[t.length-1],s=t[0];for(;e.nodeCount();){for(;r=s.dequeue();)o(e,t,n,r);for(;r=a.dequeue();)o(e,t,n,r);if(e.nodeCount())for(let a=t.length-2;a>0;--a)if(r=t[a].dequeue(),r){i=i.concat(o(e,t,n,r,!0));break}}return i}(s.graph,s.buckets,s.zeroIdx).flatMap(e=>i.outEdges(e.v,e.w))};let n=()=>1;function o(e,t,n,o,i){let a=i?[]:void 0;return e.inEdges(o.v).forEach(o=>{let s=e.edge(o),l=e.node(o.v);i&&a.push({v:o.v,w:o.w}),l.out-=s,r(t,n,l)}),e.outEdges(o.v).forEach(o=>{let i=e.edge(o),a=o.w,s=e.node(a);s.in-=i,r(t,n,s)}),e.removeNode(o.v),a}function r(e,t,n){n.out?n.in?e[n.out-n.in+t].enqueue(n):e[e.length-1].enqueue(n):e[0].enqueue(n)}return nu}function wd(){if(iu)return ru;iu=1;let e=vd().Graph;function t(e,t,n,o){for(var r=o;e.hasNode(r);)r=a(o);return n.dummy=t,e.setNode(r,n),r}ru={addBorderNode:function(e,n,o,r){let i={width:0,height:0};arguments.length>=4&&(i.rank=o,i.order=r);return t(e,"border",i,n)},addDummyNode:t,applyWithChunking:o,asNonCompoundGraph:function(t){let n=new e({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(e=>{t.children(e).length||n.setNode(e,t.node(e))}),t.edges().forEach(e=>{n.setEdge(e,t.edge(e))}),n},buildLayerMatrix:function(e){let t=s(r(e)+1).map(()=>[]);return e.nodes().forEach(n=>{let o=e.node(n),r=o.rank;void 0!==r&&(t[r][o.order]=n)}),t},intersectRect:function(e,t){let n,o,r=e.x,i=e.y,a=t.x-r,s=t.y-i,l=e.width/2,c=e.height/2;if(!a&&!s)throw new Error("Not possible to find intersection inside of the rectangle");Math.abs(s)*l>Math.abs(a)*c?(s<0&&(c=-c),n=c*a/s,o=c):(a<0&&(l=-l),n=l,o=l*s/a);return{x:r+n,y:i+o}},mapValues:function(e,t){let n=t;"string"==typeof t&&(n=e=>e[t]);return Object.entries(e).reduce((e,[t,o])=>(e[t]=n(o,t),e),{})},maxRank:r,normalizeRanks:function(e){let t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MAX_VALUE:n}),n=o(Math.min,t);e.nodes().forEach(t=>{let o=e.node(t);Object.hasOwn(o,"rank")&&(o.rank-=n)})},notime:function(e,t){return t()},partition:function(e,t){let n={lhs:[],rhs:[]};return e.forEach(e=>{t(e)?n.lhs.push(e):n.rhs.push(e)}),n},pick:function(e,t){const n={};for(const o of t)void 0!==e[o]&&(n[o]=e[o]);return n},predecessorWeights:function(e){let t=e.nodes().map(t=>{let n={};return e.inEdges(t).forEach(t=>{n[t.v]=(n[t.v]||0)+e.edge(t).weight}),n});return l(e.nodes(),t)},range:s,removeEmptyRanks:function(e){let t=e.nodes().map(t=>e.node(t).rank),n=o(Math.min,t),r=[];e.nodes().forEach(t=>{let o=e.node(t).rank-n;r[o]||(r[o]=[]),r[o].push(t)});let i=0,a=e.graph().nodeRankFactor;Array.from(r).forEach((t,n)=>{void 0===t&&n%a!==0?--i:void 0!==t&&i&&t.forEach(t=>e.node(t).rank+=i)})},simplify:function(t){let n=(new e).setGraph(t.graph());return t.nodes().forEach(e=>n.setNode(e,t.node(e))),t.edges().forEach(e=>{let o=n.edge(e.v,e.w)||{weight:0,minlen:1},r=t.edge(e);n.setEdge(e.v,e.w,{weight:o.weight+r.weight,minlen:Math.max(o.minlen,r.minlen)})}),n},successorWeights:function(e){let t=e.nodes().map(t=>{let n={};return e.outEdges(t).forEach(t=>{n[t.w]=(n[t.w]||0)+e.edge(t).weight}),n});return l(e.nodes(),t)},time:function(e,t){let n=Date.now();try{return t()}finally{console.log(e+" time: "+(Date.now()-n)+"ms")}},uniqueId:a,zipObject:l};const n=65535;function o(e,t){if(t.length>n){const o=function(e,t=n){const o=[];for(let n=0;n<e.length;n+=t){const r=e.slice(n,n+t);o.push(r)}return o}(t);return e.apply(null,o.map(t=>e.apply(null,t)))}return e.apply(null,t)}function r(e){const t=e.nodes().map(t=>{let n=e.node(t).rank;return void 0===n?Number.MIN_VALUE:n});return o(Math.max,t)}let i=0;function a(e){return e+""+ ++i}function s(e,t,n=1){null==t&&(t=e,e=0);let o=e=>e<t;n<0&&(o=e=>t<e);const r=[];for(let t=e;o(t);t+=n)r.push(t);return r}function l(e,t){return e.reduce((e,n,o)=>(e[n]=t[o],e),{})}return ru}function xd(){if(su)return au;su=1;let e=bd(),t=wd().uniqueId;return au={run:function(n){("greedy"===n.graph().acyclicer?e(n,function(e){return t=>e.edge(t).weight}(n)):function(e){let t=[],n={},o={};function r(i){Object.hasOwn(o,i)||(o[i]=!0,n[i]=!0,e.outEdges(i).forEach(e=>{Object.hasOwn(n,e.w)?t.push(e):r(e.w)}),delete n[i])}return e.nodes().forEach(r),t}(n)).forEach(e=>{let o=n.edge(e);n.removeEdge(e),o.forwardName=e.name,o.reversed=!0,n.setEdge(e.w,e.v,o,t("rev"))})},undo:function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.reversed){e.removeEdge(t);let o=n.forwardName;delete n.reversed,delete n.forwardName,e.setEdge(t.w,t.v,n,o)}})}},au}function _d(){if(cu)return lu;cu=1;let e=wd();return lu={run:function(t){t.graph().dummyChains=[],t.edges().forEach(n=>function(t,n){let o,r,i,a=n.v,s=t.node(a).rank,l=n.w,c=t.node(l).rank,u=n.name,d=t.edge(n),f=d.labelRank;if(c===s+1)return;for(t.removeEdge(n),i=0,++s;s<c;++i,++s)d.points=[],r={width:0,height:0,edgeLabel:d,edgeObj:n,rank:s},o=e.addDummyNode(t,"edge",r,"_d"),s===f&&(r.width=d.width,r.height=d.height,r.dummy="edge-label",r.labelpos=d.labelpos),t.setEdge(a,o,{weight:d.weight},u),0===i&&t.graph().dummyChains.push(o),a=o;t.setEdge(a,l,{weight:d.weight},u)}(t,n))},undo:function(e){e.graph().dummyChains.forEach(t=>{let n,o=e.node(t),r=o.edgeLabel;for(e.setEdge(o.edgeObj,r);o.dummy;)n=e.successors(t)[0],e.removeNode(t),r.points.push({x:o.x,y:o.y}),"edge-label"===o.dummy&&(r.x=o.x,r.y=o.y,r.width=o.width,r.height=o.height),t=n,o=e.node(t)})}},lu}function Ed(){if(du)return uu;du=1;const{applyWithChunking:e}=wd();return uu={longestPath:function(t){var n={};t.sources().forEach(function o(r){var i=t.node(r);if(Object.hasOwn(n,r))return i.rank;n[r]=!0;let a=t.outEdges(r).map(e=>null==e?Number.POSITIVE_INFINITY:o(e.w)-t.edge(e).minlen);var s=e(Math.min,a);return s===Number.POSITIVE_INFINITY&&(s=0),i.rank=s})},slack:function(e,t){return e.node(t.w).rank-e.node(t.v).rank-e.edge(t).minlen}},uu}function kd(){if(hu)return fu;hu=1;var e=vd().Graph,t=Ed().slack;function n(e,n){return e.nodes().forEach(function o(r){n.nodeEdges(r).forEach(i=>{var a=i.v,s=r===a?i.w:a;e.hasNode(s)||t(n,i)||(e.setNode(s,{}),e.setEdge(r,s,{}),o(s))})}),e.nodeCount()}function o(e,n){return n.edges().reduce((o,r)=>{let i=Number.POSITIVE_INFINITY;return e.hasNode(r.v)!==e.hasNode(r.w)&&(i=t(n,r)),i<o[0]?[i,r]:o},[Number.POSITIVE_INFINITY,null])[1]}function r(e,t,n){e.nodes().forEach(e=>t.node(e).rank+=n)}return fu=function(i){var a,s,l=new e({directed:!1}),c=i.nodes()[0],u=i.nodeCount();l.setNode(c,{});for(;n(l,i)<u;)a=o(l,i),s=l.hasNode(a.v)?t(i,a):-t(i,a),r(l,i,s);return l},fu}function Sd(){if(gu)return pu;gu=1;var e=kd(),t=Ed().slack,n=Ed().longestPath,o=vd().alg.preorder,r=vd().alg.postorder,i=wd().simplify;function a(t){t=i(t),n(t);var o,r=e(t);for(c(r),s(r,t);o=d(r);)h(r,t,o,f(r,t,o))}function s(e,t){var n=r(e,e.nodes());(n=n.slice(0,n.length-1)).forEach(n=>function(e,t,n){var o=e.node(n),r=o.parent;e.edge(n,r).cutvalue=l(e,t,n)}(e,t,n))}function l(e,t,n){var o=e.node(n).parent,r=!0,i=t.edge(n,o),a=0;return i||(r=!1,i=t.edge(o,n)),a=i.weight,t.nodeEdges(n).forEach(i=>{var s=i.v===n,l=s?i.w:i.v;if(l!==o){var c=s===r,u=t.edge(i).weight;if(a+=c?u:-u,function(e,t,n){return e.hasEdge(t,n)}(e,n,l)){var d=e.edge(n,l).cutvalue;a+=c?-d:d}}}),a}function c(e,t){arguments.length<2&&(t=e.nodes()[0]),u(e,{},1,t)}function u(e,t,n,o,r){var i=n,a=e.node(o);return t[o]=!0,e.neighbors(o).forEach(r=>{Object.hasOwn(t,r)||(n=u(e,t,n,r,o))}),a.low=i,a.lim=n++,r?a.parent=r:delete a.parent,n}function d(e){return e.edges().find(t=>e.edge(t).cutvalue<0)}function f(e,n,o){var r=o.v,i=o.w;n.hasEdge(r,i)||(r=o.w,i=o.v);var a=e.node(r),s=e.node(i),l=a,c=!1;a.lim>s.lim&&(l=s,c=!0);var u=n.edges().filter(t=>c===p(e,e.node(t.v),l)&&c!==p(e,e.node(t.w),l));return u.reduce((e,o)=>t(n,o)<t(n,e)?o:e)}function h(e,t,n,r){var i=n.v,a=n.w;e.removeEdge(i,a),e.setEdge(r.v,r.w,{}),c(e),s(e,t),function(e,t){var n=e.nodes().find(e=>!t.node(e).parent),r=o(e,n);(r=r.slice(1)).forEach(n=>{var o=e.node(n).parent,r=t.edge(n,o),i=!1;r||(r=t.edge(o,n),i=!0),t.node(n).rank=t.node(o).rank+(i?r.minlen:-r.minlen)})}(e,t)}function p(e,t,n){return n.low<=t.lim&&t.lim<=n.lim}return pu=a,a.initLowLimValues=c,a.initCutValues=s,a.calcCutValue=l,a.leaveEdge=d,a.enterEdge=f,a.exchangeEdges=h,pu}function Od(){if(yu)return mu;yu=1;var e=Ed().longestPath,t=kd(),n=Sd();mu=function(n){var i=n.graph().ranker;if(i instanceof Function)return i(n);switch(n.graph().ranker){case"network-simplex":default:r(n);break;case"tight-tree":!function(n){e(n),t(n)}(n);break;case"longest-path":o(n);case"none":}};var o=e;function r(e){n(e)}return mu}function Cd(){if(bu)return vu;return bu=1,vu=function(e){let t=function(e){let t={},n=0;function o(r){let i=n;e.children(r).forEach(o),t[r]={low:i,lim:n++}}return e.children().forEach(o),t}(e);e.graph().dummyChains.forEach(n=>{let o=e.node(n),r=o.edgeObj,i=function(e,t,n,o){let r,i,a=[],s=[],l=Math.min(t[n].low,t[o].low),c=Math.max(t[n].lim,t[o].lim);r=n;do{r=e.parent(r),a.push(r)}while(r&&(t[r].low>l||c>t[r].lim));i=r,r=o;for(;(r=e.parent(r))!==i;)s.push(r);return{path:a.concat(s.reverse()),lca:i}}(e,t,r.v,r.w),a=i.path,s=i.lca,l=0,c=a[l],u=!0;for(;n!==r.w;){if(o=e.node(n),u){for(;(c=a[l])!==s&&e.node(c).maxRank<o.rank;)l++;c===s&&(u=!1)}if(!u){for(;l<a.length-1&&e.node(c=a[l+1]).minRank<=o.rank;)l++;c=a[l]}e.setParent(n,c),n=e.successors(n)[0]}})},vu}function Nd(){if(xu)return wu;xu=1;let e=wd();function t(n,o,r,i,a,s,l){let c=n.children(l);if(!c.length)return void(l!==o&&n.setEdge(o,l,{weight:0,minlen:r}));let u=e.addBorderNode(n,"_bt"),d=e.addBorderNode(n,"_bb"),f=n.node(l);n.setParent(u,l),f.borderTop=u,n.setParent(d,l),f.borderBottom=d,c.forEach(e=>{t(n,o,r,i,a,s,e);let c=n.node(e),f=c.borderTop?c.borderTop:e,h=c.borderBottom?c.borderBottom:e,p=c.borderTop?i:2*i,g=f!==h?1:a-s[l]+1;n.setEdge(u,f,{weight:p,minlen:g,nestingEdge:!0}),n.setEdge(h,d,{weight:p,minlen:g,nestingEdge:!0})}),n.parent(l)||n.setEdge(o,u,{weight:0,minlen:a+s[l]})}return wu={run:function(n){let o=e.addDummyNode(n,"root",{},"_root"),r=function(e){var t={};function n(o,r){var i=e.children(o);i&&i.length&&i.forEach(e=>n(e,r+1)),t[o]=r}return e.children().forEach(e=>n(e,1)),t}(n),i=Object.values(r),a=e.applyWithChunking(Math.max,i)-1,s=2*a+1;n.graph().nestingRoot=o,n.edges().forEach(e=>n.edge(e).minlen*=s);let l=function(e){return e.edges().reduce((t,n)=>t+e.edge(n).weight,0)}(n)+1;n.children().forEach(e=>t(n,o,s,l,a,r,e)),n.graph().nodeRankFactor=s},cleanup:function(e){var t=e.graph();e.removeNode(t.nestingRoot),delete t.nestingRoot,e.edges().forEach(t=>{e.edge(t).nestingEdge&&e.removeEdge(t)})}},wu}function Md(){if(Su)return ku;function e(e){e.nodes().forEach(n=>t(e.node(n))),e.edges().forEach(n=>t(e.edge(n)))}function t(e){let t=e.width;e.width=e.height,e.height=t}function n(e){e.y=-e.y}function o(e){let t=e.x;e.x=e.y,e.y=t}return Su=1,ku={adjust:function(t){let n=t.graph().rankdir.toLowerCase();"lr"!==n&&"rl"!==n||e(t)},undo:function(t){let r=t.graph().rankdir.toLowerCase();"bt"!==r&&"rl"!==r||function(e){e.nodes().forEach(t=>n(e.node(t))),e.edges().forEach(t=>{let o=e.edge(t);o.points.forEach(n),Object.hasOwn(o,"y")&&n(o)})}(t);"lr"!==r&&"rl"!==r||(!function(e){e.nodes().forEach(t=>o(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);n.points.forEach(o),Object.hasOwn(n,"x")&&o(n)})}(t),e(t))}},ku}function Pd(){if(Tu)return Iu;Tu=1;let e=wd();return Iu=function(t,n){let o={};return t.forEach((e,t)=>{let n=o[e.v]={indegree:0,in:[],out:[],vs:[e.v],i:t};void 0!==e.barycenter&&(n.barycenter=e.barycenter,n.weight=e.weight)}),n.edges().forEach(e=>{let t=o[e.v],n=o[e.w];void 0!==t&&void 0!==n&&(n.indegree++,t.out.push(o[e.w]))}),function(t){let n=[];function o(e){return t=>{t.merged||(void 0===t.barycenter||void 0===e.barycenter||t.barycenter>=e.barycenter)&&function(e,t){let n=0,o=0;e.weight&&(n+=e.barycenter*e.weight,o+=e.weight);t.weight&&(n+=t.barycenter*t.weight,o+=t.weight);e.vs=t.vs.concat(e.vs),e.barycenter=n/o,e.weight=o,e.i=Math.min(t.i,e.i),t.merged=!0}(e,t)}}function r(e){return n=>{n.in.push(e),0===--n.indegree&&t.push(n)}}for(;t.length;){let e=t.pop();n.push(e),e.in.reverse().forEach(o(e)),e.out.forEach(r(e))}return n.filter(e=>!e.merged).map(t=>e.pick(t,["vs","i","barycenter","weight"]))}(Object.values(o).filter(e=>!e.indegree))}}function jd(){if(Au)return Du;Au=1;let e=(ju||(ju=1,Pu=function(e,t=[]){return t.map(t=>{let n=e.inEdges(t);if(n.length){let o=n.reduce((t,n)=>{let o=e.edge(n),r=e.node(n.v);return{sum:t.sum+o.weight*r.order,weight:t.weight+o.weight}},{sum:0,weight:0});return{v:t,barycenter:o.sum/o.weight,weight:o.weight}}return{v:t}})}),Pu),t=Pd(),n=function(){if(Ru)return zu;Ru=1;let e=wd();function t(e,t,n){let o;for(;t.length&&(o=t[t.length-1]).i<=n;)t.pop(),e.push(o.vs),n++;return n}return zu=function(n,o){let r=e.partition(n,e=>Object.hasOwn(e,"barycenter")),i=r.lhs,a=r.rhs.sort((e,t)=>t.i-e.i),s=[],l=0,c=0,u=0;var d;i.sort((d=!!o,(e,t)=>e.barycenter<t.barycenter?-1:e.barycenter>t.barycenter?1:d?t.i-e.i:e.i-t.i)),u=t(s,a,u),i.forEach(e=>{u+=e.vs.length,s.push(e.vs),l+=e.barycenter*e.weight,c+=e.weight,u=t(s,a,u)});let f={vs:s.flat(!0)};return c&&(f.barycenter=l/c,f.weight=c),f}}();return Du=function o(r,i,a,s){let l=r.children(i),c=r.node(i),u=c?c.borderLeft:void 0,d=c?c.borderRight:void 0,f={};u&&(l=l.filter(e=>e!==u&&e!==d));let h=e(r,l);h.forEach(e=>{if(r.children(e.v).length){let i=o(r,e.v,a,s);f[e.v]=i,Object.hasOwn(i,"barycenter")&&(n=i,void 0!==(t=e).barycenter?(t.barycenter=(t.barycenter*t.weight+n.barycenter*n.weight)/(t.weight+n.weight),t.weight+=n.weight):(t.barycenter=n.barycenter,t.weight=n.weight))}var t,n});let p=t(h,a);!function(e,t){e.forEach(e=>{e.vs=e.vs.flatMap(e=>t[e]?t[e].vs:e)})}(p,f);let g=n(p,s);if(u&&(g.vs=[u,g.vs,d].flat(!0),r.predecessors(u).length)){let e=r.node(r.predecessors(u)[0]),t=r.node(r.predecessors(d)[0]);Object.hasOwn(g,"barycenter")||(g.barycenter=0,g.weight=0),g.barycenter=(g.barycenter*g.weight+e.order+t.order)/(g.weight+2),g.weight+=2}return g},Du}function Id(){if(Vu)return Lu;Vu=1;let e=vd().Graph,t=wd();return Lu=function(n,o,r){let i=function(e){var n;for(;e.hasNode(n=t.uniqueId("_root")););return n}(n),a=new e({compound:!0}).setGraph({root:i}).setDefaultNodeLabel(e=>n.node(e));return n.nodes().forEach(e=>{let t=n.node(e),s=n.parent(e);(t.rank===o||t.minRank<=o&&o<=t.maxRank)&&(a.setNode(e),a.setParent(e,s||i),n[r](e).forEach(t=>{let o=t.v===e?t.w:t.v,r=a.edge(o,e),i=void 0!==r?r.weight:0;a.setEdge(o,e,{weight:n.edge(t).weight+i})}),Object.hasOwn(t,"minRank")&&a.setNode(e,{borderLeft:t.borderLeft[o],borderRight:t.borderRight[o]}))}),a},Lu}function Td(){if(Fu)return Hu;Fu=1;let e=function(){if(Cu)return Ou;Cu=1;let e=wd();return Ou=function(t){let n={},o=t.nodes().filter(e=>!t.children(e).length),r=o.map(e=>t.node(e).rank),i=e.applyWithChunking(Math.max,r),a=e.range(i+1).map(()=>[]);return o.sort((e,n)=>t.node(e).rank-t.node(n).rank).forEach(function e(o){if(n[o])return;n[o]=!0;let r=t.node(o);a[r.rank].push(o),t.successors(o).forEach(e)}),a},Ou}(),t=function(){if(Mu)return Nu;Mu=1;let e=wd().zipObject;function t(t,n,o){let r=e(o,o.map((e,t)=>t)),i=n.flatMap(e=>t.outEdges(e).map(e=>({pos:r[e.w],weight:t.edge(e).weight})).sort((e,t)=>e.pos-t.pos)),a=1;for(;a<o.length;)a<<=1;let s=2*a-1;a-=1;let l=new Array(s).fill(0),c=0;return i.forEach(e=>{let t=e.pos+a;l[t]+=e.weight;let n=0;for(;t>0;)t%2&&(n+=l[t+1]),t=t-1>>1,l[t]+=e.weight;c+=e.weight*n}),c}return Nu=function(e,n){let o=0;for(let r=1;r<n.length;++r)o+=t(e,n[r-1],n[r]);return o},Nu}(),n=jd(),o=Id(),r=($u||($u=1,Bu=function(e,t,n){let o,r={};n.forEach(n=>{let i,a,s=e.parent(n);for(;s;){if(i=e.parent(s),i?(a=r[i],r[i]=s):(a=o,o=s),a&&a!==s)return void t.setEdge(a,s);s=i}})}),Bu),i=vd().Graph,a=wd();function s(e,t,n){return t.map(function(t){return o(e,t,n)})}function l(e,t){let o=new i;e.forEach(function(e){let i=e.graph().root,a=n(e,i,o,t);a.vs.forEach((t,n)=>e.node(t).order=n),r(e,o,a.vs)})}function c(e,t){Object.values(t).forEach(t=>t.forEach((t,n)=>e.node(t).order=n))}return Hu=function n(o,r){if(r&&"function"==typeof r.customOrder)return void r.customOrder(o,n);let i=a.maxRank(o),u=s(o,a.range(1,i+1),"inEdges"),d=s(o,a.range(i-1,-1,-1),"outEdges"),f=e(o);if(c(o,f),r&&r.disableOptimalOrderHeuristic)return;let h,p=Number.POSITIVE_INFINITY;for(let e=0,n=0;n<4;++e,++n){l(e%2?u:d,e%4>=2),f=a.buildLayerMatrix(o);let r=t(o,f);r<p&&(n=0,h=Object.assign({},f),p=r)}c(o,h)},Hu}function zd(){if(Zu)return Yu;Zu=1;let e=vd().Graph,t=wd();function n(e,t){let n={};return t.length&&t.reduce(function(t,o){let i=0,a=0,s=t.length,l=o[o.length-1];return o.forEach((t,c)=>{let u=function(e,t){if(e.node(t).dummy)return e.predecessors(t).find(t=>e.node(t).dummy)}(e,t),d=u?e.node(u).order:s;(u||t===l)&&(o.slice(a,c+1).forEach(t=>{e.predecessors(t).forEach(o=>{let a=e.node(o),s=a.order;!(s<i||d<s)||a.dummy&&e.node(t).dummy||r(n,o,t)})}),a=c+1,i=d)}),o}),n}function o(e,n){let o={};function i(n,i,a,s,l){let c;t.range(i,a).forEach(t=>{c=n[t],e.node(c).dummy&&e.predecessors(c).forEach(t=>{let n=e.node(t);n.dummy&&(n.order<s||n.order>l)&&r(o,t,c)})})}return n.length&&n.reduce(function(t,n){let o,r=-1,a=0;return n.forEach((s,l)=>{if("border"===e.node(s).dummy){let t=e.predecessors(s);t.length&&(o=e.node(t[0]).order,i(n,a,l,r,o),a=l,r=o)}i(n,a,n.length,o,t.length)}),n}),o}function r(e,t,n){if(t>n){let e=t;t=n,n=e}let o=e[t];o||(e[t]=o={}),o[n]=!0}function i(e,t,n){if(t>n){let e=t;t=n,n=e}return!!e[t]&&Object.hasOwn(e[t],n)}function a(e,t,n,o){let r={},a={},s={};return t.forEach(e=>{e.forEach((e,t)=>{r[e]=e,a[e]=e,s[e]=t})}),t.forEach(e=>{let t=-1;e.forEach(e=>{let l=o(e);if(l.length){l=l.sort((e,t)=>s[e]-s[t]);let o=(l.length-1)/2;for(let c=Math.floor(o),u=Math.ceil(o);c<=u;++c){let o=l[c];a[e]===e&&t<s[o]&&!i(n,e,o)&&(a[o]=e,a[e]=r[e]=r[o],t=s[o])}}})}),{root:r,align:a}}function s(t,n,o,r,i){let a={},s=function(t,n,o,r){let i=new e,a=t.graph(),s=function(e,t,n){return(o,r,i)=>{let a,s=o.node(r),l=o.node(i),c=0;if(c+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":a=-s.width/2;break;case"r":a=s.width/2}if(a&&(c+=n?a:-a),a=0,c+=(s.dummy?t:e)/2,c+=(l.dummy?t:e)/2,c+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":a=l.width/2;break;case"r":a=-l.width/2}return a&&(c+=n?a:-a),a=0,c}}(a.nodesep,a.edgesep,r);return n.forEach(e=>{let n;e.forEach(e=>{let r=o[e];if(i.setNode(r),n){var a=o[n],l=i.edge(a,r);i.setEdge(a,r,Math.max(s(t,e,n),l||0))}n=e})}),i}(t,n,o,i),l=i?"borderLeft":"borderRight";function c(e,t){let n=s.nodes(),o=n.pop(),r={};for(;o;)r[o]?e(o):(r[o]=!0,n.push(o),n=n.concat(t(o))),o=n.pop()}return c(function(e){a[e]=s.inEdges(e).reduce((e,t)=>Math.max(e,a[t.v]+s.edge(t)),0)},s.predecessors.bind(s)),c(function(e){let n=s.outEdges(e).reduce((e,t)=>Math.min(e,a[t.w]-s.edge(t)),Number.POSITIVE_INFINITY),o=t.node(e);n!==Number.POSITIVE_INFINITY&&o.borderType!==l&&(a[e]=Math.max(a[e],n))},s.successors.bind(s)),Object.keys(r).forEach(e=>a[e]=a[o[e]]),a}function l(e,t){return Object.values(t).reduce((t,n)=>{let o=Number.NEGATIVE_INFINITY,r=Number.POSITIVE_INFINITY;Object.entries(n).forEach(([t,n])=>{let i=function(e,t){return e.node(t).width}(e,t)/2;o=Math.max(n+i,o),r=Math.min(n-i,r)});const i=o-r;return i<t[0]&&(t=[i,n]),t},[Number.POSITIVE_INFINITY,null])[1]}function c(e,n){let o=Object.values(n),r=t.applyWithChunking(Math.min,o),i=t.applyWithChunking(Math.max,o);["u","d"].forEach(o=>{["l","r"].forEach(a=>{let s=o+a,l=e[s];if(l===n)return;let c=Object.values(l),u=r-t.applyWithChunking(Math.min,c);"l"!==a&&(u=i-t.applyWithChunking(Math.max,c)),u&&(e[s]=t.mapValues(l,e=>e+u))})})}function u(e,n){return t.mapValues(e.ul,(t,o)=>{if(n)return e[n.toLowerCase()][o];{let t=Object.values(e).map(e=>e[o]).sort((e,t)=>e-t);return(t[1]+t[2])/2}})}return Yu={positionX:function(e){let r,i=t.buildLayerMatrix(e),d=Object.assign(n(e,i),o(e,i)),f={};["u","d"].forEach(n=>{r="u"===n?i:Object.values(i).reverse(),["l","r"].forEach(o=>{"r"===o&&(r=r.map(e=>Object.values(e).reverse()));let i=("u"===n?e.predecessors:e.successors).bind(e),l=a(e,r,d,i),c=s(e,r,l.root,l.align,"r"===o);"r"===o&&(c=t.mapValues(c,e=>-e)),f[n+o]=c})});let h=l(e,f);return c(f,h),u(f,e.graph().align)},findType1Conflicts:n,findType2Conflicts:o,addConflict:r,hasConflict:i,verticalAlignment:a,horizontalCompaction:s,alignCoordinates:c,findSmallestWidthAlignment:l,balance:u}}function Rd(){if(Xu)return qu;Xu=1;let e=wd(),t=zd().positionX;return qu=function(n){(function(t){let n=e.buildLayerMatrix(t),o=t.graph().ranksep,r=0;n.forEach(e=>{const n=e.reduce((e,n)=>{const o=t.node(n).height;return e>o?e:o},0);e.forEach(e=>t.node(e).y=r+n/2),r+=n+o})})(n=e.asNonCompoundGraph(n)),Object.entries(t(n)).forEach(([e,t])=>n.node(e).x=t)},qu}function Dd(){if(Gu)return Wu;Gu=1;let e=xd(),t=_d(),n=Od(),o=wd().normalizeRanks,r=Cd(),i=wd().removeEmptyRanks,a=Nd(),s=function(){if(Eu)return _u;Eu=1;let e=wd();function t(t,n,o,r,i,a){let s={width:0,height:0,rank:a,borderType:n},l=i[n][a-1],c=e.addDummyNode(t,"border",s,o);i[n][a]=c,t.setParent(c,r),l&&t.setEdge(l,c,{weight:1})}return _u=function(e){e.children().forEach(function n(o){let r=e.children(o),i=e.node(o);if(r.length&&r.forEach(n),Object.hasOwn(i,"minRank")){i.borderLeft=[],i.borderRight=[];for(let n=i.minRank,r=i.maxRank+1;n<r;++n)t(e,"borderLeft","_bl",o,i,n),t(e,"borderRight","_br",o,i,n)}})},_u}(),l=Md(),c=Td(),u=Rd(),d=wd(),f=vd().Graph;Wu=function(E,k){let S=k&&k.debugTiming?d.time:d.notime;S("layout",()=>{let O=S(" buildLayoutGraph",()=>function(e){let t=new f({multigraph:!0,compound:!0}),n=_(e.graph());return t.setGraph(Object.assign({},p,x(n,h),d.pick(n,g))),e.nodes().forEach(n=>{const o=x(_(e.node(n)),m);Object.keys(y).forEach(e=>{void 0===o[e]&&(o[e]=y[e])}),t.setNode(n,o),t.setParent(n,e.parent(n))}),e.edges().forEach(n=>{let o=_(e.edge(n));t.setEdge(n,Object.assign({},b,x(o,v),d.pick(o,w)))}),t}(E));S(" runLayout",()=>function(f,h,p){h(" makeSpaceForEdgeLabels",()=>function(e){let t=e.graph();t.ranksep/=2,e.edges().forEach(n=>{let o=e.edge(n);o.minlen*=2,"c"!==o.labelpos.toLowerCase()&&("TB"===t.rankdir||"BT"===t.rankdir?o.width+=o.labeloffset:o.height+=o.labeloffset)})}(f)),h(" removeSelfEdges",()=>function(e){e.edges().forEach(t=>{if(t.v===t.w){var n=e.node(t.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e:t,label:e.edge(t)}),e.removeEdge(t)}})}(f)),h(" acyclic",()=>e.run(f)),h(" nestingGraph.run",()=>a.run(f)),h(" rank",()=>n(d.asNonCompoundGraph(f))),h(" injectEdgeLabelProxies",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(n.width&&n.height){let n=e.node(t.v),o={rank:(e.node(t.w).rank-n.rank)/2+n.rank,e:t};d.addDummyNode(e,"edge-proxy",o,"_ep")}})}(f)),h(" removeEmptyRanks",()=>i(f)),h(" nestingGraph.cleanup",()=>a.cleanup(f)),h(" normalizeRanks",()=>o(f)),h(" assignRankMinMax",()=>function(e){let t=0;e.nodes().forEach(n=>{let o=e.node(n);o.borderTop&&(o.minRank=e.node(o.borderTop).rank,o.maxRank=e.node(o.borderBottom).rank,t=Math.max(t,o.maxRank))}),e.graph().maxRank=t}(f)),h(" removeEdgeLabelProxies",()=>function(e){e.nodes().forEach(t=>{let n=e.node(t);"edge-proxy"===n.dummy&&(e.edge(n.e).labelRank=n.rank,e.removeNode(t))})}(f)),h(" normalize.run",()=>t.run(f)),h(" parentDummyChains",()=>r(f)),h(" addBorderSegments",()=>s(f)),h(" order",()=>c(f,p)),h(" insertSelfEdges",()=>function(e){var t=d.buildLayerMatrix(e);t.forEach(t=>{var n=0;t.forEach((t,o)=>{var r=e.node(t);r.order=o+n,(r.selfEdges||[]).forEach(t=>{d.addDummyNode(e,"selfedge",{width:t.label.width,height:t.label.height,rank:r.rank,order:o+ ++n,e:t.e,label:t.label},"_se")}),delete r.selfEdges})})}(f)),h(" adjustCoordinateSystem",()=>l.adjust(f)),h(" position",()=>u(f)),h(" positionSelfEdges",()=>function(e){e.nodes().forEach(t=>{var n=e.node(t);if("selfedge"===n.dummy){var o=e.node(n.e.v),r=o.x+o.width/2,i=o.y,a=n.x-r,s=o.height/2;e.setEdge(n.e,n.label),e.removeNode(t),n.label.points=[{x:r+2*a/3,y:i-s},{x:r+5*a/6,y:i-s},{x:r+a,y:i},{x:r+5*a/6,y:i+s},{x:r+2*a/3,y:i+s}],n.label.x=n.x,n.label.y=n.y}})}(f)),h(" removeBorderNodes",()=>function(e){e.nodes().forEach(t=>{if(e.children(t).length){let n=e.node(t),o=e.node(n.borderTop),r=e.node(n.borderBottom),i=e.node(n.borderLeft[n.borderLeft.length-1]),a=e.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(a.x-i.x),n.height=Math.abs(r.y-o.y),n.x=i.x+n.width/2,n.y=o.y+n.height/2}}),e.nodes().forEach(t=>{"border"===e.node(t).dummy&&e.removeNode(t)})}(f)),h(" normalize.undo",()=>t.undo(f)),h(" fixupEdgeLabelCoords",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);if(Object.hasOwn(n,"x"))switch("l"!==n.labelpos&&"r"!==n.labelpos||(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset}})}(f)),h(" undoCoordinateSystem",()=>l.undo(f)),h(" translateGraph",()=>function(e){let t=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,r=0,i=e.graph(),a=i.marginx||0,s=i.marginy||0;function l(e){let i=e.x,a=e.y,s=e.width,l=e.height;t=Math.min(t,i-s/2),n=Math.max(n,i+s/2),o=Math.min(o,a-l/2),r=Math.max(r,a+l/2)}e.nodes().forEach(t=>l(e.node(t))),e.edges().forEach(t=>{let n=e.edge(t);Object.hasOwn(n,"x")&&l(n)}),t-=a,o-=s,e.nodes().forEach(n=>{let r=e.node(n);r.x-=t,r.y-=o}),e.edges().forEach(n=>{let r=e.edge(n);r.points.forEach(e=>{e.x-=t,e.y-=o}),Object.hasOwn(r,"x")&&(r.x-=t),Object.hasOwn(r,"y")&&(r.y-=o)}),i.width=n-t+a,i.height=r-o+s}(f)),h(" assignNodeIntersects",()=>function(e){e.edges().forEach(t=>{let n,o,r=e.edge(t),i=e.node(t.v),a=e.node(t.w);r.points?(n=r.points[0],o=r.points[r.points.length-1]):(r.points=[],n=a,o=i),r.points.unshift(d.intersectRect(i,n)),r.points.push(d.intersectRect(a,o))})}(f)),h(" reversePoints",()=>function(e){e.edges().forEach(t=>{let n=e.edge(t);n.reversed&&n.points.reverse()})}(f)),h(" acyclic.undo",()=>e.undo(f))}(O,S,k)),S(" updateInputGraph",()=>function(e,t){e.nodes().forEach(n=>{let o=e.node(n),r=t.node(n);o&&(o.x=r.x,o.y=r.y,o.rank=r.rank,t.children(n).length&&(o.width=r.width,o.height=r.height))}),e.edges().forEach(n=>{let o=e.edge(n),r=t.edge(n);o.points=r.points,Object.hasOwn(r,"x")&&(o.x=r.x,o.y=r.y)}),e.graph().width=t.graph().width,e.graph().height=t.graph().height}(E,O))})};let h=["nodesep","edgesep","ranksep","marginx","marginy"],p={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},g=["acyclicer","ranker","rankdir","align"],m=["width","height","rank"],y={width:0,height:0},v=["minlen","weight","width","height","labeloffset"],b={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},w=["labelpos"];function x(e,t){return d.mapValues(d.pick(e,t),Number)}function _(e){var t={};return e&&Object.entries(e).forEach(([e,n])=>{"string"==typeof e&&(e=e.toLowerCase()),t[e]=n}),t}return Wu}function Ad(){if(Uu)return Ku;Uu=1;let e=wd(),t=vd().Graph;return Ku={debugOrdering:function(n){let o=e.buildLayerMatrix(n),r=new t({compound:!0,multigraph:!0}).setGraph({});return n.nodes().forEach(e=>{r.setNode(e,{label:e}),r.setParent(e,"layer"+n.node(e).rank)}),n.edges().forEach(e=>r.setEdge(e.v,e.w,{},e.name)),o.forEach((e,t)=>{let n="layer"+t;r.setNode(n,{rank:"same"}),e.reduce((e,t)=>(r.setEdge(e,t,{style:"invis"}),t))}),r}},Ku}r("/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #777;\n --xy-background-pattern-lines-color-default: #777;\n --xy-background-pattern-cross-color-default: #777;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n");var Ld=i(td?ed:(td=1,ed={graphlib:vd(),layout:Dd(),debug:Ad(),util:{time:wd().time,notime:wd().notime},version:Ju?Qu:(Ju=1,Qu="1.1.5")})),Vd={type:sr.ArrowClosed,width:20,height:20,color:"#FF0072"},Bd={strokeWidth:2,stroke:"#FF0072"},$d=function(n){var o=n.tree,r=ps().fitView,i=function(e){const[n,o]=t.useState(e),r=t.useCallback(e=>o(t=>ts(e,t)),[]);return[n,o,r]}([]),a=Z(i,3),s=a[0],l=a[1],c=a[2],u=function(e){const[n,o]=t.useState(e),r=t.useCallback(e=>o(t=>ns(e,t)),[]);return[n,o,r]}([]),d=Z(u,3),f=d[0],h=d[1],p=d[2];return t.useEffect(function(){if(o){var e,t=function(e,t){var n=[],o=[];return Object.keys(e).forEach(function(r,i){e[r].forEach(function(e,i){var a={id:e,flowId:e,position:{x:250,y:200*i},data:{label:String(e)}};if(0==i&&(a.type="input"),i>0){var s=o[o.length-1],l={id:s.flowId+"-"+r+"-"+i+"-"+a.flowId,source:s.flowId,target:a.flowId,animated:t,markerEnd:Vd,style:Bd};n.push(l)}o.push(a)})}),{nodes:o,edges:n}}(o.data,null!==(e=o.animated)&&void 0!==e&&e),n=function(e,t,n){var o=(new Ld.graphlib.Graph).setDefaultEdgeLabel(function(){return{}});return o.setGraph({rankdir:n.direction,ranksep:100,nodesep:170}),t.forEach(function(e){return o.setEdge(e.source,e.target)}),e.forEach(function(e){var t,n,r,i;return o.setNode(e.id,Y(Y({},e),{},{width:null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:0,height:null!==(r=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==r?r:0}))}),Ld.layout(o),{nodes:e.map(function(e){var t,n,r,i,a=o.node(e.id),s=a.x-(null!==(t=null===(n=e.measured)||void 0===n?void 0:n.width)&&void 0!==t?t:0)/2,l=a.y-(null!==(r=null===(i=e.measured)||void 0===i?void 0:i.height)&&void 0!==r?r:0)/2;return Y(Y({},e),{},{position:{x:s,y:l}})}),edges:t}}(t.nodes,t.edges,{direction:o.orientation});l(q(n.nodes)),h(q(n.edges)),r()}},[o]),e.jsx(ql,{nodes:s,edges:f,onNodesChange:c,onEdgesChange:p,colorMode:"dark",fitView:!0,children:e.jsx(ac,{})})};r(".file-browser {\n width: 100%;\n height: 100%;\n color: white;\n overflow-y: auto;\n scrollbar-gutter: stable;\n scrollbar-color: rgba(71, 71, 71, 0.4) #252526;\n scrollbar-width: thin;\n background-color: #1e1e1e;\n}");var Hd=["color","size","title","className"];function Fd(){return Fd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Fd.apply(null,arguments)}var Yd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Hd);return t.createElement("svg",Fd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-braces",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M2.114 8.063V7.9c1.005-.102 1.497-.615 1.497-1.6V4.503c0-1.094.39-1.538 1.354-1.538h.273V2h-.376C3.25 2 2.49 2.759 2.49 4.352v1.524c0 1.094-.376 1.456-1.49 1.456v1.299c1.114 0 1.49.362 1.49 1.456v1.524c0 1.593.759 2.352 2.372 2.352h.376v-.964h-.273c-.964 0-1.354-.444-1.354-1.538V9.663c0-.984-.492-1.497-1.497-1.6M13.886 7.9v.163c-1.005.103-1.497.616-1.497 1.6v1.798c0 1.094-.39 1.538-1.354 1.538h-.273v.964h.376c1.613 0 2.372-.759 2.372-2.352v-1.524c0-1.094.376-1.456 1.49-1.456V7.332c-1.114 0-1.49-.362-1.49-1.456V4.352C13.51 2.759 12.75 2 11.138 2h-.376v.964h.273c.964 0 1.354.444 1.354 1.538V6.3c0 .984.492 1.497 1.497 1.6"}))});Yd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Zd=["color","size","title","className"];function qd(){return qd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},qd.apply(null,arguments)}var Xd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Zd);return t.createElement("svg",qd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-chevron-down",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708"}))});Xd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Wd=["color","size","title","className"];function Gd(){return Gd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Gd.apply(null,arguments)}var Kd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Wd);return t.createElement("svg",Gd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-chevron-right",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708"}))});Kd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var Ud=["color","size","title","className"];function Qd(){return Qd=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},Qd.apply(null,arguments)}var Jd=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,Ud);return t.createElement("svg",Qd({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-file-code",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M6.646 5.646a.5.5 0 1 1 .708.708L5.707 8l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708zm2.708 0a.5.5 0 1 0-.708.708L10.293 8 8.646 9.646a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708z"}),t.createElement("path",{d:"M2 2a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2zm10-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1"}))});Jd.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var ef=["color","size","title","className"];function tf(){return tf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},tf.apply(null,arguments)}var nf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,ef);return t.createElement("svg",tf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-file-earmark",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z"}))});nf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var of=["color","size","title","className"];function rf(){return rf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},rf.apply(null,arguments)}var af=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,of);return t.createElement("svg",rf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-js",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2H8v-1h4a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM3.186 15.29a1.2 1.2 0 0 1-.111-.449h.765a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.153-.326q-.151-.12-.462-.193l-.619-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.457 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.513.152a.47.47 0 0 0-.184.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.327.075.566.211.24.136.375.358t.135.56q0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m-3.104-.033A1.3 1.3 0 0 1 0 14.791h.765a.6.6 0 0 0 .073.27.5.5 0 0 0 .454.246q.285 0 .422-.164.138-.165.138-.466v-2.745h.79v2.725q0 .66-.357 1.005-.354.345-.984.345a1.6 1.6 0 0 1-.569-.094 1.15 1.15 0 0 1-.407-.266 1.1 1.1 0 0 1-.243-.39"}))});af.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var sf=["color","size","title","className"];function lf(){return lf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},lf.apply(null,arguments)}var cf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,sf);return t.createElement("svg",lf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-py",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V14a2 2 0 0 1-2 2H7v-1h5a1 1 0 0 0 1-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM0 11.85h1.6q.434 0 .732.179.302.175.46.477t.158.677-.16.677q-.158.299-.464.474a1.45 1.45 0 0 1-.732.173H.79v1.342H0zm2.06 1.714a.8.8 0 0 0 .085-.381q0-.34-.185-.521-.185-.182-.513-.182H.788v1.406h.66a.8.8 0 0 0 .374-.082.57.57 0 0 0 .238-.24m2.963.75v1.535H4.23v-1.52L2.89 11.85h.876l.853 1.696h.032l.856-1.696h.855z"}))});cf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var uf=["color","size","title","className"];function df(){return df=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},df.apply(null,arguments)}var ff=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,uf);return t.createElement("svg",df({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-filetype-scss",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{fillRule:"evenodd",d:"M14 4.5V11h-1V4.5h-2A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v9H2V2a2 2 0 0 1 2-2h5.5zM1.356 15.29a1.2 1.2 0 0 1-.111-.449h.765a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.153-.326q-.151-.12-.462-.193l-.619-.143a1.7 1.7 0 0 1-.539-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.457 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.513.152a.47.47 0 0 0-.184.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.326.075.566.211t.375.358.135.56q0 .37-.188.656a1.2 1.2 0 0 1-.539.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375m4.274-2.23a1.7 1.7 0 0 0-.103.633v.495q0 .369.103.627a.83.83 0 0 0 .298.392.85.85 0 0 0 .478.132.9.9 0 0 0 .401-.088.7.7 0 0 0 .273-.249.8.8 0 0 0 .117-.363h.765v.076a1.27 1.27 0 0 1-.226.674 1.4 1.4 0 0 1-.55.454 1.8 1.8 0 0 1-.786.164q-.54 0-.914-.217a1.4 1.4 0 0 1-.571-.626q-.195-.408-.194-.976v-.498q0-.569.197-.979a1.44 1.44 0 0 1 .57-.633q.38-.222.912-.222.328 0 .607.097.28.093.489.272a1.32 1.32 0 0 1 .466.964v.073h-.765a.85.85 0 0 0-.12-.38.7.7 0 0 0-.273-.261.8.8 0 0 0-.398-.097.8.8 0 0 0-.475.138.87.87 0 0 0-.301.398m2.609 1.781a1.13 1.13 0 0 0 .401.823q.193.162.478.252.284.091.665.091.507 0 .858-.158.354-.158.54-.44a1.17 1.17 0 0 0 .187-.656q0-.336-.135-.56a1 1 0 0 0-.375-.357 2 2 0 0 0-.566-.21l-.62-.144a1 1 0 0 1-.405-.176.37.37 0 0 1-.143-.299q0-.234.184-.384.188-.152.513-.152.213 0 .369.068a.6.6 0 0 1 .246.181.56.56 0 0 1 .12.258h.75a1.1 1.1 0 0 0-.2-.566 1.2 1.2 0 0 0-.5-.41 1.8 1.8 0 0 0-.78-.152q-.438 0-.776.15-.336.149-.527.421-.19.273-.19.639 0 .302.123.524t.351.367q.228.143.54.213l.617.144q.311.073.463.193a.39.39 0 0 1 .153.326.5.5 0 0 1-.085.29.56.56 0 0 1-.255.193 1.1 1.1 0 0 1-.413.07q-.177 0-.32-.04a.8.8 0 0 1-.249-.115.58.58 0 0 1-.255-.384zm3.502.449a1.2 1.2 0 0 1-.11-.449h.764a.58.58 0 0 0 .255.384q.105.073.249.114.143.041.319.041.246 0 .413-.07a.56.56 0 0 0 .255-.193.5.5 0 0 0 .085-.29.39.39 0 0 0-.152-.326q-.153-.12-.463-.193l-.618-.143a1.7 1.7 0 0 1-.54-.214 1 1 0 0 1-.351-.367 1.1 1.1 0 0 1-.123-.524q0-.366.19-.639.19-.272.528-.422.336-.15.776-.149.458 0 .78.152.324.153.5.41.18.255.2.566h-.75a.56.56 0 0 0-.12-.258.6.6 0 0 0-.247-.181.9.9 0 0 0-.369-.068q-.325 0-.512.152a.47.47 0 0 0-.185.384q0 .18.143.3a1 1 0 0 0 .405.175l.62.143q.326.075.566.211t.375.358.135.56q0 .37-.187.656a1.2 1.2 0 0 1-.54.439q-.351.158-.858.158-.381 0-.665-.09a1.4 1.4 0 0 1-.478-.252 1.1 1.1 0 0 1-.29-.375"}))});ff.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};var hf=["color","size","title","className"];function pf(){return pf=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)({}).hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},pf.apply(null,arguments)}var gf=t.forwardRef(function(e,n){var o=e.color,r=void 0===o?"currentColor":o,i=e.size,a=void 0===i?"1em":i,s=e.title,l=void 0===s?null:s,c=e.className,u=void 0===c?"":c,d=function(e,t){if(null==e)return{};var n,o,r=function(e,t){if(null==e)return{};var n={};for(var o in e)if({}.hasOwnProperty.call(e,o)){if(-1!==t.indexOf(o))continue;n[o]=e[o]}return n}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],-1===t.indexOf(n)&&{}.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}(e,hf);return t.createElement("svg",pf({ref:n,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 16 16",width:a,height:a,fill:r,className:["bi","bi-x-lg",u].filter(Boolean).join(" ")},d),l?t.createElement("title",null,l):null,t.createElement("path",{d:"M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z"}))});gf.propTypes={color:z.string,size:z.oneOfType([z.string,z.number]),title:z.string,className:z.string};r('.file-node-row {\n width: 100%;\n min-width: 200px;\n display: flex;\n font-size: 13px;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n cursor: pointer;\n height: 28px;\n}\n\n.indent {\n height: 100%;\n margin-left: 10px;\n}\n\n.folder-icon {\n display: flex;\n margin-right: 5px;\n align-items: center;\n}\n\n.file-icon {\n display: flex;\n margin-right: 5px;\n align-items: center;\n}\n\n.file-name {\n color: #DDD;\n display: flex;\n align-items: center;\n}');var mf=function(o){var r=o.id,i=o.parentId,a=o.node,s=n.useDraggable({id:r,data:{type:"FileTreeNode",parentId:i,node:a,preview:e.jsx(yf,{node:a})}}),l=s.attributes,c=s.listeners,u=s.setNodeRef;s.transform;var d=Sf().selectNode,f=t.useCallback(function(){d(a)},[d]);return e.jsxs("div",Y(Y(Y({className:"file-node-row",ref:u},c),l),{},{style:function(){var e={};return a.selected&&(e.backgroundColor="#00426b"),e}(),onClick:f,children:[e.jsx("div",{className:"indent",style:{width:20*a.level+"px"}}),"folder"===a.type?e.jsx("span",{className:"folder-icon",children:a.collapsed?e.jsx(Kd,{}):e.jsx(Xd,{})}):e.jsx("span",{className:"file-icon",children:function(){switch(a.name.split(".").pop()){case"js":return e.jsx(af,{color:"#f1e05a"});case"json":return e.jsx(Yd,{color:"#fffb00"});case"scss":return e.jsx(ff,{color:"#f12727"});case"py":return e.jsx(cf,{color:"#686affbd"});default:return e.jsx(Jd,{color:"#ffffff"})}}()}),e.jsx("span",{className:"file-name",children:a.name})]}))},yf=function(t){var n=t.node;return e.jsx("div",{className:"file-node-row",children:e.jsx("span",{className:"file-name",children:n.name})})};r("");var vf=function(n){H(n);var o=Z(t.useState([]),2),r=o[0],i=o[1],a=Sf().state;t.useEffect(function(){var e;s(null!==(e=a.collapsedTree)&&void 0!==e?e:[])},[a.collapsedTree]);var s=function(t,n){var o=[];t.forEach(function(t){o.push(e.jsx(mf,{parentId:n,node:t,id:"tree-node-"+t.uid},n+"-"+t.uid))}),i(o)};return e.jsx(e.Fragment,{children:r})},bf=t.createContext(),wf=function(e,t){t||(t=0);for(var n=[],o=0;o<e.length;o++){var r=e[o];r.level=t,n.push(r),null!=r&&r.children&&(n=n.concat(wf(r.children,t+1)))}return n},xf=function(e){for(var t,n,o=[],r=0;r<e.length;r++){if(t){if(!(e[r].level<=n))continue;t=!1}e[r].collapsed&&(t=!0,n=e[r].level),o.push(e[r])}return o},_f={uid:crypto.randomUUID(),tree:{},flattenedTree:[],selectedNode:null,collapsedTree:[]},Ef=function(e,t){switch(t.type){case"ADD_FILE_TREE":var n=function(e){return e.forEach(function(e){e.collapsed=!1}),e}(wf(q(t.payload))),o=xf(n);return Y(Y({},e),{},{tree:t.payload,flattenedTree:n,collapsedTree:o});case"SELECT_NODE":var r=e.flattenedTree.map(function(e){return e.uid===t.payload.uid?Y(Y({},e),{},{selected:!0,collapsed:!e.collapsed}):Y(Y({},e),{},{selected:!1})});return Y(Y({},e),{},{flattenedTree:r,collapsedTree:xf(r),selectedNode:t.payload});case"RESET_STATE":return _f;default:return e}},kf=t.forwardRef(function(n,o){var r=n.onSelectFile,i=Z(t.useReducer(Ef,_f),2),a=i[0],s=i[1],l=t.useCallback(function(e){s({type:"RESET_STATE"}),s({type:"ADD_FILE_TREE",payload:e})},[]);t.useEffect(function(){a.selectedNode&&"file"===a.selectedNode.type&&r(a.selectedNode)},[a.selectedNode]);var c=t.useCallback(function(e){s({type:"SELECT_NODE",payload:e})},[]),u=t.useMemo(function(){return{state:a,addFileTree:l,selectNode:c}},[a,l,c]);return t.useImperativeHandle(o,function(){return u},[u]),e.jsx(bf.Provider,{value:u,children:e.jsx("div",{className:"file-browser",children:e.jsx(vf,{})})})});function Sf(){var e=t.useContext(bf);if(!e)throw new Error("useFileBrowser must be used inside <FileBrowser>");return e}kf.displayName="FileBrowser";function Of(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cf(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 Nf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Cf(Object(n),!0).forEach(function(t){Of(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Cf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Mf(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<i.length;o++)n=i[o],t.indexOf(n)>=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o<i.length;o++)n=i[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}function Pf(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}function jf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function If(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 Tf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?If(Object(n),!0).forEach(function(t){jf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):If(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function zf(e){return function t(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=e.length?e.apply(this,r):function(){for(var e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return t.apply(n,[].concat(r,o))}}}function Rf(e){return{}.toString.call(e).includes("Object")}function Df(e){return"function"==typeof e}r('.editorContainer {\n position: relative;\n width: 100%;\n height: 100%;\n font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;\n}\n\n.tabContainer {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 35px;\n right: 0;\n}\n\n.monacoContainer {\n position: absolute;\n top: 35px;\n left: 0;\n bottom: 0;\n right: 0;\n}');var Af=zf(function(e,t){throw new Error(e[t]||e.default)})({initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"}),Lf={changes:function(e,t){return Rf(t)||Af("changeType"),Object.keys(t).some(function(t){return!function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)})&&Af("changeField"),t},selector:function(e){Df(e)||Af("selectorType")},handler:function(e){Df(e)||Rf(e)||Af("handlerType"),Rf(e)&&Object.values(e).some(function(e){return!Df(e)})&&Af("handlersType")},initial:function(e){var t;e||Af("initialIsRequired"),Rf(e)||Af("initialType"),t=e,Object.keys(t).length||Af("initialContent")}};function Vf(e,t){return Df(t)?t(e.current):t}function Bf(e,t){return e.current=Tf(Tf({},e.current),t),t}function $f(e,t,n){return Df(t)?t(e.current):Object.keys(n).forEach(function(n){var o;return null===(o=t[n])||void 0===o?void 0:o.call(t,e.current[n])}),n}var Hf={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Lf.initial(e),Lf.handler(t);var n={current:e},o=zf($f)(n,t),r=zf(Bf)(n),i=zf(Lf.changes)(e),a=zf(Vf)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return Lf.selector(e),e(n.current)},function(e){!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(o,r,i,a)(e)}]}};var Ff,Yf={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:"Deprecation warning!\n You are using deprecated way of configuration.\n\n Instead of using\n monaco.config({ urls: { monacoBase: '...' } })\n use\n monaco.config({ paths: { vs: '...' } })\n\n For more please check the link https://github.com/suren-atoyan/monaco-loader#config\n "},Zf=(Ff=function(e,t){throw new Error(e[t]||e.default)},function e(){for(var t=this,n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];return o.length>=Ff.length?Ff.apply(this,o):function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return e.apply(t,[].concat(o,r))}})(Yf),qf={config:function(e){var t;return e||Zf("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||Zf("configType"),e.urls?(console.warn(Yf.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function Xf(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Xf(e[n],t[n]))}),Nf(Nf({},e),t)}var Wf={type:"cancelation",msg:"operation is manually canceled"};function Gf(e){var t=!1,n=new Promise(function(n,o){e.then(function(e){return t?o(Wf):n(e)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var Kf,Uf,Qf=Hf.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),Jf=(Uf=2,function(e){if(Array.isArray(e))return e}(Kf=Qf)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);o=!0);}catch(e){r=!0,i=e}finally{try{o||null==s.return||s.return()}finally{if(r)throw i}}return n}}(Kf,Uf)||function(e,t){if(e){if("string"==typeof e)return Pf(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Pf(e,t):void 0}}(Kf,Uf)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),eh=Jf[0],th=Jf[1];function nh(e){return document.body.appendChild(e)}function oh(e){var t,n,o=eh(function(e){return{config:e.config,reject:e.reject}}),r=(t="".concat(o.config.paths.vs,"/loader.js"),n=document.createElement("script"),t&&(n.src=t),n);return r.onload=function(){return e()},r.onerror=o.reject,r}function rh(){var e=eh(function(e){return{config:e.config,resolve:e.resolve,reject:e.reject}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(t){ih(t),e.resolve(t)},function(t){e.reject(t)})}function ih(e){eh().monaco||th({monaco:e})}var ah=new Promise(function(e,t){return th({resolve:e,reject:t})}),sh={config:function(e){var t=qf.config(e),n=t.monaco,o=Mf(t,["monaco"]);th(function(e){return{config:Xf(e.config,o),monaco:n}})},init:function(){var e=eh(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(th({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Gf(ah);if(window.monaco&&window.monaco.editor)return ih(window.monaco),e.resolve(window.monaco),Gf(ah);!function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return t.reduceRight(function(e,t){return t(e)},e)}}(nh,oh)(rh)}return Gf(ah)},__getMonacoInstance:function(){return eh(function(e){return e.monaco})}},lh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ch={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var uh=function({children:e}){return t.createElement("div",{style:ch.container},e)};var dh=function({width:e,height:n,isEditorReady:o,loading:r,_ref:i,className:a,wrapperProps:s}){return t.createElement("section",{style:{...lh.wrapper,width:e,height:n},...s},!o&&t.createElement(uh,null,r),t.createElement("div",{ref:i,style:{...lh.fullWidth,...!o&&lh.hide},className:a}))},fh=t.memo(dh);var hh=function(e){t.useEffect(e,[])};var ph=function(e,n,o=!0){let r=t.useRef(!0);t.useEffect(r.current||!o?()=>{r.current=!1}:e,n)};function gh(){}function mh(e,t,n,o){return function(e,t){return e.editor.getModel(yh(e,t))}(e,o)||function(e,t,n,o){return e.editor.createModel(t,n,o?yh(e,o):void 0)}(e,t,n,o)}function yh(e,t){return e.Uri.parse(t)}var vh=function({original:e,modified:n,language:o,originalLanguage:r,modifiedLanguage:i,originalModelPath:a,modifiedModelPath:s,keepCurrentOriginalModel:l=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:f={},height:h="100%",width:p="100%",className:g,wrapperProps:m={},beforeMount:y=gh,onMount:v=gh}){let[b,w]=t.useState(!1),[x,_]=t.useState(!0),E=t.useRef(null),k=t.useRef(null),S=t.useRef(null),O=t.useRef(v),C=t.useRef(y),N=t.useRef(!1);hh(()=>{let e=sh.init();return e.then(e=>(k.current=e)&&_(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>E.current?function(){let e=E.current?.getModel();l||e?.original?.dispose(),c||e?.modified?.dispose(),E.current?.dispose()}():e.cancel()}),ph(()=>{if(E.current&&k.current){let t=E.current.getOriginalEditor(),n=mh(k.current,e||"",r||o||"text",a||"");n!==t.getModel()&&t.setModel(n)}},[a],b),ph(()=>{if(E.current&&k.current){let e=E.current.getModifiedEditor(),t=mh(k.current,n||"",i||o||"text",s||"");t!==e.getModel()&&e.setModel(t)}},[s],b),ph(()=>{let e=E.current.getModifiedEditor();e.getOption(k.current.editor.EditorOption.readOnly)?e.setValue(n||""):n!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:n||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[n],b),ph(()=>{E.current?.getModel()?.original.setValue(e||"")},[e],b),ph(()=>{let{original:e,modified:t}=E.current.getModel();k.current.editor.setModelLanguage(e,r||o||"text"),k.current.editor.setModelLanguage(t,i||o||"text")},[o,r,i],b),ph(()=>{k.current?.editor.setTheme(u)},[u],b),ph(()=>{E.current?.updateOptions(f)},[f],b);let M=t.useCallback(()=>{if(!k.current)return;C.current(k.current);let t=mh(k.current,e||"",r||o||"text",a||""),l=mh(k.current,n||"",i||o||"text",s||"");E.current?.setModel({original:t,modified:l})},[o,n,i,e,r,a,s]),P=t.useCallback(()=>{!N.current&&S.current&&(E.current=k.current.editor.createDiffEditor(S.current,{automaticLayout:!0,...f}),M(),k.current?.editor.setTheme(u),w(!0),N.current=!0)},[f,u,M]);return t.useEffect(()=>{b&&O.current(E.current,k.current)},[b]),t.useEffect(()=>{!x&&!b&&P()},[x,b,P]),t.createElement(fh,{width:p,height:h,isEditorReady:b,loading:d,_ref:S,className:g,wrapperProps:m})};t.memo(vh);var bh=function(e){let n=t.useRef();return t.useEffect(()=>{n.current=e},[e]),n.current},wh=new Map;var xh=function({defaultValue:e,defaultLanguage:n,defaultPath:o,value:r,language:i,path:a,theme:s="light",line:l,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:h=!1,width:p="100%",height:g="100%",className:m,wrapperProps:y={},beforeMount:v=gh,onMount:b=gh,onChange:w,onValidate:x=gh}){let[_,E]=t.useState(!1),[k,S]=t.useState(!0),O=t.useRef(null),C=t.useRef(null),N=t.useRef(null),M=t.useRef(b),P=t.useRef(v),j=t.useRef(),I=t.useRef(r),T=bh(a),z=t.useRef(!1),R=t.useRef(!1);hh(()=>{let e=sh.init();return e.then(e=>(O.current=e)&&S(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>C.current?(j.current?.dispose(),h?f&&wh.set(a,C.current.saveViewState()):C.current.getModel()?.dispose(),void C.current.dispose()):e.cancel()}),ph(()=>{let t=mh(O.current,e||r||"",n||i||"",a||o||"");t!==C.current?.getModel()&&(f&&wh.set(T,C.current?.saveViewState()),C.current?.setModel(t),f&&C.current?.restoreViewState(wh.get(a)))},[a],_),ph(()=>{C.current?.updateOptions(u)},[u],_),ph(()=>{!C.current||void 0===r||(C.current.getOption(O.current.editor.EditorOption.readOnly)?C.current.setValue(r):r!==C.current.getValue()&&(R.current=!0,C.current.executeEdits("",[{range:C.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),C.current.pushUndoStop(),R.current=!1))},[r],_),ph(()=>{let e=C.current?.getModel();e&&i&&O.current?.editor.setModelLanguage(e,i)},[i],_),ph(()=>{void 0!==l&&C.current?.revealLine(l)},[l],_),ph(()=>{O.current?.editor.setTheme(s)},[s],_);let D=t.useCallback(()=>{if(N.current&&O.current&&!z.current){P.current(O.current);let t=a||o,c=mh(O.current,r||e||"",n||i||"",t||"");C.current=O.current?.editor.create(N.current,{model:c,automaticLayout:!0,...u},d),f&&C.current.restoreViewState(wh.get(t)),O.current.editor.setTheme(s),void 0!==l&&C.current.revealLine(l),E(!0),z.current=!0}},[e,n,o,r,i,a,u,d,f,s,l]);return t.useEffect(()=>{_&&M.current(C.current,O.current)},[_]),t.useEffect(()=>{!k&&!_&&D()},[k,_,D]),I.current=r,t.useEffect(()=>{_&&w&&(j.current?.dispose(),j.current=C.current?.onDidChangeModelContent(e=>{R.current||w(C.current.getValue(),e)}))},[_,w]),t.useEffect(()=>{if(_){let e=O.current.editor.onDidChangeMarkers(e=>{let t=C.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=O.current.editor.getModelMarkers({resource:t});x?.(e)}});return()=>{e?.dispose()}}return()=>{}},[_,x]),t.createElement(fh,{width:p,height:g,isEditorReady:_,loading:c,_ref:N,className:m,wrapperProps:y})},_h=t.memo(xh);r(".no-tab {\n background-color: #1e1e1e;\n color: #6b6b6b;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.editor-container {\n position: relative;\n width: 100%;\n height: 100%;\n}");var Eh=function(n){H(n);var o=zh().state,r=Z(t.useState("Loading content..."),2),i=r[0],a=r[1],s=Z(t.useState(!1),2),l=s[0],c=s[1],u=t.useRef(null),d=t.useRef(),f=t.useRef(null),h=t.useRef(0);t.useEffect(function(){o.activeTab?(a(o.activeTab.content),c(!0)):c(!1)},[o.activeTab]),t.useEffect(function(){d.current=i,null!=u&&u.current&&void 0!==d.current&&null!==d.current&&u.current.setValue(d.current)},[i]);var p=function(e,t){u.current=e,null!=d&&d.current&&u.current.setValue(d.current),u.current.layout()},g={fontSize:"13px",minimap:{enabled:!1},padding:{top:10},renderWhitespace:"none",wordWrap:"on",scrollBeyondLastLine:!1,readOnly:!0,automaticLayout:!1};t.useEffect(function(){if(f.current){var e=new ResizeObserver(function(){cancelAnimationFrame(h.current),h.current=requestAnimationFrame(function(){var e;null===(e=u.current)||void 0===e||e.layout()})});return e.observe(f.current),function(){cancelAnimationFrame(h.current),e.disconnect()}}},[]);return e.jsx("div",{className:"editor-container",ref:f,children:l?e.jsx(_h,{defaultLanguage:"python",defaultValue:i,onMount:p,theme:"vs-dark",options:g}):e.jsx("div",{className:"no-tab",children:"Select file or drag and drop to view."})})};Eh.propTypes={editorContent:z.string};r(".gutter {\n min-width: 2px;\n height: 35px;\n width: 2px;\n}");var kh=function(t){var o=t.id,r=t.index,i=t.parentId,a=n.useDroppable({id:o,data:{type:"EditorTabGutter",parentId:i,index:r}}),s=a.setNodeRef,l={backgroundColor:a.isOver?"#FFFFFF":"#222425"};return e.jsx("div",{className:"gutter",ref:s,style:l})};kh.propTypes={id:z.string.isRequired,parentId:z.string.isRequired,index:z.number.isRequired};r(".tab {\n padding: 0px 18px;\n cursor: default !important;\n height: 35px;\n width: auto;\n}\n\n.tab-content {\n width: auto;\n height: 31px;\n display: flex;\n align-items: center;\n vertical-align: middle;\n overflow-y: hidden;\n}\n\n.tab > .tab-content > .icon {\n padding-right: 2px;\n display: flex;\n align-items: center;\n width: 20px;\n}\n\n.tab > .tab-content > .tab-name {\n display: flex;\n align-items: center;\n width: auto;\n font-size: 13px;\n}\n\n.tab > .tab-content > .close-icon {\n display: flex;\n margin-left: 7px;\n padding-top: 3px;\n align-items: center;\n vertical-align: middle;\n width: 10px;\n cursor: pointer;\n}");var Sh="#1e1e1e",Oh="#FFFFFF",Ch=function(o){var r=o.id,i=o.parentId,a=o.node,s=Z(t.useState(),2),l=s[0],c=s[1],u=zh(),d=u.selectTab,f=u.closeTab,h=u.state,p=n.useDraggable({id:r,data:{type:"EditorTab",parentId:i,node:a,preview:e.jsx(Nh,{node:a})}}),g=p.attributes,m=p.listeners,y=p.setNodeRef;p.transform,t.useEffect(function(){v(h.activeTab&&h.activeTab.uid===a.uid)},[h.activeTab]);var v=function(e){c({backgroundColor:e?Sh:"#2d2d2d",color:e?Oh:"#969690"})};return e.jsx("div",Y(Y(Y({ref:y,style:l,id:r,onMouseDown:function(e){e.stopPropagation(),1===e.button?f(a.uid):d(a.uid)},className:"tab"},m),g),{},{children:e.jsxs("div",{className:"tab-content",children:[e.jsx("div",{className:"icon",children:e.jsx(nf,{size:14,style:{pointerEvents:"none"}})}),e.jsx("div",{className:"tab-name",children:e.jsx("span",{children:a.name})}),e.jsx("div",{className:"close-icon",onMouseDown:function(e){e.stopPropagation(),f(a.uid)},children:e.jsx(gf,{size:18})})]})}))};Ch.propTypes={id:z.string.isRequired,parentId:z.string.isRequired,node:z.shape({name:z.string.isRequired}).isRequired};var Nh=function(t){var n=t.node;return e.jsx("div",{className:"tab",style:{backgroundColor:Sh,color:Oh,opacity:.5},children:e.jsxs("div",{className:"tab-content",children:[e.jsx("div",{className:"icon",children:e.jsx(nf,{size:14,style:{pointerEvents:"none"}})}),e.jsx("div",{className:"tab-name",children:e.jsx("span",{children:n.name})}),e.jsx("div",{className:"close-icon",children:e.jsx(gf,{size:18})})]})})};r(".tabs-container {\n display: flex;\n flex-direction: row;\n height: 35px;\n width: 100%;\n position: relative;\n overflow-x: auto;\n overflow-y: hidden;\n white-space: nowrap;\n scrollbar-width: thin;\n scrollbar-color: rgba(255, 255, 255, 0.2) transparent;\n}\n\n.tabs-container::-webkit-scrollbar {\n height: 4px;\n}\n\n.tabs-container::-webkit-scrollbar-track {\n background: transparent;\n}\n\n.tabs-container::-webkit-scrollbar-thumb {\n background: rgba(255, 255, 255, 0.2);\n border-radius: 4px;\n}");var Mh=function(){var n=zh().state,o=Z(t.useState(),2),r=o[0],i=o[1];t.useEffect(function(){var e;(null===(e=n.tabs)||void 0===e?void 0:e.length)>=0&&null!=n.parentTabGroupId&&a(n.tabs,n.parentTabGroupId)},[n.tabs,n.parentTabGroupId]);var a=function(t,n){var o=[];t.forEach(function(t,r){o.push(e.jsx(kh,{id:n+"-"+r,index:r,parentId:n},t.uid+"-gutter")),o.push(e.jsx(Ch,{id:n+"-"+t.uid,parentId:n,node:t},t.uid))}),o.push(e.jsx(kh,{id:n+"-"+t.length,index:t.length,parentId:n},"last-gutter")),i(o)};return e.jsx("div",{className:"tabs-container",style:{background:"#222425"},children:r})},Ph=t.createContext(),jh={uid:crypto.randomUUID(),tabs:[],activeTab:null,parentTabGroupId:null},Ih=function(e,t){switch(t.type){case"ADD_TAB":var n=t.payload,o=n.tab,r=n.index,i=e.tabs.find(function(e){return e.uid===o.uid});if(i)return console.warn("Tab with id ".concat(i.uid," already exists")),Y(Y({},e),{},{activeTab:i});var a=q(e.tabs);return void 0!==r&&r<e.tabs.length?a.splice(r,0,o):a.push(o),Y(Y({},e),{},{tabs:a,activeTab:o});case"SET_PARENT_TAB_GROUP_ID":return Y(Y({},e),{},{parentTabGroupId:t.payload});case"SELECT_TAB":var s=e.tabs.find(function(e){return e.uid===t.payload});return s?Y(Y({},e),{},{activeTab:s}):(console.error("Tab with id ".concat(t.payload," not found.")),e);case"CLOSE_TAB":var l=e.tabs.findIndex(function(e){return e.uid===t.payload});if(-1===l)return console.warn("Tab with id ".concat(t.payload," not found.")),e;var c=q(e.tabs);c.splice(l,1);var u=e.activeTab,d=e.activeTab&&e.activeTab.uid===t.payload;return d&&l<c.length?u=c[Math.max(0,l)]:d&&l>=c.length&&(u=c.length>0?c[c.length-1]:null),Y(Y({},e),{},{tabs:c,activeTab:u});case"MOVE_TAB":var f=q(e.tabs),h=t.payload,p=h.tabId,g=h.newIndex,m=f.findIndex(function(e){return e.uid===p});if(-1===m)return console.warn("Tab with id ".concat(p," not found.")),e;if(g-1===m||g===m)return e;var y=Z(f.splice(m,1),1)[0],v=m<g?g-1:g;return f.splice(v,0,y),Y(Y({},e),{},{tabs:f});case"RESET_STATE":return jh;default:return e}},Th=t.forwardRef(function(n,o){H(n);var r=Z(t.useReducer(Ih,jh),2),i=r[0],a=r[1],s=t.useCallback(function(e){a({type:"SELECT_TAB",payload:e})},[]),l=t.useCallback(function(e){a({type:"CLOSE_TAB",payload:e})},[]),c=t.useCallback(function(e,t){a({type:"MOVE_TAB",payload:{tabId:e,newIndex:t}})},[]),u=t.useCallback(function(e,t){a({type:"ADD_TAB",payload:{tab:e,index:t}})},[]),d=t.useCallback(function(e){a({type:"RESET_STATE"}),a({type:"SET_PARENT_TAB_GROUP_ID",payload:e})},[]),f=t.useMemo(function(){return{state:i,addTab:u,setTabGroupId:d,selectTab:s,closeTab:l,moveTab:c}},[i,u,s,l,c,d]);return t.useImperativeHandle(o,function(){return f},[f]),e.jsx(Ph.Provider,{value:f,children:e.jsxs("div",{className:"editorContainer",children:[e.jsx("div",{className:"tabContainer",children:e.jsx(Mh,{})}),e.jsx("div",{className:"monacoContainer",children:e.jsx(Eh,{})})]})})});function zh(){var e=t.useContext(Ph);if(!e)throw new Error("useEditor must be used inside <Editor>");return e}Th.displayName="Editor";r(".canvas-wrapper {\n position: relative;\n width: 100%;\n height: 100%;\n background-color: #1b1c1d;\n overflow: hidden;\n}\n\ncanvas {\n overflow: hidden;\n}");var Rh=t.forwardRef(function(n,r){var i=n.connectBehaviors,a=n.deleteTransition,s=n.deleteBehavior,l=n.selectBehavior,c=t.useRef(),u=t.useRef(),d=Z(t.useState({width:0,height:0}),2),f=d[0],h=d[1];t.useEffect(function(){var e=new ResizeObserver(function(e){var t=Z(e,1)[0].contentRect,n=t.width,o=t.height;h({width:n,height:o})});return u.current&&e.observe(u.current),function(){return e.disconnect()}},[]);var p=Z(t.useState([]),2),g=p[0],m=p[1],y=Z(t.useState([]),2),v=y[0],b=y[1],w=Z(t.useState([]),2),x=w[0],_=w[1],E=t.useCallback(function(e){if(e){var t=function(e){for(var t=[],n=[],o=0;o<e.graph.nodes.length;o++){var r=e.graph.nodes[o];n.push({id:r.getBehavior().name,text:r.getBehavior().name})}for(var i=function(){var n=e.graph.nodes[a];if(null==n||!n.getGoToBehaviors())return 1;n.getGoToBehaviors().forEach(function(e){t.push({id:"".concat(n.getBehavior().name,"->").concat(e),from:n.getBehavior().name,to:e})})},a=0;a<e.graph.nodes.length;a++)i();return{nodes:n,edges:t}}(e),n=t.nodes,o=t.edges;b(n),m(o)}},[b,m]),k=t.useMemo(function(){return{updateEngine:E}},[E]);t.useImperativeHandle(r,function(){return k},[k]);var S=t.useCallback(function(e){e.deltaY<0?c.current.zoomIn():c.current.zoomOut()},[c]),O=t.useCallback(function(e,t){_([t.id]),l(t.id)},[l]),C=t.useCallback(function(e,t){s(t),_([])},[s]),N=t.useCallback(function(e,t){_([t.id])},[]),M=t.useCallback(function(e,t){a(t),_([])},[a]),P=t.useCallback(function(e){l(null),_([])},[l]),j=t.useCallback(function(e,t,n){n&&i(t,n)},[i]);return e.jsx("div",{onWheel:S,ref:u,className:"canvas-wrapper",children:e.jsx(o.Canvas,{panType:"drag",fit:!0,center:!0,ref:c,nodes:v,edges:g,width:f.width,height:f.height,selections:x,onNodeLink:j,node:e.jsx(o.Node,{onClick:O,onRemove:C}),edge:e.jsx(o.Edge,{onClick:N,onRemove:M}),onCanvasClick:P})})});Rh.propTypes={connectBehaviors:z.func.isRequired,deleteTransition:z.func.isRequired,deleteBehavior:z.func.isRequired,selectBehavior:z.func.isRequired},exports.BehavioralGraphBuilder=Rh,exports.Editor=Th,exports.FileBrowser=kf,exports.FlowDiagram=function(n){var o=n.treeInfo,r=Z(t.useState(),2),i=r[0],a=r[1];return t.useEffect(function(){a(o)},[o]),e.jsx(Hl,{children:e.jsx($d,{tree:i})})},exports.StackList=V,exports.useEditor=zh,exports.useFileBrowser=Sf;
|
|
42
42
|
//# sourceMappingURL=index.js.map
|