sample-ui-component-library 0.0.38-dev → 0.0.40-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 +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/BehavioralGraphBuilder/BehavioralGraphBuilder.jsx +32 -0
- package/src/components/BehavioralGraphBuilder/BehavioralGraphBuilder.scss +0 -0
- package/src/components/BehavioralGraphBuilder/DagreLayout.js +33 -0
- package/src/components/BehavioralGraphBuilder/Flow.jsx +164 -0
- package/src/components/BehavioralGraphBuilder/helper.js +35 -0
- package/src/components/BehavioralGraphBuilder/index.js +1 -0
- package/src/index.js +2 -1
- package/src/stories/BehavioralGraphBuilder.stories.js +66 -0
- package/src/stories/BehavioralGraphBuilderStories.scss +17 -0
- package/src/stories/components/ToolBar/ToolBar.js +57 -0
- package/src/stories/components/ToolBar/ToolBar.scss +29 -0
- package/src/stories/data/Designs/simple_design_temp.json +1 -0
package/dist/esm/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import o,{useSta
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/function
|
|
9
|
+
*/function B(){return S||(S=1,"production"===process.env.NODE_ENV?_.exports=function(){if(w)return E;w=1;var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,r=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:switch(e=e.type){case l:case c:case o:case i:case r:case d:return e;default:switch(e=e&&e.$$typeof){case s:case u:case p:case h:case a:return e;default:return f}}case n:return f}}}function x(e){return b(e)===c}return E.AsyncMode=l,E.ConcurrentMode=c,E.ContextConsumer=s,E.ContextProvider=a,E.Element=t,E.ForwardRef=u,E.Fragment=o,E.Lazy=p,E.Memo=h,E.Portal=n,E.Profiler=i,E.StrictMode=r,E.Suspense=d,E.isAsyncMode=function(e){return x(e)||b(e)===l},E.isConcurrentMode=x,E.isContextConsumer=function(e){return b(e)===s},E.isContextProvider=function(e){return b(e)===a},E.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},E.isForwardRef=function(e){return b(e)===u},E.isFragment=function(e){return b(e)===o},E.isLazy=function(e){return b(e)===p},E.isMemo=function(e){return b(e)===h},E.isPortal=function(e){return b(e)===n},E.isProfiler=function(e){return b(e)===i},E.isStrictMode=function(e){return b(e)===r},E.isSuspense=function(e){return b(e)===d},E.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===c||e===i||e===r||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===a||e.$$typeof===s||e.$$typeof===u||e.$$typeof===m||e.$$typeof===y||e.$$typeof===v||e.$$typeof===g)},E.typeOf=b,E}():_.exports=(k||(k=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,r=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,f=e?Symbol.for("react.suspense_list"):60120,h=e?Symbol.for("react.memo"):60115,p=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,y=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var f=e.$$typeof;switch(f){case t:var g=e.type;switch(g){case l:case c:case o:case i:case r:case d:return g;default:var m=g&&g.$$typeof;switch(m){case s:case u:case p:case h:case a:return m;default:return f}}case n:return f}}}var w=l,x=c,_=s,E=a,k=t,S=u,O=o,N=p,C=h,M=n,P=i,I=r,T=d,z=!1;function D(e){return b(e)===c}V.AsyncMode=w,V.ConcurrentMode=x,V.ContextConsumer=_,V.ContextProvider=E,V.Element=k,V.ForwardRef=S,V.Fragment=O,V.Lazy=N,V.Memo=C,V.Portal=M,V.Profiler=P,V.StrictMode=I,V.Suspense=T,V.isAsyncMode=function(e){return z||(z=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),D(e)||b(e)===l},V.isConcurrentMode=D,V.isContextConsumer=function(e){return b(e)===s},V.isContextProvider=function(e){return b(e)===a},V.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},V.isForwardRef=function(e){return b(e)===u},V.isFragment=function(e){return b(e)===o},V.isLazy=function(e){return b(e)===p},V.isMemo=function(e){return b(e)===h},V.isPortal=function(e){return b(e)===n},V.isProfiler=function(e){return b(e)===i},V.isStrictMode=function(e){return b(e)===r},V.isSuspense=function(e){return b(e)===d},V.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===c||e===i||e===r||e===d||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===a||e.$$typeof===s||e.$$typeof===u||e.$$typeof===m||e.$$typeof===y||e.$$typeof===v||e.$$typeof===g)},V.typeOf=b}()),V)),_.exports}
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
13
|
@license MIT
|
|
14
|
-
*/function B(){if(N)return O;N=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return O=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},O}function H(){if(M)return C;M=1;return C="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function F(){return I?P:(I=1,P=Function.call.bind(Object.prototype.hasOwnProperty))}function Y(){if(z)return T;z=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=H(),n={},o=F();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={})},T=r}function Z(){if(A)return D;A=1;var e=$(),t=B(),n=H(),o=F(),r=Y(),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){}}),D=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},D}function X(){if(R)return L;R=1;var e=H();function t(){}function n(){}return n.resetWarningCache=t,L=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},L}function q(){if(j)return x.exports;if(j=1,"production"!==process.env.NODE_ENV){var e=$();x.exports=Z()(e.isElement,true)}else x.exports=X()();return x.exports}var W=b(q()),G="#184b2d",K="#420b0e",U="#4b4b18",Q=function(n){var o=n.index,r=n.functionName,i=n.fileName,a=n.lineNumber,s=n.selected,l=n.selectTraceItem,c=n.hasException,u={};return s&&0===o?u={backgroundColor:c?K:U}:s&&(u={backgroundColor:c?K:G}),t("div",{className:"stackRow",style:u,onClick:function(e){return l(o)},children:[e("div",{className:"left",children:e("span",{className:"functionName",children:r})}),t("div",{className:"right",children:[e("span",{className:"fileName",children:i}),t("span",{className:"lineNumber",children:[a,":1"]})]})]})};Q.propTypes={index:W.number,functionName:W.string,fileName:W.string,lineNumber:W.number,selected:W.bool,selectTraceItem:W.func,hasException:W.bool};var J=function(t){var n,o=t.traces,r=t.selectTraceItem;return e("div",{className:"stackContainer",children:(n=o.map(function(t,n){return e(Q,{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 ee(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 te(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 ne(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function oe(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 re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach(function(t){te(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ie(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)||se(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 ae(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||se(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 se(e,t){if(e){if("string"==typeof e)return ee(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)?ee(e,t):void 0}}function le(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=le(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}J.propTypes={traces:W.array,selectTraceItem:W.func};var ce={value:()=>{}};function ue(){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 de(o)}function de(e){this._=e}function fe(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function he(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ce,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}de.prototype=ue.prototype={constructor:de,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]=he(r[n],e.name,t);else if(null==t)for(n in r)r[n]=he(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=i[a]).type)&&(n=fe(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new de(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 pe="http://www.w3.org/1999/xhtml",ge={svg:"http://www.w3.org/2000/svg",xhtml:pe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function me(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ge.hasOwnProperty(t)?{space:ge[t],local:e}:e}function ye(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===pe&&t.documentElement.namespaceURI===pe?t.createElement(e):t.createElementNS(n,e)}}function ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function be(e){var t=me(e);return(t.local?ve:ye)(t)}function we(){}function xe(e){return null==e?we:function(){return this.querySelector(e)}}function _e(){return[]}function Ee(e){return null==e?_e:function(){return this.querySelectorAll(e)}}function ke(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function Se(e){return function(){return this.matches(e)}}function Oe(e){return function(t){return t.matches(e)}}var Ne=Array.prototype.find;function Ce(){return this.firstElementChild}var Me=Array.prototype.filter;function Pe(){return Array.from(this.children)}function Ie(e){return new Array(e.length)}function Te(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function ze(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 Te(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function De(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 Te(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(h[s])===l&&(r[s]=l)}function Ae(e){return e.__data__}function Le(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Re(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function je(e){return function(){this.removeAttribute(e)}}function Ve(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $e(e,t){return function(){this.setAttribute(e,t)}}function Be(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function He(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Fe(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 Ye(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ze(e){return function(){this.style.removeProperty(e)}}function Xe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function qe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function We(e,t){return e.style.getPropertyValue(t)||Ye(e).getComputedStyle(e,null).getPropertyValue(t)}function Ge(e){return function(){delete this[e]}}function Ke(e,t){return function(){this[e]=t}}function Ue(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Qe(e){return e.trim().split(/^|\s+/)}function Je(e){return e.classList||new et(e)}function et(e){this._node=e,this._names=Qe(e.getAttribute("class")||"")}function tt(e,t){for(var n=Je(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function nt(e,t){for(var n=Je(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ot(e){return function(){tt(this,e)}}function rt(e){return function(){nt(this,e)}}function it(e,t){return function(){(t.apply(this,arguments)?tt:nt)(this,e)}}function at(){this.textContent=""}function st(e){return function(){this.textContent=e}}function lt(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ct(){this.innerHTML=""}function ut(e){return function(){this.innerHTML=e}}function dt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function ft(){this.nextSibling&&this.parentNode.appendChild(this)}function ht(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pt(){return null}function gt(){var e=this.parentNode;e&&e.removeChild(this)}function mt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vt(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 bt(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 wt(e,t,n){var o=Ye(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 xt(e,t){return function(){return wt(this,e,t)}}function _t(e,t){return function(){return wt(this,e,t.apply(this,arguments))}}Te.prototype={constructor:Te,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)}},et.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 Et=[null];function kt(e,t){this._groups=e,this._parents=t}function St(){return new kt([[document.documentElement]],Et)}function Ot(e){return"string"==typeof e?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],Et)}function Nt(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]}kt.prototype=St.prototype={constructor:kt,select:function(e){"function"!=typeof e&&(e=xe(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 kt(o,this._parents)},selectAll:function(e){e="function"==typeof e?ke(e):Ee(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 kt(o,r)},selectChild:function(e){return this.select(null==e?Ce:function(e){return function(){return Ne.call(this.children,e)}}("function"==typeof e?e:Oe(e)))},selectChildren:function(e){return this.selectAll(null==e?Pe:function(e){return function(){return Me.call(this.children,e)}}("function"==typeof e?e:Oe(e)))},filter: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=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 kt(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Ae);var n,o=t?De:ze,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=Le(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 kt(s,r))._enter=l,s._exit=c,s},enter:function(){return new kt(this._enter||this._groups.map(Ie),this._parents)},exit:function(){return new kt(this._exit||this._groups.map(Ie),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 kt(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=Re);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 kt(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=me(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?Ve:je:"function"==typeof t?n.local?Fe:He:n.local?Be:$e)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Ze:"function"==typeof t?qe:Xe)(e,t,null==n?"":n)):We(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Ge:"function"==typeof t?Ue:Ke)(e,t)):this.node()[e]},classed:function(e,t){var n=Qe(e+"");if(arguments.length<2){for(var o=Je(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?it:t?ot:rt)(n,t))},text:function(e){return arguments.length?this.each(null==e?at:("function"==typeof e?lt:st)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ct:("function"==typeof e?dt:ut)(e)):this.node().innerHTML},raise:function(){return this.each(ft)},lower:function(){return this.each(ht)},append:function(e){var t="function"==typeof e?e:be(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:be(e),o=null==t?pt:"function"==typeof t?t:xe(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(gt)},clone:function(e){return this.select(e?yt:mt)},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?bt:vt,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?_t:xt)(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 Ct={passive:!1},Mt={capture:!0,passive:!1};function Pt(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Tt(e){var t=e.document.documentElement,n=Ot(e).on("dragstart.drag",It,Mt);"onselectstart"in t?n.on("selectstart.drag",It,Mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zt(e,t){var n=e.document.documentElement,o=Ot(e).on("dragstart.drag",null);t&&(o.on("click.drag",It,Mt),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 Dt=e=>()=>e;function At(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 Lt(e){return!e.ctrlKey&&!e.button}function Rt(){return this.parentNode}function jt(e,t){return null==t?{x:e.x,y:e.y}:t}function Vt(){return navigator.maxTouchPoints||"ontouchstart"in this}function $t(){var e,t,n,o,r=Lt,i=Rt,a=jt,s=Vt,l={},c=ue("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,Ct).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&&(Ot(a.view).on("mousemove.drag",p,Mt).on("mouseup.drag",g,Mt),Tt(a.view),Pt(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function p(o){if(It(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>d}l.mouse("drag",o)}function g(e){Ot(e.view).on("mousemove.drag mouseup.drag",null),zt(e.view,n),It(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]))&&(Pt(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])&&(It(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])&&(Pt(e),n("end",e,r[t]))}function b(e,t,n,o,r,i){var s,d,h,p=c.copy(),g=Nt(i||n,t);if(null!=(h=a.call(e,new At("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=Nt(c||a,t),m=u}p.call(i,e,new At(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:Dt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:Dt(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:Dt(e),f):a},f.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Dt(!!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 Bt(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ht(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ft(){}At.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Yt=.7,Zt=1/Yt,Xt="\\s*([+-]?\\d+)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gt=/^#([0-9a-f]{3,8})$/,Kt=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),Ut=new RegExp(`^rgb\\(${Wt},${Wt},${Wt}\\)$`),Qt=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${qt}\\)$`),Jt=new RegExp(`^rgba\\(${Wt},${Wt},${Wt},${qt}\\)$`),en=new RegExp(`^hsl\\(${qt},${Wt},${Wt}\\)$`),tn=new RegExp(`^hsla\\(${qt},${Wt},${Wt},${qt}\\)$`),nn={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 on(){return this.rgb().formatHex()}function rn(){return this.rgb().formatRgb()}function an(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?sn(t):3===n?new un(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ln(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ln(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=Kt.exec(e))?new un(t[1],t[2],t[3],1):(t=Ut.exec(e))?new un(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Qt.exec(e))?ln(t[1],t[2],t[3],t[4]):(t=Jt.exec(e))?ln(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=en.exec(e))?mn(t[1],t[2]/100,t[3]/100,1):(t=tn.exec(e))?mn(t[1],t[2]/100,t[3]/100,t[4]):nn.hasOwnProperty(e)?sn(nn[e]):"transparent"===e?new un(NaN,NaN,NaN,0):null}function sn(e){return new un(e>>16&255,e>>8&255,255&e,1)}function ln(e,t,n,o){return o<=0&&(e=t=n=NaN),new un(e,t,n,o)}function cn(e,t,n,o){return 1===arguments.length?((r=e)instanceof Ft||(r=an(r)),r?new un((r=r.rgb()).r,r.g,r.b,r.opacity):new un):new un(e,t,n,null==o?1:o);var r}function un(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function dn(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function fn(){const e=hn(this.opacity);return`${1===e?"rgb(":"rgba("}${pn(this.r)}, ${pn(this.g)}, ${pn(this.b)}${1===e?")":`, ${e})`}`}function hn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return((e=pn(e))<16?"0":"")+e.toString(16)}function mn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new vn(e,t,n,o)}function yn(e){if(e instanceof vn)return new vn(e.h,e.s,e.l,e.opacity);if(e instanceof Ft||(e=an(e)),!e)return new vn;if(e instanceof vn)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 vn(a,s,l,e.opacity)}function vn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function bn(e){return(e=(e||0)%360)<0?e+360:e}function wn(e){return Math.max(0,Math.min(1,e||0))}function xn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Bt(Ft,an,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:on,formatHex:on,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return yn(this).formatHsl()},formatRgb:rn,toString:rn}),Bt(un,cn,Ht(Ft,{brighter(e){return e=null==e?Zt:Math.pow(Zt,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Yt:Math.pow(Yt,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new un(pn(this.r),pn(this.g),pn(this.b),hn(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:dn,formatHex:dn,formatHex8:function(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:fn,toString:fn})),Bt(vn,function(e,t,n,o){return 1===arguments.length?yn(e):new vn(e,t,n,null==o?1:o)},Ht(Ft,{brighter(e){return e=null==e?Zt:Math.pow(Zt,e),new vn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Yt:Math.pow(Yt,e),new vn(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 un(xn(e>=240?e-240:e+120,r,o),xn(e,r,o),xn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new vn(bn(this.h),wn(this.s),wn(this.l),hn(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=hn(this.opacity);return`${1===e?"hsl(":"hsla("}${bn(this.h)}, ${100*wn(this.s)}%, ${100*wn(this.l)}%${1===e?")":`, ${e})`}`}}));var _n=e=>()=>e;function En(e){return 1===(e=+e)?kn: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):_n(isNaN(t)?n:t)}}function kn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):_n(isNaN(e)?t:e)}var Sn=function e(t){var n=En(t);function o(e,t){var o=n((e=cn(e)).r,(t=cn(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=kn(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 On(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 Nn(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]=Dn(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 Cn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Mn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Pn(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]=Dn(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tn=new RegExp(In.source,"g");function zn(e,t){var n,o,r,i=In.lastIndex=Tn.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=In.exec(e))&&(o=Tn.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:Mn(n,o)})),i=Tn.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 Dn(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?_n(t):("number"===r?Mn:"string"===r?(n=an(t))?(t=n,Sn):zn:t instanceof an?Sn:t instanceof Date?Cn:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?Nn:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Pn:Mn:On))(e,t)}var An,Ln=180/Math.PI,Rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jn(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)*Ln,skewX:Math.atan(l)*Ln,scaleX:a,scaleY:s}}function Vn(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:Mn(e,r)},{i:l-2,x:Mn(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:Mn(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:Mn(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:Mn(e,n)},{i:s-2,x:Mn(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 $n=Vn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rn:jn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Bn=Vn(function(e){return null==e?Rn:(An||(An=document.createElementNS("http://www.w3.org/2000/svg","g")),An.setAttribute("transform",e),(e=An.transform.baseVal.consolidate())?jn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Rn)},", ",")",")");function Hn(e){return((e=Math.exp(e))+1/e)/2}var Fn,Yn,Zn=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=Hn(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/Hn(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),Xn=0,qn=0,Wn=0,Gn=0,Kn=0,Un=0,Qn="object"==typeof performance&&performance.now?performance:Date,Jn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eo(){return Kn||(Jn(to),Kn=Qn.now()+Un)}function to(){Kn=0}function no(){this._call=this._time=this._next=null}function oo(e,t,n){var o=new no;return o.restart(e,t,n),o}function ro(){Kn=(Gn=Qn.now())+Un,Xn=qn=0;try{!function(){eo(),++Xn;for(var e,t=Fn;t;)(e=Kn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Xn}()}finally{Xn=0,function(){var e,t,n=Fn,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:Fn=t);Yn=e,ao(o)}(),Kn=0}}function io(){var e=Qn.now(),t=e-Gn;t>1e3&&(Un-=t,Gn=e)}function ao(e){Xn||(qn&&(qn=clearTimeout(qn)),e-Kn>24?(e<1/0&&(qn=setTimeout(ro,e-Qn.now()-Un)),Wn&&(Wn=clearInterval(Wn))):(Wn||(Gn=Qn.now(),Wn=setInterval(io,1e3)),Xn=1,Jn(ro)))}function so(e,t,n){var o=new no;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}no.prototype=oo.prototype={constructor:no,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?eo():+n)+(null==t?0:+t),this._next||Yn===this||(Yn?Yn._next=this:Fn=this,Yn=this),this._call=e,this._time=n,ao()},stop:function(){this._call&&(this._call=null,this._time=1/0,ao())}};var lo=ue("start","end","cancel","interrupt"),co=[];function uo(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 so(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(so(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=oo(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:lo,tween:co,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function fo(e,t){var n=po(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function ho(e,t){var n=po(e,t);if(n.state>3)throw new Error("too late; already running");return n}function po(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function go(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 mo(e,t){var n,o;return function(){var r=ho(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 yo(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=ho(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 vo(e,t,n){var o=e._id;return e.each(function(){var e=ho(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return po(e,o).value[t]}}function bo(e,t){var n;return("number"==typeof t?Mn:t instanceof an?Sn:(n=an(t))?(t=n,Sn):zn)(e,t)}function wo(e){return function(){this.removeAttribute(e)}}function xo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _o(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 Eo(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 ko(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 So(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 Oo(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 No(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 Co(e,t){return function(){fo(this,e).delay=+t.apply(this,arguments)}}function Mo(e,t){return t=+t,function(){fo(this,e).delay=t}}function Po(e,t){return function(){ho(this,e).duration=+t.apply(this,arguments)}}function Io(e,t){return t=+t,function(){ho(this,e).duration=t}}var To=St.prototype.constructor;function zo(e){return function(){this.style.removeProperty(e)}}var Do=0;function Ao(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Lo(){return++Do}var Ro=St.prototype;Ao.prototype={constructor:Ao,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=xe(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,uo(d[f],t,n,f,d,po(s,n)));return new Ao(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Ee(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=po(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&uo(f,t,n,g,h,p);i.push(h),a.push(l)}return new Ao(i,a,t,n)},selectChild:Ro.selectChild,selectChildren:Ro.selectChildren,filter: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=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 Ao(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 Ao(a,this._parents,this._name,this._id)},selection:function(){return new To(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Lo(),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=po(a,t);uo(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ao(o,this._parents,e,n)},call:Ro.call,nodes:Ro.nodes,node:Ro.node,size:Ro.size,empty:Ro.empty,each:Ro.each,on:function(e,t){var n=this._id;return arguments.length<2?po(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)?fo:ho;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=me(e),o="transform"===n?Bn:bo;return this.attrTween(e,"function"==typeof t?(n.local?So:ko)(n,o,vo(this,"attr."+e,t)):null==t?(n.local?xo:wo)(n):(n.local?Eo:_o)(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=me(e);return this.tween(n,(o.local?Oo:No)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?$n:bo;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=We(this,e),a=(this.style.removeProperty(e),We(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,zo(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=We(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=We(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,vo(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=ho(this,e),c=l.on,u=null==l.value[a]?i||(i=zo(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=We(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}}(vo(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=po(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?mo:yo)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Co:Mo)(t,e)):po(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Po:Io)(t,e)):po(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(){ho(this,e).ease=t}}(t,e)):po(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;ho(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=ho(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]:Ro[Symbol.iterator]};var jo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Vo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}St.prototype.interrupt=function(e){return this.each(function(){go(this,e)})},St.prototype.transition=function(e){var t,n;e instanceof Ao?(t=e._id,e=e._name):(t=Lo(),(n=jo).time=eo(),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])&&uo(a,e,t,c,s,n||Vo(a,t));return new Ao(o,this._parents,e,t)};var $o=e=>()=>e;function Bo(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 Ho(e,t,n){this.k=e,this.x=t,this.y=n}Ho.prototype={constructor:Ho,scale:function(e){return 1===e?this:new Ho(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ho(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 Fo=new Ho(1,0,0);function Yo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fo;return e.__zoom}function Zo(e){e.stopImmediatePropagation()}function Xo(e){e.preventDefault(),e.stopImmediatePropagation()}function qo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Wo(){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 Go(){return this.__zoom||Fo}function Ko(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(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 Jo(){var e,t,n,o=qo,r=Wo,i=Qo,a=Ko,s=Uo,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=Zn,f=ue("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",Go).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",N).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 Ho(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 Ho(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 Ho(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=Nt(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)],go(this),n.start()}Xo(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=Ot(e.view).on("mousemove.zoom",function(e){if(Xo(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]=Nt(e,r),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),zt(e.view,a.moved),Xo(e),a.event(e).end()},!0),l=Nt(e,r),u=e.clientX,d=e.clientY;Tt(e.view),Zo(e),a.mouse=[l,this.__zoom.invert(l)],go(this),a.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=Nt(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);Xo(e),u>0?Ot(this).transition().duration(u).call(b,d,a,e):Ot(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(Zo(n),a=0;a<u;++a)l=[l=Nt(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)),go(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(Xo(e),n=0;n<u;++n)r=Nt(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 N(e,...o){if(this.__zooming){var r,i,a=w(this,o).event(e),s=e.changedTouches,l=s.length;for(Zo(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=Nt(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=Ot(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",Go),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(Fo.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=Ot(this.that).datum();f.call(e,this.that,new Bo(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:$o(+e),g):a},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:$o(!!e),g):o},g.touchable=function(e){return arguments.length?(s="function"==typeof e?e:$o(!!e),g):s},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:$o([[+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}Yo.prototype=Ho.prototype;const er=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",tr=()=>"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.",nr=e=>`Node type "${e}" not found. Using fallback type "default".`,or=()=>"The React Flow parent container needs a width and a height to render the graph.",rr=()=>"Only child nodes can use a parent extent.",ir=()=>"Can't create edge. An edge needs a source and a target.",ar=e=>`Marker type "${e}" doesn't exist.`,sr=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,lr=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",cr=e=>`Edge type "${e}" not found. Using fallback type "default".`,ur=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.`,dr=(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.`,fr=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",hr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],pr=["Enter"," ","Escape"],gr={"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 mr,yr,vr;!function(e){e.Strict="strict",e.Loose="loose"}(mr||(mr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(yr||(yr={})),function(e){e.Partial="partial",e.Full="full"}(vr||(vr={}));const br={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var wr,xr,_r;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(wr||(wr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(xr||(xr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(_r||(_r={}));const Er={[_r.Left]:_r.Right,[_r.Right]:_r.Left,[_r.Top]:_r.Bottom,[_r.Bottom]:_r.Top};function kr(e){return null===e?null:e?"valid":"invalid"}const Sr=e=>"id"in e&&"source"in e&&"target"in e,Or=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nr=(e,t=[0,0])=>{const{width:n,height:o}=ti(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},Cr=(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=Hr(e);n=jr(n,t)}}),$r(n)},Mr=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Gr(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=Yr(s,Br(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 Pr({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=Cr(s),c=Qr(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 Ir({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&&ei(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",rr());const f=ei(d)?Dr(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",fr()),{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 Tr({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 zr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Dr=(e={x:0,y:0},t,n)=>({x:zr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:zr(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ar(e,t,n){const{width:o,height:r}=ti(n),{x:i,y:a}=n.internals.positionAbsolute;return Dr(e,[[i,a],[i+o,a+r]],t)}const Lr=(e,t,n)=>e<t?zr(Math.abs(e-t),1,t)/t:e>n?-zr(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>[Lr(e.x,o,t.width-o)*n,Lr(e.y,o,t.height-o)*n],jr=(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)}),Vr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),$r=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Br=(e,t=[0,0])=>{const{x:n,y:o}=Or(e)?e.internals.positionAbsolute:Nr(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}},Hr=(e,t=[0,0])=>{const{x:n,y:o}=Or(e)?e.internals.positionAbsolute:Nr(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)}},Fr=(e,t)=>$r(jr(Vr(e),Vr(t))),Yr=(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)},Zr=e=>Xr(e.width)&&Xr(e.height)&&Xr(e.x)&&Xr(e.y),Xr=e=>!isNaN(e)&&isFinite(e),qr=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Wr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Gr=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?Wr(s,a):s},Kr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ur(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 Qr=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Ur(e,n),r=Ur(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Ur(e.top??e.y??0,n),r=Ur(e.bottom??e.y??0,n),i=Ur(e.left??e.x??0,t),a=Ur(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=zr(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}=Kr(e,[t,n,o]),{x:l,y:c}=Kr({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}},Jr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function ei(e){return void 0!==e&&"parent"!==e}function ti(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ni(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function oi(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 ri(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ii(e){return{...gr,...e||{}}}function ai(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=fi(e),s=Gr({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?Wr(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const si=e=>({width:e.offsetWidth,height:e.offsetHeight}),li=e=>e?.getRootNode?.()||window?.document,ci=["INPUT","SELECT","TEXTAREA"];function ui(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return ci.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const di=e=>"clientX"in e,fi=(e,t)=>{const n=di(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)}},hi=(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,...si(t)}}):null};function pi({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 gi(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function mi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case _r.Left:return[t-gi(t-o,i),n];case _r.Right:return[t+gi(o-t,i),n];case _r.Top:return[t,n-gi(n-r,i)];case _r.Bottom:return[t,n+gi(r-n,i)]}}function yi({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top,curvature:a=.25}){const[s,l]=mi({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=mi({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,f,h,p]=pi({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 vi({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 bi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=jr(Hr(e),Hr(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 Yr(a,$r(i))>0}const wi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function xi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=vi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const _i={[_r.Left]:{x:-1,y:0},[_r.Right]:{x:1,y:0},[_r.Top]:{x:0,y:-1},[_r.Bottom]:{x:0,y:1}},Ei=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ki({source:e,sourcePosition:t=_r.Bottom,target:n,targetPosition:o=_r.Top,center:r,offset:i,stepPosition:a}){const s=_i[t],l=_i[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=_r.Bottom,target:n})=>t===_r.Left||t===_r.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]=vi({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 Si({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,h,p,g]=ki({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(Ei(e,t)/2,Ei(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 Oi(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ni(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 Ci(e,t,n=_r.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??ti(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case _r.Top:return{x:r+a/2,y:i};case _r.Right:return{x:r+a,y:i+s/2};case _r.Bottom:return{x:r+a/2,y:i+s};case _r.Left:return{x:r,y:i+s/2}}}function Mi(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Pi(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 Ii={nodeOrigin:[0,0],nodeExtent:hr,elevateNodesOnSelect:!0,defaults:{}},Ti={...Ii,checkEquality:!0};function zi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Di(e,t,n,o){const r=zi(Ti,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=Nr(l,r.nodeOrigin),o=ei(l.extent)?l.extent:r.nodeExtent,i=Dr(n,o,ti(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:Li(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&&Ai(e,t,n,o)}return i}function Ai(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=zi(Ii,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=ti(e),l=Nr(e,n),c=ei(e.extent)?Dr(l,e.extent,s):l;let u=Dr({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=Ar(u,s,t));const d=Li(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 Li(e,t){return(Xr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ri(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??Br(e),r=Fr(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=ti(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 ji(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 Vi(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}`;ji("source",s,`${r}-${a}--${n}-${i}`,e,n,i),ji("target",s,l,e,r,a),t.set(o.id,o)}}function $i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||$i(n,t))}function Bi(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 Hi({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 Fi({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=Cr(s);v=Vr(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=Wr(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}=Ir({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]=Hi({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]=Rr(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=ai(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||!$i(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]=Hi({nodeId:b,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),g?.(o.sourceEvent,e,t),b||m?.(o.sourceEvent,t)}}f=Ot(y);const k=$t().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=ai(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=fi(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:f,nodeLookup:p}=t(),g=ai(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=fi(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]=Hi({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||!Bi(t,`.${g}`,y))&&(!m||Bi(t,m,y))});f.call(k)},destroy:function(){f?.on(".drag",null)}}}function Yi(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())Yr(r,Br(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}=Ci(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 Zi(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,...Ci(a,l,l.position,!0)}:l}function Xi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const qi=()=>!0;function Wi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=qi,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}=fi(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=Xi(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===mr.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Zi(t,e,i,u,n,!0)}return y}const Gi={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=qi,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:x,autoPanSpeed:_,dragThreshold:E=1}){const k=li(e.target);let S,O=0;const{x:N,y:C}=fi(e),M=k?.elementFromPoint(N,C),P=Xi(i,M),I=s?.getBoundingClientRect();let T=!1;if(!I||!P)return;const z=Zi(r,P,o,l,t);if(!z)return;let D=fi(e,I),A=!1,L=null,R=!1,j=null;function V(){if(!u||!I)return;const[e,t]=Rr(D,I,_);f({x:e,y:t}),O=requestAnimationFrame(V)}const $={...z,nodeId:r,type:P,position:z.position},B=l.get(r);let H={inProgress:!0,isValid:null,from:Ci(B,$,_r.Left,!0),fromHandle:$,fromPosition:$.position,fromNode:B,to:D,toHandle:null,toPosition:Er[$.position],toNode:null};function F(){T=!0,b(H),p?.(e,{nodeId:r,handleId:o,handleType:P})}function Y(e){if(!T){const{x:t,y:n}=fi(e),o=t-N,r=n-C;if(!(o*o+r*r>E*E))return;F()}if(!x()||!$)return void Z(e);const i=w();D=fi(e,I),S=Yi(Gr(D,i,!1,[1,1]),n,l,$),A||(V(),A=!0);const s=Wi(e,{handle:S,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});j=s.handleDomNode,L=s.connection,R=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!S,s.isValid);const u={...H,isValid:R,to:s.toHandle&&R?Kr({x:s.toHandle.x,y:s.toHandle.y},i):D,toHandle:s.toHandle,toPosition:R&&s.toHandle?s.toHandle.position:Er[$.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};R&&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(T){(S||j)&&L&&R&&g?.(L);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}h(),cancelAnimationFrame(O),A=!1,R=!1,L=null,j=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:Wi};const Ki=e=>({x:e.x,y:e.y,zoom:e.k}),Ui=({x:e,y:t,zoom:n})=>Fo.translate(e,t).scale(n),Qi=(e,t)=>e.target.closest(`.${t}`),Ji=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),ea=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ta=(e,t=0,n=ea,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},na=e=>{const t=e.ctrlKey&&Jr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function oa({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=Jo().clickDistance(!Xr(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=Ot(e).call(f);v({x:i.x,y:i.y,zoom:zr(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?Dn:Zn).transform(ta(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=Ui(e),r=f?.constrain()(o,t,n);return r&&await m(r),new Promise(e=>e(r))}return f.wheelDelta(na),{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(Qi(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=Nt(u),t=na(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===yr.Vertical?0:u.deltaX*f,p=r===yr.Horizontal?0:u.deltaY*f;!Jr()&&u.shiftKey&&r!==yr.Vertical&&(h=u.deltaY*f,p=0),o.translateBy(n,-h/d*i,-p/d*i,{internal:!0});const g=Ki(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=Qi(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=Ki(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||!Ji(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Ki(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&&Ji(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=Ki(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&&(Qi(u,`${c}-flow__node`)||Qi(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(Qi(u,s)&&"wheel"===u.type)return!1;if(Qi(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=Ui(e);return await m(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){const e=h?Yo(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?Dn:Zn).scaleTo(ta(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?Dn:Zn).scaleBy(ta(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=Ui(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=!Xr(e)||e<0?0:e;f?.clickDistance(t)}}}var ra;function ia(e,t){return Math.max(0,t-e)}function aa(e,t){return Math.max(0,e-t)}function sa(e,t,n){return Math.max(0,t-e,e-n)}function la(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(ra||(ra={}));const ca={width:0,height:0,x:0,y:0},ua={...ca,pointerX:0,pointerY:0,aspectRatio:1};function da(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 fa({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Ot(e);return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:s,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:f}){let h={...ca},p={...ua};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 _=$t().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}=ai(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=da(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=ai(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),_=[];if(!m)return;const{x:E,y:k,width:S,height:O}=h,N={},C=m.origin??c,{width:M,height:P,x:I,y:T}=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),N=_+(c?-S:S),C=-i[0]*x,M=-i[1]*_;let P=sa(O,g,m),I=sa(N,y,v);if(a){let e=0,t=0;l&&k<0?e=ia(b+k+C,a[0][0]):!l&&k>0&&(e=aa(b+O+C,a[1][0])),c&&S<0?t=ia(w+S+M,a[0][1]):!c&&S>0&&(t=aa(w+N+M,a[1][1])),P=Math.max(P,e),I=Math.max(I,t)}if(s){let e=0,t=0;l&&k>0?e=aa(b+k,s[0][0]):!l&&k<0&&(e=ia(b+O,s[1][0])),c&&S>0?t=aa(w+S,s[0][1]):!c&&S<0&&(t=ia(w+N,s[1][1])),P=Math.max(P,e),I=Math.max(I,t)}if(r){if(u){const e=sa(O/E,y,v)*E;if(P=Math.max(P,e),a){let e=0;e=!l&&!c||l&&!c&&f?aa(w+M+O/E,a[1][1])*E:ia(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?ia(w+O/E,s[1][1])*E:aa(w+(l?k:-k)/E,s[0][1])*E,P=Math.max(P,e)}}if(d){const e=sa(N*E,g,m)/E;if(I=Math.max(I,e),a){let e=0;e=!l&&!c||c&&!l&&f?aa(b+N*E+C,a[1][0])/E:ia(b+(c?S:-S)*E+C,a[0][0])/E,I=Math.max(I,e)}if(s){let e=0;e=!l&&!c||c&&!l&&f?ia(b+N*E,s[1][0])/E:aa(b+(c?S:-S)*E,s[0][0])/E,I=Math.max(I,e)}}}S+=S<0?I:-I,k+=k<0?P:-P,r&&(f?O>N*E?S=(la(l,c)?-k:k)/E:k=(la(l,c)?-S:S)*E:u?(S=k/E,c=l):(k=S*E,l=c));const T=l?b+k:b,z=c?w+S:w;return{width:x+(l?-k:k),height:_+(c?-S:S),x:i[0]*k*(l?-1:1)+T,y:i[1]*S*(c?-1:1)+z}}(p,g,d,a,s,C,v,b),z=M!==S,D=P!==O,A=I!==E&&z,L=T!==k&&D;if(!(A||L||z||D))return;if((A||L||1===C[0]||1===C[1])&&(N.x=A?I:h.x,N.y=L?T:h.y,h.x=N.x,h.y=N.y,x.length>0)){const e=I-E,t=T-k;for(const n of x)n.position={x:n.position.x-e+C[0]*(M-S),y:n.position.y-t+C[1]*(P-O)},_.push(n)}if((z||D)&&(N.width=!z||l&&"horizontal"!==l?h.width:M,N.height=!D||l&&"vertical"!==l?h.height:P,h.width=N.width,h.height=N.height),y&&m.expandParent){const e=C[0]*(N.width??0);N.x&&N.x<e&&(h.x=e,p.x=p.x-(N.x-e));const t=C[1]*(N.height??0);N.y&&N.y<t&&(h.y=t,p.y=p.y-(N.y-t))}const R=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}),j={...h,direction:R},V=f?.(e,j);!1!==V&&(u?.(e,j),o(N,_))}).on("end",e=>{d?.(e,{...h}),r?.({...h})});i.call(_)},destroy:function(){i.on(".drag",null)}}}var ha,pa={exports:{}},ga={},ma={exports:{}},ya={};var va,ba,wa,xa={};
|
|
14
|
+
*/function $(){if(N)return O;N=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;return O=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},O}function H(){if(M)return C;M=1;return C="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"}function F(){return I?P:(I=1,P=Function.call.bind(Object.prototype.hasOwnProperty))}function Y(){if(z)return T;z=1;var e=function(){};if("production"!==process.env.NODE_ENV){var t=H(),n={},o=F();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={})},T=r}function Z(){if(A)return D;A=1;var e=B(),t=$(),n=H(),o=F(),r=Y(),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){}}),D=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},D}function X(){if(R)return L;R=1;var e=H();function t(){}function n(){}return n.resetWarningCache=t,L=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},L}function q(){if(j)return x.exports;if(j=1,"production"!==process.env.NODE_ENV){var e=B();x.exports=Z()(e.isElement,true)}else x.exports=X()();return x.exports}var W=b(q()),G="#184b2d",K="#420b0e",U="#4b4b18",Q=function(n){var o=n.index,r=n.functionName,i=n.fileName,a=n.lineNumber,s=n.selected,l=n.selectTraceItem,c=n.hasException,u={};return s&&0===o?u={backgroundColor:c?K:U}:s&&(u={backgroundColor:c?K:G}),t("div",{className:"stackRow",style:u,onClick:function(e){return l(o)},children:[e("div",{className:"left",children:e("span",{className:"functionName",children:r})}),t("div",{className:"right",children:[e("span",{className:"fileName",children:i}),t("span",{className:"lineNumber",children:[a,":1"]})]})]})};Q.propTypes={index:W.number,functionName:W.string,fileName:W.string,lineNumber:W.number,selected:W.bool,selectTraceItem:W.func,hasException:W.bool};var J=function(t){var n,o=t.traces,r=t.selectTraceItem;return e("div",{className:"stackContainer",children:(n=o.map(function(t,n){return e(Q,{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 ee(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 te(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 ne(e){if(null==e)throw new TypeError("Cannot destructure "+e)}function oe(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 re(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?oe(Object(n),!0).forEach(function(t){te(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oe(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function ie(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)||se(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 ae(e){return function(e){if(Array.isArray(e))return ee(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||se(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 se(e,t){if(e){if("string"==typeof e)return ee(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)?ee(e,t):void 0}}function le(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=le(e[o]))&&(t+=(t&&" ")+n);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}J.propTypes={traces:W.array,selectTraceItem:W.func};var ce={value:()=>{}};function ue(){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 de(o)}function de(e){this._=e}function fe(e,t){for(var n,o=0,r=e.length;o<r;++o)if((n=e[o]).name===t)return n.value}function he(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ce,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}de.prototype=ue.prototype={constructor:de,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]=he(r[n],e.name,t);else if(null==t)for(n in r)r[n]=he(r[n],e.name,null);return this}for(;++a<s;)if((n=(e=i[a]).type)&&(n=fe(r[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new de(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 pe="http://www.w3.org/1999/xhtml",ge={svg:"http://www.w3.org/2000/svg",xhtml:pe,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function me(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ge.hasOwnProperty(t)?{space:ge[t],local:e}:e}function ye(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===pe&&t.documentElement.namespaceURI===pe?t.createElement(e):t.createElementNS(n,e)}}function ve(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function be(e){var t=me(e);return(t.local?ve:ye)(t)}function we(){}function xe(e){return null==e?we:function(){return this.querySelector(e)}}function _e(){return[]}function Ee(e){return null==e?_e:function(){return this.querySelectorAll(e)}}function ke(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function Se(e){return function(){return this.matches(e)}}function Oe(e){return function(t){return t.matches(e)}}var Ne=Array.prototype.find;function Ce(){return this.firstElementChild}var Me=Array.prototype.filter;function Pe(){return Array.from(this.children)}function Ie(e){return new Array(e.length)}function Te(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function ze(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 Te(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function De(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 Te(e,i[s]);for(s=0;s<d;++s)(l=t[s])&&u.get(h[s])===l&&(r[s]=l)}function Ae(e){return e.__data__}function Le(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Re(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function je(e){return function(){this.removeAttribute(e)}}function Ve(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Be(e,t){return function(){this.setAttribute(e,t)}}function $e(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function He(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Fe(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 Ye(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ze(e){return function(){this.style.removeProperty(e)}}function Xe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function qe(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function We(e,t){return e.style.getPropertyValue(t)||Ye(e).getComputedStyle(e,null).getPropertyValue(t)}function Ge(e){return function(){delete this[e]}}function Ke(e,t){return function(){this[e]=t}}function Ue(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function Qe(e){return e.trim().split(/^|\s+/)}function Je(e){return e.classList||new et(e)}function et(e){this._node=e,this._names=Qe(e.getAttribute("class")||"")}function tt(e,t){for(var n=Je(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function nt(e,t){for(var n=Je(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function ot(e){return function(){tt(this,e)}}function rt(e){return function(){nt(this,e)}}function it(e,t){return function(){(t.apply(this,arguments)?tt:nt)(this,e)}}function at(){this.textContent=""}function st(e){return function(){this.textContent=e}}function lt(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ct(){this.innerHTML=""}function ut(e){return function(){this.innerHTML=e}}function dt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function ft(){this.nextSibling&&this.parentNode.appendChild(this)}function ht(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function pt(){return null}function gt(){var e=this.parentNode;e&&e.removeChild(this)}function mt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function yt(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function vt(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 bt(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 wt(e,t,n){var o=Ye(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 xt(e,t){return function(){return wt(this,e,t)}}function _t(e,t){return function(){return wt(this,e,t.apply(this,arguments))}}Te.prototype={constructor:Te,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)}},et.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 Et=[null];function kt(e,t){this._groups=e,this._parents=t}function St(){return new kt([[document.documentElement]],Et)}function Ot(e){return"string"==typeof e?new kt([[document.querySelector(e)]],[document.documentElement]):new kt([[e]],Et)}function Nt(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]}kt.prototype=St.prototype={constructor:kt,select:function(e){"function"!=typeof e&&(e=xe(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 kt(o,this._parents)},selectAll:function(e){e="function"==typeof e?ke(e):Ee(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 kt(o,r)},selectChild:function(e){return this.select(null==e?Ce:function(e){return function(){return Ne.call(this.children,e)}}("function"==typeof e?e:Oe(e)))},selectChildren:function(e){return this.selectAll(null==e?Pe:function(e){return function(){return Me.call(this.children,e)}}("function"==typeof e?e:Oe(e)))},filter: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=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 kt(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Ae);var n,o=t?De:ze,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=Le(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 kt(s,r))._enter=l,s._exit=c,s},enter:function(){return new kt(this._enter||this._groups.map(Ie),this._parents)},exit:function(){return new kt(this._exit||this._groups.map(Ie),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 kt(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=Re);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 kt(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=me(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?Ve:je:"function"==typeof t?n.local?Fe:He:n.local?$e:Be)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Ze:"function"==typeof t?qe:Xe)(e,t,null==n?"":n)):We(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Ge:"function"==typeof t?Ue:Ke)(e,t)):this.node()[e]},classed:function(e,t){var n=Qe(e+"");if(arguments.length<2){for(var o=Je(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each(("function"==typeof t?it:t?ot:rt)(n,t))},text:function(e){return arguments.length?this.each(null==e?at:("function"==typeof e?lt:st)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ct:("function"==typeof e?dt:ut)(e)):this.node().innerHTML},raise:function(){return this.each(ft)},lower:function(){return this.each(ht)},append:function(e){var t="function"==typeof e?e:be(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:be(e),o=null==t?pt:"function"==typeof t?t:xe(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(gt)},clone:function(e){return this.select(e?yt:mt)},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?bt:vt,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?_t:xt)(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 Ct={passive:!1},Mt={capture:!0,passive:!1};function Pt(e){e.stopImmediatePropagation()}function It(e){e.preventDefault(),e.stopImmediatePropagation()}function Tt(e){var t=e.document.documentElement,n=Ot(e).on("dragstart.drag",It,Mt);"onselectstart"in t?n.on("selectstart.drag",It,Mt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function zt(e,t){var n=e.document.documentElement,o=Ot(e).on("dragstart.drag",null);t&&(o.on("click.drag",It,Mt),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 Dt=e=>()=>e;function At(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 Lt(e){return!e.ctrlKey&&!e.button}function Rt(){return this.parentNode}function jt(e,t){return null==t?{x:e.x,y:e.y}:t}function Vt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Bt(){var e,t,n,o,r=Lt,i=Rt,a=jt,s=Vt,l={},c=ue("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,Ct).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&&(Ot(a.view).on("mousemove.drag",p,Mt).on("mouseup.drag",g,Mt),Tt(a.view),Pt(a),n=!1,e=a.clientX,t=a.clientY,l("start",a))}}function p(o){if(It(o),!n){var r=o.clientX-e,i=o.clientY-t;n=r*r+i*i>d}l.mouse("drag",o)}function g(e){Ot(e.view).on("mousemove.drag mouseup.drag",null),zt(e.view,n),It(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]))&&(Pt(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])&&(It(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])&&(Pt(e),n("end",e,r[t]))}function b(e,t,n,o,r,i){var s,d,h,p=c.copy(),g=Nt(i||n,t);if(null!=(h=a.call(e,new At("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=Nt(c||a,t),m=u}p.call(i,e,new At(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:Dt(!!e),f):r},f.container=function(e){return arguments.length?(i="function"==typeof e?e:Dt(e),f):i},f.subject=function(e){return arguments.length?(a="function"==typeof e?e:Dt(e),f):a},f.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Dt(!!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 $t(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Ht(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ft(){}At.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Yt=.7,Zt=1/Yt,Xt="\\s*([+-]?\\d+)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Gt=/^#([0-9a-f]{3,8})$/,Kt=new RegExp(`^rgb\\(${Xt},${Xt},${Xt}\\)$`),Ut=new RegExp(`^rgb\\(${Wt},${Wt},${Wt}\\)$`),Qt=new RegExp(`^rgba\\(${Xt},${Xt},${Xt},${qt}\\)$`),Jt=new RegExp(`^rgba\\(${Wt},${Wt},${Wt},${qt}\\)$`),en=new RegExp(`^hsl\\(${qt},${Wt},${Wt}\\)$`),tn=new RegExp(`^hsla\\(${qt},${Wt},${Wt},${qt}\\)$`),nn={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 on(){return this.rgb().formatHex()}function rn(){return this.rgb().formatRgb()}function an(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Gt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?sn(t):3===n?new un(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ln(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ln(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=Kt.exec(e))?new un(t[1],t[2],t[3],1):(t=Ut.exec(e))?new un(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Qt.exec(e))?ln(t[1],t[2],t[3],t[4]):(t=Jt.exec(e))?ln(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=en.exec(e))?mn(t[1],t[2]/100,t[3]/100,1):(t=tn.exec(e))?mn(t[1],t[2]/100,t[3]/100,t[4]):nn.hasOwnProperty(e)?sn(nn[e]):"transparent"===e?new un(NaN,NaN,NaN,0):null}function sn(e){return new un(e>>16&255,e>>8&255,255&e,1)}function ln(e,t,n,o){return o<=0&&(e=t=n=NaN),new un(e,t,n,o)}function cn(e,t,n,o){return 1===arguments.length?((r=e)instanceof Ft||(r=an(r)),r?new un((r=r.rgb()).r,r.g,r.b,r.opacity):new un):new un(e,t,n,null==o?1:o);var r}function un(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function dn(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}`}function fn(){const e=hn(this.opacity);return`${1===e?"rgb(":"rgba("}${pn(this.r)}, ${pn(this.g)}, ${pn(this.b)}${1===e?")":`, ${e})`}`}function hn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function pn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function gn(e){return((e=pn(e))<16?"0":"")+e.toString(16)}function mn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new vn(e,t,n,o)}function yn(e){if(e instanceof vn)return new vn(e.h,e.s,e.l,e.opacity);if(e instanceof Ft||(e=an(e)),!e)return new vn;if(e instanceof vn)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 vn(a,s,l,e.opacity)}function vn(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function bn(e){return(e=(e||0)%360)<0?e+360:e}function wn(e){return Math.max(0,Math.min(1,e||0))}function xn(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}$t(Ft,an,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:on,formatHex:on,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return yn(this).formatHsl()},formatRgb:rn,toString:rn}),$t(un,cn,Ht(Ft,{brighter(e){return e=null==e?Zt:Math.pow(Zt,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Yt:Math.pow(Yt,e),new un(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new un(pn(this.r),pn(this.g),pn(this.b),hn(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:dn,formatHex:dn,formatHex8:function(){return`#${gn(this.r)}${gn(this.g)}${gn(this.b)}${gn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:fn,toString:fn})),$t(vn,function(e,t,n,o){return 1===arguments.length?yn(e):new vn(e,t,n,null==o?1:o)},Ht(Ft,{brighter(e){return e=null==e?Zt:Math.pow(Zt,e),new vn(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Yt:Math.pow(Yt,e),new vn(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 un(xn(e>=240?e-240:e+120,r,o),xn(e,r,o),xn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new vn(bn(this.h),wn(this.s),wn(this.l),hn(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=hn(this.opacity);return`${1===e?"hsl(":"hsla("}${bn(this.h)}, ${100*wn(this.s)}%, ${100*wn(this.l)}%${1===e?")":`, ${e})`}`}}));var _n=e=>()=>e;function En(e){return 1===(e=+e)?kn: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):_n(isNaN(t)?n:t)}}function kn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):_n(isNaN(e)?t:e)}var Sn=function e(t){var n=En(t);function o(e,t){var o=n((e=cn(e)).r,(t=cn(t)).r),r=n(e.g,t.g),i=n(e.b,t.b),a=kn(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 On(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 Nn(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]=Dn(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 Cn(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Mn(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Pn(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]=Dn(e[n],t[n]):r[n]=t[n];return function(e){for(n in o)r[n]=o[n](e);return r}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Tn=new RegExp(In.source,"g");function zn(e,t){var n,o,r,i=In.lastIndex=Tn.lastIndex=0,a=-1,s=[],l=[];for(e+="",t+="";(n=In.exec(e))&&(o=Tn.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:Mn(n,o)})),i=Tn.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 Dn(e,t){var n,o,r=typeof t;return null==t||"boolean"===r?_n(t):("number"===r?Mn:"string"===r?(n=an(t))?(t=n,Sn):zn:t instanceof an?Sn:t instanceof Date?Cn:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?Nn:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Pn:Mn:On))(e,t)}var An,Ln=180/Math.PI,Rn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jn(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)*Ln,skewX:Math.atan(l)*Ln,scaleX:a,scaleY:s}}function Vn(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:Mn(e,r)},{i:l-2,x:Mn(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:Mn(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:Mn(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:Mn(e,n)},{i:s-2,x:Mn(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 Bn=Vn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Rn:jn(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),$n=Vn(function(e){return null==e?Rn:(An||(An=document.createElementNS("http://www.w3.org/2000/svg","g")),An.setAttribute("transform",e),(e=An.transform.baseVal.consolidate())?jn((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Rn)},", ",")",")");function Hn(e){return((e=Math.exp(e))+1/e)/2}var Fn,Yn,Zn=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=Hn(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/Hn(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),Xn=0,qn=0,Wn=0,Gn=0,Kn=0,Un=0,Qn="object"==typeof performance&&performance.now?performance:Date,Jn="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function eo(){return Kn||(Jn(to),Kn=Qn.now()+Un)}function to(){Kn=0}function no(){this._call=this._time=this._next=null}function oo(e,t,n){var o=new no;return o.restart(e,t,n),o}function ro(){Kn=(Gn=Qn.now())+Un,Xn=qn=0;try{!function(){eo(),++Xn;for(var e,t=Fn;t;)(e=Kn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Xn}()}finally{Xn=0,function(){var e,t,n=Fn,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:Fn=t);Yn=e,ao(o)}(),Kn=0}}function io(){var e=Qn.now(),t=e-Gn;t>1e3&&(Un-=t,Gn=e)}function ao(e){Xn||(qn&&(qn=clearTimeout(qn)),e-Kn>24?(e<1/0&&(qn=setTimeout(ro,e-Qn.now()-Un)),Wn&&(Wn=clearInterval(Wn))):(Wn||(Gn=Qn.now(),Wn=setInterval(io,1e3)),Xn=1,Jn(ro)))}function so(e,t,n){var o=new no;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}no.prototype=oo.prototype={constructor:no,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?eo():+n)+(null==t?0:+t),this._next||Yn===this||(Yn?Yn._next=this:Fn=this,Yn=this),this._call=e,this._time=n,ao()},stop:function(){this._call&&(this._call=null,this._time=1/0,ao())}};var lo=ue("start","end","cancel","interrupt"),co=[];function uo(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 so(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(so(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=oo(i,0,n.time)}(e,n,{name:t,index:o,group:r,on:lo,tween:co,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:0})}function fo(e,t){var n=po(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function ho(e,t){var n=po(e,t);if(n.state>3)throw new Error("too late; already running");return n}function po(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function go(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 mo(e,t){var n,o;return function(){var r=ho(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 yo(e,t,n){var o,r;if("function"!=typeof n)throw new Error;return function(){var i=ho(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 vo(e,t,n){var o=e._id;return e.each(function(){var e=ho(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return po(e,o).value[t]}}function bo(e,t){var n;return("number"==typeof t?Mn:t instanceof an?Sn:(n=an(t))?(t=n,Sn):zn)(e,t)}function wo(e){return function(){this.removeAttribute(e)}}function xo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function _o(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 Eo(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 ko(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 So(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 Oo(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 No(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 Co(e,t){return function(){fo(this,e).delay=+t.apply(this,arguments)}}function Mo(e,t){return t=+t,function(){fo(this,e).delay=t}}function Po(e,t){return function(){ho(this,e).duration=+t.apply(this,arguments)}}function Io(e,t){return t=+t,function(){ho(this,e).duration=t}}var To=St.prototype.constructor;function zo(e){return function(){this.style.removeProperty(e)}}var Do=0;function Ao(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Lo(){return++Do}var Ro=St.prototype;Ao.prototype={constructor:Ao,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=xe(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,uo(d[f],t,n,f,d,po(s,n)));return new Ao(i,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Ee(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=po(l,n),g=0,m=h.length;g<m;++g)(f=h[g])&&uo(f,t,n,g,h,p);i.push(h),a.push(l)}return new Ao(i,a,t,n)},selectChild:Ro.selectChild,selectChildren:Ro.selectChildren,filter: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=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 Ao(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 Ao(a,this._parents,this._name,this._id)},selection:function(){return new To(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Lo(),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=po(a,t);uo(a,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ao(o,this._parents,e,n)},call:Ro.call,nodes:Ro.nodes,node:Ro.node,size:Ro.size,empty:Ro.empty,each:Ro.each,on:function(e,t){var n=this._id;return arguments.length<2?po(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)?fo:ho;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=me(e),o="transform"===n?$n:bo;return this.attrTween(e,"function"==typeof t?(n.local?So:ko)(n,o,vo(this,"attr."+e,t)):null==t?(n.local?xo:wo)(n):(n.local?Eo:_o)(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=me(e);return this.tween(n,(o.local?Oo:No)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?Bn:bo;return null==t?this.styleTween(e,function(e,t){var n,o,r;return function(){var i=We(this,e),a=(this.style.removeProperty(e),We(this,e));return i===a?null:i===n&&a===o?r:r=t(n=i,o=a)}}(e,o)).on("end.style."+e,zo(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,r,i;return function(){var a=We(this,e),s=n(this),l=s+"";return null==s&&(this.style.removeProperty(e),l=s=We(this,e)),a===l?null:a===o&&l===r?i:(r=l,i=t(o=a,s))}}(e,o,vo(this,"style."+e,t))).each(function(e,t){var n,o,r,i,a="style."+t,s="end."+a;return function(){var l=ho(this,e),c=l.on,u=null==l.value[a]?i||(i=zo(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=We(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}}(vo(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=po(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?mo:yo)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Co:Mo)(t,e)):po(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Po:Io)(t,e)):po(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(){ho(this,e).ease=t}}(t,e)):po(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;ho(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=ho(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]:Ro[Symbol.iterator]};var jo={time:null,delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Vo(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}St.prototype.interrupt=function(e){return this.each(function(){go(this,e)})},St.prototype.transition=function(e){var t,n;e instanceof Ao?(t=e._id,e=e._name):(t=Lo(),(n=jo).time=eo(),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])&&uo(a,e,t,c,s,n||Vo(a,t));return new Ao(o,this._parents,e,t)};var Bo=e=>()=>e;function $o(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 Ho(e,t,n){this.k=e,this.x=t,this.y=n}Ho.prototype={constructor:Ho,scale:function(e){return 1===e?this:new Ho(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Ho(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 Fo=new Ho(1,0,0);function Yo(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Fo;return e.__zoom}function Zo(e){e.stopImmediatePropagation()}function Xo(e){e.preventDefault(),e.stopImmediatePropagation()}function qo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Wo(){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 Go(){return this.__zoom||Fo}function Ko(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Uo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(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 Jo(){var e,t,n,o=qo,r=Wo,i=Qo,a=Ko,s=Uo,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=Zn,f=ue("start","zoom","end"),h=0,p=10;function g(e){e.property("__zoom",Go).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",N).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 Ho(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 Ho(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 Ho(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=Nt(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)],go(this),n.start()}Xo(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=Ot(e.view).on("mousemove.zoom",function(e){if(Xo(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]=Nt(e,r),a.mouse[1]),a.extent,c))},!0).on("mouseup.zoom",function(e){s.on("mousemove.zoom mouseup.zoom",null),zt(e.view,a.moved),Xo(e),a.event(e).end()},!0),l=Nt(e,r),u=e.clientX,d=e.clientY;Tt(e.view),Zo(e),a.mouse=[l,this.__zoom.invert(l)],go(this),a.start()}}function k(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=Nt(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);Xo(e),u>0?Ot(this).transition().duration(u).call(b,d,a,e):Ot(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(Zo(n),a=0;a<u;++a)l=[l=Nt(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)),go(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(Xo(e),n=0;n<u;++n)r=Nt(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 N(e,...o){if(this.__zooming){var r,i,a=w(this,o).event(e),s=e.changedTouches,l=s.length;for(Zo(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=Nt(i,this),Math.hypot(t[0]-i[0],t[1]-i[1])<p)){var c=Ot(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",Go),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(Fo.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=Ot(this.that).datum();f.call(e,this.that,new $o(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:Bo(+e),g):a},g.filter=function(e){return arguments.length?(o="function"==typeof e?e:Bo(!!e),g):o},g.touchable=function(e){return arguments.length?(s="function"==typeof e?e:Bo(!!e),g):s},g.extent=function(e){return arguments.length?(r="function"==typeof e?e:Bo([[+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}Yo.prototype=Ho.prototype;const er=()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",tr=()=>"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.",nr=e=>`Node type "${e}" not found. Using fallback type "default".`,or=()=>"The React Flow parent container needs a width and a height to render the graph.",rr=()=>"Only child nodes can use a parent extent.",ir=()=>"Can't create edge. An edge needs a source and a target.",ar=e=>`Marker type "${e}" doesn't exist.`,sr=(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${"source"===e?n:o}", edge id: ${t}.`,lr=()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",cr=e=>`Edge type "${e}" not found. Using fallback type "default".`,ur=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.`,dr=(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.`,fr=()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",hr=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],pr=["Enter"," ","Escape"],gr={"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 mr,yr,vr;!function(e){e.Strict="strict",e.Loose="loose"}(mr||(mr={})),function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"}(yr||(yr={})),function(e){e.Partial="partial",e.Full="full"}(vr||(vr={}));const br={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null};var wr,xr,_r;!function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"}(wr||(wr={})),function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"}(xr||(xr={})),function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"}(_r||(_r={}));const Er={[_r.Left]:_r.Right,[_r.Right]:_r.Left,[_r.Top]:_r.Bottom,[_r.Bottom]:_r.Top};function kr(e){return null===e?null:e?"valid":"invalid"}const Sr=e=>"id"in e&&"source"in e&&"target"in e,Or=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Nr=(e,t=[0,0])=>{const{width:n,height:o}=ti(e),r=e.origin??t,i=n*r[0],a=o*r[1];return{x:e.position.x-i,y:e.position.y-a}},Cr=(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=Hr(e);n=jr(n,t)}}),Br(n)},Mr=(e,t,[n,o,r]=[0,0,1],i=!1,a=!1)=>{const s={...Gr(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=Yr(s,$r(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 Pr({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=Cr(s),c=Qr(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 Ir({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&&ei(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",rr());const f=ei(d)?Dr(t,d,a.measured):t;return void 0!==a.measured.width&&void 0!==a.measured.height||i?.("015",fr()),{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 Tr({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 zr=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Dr=(e={x:0,y:0},t,n)=>({x:zr(e.x,t[0][0],t[1][0]-(n?.width??0)),y:zr(e.y,t[0][1],t[1][1]-(n?.height??0))});function Ar(e,t,n){const{width:o,height:r}=ti(n),{x:i,y:a}=n.internals.positionAbsolute;return Dr(e,[[i,a],[i+o,a+r]],t)}const Lr=(e,t,n)=>e<t?zr(Math.abs(e-t),1,t)/t:e>n?-zr(Math.abs(e-n),1,t)/t:0,Rr=(e,t,n=15,o=40)=>[Lr(e.x,o,t.width-o)*n,Lr(e.y,o,t.height-o)*n],jr=(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)}),Vr=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),Br=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),$r=(e,t=[0,0])=>{const{x:n,y:o}=Or(e)?e.internals.positionAbsolute:Nr(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}},Hr=(e,t=[0,0])=>{const{x:n,y:o}=Or(e)?e.internals.positionAbsolute:Nr(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)}},Fr=(e,t)=>Br(jr(Vr(e),Vr(t))),Yr=(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)},Zr=e=>Xr(e.width)&&Xr(e.height)&&Xr(e.x)&&Xr(e.y),Xr=e=>!isNaN(e)&&isFinite(e),qr=(e,t)=>{"development"===process.env.NODE_ENV&&console.warn(`[React Flow]: ${t} Help: https://reactflow.dev/error#${e}`)},Wr=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Gr=({x:e,y:t},[n,o,r],i=!1,a=[1,1])=>{const s={x:(e-n)/r,y:(t-o)/r};return i?Wr(s,a):s},Kr=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ur(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 Qr=(e,t,n,o,r,i)=>{const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Ur(e,n),r=Ur(e,t);return{top:o,right:r,bottom:o,left:r,x:2*r,y:2*o}}if("object"==typeof e){const o=Ur(e.top??e.y??0,n),r=Ur(e.bottom??e.y??0,n),i=Ur(e.left??e.x??0,t),a=Ur(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=zr(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}=Kr(e,[t,n,o]),{x:l,y:c}=Kr({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}},Jr=()=>"undefined"!=typeof navigator&&navigator?.userAgent?.indexOf("Mac")>=0;function ei(e){return void 0!==e&&"parent"!==e}function ti(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ni(e){return void 0!==(e.measured?.width??e.width??e.initialWidth)&&void 0!==(e.measured?.height??e.height??e.initialHeight)}function oi(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 ri(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function ii(e){return{...gr,...e||{}}}function ai(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:a}=fi(e),s=Gr({x:i-(r?.left??0),y:a-(r?.top??0)},o),{x:l,y:c}=n?Wr(s,t):s;return{xSnapped:l,ySnapped:c,...s}}const si=e=>({width:e.offsetWidth,height:e.offsetHeight}),li=e=>e?.getRootNode?.()||window?.document,ci=["INPUT","SELECT","TEXTAREA"];function ui(e){const t=e.composedPath?.()?.[0]||e.target;if(1!==t?.nodeType)return!1;return ci.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const di=e=>"clientX"in e,fi=(e,t)=>{const n=di(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)}},hi=(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,...si(t)}}):null};function pi({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 gi(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function mi({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case _r.Left:return[t-gi(t-o,i),n];case _r.Right:return[t+gi(o-t,i),n];case _r.Top:return[t,n-gi(n-r,i)];case _r.Bottom:return[t,n+gi(r-n,i)]}}function yi({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top,curvature:a=.25}){const[s,l]=mi({pos:n,x1:e,y1:t,x2:o,y2:r,c:a}),[c,u]=mi({pos:i,x1:o,y1:r,x2:e,y2:t,c:a}),[d,f,h,p]=pi({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 vi({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 bi({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=jr(Hr(e),Hr(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 Yr(a,Br(i))>0}const wi=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`;function xi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,a,s]=vi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,a,s]}const _i={[_r.Left]:{x:-1,y:0},[_r.Right]:{x:1,y:0},[_r.Top]:{x:0,y:-1},[_r.Bottom]:{x:0,y:1}},Ei=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function ki({source:e,sourcePosition:t=_r.Bottom,target:n,targetPosition:o=_r.Top,center:r,offset:i,stepPosition:a}){const s=_i[t],l=_i[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=_r.Bottom,target:n})=>t===_r.Left||t===_r.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]=vi({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 Si({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top,borderRadius:a=5,centerX:s,centerY:l,offset:c=20,stepPosition:u=.5}){const[d,f,h,p,g]=ki({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(Ei(e,t)/2,Ei(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 Oi(e){return e&&!(!e.internals.handleBounds&&!e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function Ni(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 Ci(e,t,n=_r.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??ti(e);if(o)return{x:r+a/2,y:i+s/2};switch(t?.position??n){case _r.Top:return{x:r+a/2,y:i};case _r.Right:return{x:r+a,y:i+s/2};case _r.Bottom:return{x:r+a/2,y:i+s};case _r.Left:return{x:r,y:i+s/2}}}function Mi(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function Pi(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 Ii={nodeOrigin:[0,0],nodeExtent:hr,elevateNodesOnSelect:!0,defaults:{}},Ti={...Ii,checkEquality:!0};function zi(e,t){const n={...e};for(const e in t)void 0!==t[e]&&(n[e]=t[e]);return n}function Di(e,t,n,o){const r=zi(Ti,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=Nr(l,r.nodeOrigin),o=ei(l.extent)?l.extent:r.nodeExtent,i=Dr(n,o,ti(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:Li(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&&Ai(e,t,n,o)}return i}function Ai(e,t,n,o){const{elevateNodesOnSelect:r,nodeOrigin:i,nodeExtent:a}=zi(Ii,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=ti(e),l=Nr(e,n),c=ei(e.extent)?Dr(l,e.extent,s):l;let u=Dr({x:i+c.x,y:a+c.y},o,s);"parent"===e.extent&&(u=Ar(u,s,t));const d=Li(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 Li(e,t){return(Xr(e.zIndex)?e.zIndex:0)+(e.selected?t:0)}function Ri(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??$r(e),r=Fr(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=ti(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 ji(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 Vi(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}`;ji("source",s,`${r}-${a}--${n}-${i}`,e,n,i),ji("target",s,l,e,r,a),t.set(o.id,o)}}function Bi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return!!n&&(!!n.selected||Bi(n,t))}function $i(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 Hi({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 Fi({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=Cr(s);v=Vr(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=Wr(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}=Ir({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]=Hi({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]=Rr(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=ai(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||!Bi(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]=Hi({nodeId:b,dragItems:s,nodeLookup:r});n?.(o.sourceEvent,s,e,t),g?.(o.sourceEvent,e,t),b||m?.(o.sourceEvent,t)}}f=Ot(y);const k=Bt().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=ai(e.sourceEvent,{transform:r,snapGrid:a,snapToGrid:s,containerBounds:u});i=l,c=fi(e.sourceEvent,u)}).on("drag",e=>{const{autoPanOnNodeDrag:n,transform:o,snapGrid:r,snapToGrid:a,nodeDragThreshold:f,nodeLookup:p}=t(),g=ai(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=fi(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]=Hi({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||!$i(t,`.${g}`,y))&&(!m||$i(t,m,y))});f.call(k)},destroy:function(){f?.on(".drag",null)}}}function Yi(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())Yr(r,$r(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}=Ci(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 Zi(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,...Ci(a,l,l.position,!0)}:l}function Xi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}const qi=()=>!0;function Wi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:a,lib:s,flowId:l,isValidConnection:c=qi,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}=fi(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=Xi(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===mr.Strict?d&&"source"===e||!d&&"target"===e:t!==o||i!==r);y.isValid=f&&c(l),y.toHandle=Zi(t,e,i,u,n,!0)}return y}const Gi={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=qi,onReconnectEnd:v,updateConnection:b,getTransform:w,getFromHandle:x,autoPanSpeed:_,dragThreshold:E=1}){const k=li(e.target);let S,O=0;const{x:N,y:C}=fi(e),M=k?.elementFromPoint(N,C),P=Xi(i,M),I=s?.getBoundingClientRect();let T=!1;if(!I||!P)return;const z=Zi(r,P,o,l,t);if(!z)return;let D=fi(e,I),A=!1,L=null,R=!1,j=null;function V(){if(!u||!I)return;const[e,t]=Rr(D,I,_);f({x:e,y:t}),O=requestAnimationFrame(V)}const B={...z,nodeId:r,type:P,position:z.position},$=l.get(r);let H={inProgress:!0,isValid:null,from:Ci($,B,_r.Left,!0),fromHandle:B,fromPosition:B.position,fromNode:$,to:D,toHandle:null,toPosition:Er[B.position],toNode:null};function F(){T=!0,b(H),p?.(e,{nodeId:r,handleId:o,handleType:P})}function Y(e){if(!T){const{x:t,y:n}=fi(e),o=t-N,r=n-C;if(!(o*o+r*r>E*E))return;F()}if(!x()||!B)return void Z(e);const i=w();D=fi(e,I),S=Yi(Gr(D,i,!1,[1,1]),n,l,B),A||(V(),A=!0);const s=Wi(e,{handle:S,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:a?"target":"source",isValidConnection:y,doc:k,lib:c,flowId:d,nodeLookup:l});j=s.handleDomNode,L=s.connection,R=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!S,s.isValid);const u={...H,isValid:R,to:s.toHandle&&R?Kr({x:s.toHandle.x,y:s.toHandle.y},i):D,toHandle:s.toHandle,toPosition:R&&s.toHandle?s.toHandle.position:Er[B.position],toNode:s.toHandle?l.get(s.toHandle.nodeId):null};R&&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(T){(S||j)&&L&&R&&g?.(L);const{inProgress:t,...n}=H,o={...n,toPosition:H.toHandle?H.toPosition:null};m?.(e,o),i&&v?.(e,o)}h(),cancelAnimationFrame(O),A=!1,R=!1,L=null,j=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:Wi};const Ki=e=>({x:e.x,y:e.y,zoom:e.k}),Ui=({x:e,y:t,zoom:n})=>Fo.translate(e,t).scale(n),Qi=(e,t)=>e.target.closest(`.${t}`),Ji=(e,t)=>2===t&&Array.isArray(e)&&e.includes(2),ea=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,ta=(e,t=0,n=ea,o=()=>{})=>{const r="number"==typeof t&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},na=e=>{const t=e.ctrlKey&&Jr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t};function oa({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=Jo().clickDistance(!Xr(o)||o<0?0:o).scaleExtent([t,n]).translateExtent(r),h=Ot(e).call(f);v({x:i.x,y:i.y,zoom:zr(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?Dn:Zn).transform(ta(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=Ui(e),r=f?.constrain()(o,t,n);return r&&await m(r),new Promise(e=>e(r))}return f.wheelDelta(na),{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(Qi(u,t))return!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&a){const e=Nt(u),t=na(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===yr.Vertical?0:u.deltaX*f,p=r===yr.Horizontal?0:u.deltaY*f;!Jr()&&u.shiftKey&&r!==yr.Vertical&&(h=u.deltaY*f,p=0),o.translateBy(n,-h/d*i,-p/d*i,{internal:!0});const g=Ki(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=Qi(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=Ki(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||!Ji(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Ki(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&&Ji(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=Ki(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&&(Qi(u,`${c}-flow__node`)||Qi(u,`${c}-flow__edge`)))return!0;if(!(o||d||r||i||n))return!1;if(a)return!1;if(Qi(u,s)&&"wheel"===u.type)return!1;if(Qi(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=Ui(e);return await m(n,t),new Promise(e=>e(n))},setViewportConstrained:v,getViewport:function(){const e=h?Yo(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?Dn:Zn).scaleTo(ta(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?Dn:Zn).scaleBy(ta(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=Ui(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=!Xr(e)||e<0?0:e;f?.clickDistance(t)}}}var ra;function ia(e,t){return Math.max(0,t-e)}function aa(e,t){return Math.max(0,e-t)}function sa(e,t,n){return Math.max(0,t-e,e-n)}function la(e,t){return e?!t:t}!function(e){e.Line="line",e.Handle="handle"}(ra||(ra={}));const ca={width:0,height:0,x:0,y:0},ua={...ca,pointerX:0,pointerY:0,aspectRatio:1};function da(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 fa({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=Ot(e);return{update:function({controlPosition:e,boundaries:a,keepAspectRatio:s,resizeDirection:l,onResizeStart:c,onResize:u,onResizeEnd:d,shouldResize:f}){let h={...ca},p={...ua};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 _=Bt().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}=ai(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=da(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=ai(e.sourceEvent,{transform:t,snapGrid:r,snapToGrid:i,containerBounds:w}),_=[];if(!m)return;const{x:E,y:k,width:S,height:O}=h,N={},C=m.origin??c,{width:M,height:P,x:I,y:T}=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),N=_+(c?-S:S),C=-i[0]*x,M=-i[1]*_;let P=sa(O,g,m),I=sa(N,y,v);if(a){let e=0,t=0;l&&k<0?e=ia(b+k+C,a[0][0]):!l&&k>0&&(e=aa(b+O+C,a[1][0])),c&&S<0?t=ia(w+S+M,a[0][1]):!c&&S>0&&(t=aa(w+N+M,a[1][1])),P=Math.max(P,e),I=Math.max(I,t)}if(s){let e=0,t=0;l&&k>0?e=aa(b+k,s[0][0]):!l&&k<0&&(e=ia(b+O,s[1][0])),c&&S>0?t=aa(w+S,s[0][1]):!c&&S<0&&(t=ia(w+N,s[1][1])),P=Math.max(P,e),I=Math.max(I,t)}if(r){if(u){const e=sa(O/E,y,v)*E;if(P=Math.max(P,e),a){let e=0;e=!l&&!c||l&&!c&&f?aa(w+M+O/E,a[1][1])*E:ia(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?ia(w+O/E,s[1][1])*E:aa(w+(l?k:-k)/E,s[0][1])*E,P=Math.max(P,e)}}if(d){const e=sa(N*E,g,m)/E;if(I=Math.max(I,e),a){let e=0;e=!l&&!c||c&&!l&&f?aa(b+N*E+C,a[1][0])/E:ia(b+(c?S:-S)*E+C,a[0][0])/E,I=Math.max(I,e)}if(s){let e=0;e=!l&&!c||c&&!l&&f?ia(b+N*E,s[1][0])/E:aa(b+(c?S:-S)*E,s[0][0])/E,I=Math.max(I,e)}}}S+=S<0?I:-I,k+=k<0?P:-P,r&&(f?O>N*E?S=(la(l,c)?-k:k)/E:k=(la(l,c)?-S:S)*E:u?(S=k/E,c=l):(k=S*E,l=c));const T=l?b+k:b,z=c?w+S:w;return{width:x+(l?-k:k),height:_+(c?-S:S),x:i[0]*k*(l?-1:1)+T,y:i[1]*S*(c?-1:1)+z}}(p,g,d,a,s,C,v,b),z=M!==S,D=P!==O,A=I!==E&&z,L=T!==k&&D;if(!(A||L||z||D))return;if((A||L||1===C[0]||1===C[1])&&(N.x=A?I:h.x,N.y=L?T:h.y,h.x=N.x,h.y=N.y,x.length>0)){const e=I-E,t=T-k;for(const n of x)n.position={x:n.position.x-e+C[0]*(M-S),y:n.position.y-t+C[1]*(P-O)},_.push(n)}if((z||D)&&(N.width=!z||l&&"horizontal"!==l?h.width:M,N.height=!D||l&&"vertical"!==l?h.height:P,h.width=N.width,h.height=N.height),y&&m.expandParent){const e=C[0]*(N.width??0);N.x&&N.x<e&&(h.x=e,p.x=p.x-(N.x-e));const t=C[1]*(N.height??0);N.y&&N.y<t&&(h.y=t,p.y=p.y-(N.y-t))}const R=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}),j={...h,direction:R},V=f?.(e,j);!1!==V&&(u?.(e,j),o(N,_))}).on("end",e=>{d?.(e,{...h}),r?.({...h})});i.call(_)},destroy:function(){i.on(".drag",null)}}}var ha,pa={exports:{}},ga={},ma={exports:{}},ya={};var va,ba,wa,xa={};
|
|
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 Oa=(ka||(ka=1,"production"===process.env.NODE_ENV?pa.exports=function(){if(wa)return ga;wa=1;var e=o,t=_a(),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return ga.useSyncExternalStoreWithSelector=function(e,t,o,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,n(r,e))return t;var o=c(e);return void 0!==u&&u(t,o)?(r=e,t):(r=e,i=o)}var r,i,a=!1,s=void 0===o?null:o;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,o,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},ga}():pa.exports=(Ea||(Ea=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=o,t=_a(),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;Sa.useSyncExternalStoreWithSelector=function(e,t,o,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,n(r,e))return t;var o=c(e);return void 0!==u&&u(t,o)?(r=e,t):(r=e,i=o)}var r,i,a=!1,s=void 0===o?null:o;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,o,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())}()),Sa)),pa.exports),Na=b(Oa);const Ca=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:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},{useDebugValue:Ma}=o,{useSyncExternalStoreWithSelector:Pa}=Na,Ia=e=>e;function Ta(e,t=Ia,n){const o=Pa(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ma(o),o}const za=(e,t)=>{const n=(e=>e?Ca(e):Ca)(e),o=(e,o=t)=>Ta(n,e,o);return Object.assign(o,n),o};function Da(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 Aa=i(null),La=Aa.Provider,Ra=er();function ja(e,t){const n=u(Aa);if(null===n)throw new Error(Ra);return Ta(n,e,t)}function Va(){const e=u(Aa);if(null===e)throw new Error(Ra);return l(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const $a={display:"none"},Ba={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ha="react-flow__node-desc",Fa="react-flow__edge-desc",Ya=e=>e.ariaLiveMessage,Za=e=>e.ariaLabelConfig;function Xa({rfId:t}){const n=ja(Ya);return e("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Ba,children:n})}function qa({rfId:o,disableKeyboardA11y:r}){const i=ja(Za);return t(n,{children:[e("div",{id:`${Ha}-${o}`,style:$a,children:r?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),e("div",{id:`${Fa}-${o}`,style:$a,children:i["edge.a11yDescription.default"]}),!r&&e(Xa,{rfId:o})]})}const Wa=c(({position:t="top-left",children:n,className:o,style:r,...i},a)=>{const s=`${t}`.split("-");return e("div",{className:le(["react-flow__panel",o,...s]),style:r,ref:a,...i,children:n})});function Ga({proOptions:t,position:n="bottom-right"}){return t?.hideAttribution?null:e(Wa,{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("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}Wa.displayName="Panel";const Ka=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}},Ua=e=>e.id;function Qa(e,t){return Da(e.selectedNodes.map(Ua),t.selectedNodes.map(Ua))&&Da(e.selectedEdges.map(Ua),t.selectedEdges.map(Ua))}function Ja({onSelectionChange:e}){const t=Va(),{selectedNodes:n,selectedEdges:o}=ja(Ka,Qa);return f(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const es=e=>!!e.onSelectionChangeHandlers;function ts({onSelectionChange:t}){const n=ja(es);return t||n?e(Ja,{onSelectionChange:t}):null}const ns=[0,0],os={x:0,y:0,zoom:1},rs=["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"],is=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}),as={translateExtent:hr,nodeOrigin:ns,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function ss(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:l,setPaneClickDistance:c}=ja(is,Da),u=Va();f(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=as,s()}),[]);const d=h(as);return f(()=>{for(const s of rs){const l=e[s];l!==d.current[s]&&(void 0!==e[s]&&("nodes"===s?t(l):"edges"===s?n(l):"minZoom"===s?o(l):"maxZoom"===s?r(l):"translateExtent"===s?i(l):"nodeExtent"===s?a(l):"paneClickDistance"===s?c(l):"ariaLabelConfig"===s?u.setState({ariaLabelConfig:ii(l)}):"fitView"===s?u.setState({fitViewQueued:l}):"fitViewOptions"===s?u.setState({fitViewOptions:l}):u.setState({[s]:l})))}d.current=e},rs.map(t=>e[t])),null}function ls(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const cs="undefined"!=typeof document?document:null;function us(e=null,t={target:cs,actInsideInputWithModifier:!0}){const[n,o]=r(!1),i=h(!1),a=h(new Set([])),[s,c]=l(()=>{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 f(()=>{const n=t?.target??cs,r=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!r)&&ui(e))return!1;const n=fs(e.code,c);if(a.current.add(e[n]),ds(s,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,r="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&r||e.preventDefault(),o(!0)}},l=e=>{const t=fs(e.code,c);ds(s,a.current,!0)?(o(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",l),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",l),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,o]),n}function ds(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function fs(e,t){return t.includes(e)?"code":"key"}function hs(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)ps(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 ps(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 gs(e,t){return hs(e,t)}function ms(e,t){return hs(e,t)}function ys(e,t){return{id:e,type:"select",selected:t}}function vs(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(ys(i.id,e)))}return o}function bs({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 ws(e){return{id:e.id,type:"remove"}}const xs=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function _s(e){return c(e)}const Es="undefined"!=typeof window?d:f;function ks(e){const[t,n]=r(BigInt(0)),[o]=r(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>n(e=>e+BigInt(1))));return Es(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const Ss=i(null);function Os({children:t}){const n=Va(),o=ks(s(e=>{const{nodes:t=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=n.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=bs({items:l,lookup:a});r&&o(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:o}=n.getState();e&&o(t)})},[])),r=ks(s(e=>{const{edges:t=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=n.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?o(s):i&&i(bs({items:s,lookup:a}))},[])),i=l(()=>({nodeQueue:o,edgeQueue:r}),[]);return e(Ss.Provider,{value:i,children:t})}const Ns=e=>!!e.panZoom;function Cs(){const e=(()=>{const e=Va();return l(()=>({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=Qr(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 Gr(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=Kr(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),t=Va(),n=function(){const e=u(Ss);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ja(Ns),r=l(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=xs(e)?e:n.get(e.id),i=r.parentId?oi(r.position,r.measured,r.parentId,n,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return Br(a)},a=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&xs(e)?e:{...o,...e}}return o}))},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&&Sr(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Tr({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),h=f.length>0,p=d.length>0;if(h){const e=f.map(ws);a?.(f),l(e)}if(p){const e=d.map(ws);i?.(d),s(e)}return(p||h)&&c?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Zr(e),a=r?e:i(e),s=void 0!==o;return a?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=Br(s?o:i),c=Yr(l,a);return n&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Zr(e)?e:i(e);if(!o)return!1;const r=Yr(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:n,nodeOrigin:o}=t.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):Or(n)?n:t.nodeLookup.get(n.id));const i=r?Hr(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return jr(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return $r(n)})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return l(()=>({...r,...e,viewportInitialized:o}),[o])}const Ms=e=>e.selected,Ps="undefined"!=typeof window?window:void 0;const Is={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ts=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function zs({onPaneContextMenu:t,zoomOnScroll:n=!0,zoomOnPinch:o=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=yr.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:p,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:y=!0,children:v,noWheelClassName:b,noPanClassName:w,onViewportChange:x,isControlledViewport:_,paneClickDistance:E}){const k=Va(),S=h(null),{userSelectionActive:O,lib:N}=ja(Ts,Da),C=us(m),M=h();!function(e){const t=Va();f(()=>{const n=()=>{if(!e.current)return!1;const n=si(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",or()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(S);const P=s(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),_||k.setState({transform:e})},[x,_]);return f(()=>{if(S.current){M.current=oa({domNode:S.current,minZoom:p,maxZoom:g,translateExtent:d,viewport:u,paneClickDistance:E,onDraggingChange:e=>k.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=k.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=k.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=k.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=M.current.getViewport();return k.setState({panZoom:M.current,transform:[e,t,n],domNode:S.current.closest(".react-flow")}),()=>{M.current?.destroy()}}},[]),f(()=>{M.current?.update({onPaneContextMenu:t,zoomOnScroll:n,zoomOnPinch:o,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:C,preventScrolling:y,noPanClassName:w,userSelectionActive:O,noWheelClassName:b,lib:N,onTransformChange:P})},[t,n,o,r,i,a,l,c,C,y,w,O,b,N,P]),e("div",{className:"react-flow__renderer",ref:S,style:Is,children:v})}const Ds=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function As(){const{userSelectionActive:t,userSelectionRect:n}=ja(Ds,Da);return t&&n?e("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 Ls=(e,t)=>n=>{n.target===t.current&&e?.(n)},Rs=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function js({isSelecting:n,selectionKeyPressed:o,selectionMode:r=vr.Full,panOnDrag:i,selectionOnDrag:a,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:g,children:m}){const y=Va(),{userSelectionActive:v,elementsSelectable:b,dragging:w,connectionInProgress:x}=ja(Rs,Da),_=b&&(n||v),E=h(null),k=h(),S=h(new Set),O=h(new Set),N=h(!1),C=h(!1),M=e=>{N.current||x?N.current=!1:(c?.(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1}))},P=d?e=>d(e):void 0,I=!0===i||Array.isArray(i)&&i.includes(0);return t("div",{className:le(["react-flow__pane",{draggable:I,dragging:w,selection:n}]),onClick:_?void 0:Ls(M,E),onContextMenu:Ls(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():u?.(e)},E),onWheel:Ls(P,E),onPointerEnter:_?void 0:f,onPointerDown:_?e=>{const{resetSelectedElements:t,domNode:o}=y.getState();if(k.current=o?.getBoundingClientRect(),!b||!n||0!==e.button||e.target!==E.current||!k.current)return;e.target?.setPointerCapture?.(e.pointerId),C.current=!0,N.current=!1;const{x:r,y:i}=fi(e.nativeEvent,k.current);t(),y.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),s?.(e)}:p,onPointerMove:_?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:i,connectionLookup:a,triggerNodeChanges:s,triggerEdgeChanges:l,defaultEdgeOptions:c}=y.getState();if(!k.current||!t)return;N.current=!0;const{x:u,y:d}=fi(e.nativeEvent,k.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=S.current,m=O.current;S.current=new Set(Mr(o,p,n,r===vr.Partial,!0).map(e=>e.id)),O.current=new Set;const v=c?.selectable??!0;for(const e of S.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??v)&&O.current.add(e)}}if(!ri(g,S.current)){s(vs(o,S.current,!0))}if(!ri(m,O.current)){l(vs(i,O.current))}y.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:_?e=>{if(0!==e.button||!C.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=y.getState();!v&&t&&e.target===E.current&&M?.(e),y.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:S.current.size>0}),l?.(e),(o||a)&&(N.current=!1),C.current=!1}:void 0,onPointerLeave:g,ref:E,style:Is,children:[m,e(As,{})]})}function Vs({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",ur(e))}function $s({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Va(),[c,u]=r(!1),d=h();return f(()=>{d.current=Fi({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Vs({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),f(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[n,o,t,a,e,i]),c}function Bs(){const e=Va();return s(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=Wr(t,r));const{position:i,positionAbsolute:s}=Ir({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 Hs=i(null),Fs=Hs.Provider;Hs.Consumer;const Ys=()=>u(Hs),Zs=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Xs=a(_s(function({type:t="source",position:n=_r.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=Va(),v=Ys(),{connectOnClick:b,noPanClassName:w,rfId:x}=ja(Zs,Da),{connectingFrom:_,connectingTo:E,clickConnecting:k,isPossibleEndHandle:S,connectionInProcess:O,clickConnectionInProcess:N,valid:C}=ja(((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===mr.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(v,g,t),Da);v||y.getState().onError?.("010",lr());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 qr("006",ir()),t;let n;return n=Sr(e)?{...e}:{...e,id:wi(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=di(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=y.getState();Gi.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("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":n,"data-id":`${x}-${v}-${g}-${t}`,className:le(["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:C,connectionindicator:r&&(!O||S)&&(O||N?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=li(e.target),p=o||l,{connection:m,isValid:b}=Gi.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 qs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ws={input:function({data:o,isConnectable:r,sourcePosition:i=_r.Bottom}){return t(n,{children:[o?.label,e(Xs,{type:"source",position:i,isConnectable:r})]})},default:function({data:o,isConnectable:r,targetPosition:i=_r.Top,sourcePosition:a=_r.Bottom}){return t(n,{children:[e(Xs,{type:"target",position:i,isConnectable:r}),o?.label,e(Xs,{type:"source",position:a,isConnectable:r})]})},output:function({data:o,isConnectable:r,targetPosition:i=_r.Top}){return t(n,{children:[e(Xs,{type:"target",position:i,isConnectable:r}),o?.label]})},group:function(){return null}};const Gs=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Xr(t)?t:null,height:Xr(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 Ks({onSelectionContextMenu:t,noPanClassName:n,disableKeyboardA11y:o}){const r=Va(),{width:i,height:a,transformString:s,userSelectionActive:l}=ja(Gs,Da),c=Bs(),u=h(null);if(f(()=>{o||u.current?.focus({preventScroll:!0})},[o]),$s({nodeRef:u}),l||!i||!a)return null;const d=t?e=>{const n=r.getState().nodes.filter(e=>e.selected);t(e,n)}:void 0;return e("div",{className:le(["react-flow__nodesselection","react-flow__container",n]),style:{transform:s},children:e("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:o?void 0:-1,onKeyDown:o?void 0:e=>{Object.prototype.hasOwnProperty.call(qs,e.key)&&(e.preventDefault(),c({direction:qs[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}const Us="undefined"!=typeof window?window:void 0,Qs=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Js({children:n,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:p,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:O,panOnDrag:N,defaultViewport:C,translateExtent:M,minZoom:P,maxZoom:I,preventScrolling:T,onSelectionContextMenu:z,noWheelClassName:D,noPanClassName:A,disableKeyboardA11y:L,onViewportChange:R,isControlledViewport:j}){const{nodesSelectionActive:V,userSelectionActive:$}=ja(Qs),B=us(d,{target:Us}),H=us(v,{target:Us}),F=H||N,Y=H||E,Z=h&&!0!==F,X=B||$||Z;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Va(),{deleteElements:o}=Cs(),r=us(e,{actInsideInputWithModifier:!1}),i=us(t,{target:Ps});f(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(Ms),edges:e.filter(Ms)}),n.setState({nodesSelectionActive:!1})}},[r]),f(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:u,multiSelectionKeyCode:y}),e(zs,{onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:_,panOnScroll:Y,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:O,panOnDrag:!B&&F,defaultViewport:C,translateExtent:M,minZoom:P,maxZoom:I,zoomActivationKeyCode:b,preventScrolling:T,noWheelClassName:D,noPanClassName:A,onViewportChange:R,isControlledViewport:j,paneClickDistance:c,children:t(js,{onSelectionStart:g,onSelectionEnd:m,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:F,isSelecting:!!X,selectionMode:p,selectionKeyPressed:B,selectionOnDrag:Z,children:[n,V&&e(Ks,{onSelectionContextMenu:z,noPanClassName:A,disableKeyboardA11y:L})]})})}Js.displayName="FlowRenderer";const el=a(Js);function tl(e){return ja(s((e=>t=>e?Mr(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]),Da)}const nl=e=>e.updateNodeInternals;function ol({id:t,onClick:n,onMouseEnter:o,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:s,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:b,nodeClickDistance:w,onError:x}){const{node:_,internals:E,isParent:k}=ja(e=>{const n=e.nodeLookup.get(t),o=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:o}},Da);let S=_.type||"default",O=b?.[S]||Ws[S];void 0===O&&(x?.("003",nr(S)),S="default",O=b?.default||Ws.default);const N=!!(_.draggable||l&&void 0===_.draggable),C=!!(_.selectable||c&&void 0===_.selectable),M=!!(_.connectable||u&&void 0===_.connectable),P=!!(_.focusable||d&&void 0===_.focusable),I=Va(),T=ni(_),z=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=Va(),i=h(null),a=h(null),s=h(e.sourcePosition),l=h(e.targetPosition),c=h(t),u=n&&!!e.internals.handleBounds;return f(()=>{!i.current||e.hidden||u&&a.current===i.current||(a.current&&o?.unobserve(a.current),o?.observe(i.current),a.current=i.current)},[u,e.hidden]),f(()=>()=>{a.current&&(o?.unobserve(a.current),a.current=null)},[]),f(()=>{if(i.current){const n=c.current!==t,o=s.current!==e.sourcePosition,a=l.current!==e.targetPosition;(n||o||a)&&(c.current=t,s.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:S,hasDimensions:T,resizeObserver:p}),D=$s({nodeRef:z,disabled:_.hidden||!N,noDragClassName:g,handleSelector:_.dragHandle,nodeId:t,isSelectable:C,nodeClickDistance:w}),A=Bs();if(_.hidden)return null;const L=ti(_),R=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}}(_),j=C||N||n||o||r||i,V=o?e=>o(e,{...E.userNode}):void 0,$=r?e=>r(e,{...E.userNode}):void 0,B=i?e=>i(e,{...E.userNode}):void 0,H=a?e=>a(e,{...E.userNode}):void 0,F=s?e=>s(e,{...E.userNode}):void 0;return e("div",{className:le(["react-flow__node",`react-flow__node-${S}`,{[m]:N},_.className,{selected:_.selected,selectable:C,parent:k,draggable:N,dragging:D}]),ref:z,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:T?"visible":"hidden",..._.style,...R},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:V,onMouseMove:$,onMouseLeave:B,onContextMenu:H,onClick:e=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=I.getState();C&&(!o||!N||r>0)&&Vs({id:t,store:I,nodeRef:z}),n&&n(e,{...E.userNode})},onDoubleClick:F,onKeyDown:P?e=>{if(!ui(e.nativeEvent)&&!y)if(pr.includes(e.key)&&C){const n="Escape"===e.key;Vs({id:t,store:I,unselect:n,nodeRef:z})}else if(N&&_.selected&&Object.prototype.hasOwnProperty.call(qs,e.key)){e.preventDefault();const{ariaLabelConfig:t}=I.getState();I.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),A({direction:qs[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:P?0:void 0,onFocus:P?()=>{if(y||!z.current?.matches(":focus-visible"))return;const{transform:e,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=I.getState();if(!r)return;Mr(new Map([[t,_]]),{x:0,y:0,width:n,height:o},e,!0).length>0||i(_.position.x+L.width/2,_.position.y+L.height/2,{zoom:e[2]})}:void 0,role:_.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Ha}-${v}`,"aria-label":_.ariaLabel,..._.domAttributes,children:e(Fs,{value:t,children:e(O,{id:t,data:_.data,type:S,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:_.selected??!1,selectable:C,draggable:N,deletable:_.deletable??!0,isConnectable:M,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:D,dragHandle:_.dragHandle,zIndex:E.z,parentId:_.parentId,...L})})})}const rl=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function il(t){const{nodesDraggable:n,nodesConnectable:o,nodesFocusable:i,elementsSelectable:a,onError:s}=ja(rl,Da),l=tl(t.onlyRenderVisibleElements),c=function(){const e=ja(nl),[t]=r(()=>"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 f(()=>()=>{t?.disconnect()},[t]),t}();return e("div",{className:"react-flow__nodes",style:Is,children:l.map(r=>e(ol,{id:r,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:c,nodesDraggable:n,nodesConnectable:o,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:t.nodeClickDistance,onError:s},r))})}il.displayName="NodeRenderer";const al=a(il);const sl={[xr.Arrow]:({color:t="none",strokeWidth:n=1})=>e("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[xr.ArrowClosed]:({color:t="none",strokeWidth:n=1})=>e("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const ll=({id:t,type:n,color:o,width:r=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const u=function(e){const t=Va();return l(()=>Object.prototype.hasOwnProperty.call(sl,e)?sl[e]:(t.getState().onError?.("009",ar(e)),null),[e])}(n);return u?e("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:e(u,{color:o,strokeWidth:s})}):null},cl=({defaultColor:t,rfId:n})=>{const o=ja(e=>e.edges),r=ja(e=>e.defaultEdgeOptions),i=l(()=>{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=Pi(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))}(o,{id:n,defaultColor:t,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd});return e},[o,r,n,t]);return i.length?e("svg",{className:"react-flow__marker","aria-hidden":"true",children:e("defs",{children:i.map(t=>e(ll,{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};cl.displayName="MarkerDefinitions";var ul=a(cl);function dl({x:n,y:o,label:i,labelStyle:a,labelShowBg:s=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:p,...g}){const[m,y]=r({x:1,y:0,width:0,height:0}),v=le(["react-flow__edge-textwrapper",p]),b=h(null);return f(()=>{if(b.current){const e=b.current.getBBox();y({x:e.x,y:e.y,width:e.width,height:e.height})}},[i]),i?t("g",{transform:`translate(${n-m.width/2} ${o-m.height/2})`,className:v,visibility:m.width?"visible":"hidden",...g,children:[s&&e("rect",{width:m.width+2*c[0],x:-c[0],y:-c[1],height:m.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),e("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:b,style:a,children:i}),d]}):null}dl.displayName="EdgeText";const fl=a(dl);function hl({path:o,labelX:r,labelY:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:f=20,...h}){return t(n,{children:[e("path",{...h,d:o,fill:"none",className:le(["react-flow__edge-path",h.className])}),f&&e("path",{d:o,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),a&&Xr(r)&&Xr(i)?e(fl,{x:r,y:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function pl({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===_r.Left||e===_r.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function gl({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top}){const[a,s]=pl({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=pl({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,h]=pi({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 ml(t){return a(({id:n,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]=gl({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),_=t.isInternal?void 0:n;return e(hl,{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 yl=ml({isInternal:!1}),vl=ml({isInternal:!0});function bl(t){return a(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=_r.Bottom,targetPosition:g=_r.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=Si({sourceX:o,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:g,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),E=t.isInternal?void 0:n;return e(hl,{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})})}yl.displayName="SimpleBezierEdge",vl.displayName="SimpleBezierEdgeInternal";const wl=bl({isInternal:!1}),xl=bl({isInternal:!0});function _l(t){return a(({id:n,...o})=>{const r=t.isInternal?void 0:n;return e(wl,{...o,id:r,pathOptions:l(()=>({borderRadius:0,offset:o.pathOptions?.offset}),[o.pathOptions?.offset])})})}wl.displayName="SmoothStepEdge",xl.displayName="SmoothStepEdgeInternal";const El=_l({isInternal:!1}),kl=_l({isInternal:!0});function Sl(t){return a(({id:n,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]=xi({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=t.isInternal?void 0:n;return e(hl,{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})})}El.displayName="StepEdge",kl.displayName="StepEdgeInternal";const Ol=Sl({isInternal:!1}),Nl=Sl({isInternal:!0});function Cl(t){return a(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=_r.Bottom,targetPosition:l=_r.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,_]=yi({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),E=t.isInternal?void 0:n;return e(hl,{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})})}Ol.displayName="StraightEdge",Nl.displayName="StraightEdgeInternal";const Ml=Cl({isInternal:!1}),Pl=Cl({isInternal:!0});Ml.displayName="BezierEdge",Pl.displayName="BezierEdgeInternal";const Il={default:Pl,straight:Nl,step:kl,smoothstep:xl,simplebezier:vl},Tl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},zl=(e,t,n)=>n===_r.Left?e-t:n===_r.Right?e+t:e,Dl=(e,t,n)=>n===_r.Top?e-t:n===_r.Bottom?e+t:e,Al="react-flow__edgeupdater";function Ll({position:t,centerX:n,centerY:o,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:s,type:l}){return e("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:s,className:le([Al,`${Al}-${l}`]),cx:zl(n,r,t),cy:Dl(o,r,t),r:r,stroke:"transparent",fill:"transparent"})}function Rl({isReconnectable:o,reconnectRadius:r,edge:i,sourceX:a,sourceY:s,targetX:l,targetY:c,sourcePosition:u,targetPosition:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,setReconnecting:g,setUpdateHover:m}){const y=Va(),v=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:o,isValidConnection:r,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:u,cancelConnection:d,nodeLookup:m,rfId:v,panBy:b,updateConnection:w}=y.getState(),x="target"===t.type;Gi.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:o,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:x,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:d,panBy:b,isValidConnection:r,onConnect:e=>f?.(i,e),onConnectStart:(n,o)=>{g(!0),h?.(e,i,t.type),c?.(n,o)},onConnectEnd:u,onReconnectEnd:(e,n)=>{g(!1),p?.(e,i,t.type,n)},updateConnection:w,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold})},b=()=>m(!0),w=()=>m(!1);return t(n,{children:[(!0===o||"source"===o)&&e(Ll,{position:u,centerX:a,centerY:s,radius:r,onMouseDown:e=>v(e,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),onMouseEnter:b,onMouseOut:w,type:"source"}),(!0===o||"target"===o)&&e(Ll,{position:d,centerX:l,centerY:c,radius:r,onMouseDown:e=>v(e,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),onMouseEnter:b,onMouseOut:w,type:"target"})]})}function jl({id:n,edgesFocusable:o,edgesReconnectable:i,elementsSelectable:a,onClick:c,onDoubleClick:u,onContextMenu:d,onMouseEnter:f,onMouseMove:p,onMouseLeave:g,reconnectRadius:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:b,rfId:w,edgeTypes:x,noPanClassName:_,onError:E,disableKeyboardA11y:k}){let S=ja(e=>e.edgeLookup.get(n));const O=ja(e=>e.defaultEdgeOptions);S=O?{...O,...S}:S;let N=S.type||"default",C=x?.[N]||Il[N];void 0===C&&(E?.("011",cr(N)),N="default",C=x?.default||Il.default);const M=!!(S.focusable||o&&void 0===S.focusable),P=void 0!==y&&(S.reconnectable||i&&void 0===S.reconnectable),I=!!(S.selectable||a&&void 0===S.selectable),T=h(null),[z,D]=r(!1),[A,L]=r(!1),R=Va(),{zIndex:j,sourceX:V,sourceY:$,targetX:B,targetY:H,sourcePosition:F,targetPosition:Y}=ja(s(e=>{const t=e.nodeLookup.get(S.source),o=e.nodeLookup.get(S.target);if(!t||!o)return{zIndex:S.zIndex,...Tl};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!Oi(t)||!Oi(n))return null;const o=t.internals.handleBounds||Ni(t.handles),r=n.internals.handleBounds||Ni(n.handles),i=Mi(o?.source??[],e.sourceHandle),a=Mi(e.connectionMode===mr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",sr(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||_r.Bottom,l=a?.position||_r.Top,c=Ci(t,i,s),u=Ci(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:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:e.connectionMode,onError:E}),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:S.selected,zIndex:S.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return{zIndex:i,...r||Tl}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Da),Z=l(()=>S.markerStart?`url('#${Pi(S.markerStart,w)}')`:void 0,[S.markerStart,w]),X=l(()=>S.markerEnd?`url('#${Pi(S.markerEnd,w)}')`:void 0,[S.markerEnd,w]);if(S.hidden||null===V||null===$||null===B||null===H)return null;const q=u?e=>{u(e,{...S})}:void 0,W=d?e=>{d(e,{...S})}:void 0,G=f?e=>{f(e,{...S})}:void 0,K=p?e=>{p(e,{...S})}:void 0,U=g?e=>{g(e,{...S})}:void 0;return e("svg",{style:{zIndex:j},children:t("g",{className:le(["react-flow__edge",`react-flow__edge-${N}`,S.className,_,{selected:S.selected,animated:S.animated,inactive:!I&&!c,updating:z,selectable:I}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=R.getState();I&&(R.setState({nodesSelectionActive:!1}),S.selected&&r?(o({nodes:[],edges:[S]}),T.current?.blur()):t([n])),c&&c(e,S)},onDoubleClick:q,onContextMenu:W,onMouseEnter:G,onMouseMove:K,onMouseLeave:U,onKeyDown:M?e=>{if(!k&&pr.includes(e.key)&&I){const{unselectNodesAndEdges:t,addSelectedEdges:o}=R.getState();"Escape"===e.key?(T.current?.blur(),t({edges:[S]})):o([n])}}:void 0,tabIndex:M?0:void 0,role:S.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":M?`${Fa}-${w}`:void 0,ref:T,...S.domAttributes,children:[!A&&e(C,{id:n,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:I,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:V,sourceY:$,targetX:B,targetY:H,sourcePosition:F,targetPosition:Y,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:Z,markerEnd:X,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),P&&e(Rl,{edge:S,isReconnectable:P,reconnectRadius:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:b,sourceX:V,sourceY:$,targetX:B,targetY:H,sourcePosition:F,targetPosition:Y,setUpdateHover:D,setReconnecting:L})]})})}const Vl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function $l({defaultMarkerColor:n,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:h,reconnectRadius:p,onEdgeDoubleClick:g,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:w,elementsSelectable:x,onError:_}=ja(Vl,Da),E=ja(s(e=>{if(!k)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&&bi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[k=o]),Da);var k;return t("div",{className:"react-flow__edges",children:[e(ul,{defaultColor:n,rfId:r}),E.map(t=>e(jl,{id:t,edgesFocusable:b,edgesReconnectable:w,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:h,reconnectRadius:p,onDoubleClick:g,onReconnectStart:m,onReconnectEnd:y,rfId:r,onError:_,edgeTypes:i,disableKeyboardA11y:v},t))]})}$l.displayName="EdgeRenderer";const Bl=a($l),Hl=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Fl({children:t}){const n=ja(Hl);return e("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}const Yl=e=>e.panZoom?.syncViewport;function Zl(e){return e.connection.inProgress?{...e.connection,to:Gr(e.connection.to,e.transform)}:{...e.connection}}function Xl(e){return ja(Zl,Da)}const ql=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Wl({containerStyle:t,style:n,type:o,component:r}){const{nodesConnectable:i,width:a,height:s,isValid:l,inProgress:c}=ja(ql,Da);return!!(a&&i&&c)?e("svg",{style:t,width:a,height:s,className:"react-flow__connectionline react-flow__container",children:e("g",{className:le(["react-flow__connection",kr(l)]),children:e(Gl,{style:n,type:o,CustomComponent:r,isValid:l})})}):null}const Gl=({style:t,type:n=wr.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h}=Xl();if(!i)return;if(o)return e(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:kr(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 wr.Bezier:[p]=yi(g);break;case wr.SimpleBezier:[p]=gl(g);break;case wr.Step:[p]=Si({...g,borderRadius:0});break;case wr.SmoothStep:[p]=Si(g);break;default:[p]=xi(g)}return e("path",{d:p,fill:"none",className:"react-flow__connection-path",style:t})};Gl.displayName="ConnectionLine";const Kl={};function Ul(e=Kl){const t=h(e),n=Va();f(()=>{if("development"===process.env.NODE_ENV){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",tr());break}t.current=e}},[e])}function Ql({nodeTypes:n,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:_,selectionOnDrag:E,selectionMode:k,multiSelectionKeyCode:S,panActivationKeyCode:O,zoomActivationKeyCode:N,deleteKeyCode:C,onlyRenderVisibleElements:M,elementsSelectable:P,defaultViewport:I,translateExtent:T,minZoom:z,maxZoom:D,preventScrolling:A,defaultMarkerColor:L,zoomOnScroll:R,zoomOnPinch:j,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:B,zoomOnDoubleClick:H,panOnDrag:F,onPaneClick:Y,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:q,onPaneScroll:W,onPaneContextMenu:G,paneClickDistance:K,nodeClickDistance:U,onEdgeContextMenu:Q,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:te,reconnectRadius:ne,onReconnect:oe,onReconnectStart:re,onReconnectEnd:ie,noDragClassName:ae,noWheelClassName:se,noPanClassName:le,disableKeyboardA11y:ce,nodeExtent:ue,rfId:de,viewport:fe,onViewportChange:he}){return Ul(n),Ul(o),function(){const e=Va(),t=h(!1);f(()=>{if("development"===process.env.NODE_ENV&&!t.current){const n=document.querySelector(".react-flow__pane");n&&"1"!==window.getComputedStyle(n).zIndex&&e.getState().onError?.("013",dr("react")),t.current=!0}},[])}(),function(e){const t=Cs(),n=h(!1);f(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(r),function(e){const t=ja(Yl),n=Va();f(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(fe),e(el,{onPaneClick:Y,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:q,onPaneContextMenu:G,onPaneScroll:W,paneClickDistance:K,deleteKeyCode:C,selectionKeyCode:_,selectionOnDrag:E,selectionMode:k,onSelectionStart:m,onSelectionEnd:y,multiSelectionKeyCode:S,panActivationKeyCode:O,zoomActivationKeyCode:N,elementsSelectable:P,zoomOnScroll:R,zoomOnPinch:j,zoomOnDoubleClick:H,panOnScroll:V,panOnScrollSpeed:$,panOnScrollMode:B,panOnDrag:F,defaultViewport:I,translateExtent:T,minZoom:z,maxZoom:D,onSelectionContextMenu:g,preventScrolling:A,noDragClassName:ae,noWheelClassName:se,noPanClassName:le,disableKeyboardA11y:ce,onViewportChange:he,isControlledViewport:!!fe,children:t(Fl,{children:[e(Bl,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:oe,onReconnectStart:re,onReconnectEnd:ie,onlyRenderVisibleElements:M,onEdgeContextMenu:Q,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:te,reconnectRadius:ne,defaultMarkerColor:L,noPanClassName:le,disableKeyboardA11y:ce,rfId:de}),e(Wl,{style:b,type:v,component:w,containerStyle:x}),e("div",{className:"react-flow__edgelabel-renderer"}),e(al,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:U,onlyRenderVisibleElements:M,noPanClassName:le,noDragClassName:ae,disableKeyboardA11y:ce,nodeExtent:ue,rfId:de}),e("div",{className:"react-flow__viewport-portal"})]})})}Ql.displayName="GraphView";const Jl=a(Ql),ec=({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??hr;Vi(p,g,m);const w=Di(y,f,h,{nodeOrigin:v,nodeExtent:b,elevateNodesOnSelect:!1});let x=[0,0,1];if(a&&r&&i){const e=Cr(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Qr(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:hr,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mr.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:{...br},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:qr,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:gr}},tc=({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 Pr({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),f({fitViewResolver:null}))}return{...ec({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=Di(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();Vi(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=si(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=ei(e.extent)?e.extent:i;let{positionAbsolute:p}=e.internals;e.parentId&&"parent"===e.extent?p=Ar(p,a,t.get(e.parentId)):h&&(p=Dr(p,h,a));const g={...e,measured:a,internals:{...e.internals,positionAbsolute:p,handleBounds:{source:hi("source",o.nodeElement,f,u,e.id),target:hi("target",o.nodeElement,f,u,e.id)}}};t.set(e.id,g),e.parentId&&Ai(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:Br(g,r)}))}}if(d.length>0){const e=Ri(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=zi(Ii,n);for(const n of e.values())if(n.parentId)Ai(n,e,t,o);else{const e=Nr(n,o.nodeOrigin),t=ei(n.extent)?n.extent:o.nodeExtent,r=Dr(e,t,ti(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=Ri(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(gs(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(ms(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=>ys(e,!0))):(r(vs(o,new Set([...e]),!0)),i(vs(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?i(e.map(e=>ys(e,!0))):(i(vs(n,new Set([...e]))),r(vs(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),ys(e.id,!1)}),c=s.map(e=>ys(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,ys(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,ys(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]||(Di(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:{...br}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...ec()})}},h=Object.is,f?za(f,h):za;var f,h};function nc({initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:h,children:p}){const[g]=r(()=>tc({nodes:t,edges:n,defaultNodes:o,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:f,nodeExtent:h}));return e(La,{value:g,children:e(Os,{children:p})})}function oc({children:t,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:d,minZoom:f,maxZoom:h,nodeOrigin:p,nodeExtent:g}){return u(Aa)?e(n,{children:t}):e(nc,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:h,nodeOrigin:p,nodeExtent:g,children:t})}const rc={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var ic,ac=_s(function({nodes:n,edges:o,defaultNodes:i,defaultEdges:a,className:l,nodeTypes:c,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:p,onMove:g,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:_,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:S,onNodeContextMenu:O,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:M,onNodeDragStop:P,onNodesDelete:I,onEdgesDelete:T,onDelete:z,onSelectionChange:D,onSelectionDragStart:A,onSelectionDrag:L,onSelectionDragStop:R,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:$,onBeforeDelete:B,connectionMode:H,connectionLineType:F=wr.Bezier,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:X,deleteKeyCode:q="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:G=!1,selectionMode:K=vr.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:Q=(Jr()?"Meta":"Control"),zoomActivationKeyCode:J=(Jr()?"Meta":"Control"),snapToGrid:ee,snapGrid:te,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:oe,nodesDraggable:re,autoPanOnNodeFocus:ie,nodesConnectable:ae,nodesFocusable:se,nodeOrigin:ce=ns,edgesFocusable:ue,edgesReconnectable:de,elementsSelectable:fe=!0,defaultViewport:he=os,minZoom:pe=.5,maxZoom:ge=2,translateExtent:me=hr,preventScrolling:ye=!0,nodeExtent:ve,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:we=!0,zoomOnPinch:xe=!0,panOnScroll:_e=!1,panOnScrollSpeed:Ee=.5,panOnScrollMode:ke=yr.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Oe=!0,onPaneClick:Ne,onPaneMouseEnter:Ce,onPaneMouseMove:Me,onPaneMouseLeave:Pe,onPaneScroll:Ie,onPaneContextMenu:Te,paneClickDistance:ze=0,nodeClickDistance:De=0,children:Ae,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:$e,onEdgeMouseEnter:Be,onEdgeMouseMove:He,onEdgeMouseLeave:Fe,reconnectRadius:Ye=10,onNodesChange:Ze,onEdgesChange:Xe,noDragClassName:qe="nodrag",noWheelClassName:We="nowheel",noPanClassName:Ge="nopan",fitView:Ke,fitViewOptions:Ue,connectOnClick:Qe,attributionPosition:Je,proOptions:et,defaultEdgeOptions:tt,elevateNodesOnSelect:nt,elevateEdgesOnSelect:ot,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,connectionRadius:lt,isValidConnection:ct,onError:ut,style:dt,id:ft,nodeDragThreshold:ht,connectionDragThreshold:pt,viewport:gt,onViewportChange:mt,width:yt,height:vt,colorMode:bt="light",debug:wt,onScroll:xt,ariaLabelConfig:_t,...Et},kt){const St=ft||"1",Ot=function(e){const[t,n]=r("system"===e?null:e);return f(()=>{if("system"!==e)return void n(e);const t=ls(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:ls()?.matches?"dark":"light"}(bt),Nt=s(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),xt?.(e)},[xt]);return e("div",{"data-testid":"rf__wrapper",...Et,onScroll:Nt,style:{...dt,...rc},ref:kt,className:le(["react-flow",l,Ot]),id:ft,role:"application",children:t(oc,{nodes:n,edges:o,width:yt,height:vt,fitView:Ke,fitViewOptions:Ue,minZoom:pe,maxZoom:ge,nodeOrigin:ce,nodeExtent:ve,children:[e(Jl,{onInit:p,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:S,onNodeContextMenu:O,onNodeDoubleClick:N,nodeTypes:c,edgeTypes:u,connectionLineType:F,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:X,selectionKeyCode:W,selectionOnDrag:G,selectionMode:K,deleteKeyCode:q,multiSelectionKeyCode:Q,panActivationKeyCode:U,zoomActivationKeyCode:J,onlyRenderVisibleElements:ne,defaultViewport:he,translateExtent:me,minZoom:pe,maxZoom:ge,preventScrolling:ye,zoomOnScroll:we,zoomOnPinch:xe,zoomOnDoubleClick:Se,panOnScroll:_e,panOnScrollSpeed:Ee,panOnScrollMode:ke,panOnDrag:Oe,onPaneClick:Ne,onPaneMouseEnter:Ce,onPaneMouseMove:Me,onPaneMouseLeave:Pe,onPaneScroll:Ie,onPaneContextMenu:Te,paneClickDistance:ze,nodeClickDistance:De,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:$,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:$e,onEdgeMouseEnter:Be,onEdgeMouseMove:He,onEdgeMouseLeave:Fe,reconnectRadius:Ye,defaultMarkerColor:be,noDragClassName:qe,noWheelClassName:We,noPanClassName:Ge,rfId:St,disableKeyboardA11y:rt,nodeExtent:ve,viewport:gt,onViewportChange:mt}),e(ss,{nodes:n,edges:o,defaultNodes:i,defaultEdges:a,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:_,nodesDraggable:re,autoPanOnNodeFocus:ie,nodesConnectable:ae,nodesFocusable:se,edgesFocusable:ue,edgesReconnectable:de,elementsSelectable:fe,elevateNodesOnSelect:nt,elevateEdgesOnSelect:ot,minZoom:pe,maxZoom:ge,nodeExtent:ve,onNodesChange:Ze,onEdgesChange:Xe,snapToGrid:ee,snapGrid:te,connectionMode:H,translateExtent:me,connectOnClick:Qe,defaultEdgeOptions:tt,fitView:Ke,fitViewOptions:Ue,onNodesDelete:I,onEdgesDelete:T,onDelete:z,onNodeDragStart:C,onNodeDrag:M,onNodeDragStop:P,onSelectionDrag:L,onSelectionDragStart:A,onSelectionDragStop:R,onMove:g,onMoveStart:m,onMoveEnd:y,noPanClassName:Ge,nodeOrigin:ce,rfId:St,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:lt,isValidConnection:ct,selectNodesOnDrag:oe,nodeDragThreshold:ht,connectionDragThreshold:pt,onBeforeDelete:B,paneClickDistance:ze,debug:wt,ariaLabelConfig:_t}),e(ts,{onSelectionChange:D}),Ae,e(Ga,{proOptions:et,position:Je}),e(qa,{rfId:St,disableKeyboardA11y:rt})]})})});function sc({dimensions:t,lineWidth:n,variant:o,className:r}){return e("path",{strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:le(["react-flow__background-pattern",o,r])})}function lc({radius:t,className:n}){return e("circle",{cx:t,cy:t,r:t,className:le(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(ic||(ic={}));const cc={[ic.Dots]:1,[ic.Lines]:1,[ic.Cross]:6},uc=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function dc({id:n,variant:o=ic.Dots,gap:r=20,size:i,lineWidth:a=1,offset:s=0,color:l,bgColor:c,style:u,className:d,patternClassName:f}){const p=h(null),{transform:g,patternId:m}=ja(uc,Da),y=i||cc[o],v=o===ic.Dots,b=o===ic.Cross,w=Array.isArray(r)?r:[r,r],x=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],E=Array.isArray(s)?s:[s,s],k=b?[_,_]:x,S=[E[0]*g[2]||1+k[0]/2,E[1]*g[2]||1+k[1]/2],O=`${m}${n||""}`;return t("svg",{className:le(["react-flow__background",d]),style:{...u,...Is,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:p,"data-testid":"rf__background",children:[e("pattern",{id:O,x:g[0]%x[0],y:g[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:v?e(lc,{radius:_/2,className:f}):e(sc,{dimensions:k,lineWidth:a,variant:o,className:f})}),e("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}function fc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:e("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function hc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:e("path",{d:"M0 0h32v4.2H0z"})})}function pc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:e("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 gc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e("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 mc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e("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 yc({children:t,className:n,...o}){return e("button",{type:"button",className:le(["react-flow__controls-button",n]),...o,children:t})}dc.displayName="Background",a(dc);const vc=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function bc({style:o,showZoom:r=!0,showFitView:i=!0,showInteractive:a=!0,fitViewOptions:s,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:d,className:f,children:h,position:p="bottom-left",orientation:g="vertical","aria-label":m}){const y=Va(),{isInteractive:v,minZoomReached:b,maxZoomReached:w,ariaLabelConfig:x}=ja(vc,Da),{zoomIn:_,zoomOut:E,fitView:k}=Cs();return t(Wa,{className:le(["react-flow__controls","horizontal"===g?"horizontal":"vertical",f]),position:p,style:o,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[r&&t(n,{children:[e(yc,{onClick:()=>{_(),l?.()},className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:w,children:e(fc,{})}),e(yc,{onClick:()=>{E(),c?.()},className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:e(hc,{})})]}),i&&e(yc,{className:"react-flow__controls-fitview",onClick:()=>{k(s),u?.()},title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:e(pc,{})}),a&&e(yc,{className:"react-flow__controls-interactive",onClick:()=>{y.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),d?.(!v)},title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:e(v?mc:gc,{})}),h]})}bc.displayName="Controls";const wc=a(bc);const xc=a(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("rect",{className:le(["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})}),_c=e=>e.nodes.map(e=>e.id),Ec=e=>e instanceof Function?e:()=>e;const kc=a(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}=ja(e=>{const{internals:n}=e.nodeLookup.get(t),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=ti(o);return{node:o,x:r,y:i,width:a,height:s}},Da);return u&&!u.hidden&&ni(u)?e(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 Sc=a(function({nodeStrokeColor:t,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:s=xc,onClick:l}){const c=ja(_c,Da),u=Ec(o),d=Ec(t),f=Ec(r),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return e(n,{children:c.map(t=>e(kc,{id:t,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:i,nodeStrokeWidth:a,NodeComponent:s,onClick:l,shapeRendering:h},t))})});const Oc=e=>!e.hidden,Nc=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?Fr(Cr(e.nodeLookup,{filter:Oc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function Cc({style:n,className:o,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:p,maskStrokeColor:g,maskStrokeWidth:m,position:y="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:x=!1,ariaLabel:_,inversePan:E,zoomStep:k=10,offsetScale:S=5}){const O=Va(),N=h(null),{boundingRect:C,viewBB:M,rfId:P,panZoom:I,translateExtent:T,flowWidth:z,flowHeight:D,ariaLabelConfig:A}=ja(Nc,Da),L=n?.width??200,R=n?.height??150,j=C.width/L,V=C.height/R,$=Math.max(j,V),B=$*L,H=$*R,F=S*$,Y=C.x-(B-C.width)/2-F,Z=C.y-(H-C.height)/2-F,X=B+2*F,q=H+2*F,W=`react-flow__minimap-desc-${P}`,G=h(0),K=h();G.current=$,f(()=>{if(N.current&&I)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Ot(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=Jo().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:Nt}}({domNode:N.current,panZoom:I,getTransform:()=>O.getState().transform,getViewScale:()=>G.current}),()=>{K.current?.destroy()}},[I]),f(()=>{K.current?.update({translateExtent:T,width:z,height:D,inversePan:E,pannable:w,zoomStep:k,zoomable:x})},[w,x,E,k,T,z,D]);const U=v?e=>{const[t,n]=K.current?.pointer(e)||[0,0];v(e,{x:t,y:n})}:void 0,Q=b?s((e,t)=>{const n=O.getState().nodeLookup.get(t).internals.userNode;b(e,n)},[]):void 0,J=_??A["minimap.ariaLabel"];return e(Wa,{position:y,style:{...n,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof p?p:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof g?g:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof m?m*$: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 c?c:void 0},className:le(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:t("svg",{width:L,height:R,viewBox:`${Y} ${Z} ${X} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:N,onClick:U,children:[J&&e("title",{id:W,children:J}),e(Sc,{onClick:Q,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),e("path",{className:"react-flow__minimap-mask",d:`M${Y-F},${Z-F}h${X+2*F}v${q+2*F}h${-X-2*F}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Cc.displayName="MiniMap",a(Cc);const Mc={[ra.Line]:"right",[ra.Handle]:"bottom-right"};a(function({nodeId:t,position:n,variant:o=ra.Handle,className:r,style:i,children:a,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:m,autoScale:y=!0,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:x}){const _=Ys(),E="string"==typeof t?t:_,k=Va(),S=h(null),O=o===ra.Handle,N=ja(s((C=O&&y,e=>C?`${Math.max(1/e.transform[2],1)}`:void 0),[O,y]),Da);var C;const M=h(null),P=n??Mc[o];f(()=>{if(S.current&&E)return M.current||(M.current=fa({domNode:S.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=k.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}=k.getState(),a=[],s={x:e.x,y:e.y},l=o.get(E);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=Ri([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...oi({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:E,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:E,type:"dimensions",resizing:!0,setAttributes:!m||("horizontal"===m?"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:E,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};k.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:c,minHeight:u,maxWidth:d,maxHeight:p},keepAspectRatio:g,resizeDirection:m,onResizeStart:b,onResize:w,onResizeEnd:x,shouldResize:v}),()=>{M.current?.destroy()}},[P,c,u,d,p,g,b,w,x,v]);const I=P.split("-");return e("div",{className:le(["react-flow__resize-control","nodrag",...I,o,r]),ref:S,style:{...i,scale:N,...l&&{[O?"backgroundColor":"borderColor"]:l}},children:a})});var Pc,Ic,Tc,zc,Dc,Ac,Lc,Rc,jc,Vc,$c,Bc,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,Nu,Cu,Mu,Pu,Iu,Tu,zu,Du,Au,Lu,Ru,ju,Vu,$u,Bu,Hu,Fu,Yu,Zu,Xu,qu,Wu,Gu,Ku,Uu,Qu,Ju,ed,td,nd,od,rd,id,ad,sd,ld,cd,ud,dd,fd,hd,pd,gd;function md(){if(Ic)return Pc;Ic=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 Pc=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))}},Pc}function yd(){return Ac?Dc:(Ac=1,Dc={Graph:md(),version:zc?Tc:(zc=1,Tc="2.2.4")})}function vd(){if(Rc)return Lc;Rc=1;var e=md();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 Lc={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 bd(){if(Vc)return jc;return Vc=1,jc=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},jc}function wd(){if(Bc)return $c;Bc=1;return $c=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}},$c}function xd(){if(Fc)return Hc;Fc=1;var e=wd();Hc=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 Hc}function _d(){if(Zc)return Yc;Zc=1;var e=xd();return Yc=function(t,n,o){return t.nodes().reduce(function(r,i){return r[i]=e(t,i,n,o),r},{})},Yc}function Ed(){if(qc)return Xc;return qc=1,Xc=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},Xc}function kd(){if(Gc)return Wc;Gc=1;var e=Ed();return Wc=function(t){return e(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}}function Sd(){if(Uc)return Kc;Uc=1,Kc=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 Kc}function Od(){if(Jc)return Qc;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}Jc=1;class t extends Error{constructor(){super(...arguments)}}return Qc=e,e.CycleException=t,Qc}function Nd(){if(tu)return eu;tu=1;var e=Od();return eu=function(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}}function Cd(){if(ou)return nu;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 ou=1,nu=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},nu}function Md(){if(iu)return ru;iu=1;var e=Cd();return ru=function(t,n){return e(t,n,"post")}}function Pd(){if(su)return au;su=1;var e=Cd();return au=function(t,n){return e(t,n,"pre")}}function Id(){if(cu)return lu;cu=1;var e=md(),t=wd();return lu=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},lu}function Td(){if(hu)return fu;hu=1;var e=yd();return fu={Graph:e.Graph,json:vd(),alg:du?uu:(du=1,uu={components:bd(),dijkstra:xd(),dijkstraAll:_d(),findCycles:kd(),floydWarshall:Sd(),isAcyclic:Nd(),postorder:Md(),preorder:Pd(),prim:Id(),tarjan:Ed(),topsort:Od()}),version:e.version}}function zd(){if(yu)return mu;yu=1;let e=Td().Graph,t=function(){if(gu)return pu;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 gu=1,pu=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(", ")+"]"}}}();mu=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 mu}function Dd(){if(bu)return vu;bu=1;let e=Td().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}vu={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 vu}function Ad(){if(xu)return wu;xu=1;let e=zd(),t=Dd().uniqueId;return wu={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)}})}},wu}function Ld(){if(Eu)return _u;Eu=1;let e=Dd();return _u={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)})}},_u}function Rd(){if(Su)return ku;Su=1;const{applyWithChunking:e}=Dd();return ku={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}},ku}function jd(){if(Nu)return Ou;Nu=1;var e=Td().Graph,t=Rd().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 Ou=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},Ou}function Vd(){if(Mu)return Cu;Mu=1;var e=jd(),t=Rd().slack,n=Rd().longestPath,o=Td().alg.preorder,r=Td().alg.postorder,i=Dd().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 Cu=a,a.initLowLimValues=c,a.initCutValues=s,a.calcCutValue=l,a.leaveEdge=d,a.enterEdge=f,a.exchangeEdges=h,Cu}function $d(){if(Iu)return Pu;Iu=1;var e=Rd().longestPath,t=jd(),n=Vd();Pu=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 Pu}function Bd(){if(zu)return Tu;return zu=1,Tu=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]}})},Tu}function Hd(){if(Au)return Du;Au=1;let e=Dd();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 Du={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)})}},Du}function Fd(){if(Vu)return ju;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 Vu=1,ju={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))}},ju}function Yd(){if(qu)return Xu;qu=1;let e=Dd();return Xu=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 Zd(){if(Uu)return Ku;Uu=1;let e=(Zu||(Zu=1,Yu=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}})}),Yu),t=Yd(),n=function(){if(Gu)return Wu;Gu=1;let e=Dd();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 Wu=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 Ku=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},Ku}function Xd(){if(Ju)return Qu;Ju=1;let e=Td().Graph,t=Dd();return Qu=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},Qu}function qd(){if(od)return nd;od=1;let e=function(){if(Bu)return $u;Bu=1;let e=Dd();return $u=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},$u}(),t=function(){if(Fu)return Hu;Fu=1;let e=Dd().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 Hu=function(e,n){let o=0;for(let r=1;r<n.length;++r)o+=t(e,n[r-1],n[r]);return o},Hu}(),n=Zd(),o=Xd(),r=(td||(td=1,ed=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}})}),ed),i=Td().Graph,a=Dd();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 nd=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)},nd}function Wd(){if(id)return rd;id=1;let e=Td().Graph,t=Dd();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 rd={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 Gd(){if(sd)return ad;sd=1;let e=Dd(),t=Wd().positionX;return ad=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)},ad}function Kd(){if(cd)return ld;cd=1;let e=Ad(),t=Ld(),n=$d(),o=Dd().normalizeRanks,r=Bd(),i=Dd().removeEmptyRanks,a=Hd(),s=function(){if(Ru)return Lu;Ru=1;let e=Dd();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 Lu=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)}})},Lu}(),l=Fd(),c=qd(),u=Gd(),d=Dd(),f=Td().Graph;ld=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 ld}function Ud(){if(dd)return ud;dd=1;let e=Dd(),t=Td().Graph;return ud={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}},ud}v("/* 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 Qd=b(gd?pd:(gd=1,pd={graphlib:Td(),layout:Kd(),debug:Ud(),util:{time:Dd().time,notime:Dd().notime},version:hd?fd:(hd=1,fd="1.1.5")})),Jd={type:xr.ArrowClosed,width:20,height:20,color:"#FF0072"},ef={strokeWidth:2,stroke:"#FF0072"},tf=function(t){var n=t.tree,o=Cs().fitView,i=function(e){const[t,n]=r(e),o=s(e=>n(t=>gs(e,t)),[]);return[t,n,o]}([]),a=ie(i,3),l=a[0],c=a[1],u=a[2],d=function(e){const[t,n]=r(e),o=s(e=>n(t=>ms(e,t)),[]);return[t,n,o]}([]),h=ie(d,3),p=h[0],g=h[1],m=h[2];return f(function(){if(n){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:Jd,style:ef};n.push(l)}o.push(a)})}),{nodes:o,edges:n}}(n.data,null!==(e=n.animated)&&void 0!==e&&e),r=function(e,t,n){var o=(new Qd.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,re(re({},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}))}),Qd.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 re(re({},e),{},{position:{x:s,y:l}})}),edges:t}}(t.nodes,t.edges,{direction:n.orientation});c(ae(r.nodes)),g(ae(r.edges)),o()}},[n]),e(ac,{nodes:l,edges:p,onNodesChange:u,onEdgesChange:m,colorMode:"dark",fitView:!0,children:e(wc,{})})},nf=function(t){var n=t.treeInfo,o=ie(r(),2),i=o[0],a=o[1];return f(function(){a(n)},[n]),e(nc,{children:e(tf,{tree:i})})};v(".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 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=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",rf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});af.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.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=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",lf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});cf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.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=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",df({ref:t,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?o.createElement("title",null,l):null,o.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"}))});ff.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.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=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",pf({ref:t,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?o.createElement("title",null,l):null,o.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"}),o.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"}))});gf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var mf=["color","size","title","className"];function yf(){return yf=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},yf.apply(null,arguments)}var vf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,mf);return o.createElement("svg",yf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});vf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var bf=["color","size","title","className"];function wf(){return wf=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},wf.apply(null,arguments)}var xf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,bf);return o.createElement("svg",wf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});xf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var _f=["color","size","title","className"];function Ef(){return Ef=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},Ef.apply(null,arguments)}var kf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,_f);return o.createElement("svg",Ef({ref:t,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?o.createElement("title",null,l):null,o.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"}))});kf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var Sf=["color","size","title","className"];function Of(){return Of=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},Of.apply(null,arguments)}var Nf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",Of({ref:t,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?o.createElement("title",null,l):null,o.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"}))});Nf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var Cf=["color","size","title","className"];function Mf(){return Mf=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},Mf.apply(null,arguments)}var Pf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,Cf);return o.createElement("svg",Mf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});Pf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};v('.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 If=function(n){var o=n.id,r=n.parentId,i=n.node,a=m({id:o,data:{type:"FileTreeNode",parentId:r,node:i,preview:e(Tf,{node:i})}}),l=a.attributes,c=a.listeners,u=a.setNodeRef;a.transform;var d=$f().selectNode,f=s(function(){d(i)},[d]);return t("div",re(re(re({className:"file-node-row",ref:u},c),l),{},{style:function(){var e={};return i.selected&&(e.backgroundColor="#00426b"),e}(),onClick:f,children:[e("div",{className:"indent",style:{width:20*i.level+"px"}}),"folder"===i.type?e("span",{className:"folder-icon",children:i.collapsed?e(ff,{}):e(cf,{})}):e("span",{className:"file-icon",children:function(){switch(i.name.split(".").pop()){case"js":return e(xf,{color:"#f1e05a"});case"json":return e(af,{color:"#fffb00"});case"scss":return e(Nf,{color:"#f12727"});case"py":return e(kf,{color:"#686affbd"});default:return e(gf,{color:"#ffffff"})}}()}),e("span",{className:"file-name",children:i.name})]}))},Tf=function(t){var n=t.node;return e("div",{className:"file-node-row",children:e("span",{className:"file-name",children:n.name})})};v("");var zf=function(t){ne(t);var o=ie(r([]),2),i=o[0],a=o[1],s=$f().state;f(function(){var e;l(null!==(e=s.collapsedTree)&&void 0!==e?e:[])},[s.collapsedTree]);var l=function(t,n){var o=[];t.forEach(function(t){o.push(e(If,{parentId:n,node:t,id:"tree-node-"+t.uid},n+"-"+t.uid))}),a(o)};return e(n,{children:i})},Df=i(),Af=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(Af(r.children,t+1)))}return n},Lf=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},Rf={uid:crypto.randomUUID(),tree:{},flattenedTree:[],selectedNode:null,collapsedTree:[]},jf=function(e,t){switch(t.type){case"ADD_FILE_TREE":var n=function(e){return e.forEach(function(e){e.collapsed=!1}),e}(Af(ae(t.payload))),o=Lf(n);return re(re({},e),{},{tree:t.payload,flattenedTree:n,collapsedTree:o});case"SELECT_NODE":var r=e.flattenedTree.map(function(e){return e.uid===t.payload.uid?re(re({},e),{},{selected:!0,collapsed:!e.collapsed}):re(re({},e),{},{selected:!1})});return re(re({},e),{},{flattenedTree:r,collapsedTree:Lf(r),selectedNode:t.payload});case"RESET_STATE":return Rf;default:return e}},Vf=c(function(t,n){var o=t.onSelectFile,r=ie(p(jf,Rf),2),i=r[0],a=r[1],c=s(function(e){a({type:"RESET_STATE"}),a({type:"ADD_FILE_TREE",payload:e})},[]);f(function(){i.selectedNode&&"file"===i.selectedNode.type&&o(i.selectedNode)},[i.selectedNode]);var u=s(function(e){a({type:"SELECT_NODE",payload:e})},[]),d=l(function(){return{state:i,addFileTree:c,selectNode:u}},[i,c,u]);return g(n,function(){return d},[d]),e(Df.Provider,{value:d,children:e("div",{className:"file-browser",children:e(zf,{})})})});function $f(){var e=u(Df);if(!e)throw new Error("useFileBrowser must be used inside <FileBrowser>");return e}Vf.displayName="FileBrowser";function Bf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Hf(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 Ff(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Hf(Object(n),!0).forEach(function(t){Bf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Hf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Yf(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 Zf(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 Xf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function qf(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 Wf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?qf(Object(n),!0).forEach(function(t){Xf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):qf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Gf(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 Kf(e){return{}.toString.call(e).includes("Object")}function Uf(e){return"function"==typeof e}v('.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 Qf=Gf(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"}),Jf={changes:function(e,t){return Kf(t)||Qf("changeType"),Object.keys(t).some(function(t){return!function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)})&&Qf("changeField"),t},selector:function(e){Uf(e)||Qf("selectorType")},handler:function(e){Uf(e)||Kf(e)||Qf("handlerType"),Kf(e)&&Object.values(e).some(function(e){return!Uf(e)})&&Qf("handlersType")},initial:function(e){var t;e||Qf("initialIsRequired"),Kf(e)||Qf("initialType"),t=e,Object.keys(t).length||Qf("initialContent")}};function eh(e,t){return Uf(t)?t(e.current):t}function th(e,t){return e.current=Wf(Wf({},e.current),t),t}function nh(e,t,n){return Uf(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 oh={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};Jf.initial(e),Jf.handler(t);var n={current:e},o=Gf(nh)(n,t),r=Gf(th)(n),i=Gf(Jf.changes)(e),a=Gf(eh)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return Jf.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 rh,ih={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 "},ah=(rh=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>=rh.length?rh.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))}})(ih),sh={config:function(e){var t;return e||ah("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||ah("configType"),e.urls?(console.warn(ih.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function lh(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],lh(e[n],t[n]))}),Ff(Ff({},e),t)}var ch={type:"cancelation",msg:"operation is manually canceled"};function uh(e){var t=!1,n=new Promise(function(n,o){e.then(function(e){return t?o(ch):n(e)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var dh,fh,hh=oh.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),ph=(fh=2,function(e){if(Array.isArray(e))return e}(dh=hh)||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}}(dh,fh)||function(e,t){if(e){if("string"==typeof e)return Zf(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)?Zf(e,t):void 0}}(dh,fh)||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.")}()),gh=ph[0],mh=ph[1];function yh(e){return document.body.appendChild(e)}function vh(e){var t,n,o=gh(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 bh(){var e=gh(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){wh(t),e.resolve(t)},function(t){e.reject(t)})}function wh(e){gh().monaco||mh({monaco:e})}var xh=new Promise(function(e,t){return mh({resolve:e,reject:t})}),_h={config:function(e){var t=sh.config(e),n=t.monaco,o=Yf(t,["monaco"]);mh(function(e){return{config:lh(e.config,o),monaco:n}})},init:function(){var e=gh(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(mh({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),uh(xh);if(window.monaco&&window.monaco.editor)return wh(window.monaco),e.resolve(window.monaco),uh(xh);!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)}}(yh,vh)(bh)}return uh(xh)},__getMonacoInstance:function(){return gh(function(e){return e.monaco})}},Eh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},kh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var Sh=function({children:e}){return o.createElement("div",{style:kh.container},e)};var Oh=a(function({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:a,wrapperProps:s}){return o.createElement("section",{style:{...Eh.wrapper,width:e,height:t},...s},!n&&o.createElement(Sh,null,r),o.createElement("div",{ref:i,style:{...Eh.fullWidth,...!n&&Eh.hide},className:a}))});var Nh=function(e){f(e,[])};var Ch=function(e,t,n=!0){let o=h(!0);f(o.current||!n?()=>{o.current=!1}:e,t)};function Mh(){}function Ph(e,t,n,o){return function(e,t){return e.editor.getModel(Ih(e,t))}(e,o)||function(e,t,n,o){return e.editor.createModel(t,n,o?Ih(e,o):void 0)}(e,t,n,o)}function Ih(e,t){return e.Uri.parse(t)}var Th=function({original:e,modified:t,language:n,originalLanguage:i,modifiedLanguage:a,originalModelPath:l,modifiedModelPath:c,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:d=!1,theme:p="light",loading:g="Loading...",options:m={},height:y="100%",width:v="100%",className:b,wrapperProps:w={},beforeMount:x=Mh,onMount:_=Mh}){let[E,k]=r(!1),[S,O]=r(!0),N=h(null),C=h(null),M=h(null),P=h(_),I=h(x),T=h(!1);Nh(()=>{let e=_h.init();return e.then(e=>(C.current=e)&&O(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>N.current?function(){let e=N.current?.getModel();u||e?.original?.dispose(),d||e?.modified?.dispose(),N.current?.dispose()}():e.cancel()}),Ch(()=>{if(N.current&&C.current){let t=N.current.getOriginalEditor(),o=Ph(C.current,e||"",i||n||"text",l||"");o!==t.getModel()&&t.setModel(o)}},[l],E),Ch(()=>{if(N.current&&C.current){let e=N.current.getModifiedEditor(),o=Ph(C.current,t||"",a||n||"text",c||"");o!==e.getModel()&&e.setModel(o)}},[c],E),Ch(()=>{let e=N.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],E),Ch(()=>{N.current?.getModel()?.original.setValue(e||"")},[e],E),Ch(()=>{let{original:e,modified:t}=N.current.getModel();C.current.editor.setModelLanguage(e,i||n||"text"),C.current.editor.setModelLanguage(t,a||n||"text")},[n,i,a],E),Ch(()=>{C.current?.editor.setTheme(p)},[p],E),Ch(()=>{N.current?.updateOptions(m)},[m],E);let z=s(()=>{if(!C.current)return;I.current(C.current);let o=Ph(C.current,e||"",i||n||"text",l||""),r=Ph(C.current,t||"",a||n||"text",c||"");N.current?.setModel({original:o,modified:r})},[n,t,a,e,i,l,c]),D=s(()=>{!T.current&&M.current&&(N.current=C.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...m}),z(),C.current?.editor.setTheme(p),k(!0),T.current=!0)},[m,p,z]);return f(()=>{E&&P.current(N.current,C.current)},[E]),f(()=>{!S&&!E&&D()},[S,E,D]),o.createElement(Oh,{width:v,height:y,isEditorReady:E,loading:g,_ref:M,className:b,wrapperProps:w})};a(Th);var zh=function(e){let t=h();return f(()=>{t.current=e},[e]),t.current},Dh=new Map;var Ah=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:i,language:a,path:l,theme:c="light",line:u,loading:d="Loading...",options:p={},overrideServices:g={},saveViewState:m=!0,keepCurrentModel:y=!1,width:v="100%",height:b="100%",className:w,wrapperProps:x={},beforeMount:_=Mh,onMount:E=Mh,onChange:k,onValidate:S=Mh}){let[O,N]=r(!1),[C,M]=r(!0),P=h(null),I=h(null),T=h(null),z=h(E),D=h(_),A=h(),L=h(i),R=zh(l),j=h(!1),V=h(!1);Nh(()=>{let e=_h.init();return e.then(e=>(P.current=e)&&M(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>I.current?(A.current?.dispose(),y?m&&Dh.set(l,I.current.saveViewState()):I.current.getModel()?.dispose(),void I.current.dispose()):e.cancel()}),Ch(()=>{let o=Ph(P.current,e||i||"",t||a||"",l||n||"");o!==I.current?.getModel()&&(m&&Dh.set(R,I.current?.saveViewState()),I.current?.setModel(o),m&&I.current?.restoreViewState(Dh.get(l)))},[l],O),Ch(()=>{I.current?.updateOptions(p)},[p],O),Ch(()=>{!I.current||void 0===i||(I.current.getOption(P.current.editor.EditorOption.readOnly)?I.current.setValue(i):i!==I.current.getValue()&&(V.current=!0,I.current.executeEdits("",[{range:I.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),I.current.pushUndoStop(),V.current=!1))},[i],O),Ch(()=>{let e=I.current?.getModel();e&&a&&P.current?.editor.setModelLanguage(e,a)},[a],O),Ch(()=>{void 0!==u&&I.current?.revealLine(u)},[u],O),Ch(()=>{P.current?.editor.setTheme(c)},[c],O);let $=s(()=>{if(T.current&&P.current&&!j.current){D.current(P.current);let o=l||n,r=Ph(P.current,i||e||"",t||a||"",o||"");I.current=P.current?.editor.create(T.current,{model:r,automaticLayout:!0,...p},g),m&&I.current.restoreViewState(Dh.get(o)),P.current.editor.setTheme(c),void 0!==u&&I.current.revealLine(u),N(!0),j.current=!0}},[e,t,n,i,a,l,p,g,m,c,u]);return f(()=>{O&&z.current(I.current,P.current)},[O]),f(()=>{!C&&!O&&$()},[C,O,$]),L.current=i,f(()=>{O&&k&&(A.current?.dispose(),A.current=I.current?.onDidChangeModelContent(e=>{V.current||k(I.current.getValue(),e)}))},[O,k]),f(()=>{if(O){let e=P.current.editor.onDidChangeMarkers(e=>{let t=I.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=P.current.editor.getModelMarkers({resource:t});S?.(e)}});return()=>{e?.dispose()}}return()=>{}},[O,S]),o.createElement(Oh,{width:v,height:b,isEditorReady:O,loading:d,_ref:T,className:w,wrapperProps:x})},Lh=a(Ah);v(".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 Rh=function(t){ne(t);var n=Wh().state,o=ie(r("Loading content..."),2),i=o[0],a=o[1],s=ie(r(!1),2),l=s[0],c=s[1],u=h(null),d=h(),p=h(null),g=h(0);f(function(){n.activeTab?(a(n.activeTab.content),c(!0)):c(!1)},[n.activeTab]),f(function(){d.current=i,null!=u&&u.current&&void 0!==d.current&&null!==d.current&&u.current.setValue(d.current)},[i]);var m=function(e,t){u.current=e,null!=d&&d.current&&u.current.setValue(d.current),u.current.layout()},y={fontSize:"13px",minimap:{enabled:!1},padding:{top:10},renderWhitespace:"none",wordWrap:"on",scrollBeyondLastLine:!1,readOnly:!0,automaticLayout:!1};f(function(){if(p.current){var e=new ResizeObserver(function(){cancelAnimationFrame(g.current),g.current=requestAnimationFrame(function(){var e;null===(e=u.current)||void 0===e||e.layout()})});return e.observe(p.current),function(){cancelAnimationFrame(g.current),e.disconnect()}}},[]);return e("div",{className:"editor-container",ref:p,children:l?e(Lh,{defaultLanguage:"python",defaultValue:i,onMount:m,theme:"vs-dark",options:y}):e("div",{className:"no-tab",children:"Select file or drag and drop to view."})})};Rh.propTypes={editorContent:W.string};v(".gutter {\n min-width: 2px;\n height: 35px;\n width: 2px;\n}");var jh=function(t){var n=t.id,o=t.index,r=t.parentId,i=y({id:n,data:{type:"EditorTabGutter",parentId:r,index:o}}),a=i.setNodeRef,s=i.isOver;return e("div",{className:"gutter",ref:a,style:{backgroundColor:s?"#FFFFFF":"#222425"}})};jh.propTypes={id:W.string.isRequired,parentId:W.string.isRequired,index:W.number.isRequired};v(".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 Vh="#1e1e1e",$h="#FFFFFF",Bh=function(n){var o=n.id,i=n.parentId,a=n.node,s=ie(r(),2),l=s[0],c=s[1],u=Wh(),d=u.selectTab,h=u.closeTab,p=u.state,g=m({id:o,data:{type:"EditorTab",parentId:i,node:a,preview:e(Hh,{node:a})}}),y=g.attributes,v=g.listeners,b=g.setNodeRef;g.transform,f(function(){w(p.activeTab&&p.activeTab.uid===a.uid)},[p.activeTab]);var w=function(e){c({backgroundColor:e?Vh:"#2d2d2d",color:e?$h:"#969690"})};return e("div",re(re(re({ref:b,style:l,id:o,onMouseDown:function(e){e.stopPropagation(),1===e.button?h(a.uid):d(a.uid)},className:"tab"},v),y),{},{children:t("div",{className:"tab-content",children:[e("div",{className:"icon",children:e(vf,{size:14,style:{pointerEvents:"none"}})}),e("div",{className:"tab-name",children:e("span",{children:a.name})}),e("div",{className:"close-icon",onMouseDown:function(e){e.stopPropagation(),h(a.uid)},children:e(Pf,{size:18})})]})}))};Bh.propTypes={id:W.string.isRequired,parentId:W.string.isRequired,node:W.shape({name:W.string.isRequired}).isRequired};var Hh=function(n){var o=n.node;return e("div",{className:"tab",style:{backgroundColor:Vh,color:$h,opacity:.5},children:t("div",{className:"tab-content",children:[e("div",{className:"icon",children:e(vf,{size:14,style:{pointerEvents:"none"}})}),e("div",{className:"tab-name",children:e("span",{children:o.name})}),e("div",{className:"close-icon",children:e(Pf,{size:18})})]})})};v(".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 Fh=function(){var t=Wh().state,n=ie(r(),2),o=n[0],i=n[1];f(function(){var e;(null===(e=t.tabs)||void 0===e?void 0:e.length)>=0&&null!=t.parentTabGroupId&&a(t.tabs,t.parentTabGroupId)},[t.tabs,t.parentTabGroupId]);var a=function(t,n){var o=[];t.forEach(function(t,r){o.push(e(jh,{id:n+"-"+r,index:r,parentId:n},t.uid+"-gutter")),o.push(e(Bh,{id:n+"-"+t.uid,parentId:n,node:t},t.uid))}),o.push(e(jh,{id:n+"-"+t.length,index:t.length,parentId:n},"last-gutter")),i(o)};return e("div",{className:"tabs-container",style:{background:"#222425"},children:o})},Yh=i(),Zh={uid:crypto.randomUUID(),tabs:[],activeTab:null,parentTabGroupId:null},Xh=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")),re(re({},e),{},{activeTab:i});var a=ae(e.tabs);return void 0!==r&&r<e.tabs.length?a.splice(r,0,o):a.push(o),re(re({},e),{},{tabs:a,activeTab:o});case"SET_PARENT_TAB_GROUP_ID":return re(re({},e),{},{parentTabGroupId:t.payload});case"SELECT_TAB":var s=e.tabs.find(function(e){return e.uid===t.payload});return s?re(re({},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=ae(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),re(re({},e),{},{tabs:c,activeTab:u});case"MOVE_TAB":var f=ae(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=ie(f.splice(m,1),1)[0],v=m<g?g-1:g;return f.splice(v,0,y),re(re({},e),{},{tabs:f});case"RESET_STATE":return Zh;default:return e}},qh=c(function(n,o){ne(n);var r=ie(p(Xh,Zh),2),i=r[0],a=r[1],c=s(function(e){a({type:"SELECT_TAB",payload:e})},[]),u=s(function(e){a({type:"CLOSE_TAB",payload:e})},[]),d=s(function(e,t){a({type:"MOVE_TAB",payload:{tabId:e,newIndex:t}})},[]),f=s(function(e,t){a({type:"ADD_TAB",payload:{tab:e,index:t}})},[]),h=s(function(e){a({type:"RESET_STATE"}),a({type:"SET_PARENT_TAB_GROUP_ID",payload:e})},[]),m=l(function(){return{state:i,addTab:f,setTabGroupId:h,selectTab:c,closeTab:u,moveTab:d}},[i,f,c,u,d,h]);return g(o,function(){return m},[m]),e(Yh.Provider,{value:m,children:t("div",{className:"editorContainer",children:[e("div",{className:"tabContainer",children:e(Fh,{})}),e("div",{className:"monacoContainer",children:e(Rh,{})})]})})});function Wh(){var e=u(Yh);if(!e)throw new Error("useEditor must be used inside <Editor>");return e}qh.displayName="Editor";export{qh as Editor,Vf as FileBrowser,nf as FlowDiagram,J as StackList,Wh as useEditor,$f as useFileBrowser};
|
|
41
|
+
*/var Oa=(ka||(ka=1,"production"===process.env.NODE_ENV?pa.exports=function(){if(wa)return ga;wa=1;var e=o,t=_a(),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;return ga.useSyncExternalStoreWithSelector=function(e,t,o,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,n(r,e))return t;var o=c(e);return void 0!==u&&u(t,o)?(r=e,t):(r=e,i=o)}var r,i,a=!1,s=void 0===o?null:o;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,o,c,u]);var h=r(e,d[0],d[1]);return a(function(){f.hasValue=!0,f.value=h},[h]),l(h),h},ga}():pa.exports=(Ea||(Ea=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=o,t=_a(),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},r=t.useSyncExternalStore,i=e.useRef,a=e.useEffect,s=e.useMemo,l=e.useDebugValue;Sa.useSyncExternalStoreWithSelector=function(e,t,o,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,n(r,e))return t;var o=c(e);return void 0!==u&&u(t,o)?(r=e,t):(r=e,i=o)}var r,i,a=!1,s=void 0===o?null:o;return[function(){return e(t())},null===s?void 0:function(){return e(s())}]},[t,o,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())}()),Sa)),pa.exports),Na=b(Oa);const Ca=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:()=>{"production"!==(import.meta.env?import.meta.env.MODE:void 0)&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},a=t=e(o,r,i);return i},{useDebugValue:Ma}=o,{useSyncExternalStoreWithSelector:Pa}=Na,Ia=e=>e;function Ta(e,t=Ia,n){const o=Pa(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Ma(o),o}const za=(e,t)=>{const n=(e=>e?Ca(e):Ca)(e),o=(e,o=t)=>Ta(n,e,o);return Object.assign(o,n),o};function Da(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 Aa=i(null),La=Aa.Provider,Ra=er();function ja(e,t){const n=u(Aa);if(null===n)throw new Error(Ra);return Ta(n,e,t)}function Va(){const e=u(Aa);if(null===e)throw new Error(Ra);return l(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Ba={display:"none"},$a={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ha="react-flow__node-desc",Fa="react-flow__edge-desc",Ya=e=>e.ariaLiveMessage,Za=e=>e.ariaLabelConfig;function Xa({rfId:t}){const n=ja(Ya);return e("div",{id:`react-flow__aria-live-${t}`,"aria-live":"assertive","aria-atomic":"true",style:$a,children:n})}function qa({rfId:o,disableKeyboardA11y:r}){const i=ja(Za);return t(n,{children:[e("div",{id:`${Ha}-${o}`,style:Ba,children:r?i["node.a11yDescription.default"]:i["node.a11yDescription.keyboardDisabled"]}),e("div",{id:`${Fa}-${o}`,style:Ba,children:i["edge.a11yDescription.default"]}),!r&&e(Xa,{rfId:o})]})}const Wa=c(({position:t="top-left",children:n,className:o,style:r,...i},a)=>{const s=`${t}`.split("-");return e("div",{className:le(["react-flow__panel",o,...s]),style:r,ref:a,...i,children:n})});function Ga({proOptions:t,position:n="bottom-right"}){return t?.hideAttribution?null:e(Wa,{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("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}Wa.displayName="Panel";const Ka=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}},Ua=e=>e.id;function Qa(e,t){return Da(e.selectedNodes.map(Ua),t.selectedNodes.map(Ua))&&Da(e.selectedEdges.map(Ua),t.selectedEdges.map(Ua))}function Ja({onSelectionChange:e}){const t=Va(),{selectedNodes:n,selectedEdges:o}=ja(Ka,Qa);return f(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(e=>e(r))},[n,o,e]),null}const es=e=>!!e.onSelectionChangeHandlers;function ts({onSelectionChange:t}){const n=ja(es);return t||n?e(Ja,{onSelectionChange:t}):null}const ns=[0,0],os={x:0,y:0,zoom:1},rs=["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"],is=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}),as={translateExtent:hr,nodeOrigin:ns,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1",paneClickDistance:0};function ss(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:a,reset:s,setDefaultNodesAndEdges:l,setPaneClickDistance:c}=ja(is,Da),u=Va();f(()=>(l(e.defaultNodes,e.defaultEdges),()=>{d.current=as,s()}),[]);const d=h(as);return f(()=>{for(const s of rs){const l=e[s];l!==d.current[s]&&(void 0!==e[s]&&("nodes"===s?t(l):"edges"===s?n(l):"minZoom"===s?o(l):"maxZoom"===s?r(l):"translateExtent"===s?i(l):"nodeExtent"===s?a(l):"paneClickDistance"===s?c(l):"ariaLabelConfig"===s?u.setState({ariaLabelConfig:ii(l)}):"fitView"===s?u.setState({fitViewQueued:l}):"fitViewOptions"===s?u.setState({fitViewOptions:l}):u.setState({[s]:l})))}d.current=e},rs.map(t=>e[t])),null}function ls(){return"undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null}const cs="undefined"!=typeof document?document:null;function us(e=null,t={target:cs,actInsideInputWithModifier:!0}){const[n,o]=r(!1),i=h(!1),a=h(new Set([])),[s,c]=l(()=>{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 f(()=>{const n=t?.target??cs,r=t?.actInsideInputWithModifier??!0;if(null!==e){const e=e=>{i.current=e.ctrlKey||e.metaKey||e.shiftKey||e.altKey;if((!i.current||i.current&&!r)&&ui(e))return!1;const n=fs(e.code,c);if(a.current.add(e[n]),ds(s,a.current,!1)){const n=e.composedPath?.()?.[0]||e.target,r="BUTTON"===n?.nodeName||"A"===n?.nodeName;!1===t.preventDefault||!i.current&&r||e.preventDefault(),o(!0)}},l=e=>{const t=fs(e.code,c);ds(s,a.current,!0)?(o(!1),a.current.clear()):a.current.delete(e[t]),"Meta"===e.key&&a.current.clear(),i.current=!1},u=()=>{a.current.clear(),o(!1)};return n?.addEventListener("keydown",e),n?.addEventListener("keyup",l),window.addEventListener("blur",u),window.addEventListener("contextmenu",u),()=>{n?.removeEventListener("keydown",e),n?.removeEventListener("keyup",l),window.removeEventListener("blur",u),window.removeEventListener("contextmenu",u)}}},[e,o]),n}function ds(e,t,n){return e.filter(e=>n||e.length===t.size).some(e=>e.every(e=>t.has(e)))}function fs(e,t){return t.includes(e)?"code":"key"}function hs(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)ps(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 ps(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 gs(e,t){return hs(e,t)}function ms(e,t){return hs(e,t)}function ys(e,t){return{id:e,type:"select",selected:t}}function vs(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(ys(i.id,e)))}return o}function bs({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 ws(e){return{id:e.id,type:"remove"}}const xs=e=>(e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e))(e);function _s(e){return c(e)}const Es="undefined"!=typeof window?d:f;function ks(e){const[t,n]=r(BigInt(0)),[o]=r(()=>function(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}(()=>n(e=>e+BigInt(1))));return Es(()=>{const t=o.get();t.length&&(e(t),o.reset())},[t]),o}const Ss=i(null);function Os({children:t}){const n=Va(),o=ks(s(e=>{const{nodes:t=[],setNodes:o,hasDefaultNodes:r,onNodesChange:i,nodeLookup:a,fitViewQueued:s}=n.getState();let l=t;for(const t of e)l="function"==typeof t?t(l):t;const c=bs({items:l,lookup:a});r&&o(l),c.length>0?i?.(c):s&&window.requestAnimationFrame(()=>{const{fitViewQueued:e,nodes:t,setNodes:o}=n.getState();e&&o(t)})},[])),r=ks(s(e=>{const{edges:t=[],setEdges:o,hasDefaultEdges:r,onEdgesChange:i,edgeLookup:a}=n.getState();let s=t;for(const t of e)s="function"==typeof t?t(s):t;r?o(s):i&&i(bs({items:s,lookup:a}))},[])),i=l(()=>({nodeQueue:o,edgeQueue:r}),[]);return e(Ss.Provider,{value:i,children:t})}const Ns=e=>!!e.panZoom;function Cs(){const e=(()=>{const e=Va();return l(()=>({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=Qr(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 Gr(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=Kr(t,n);return{x:a.x+r,y:a.y+i}}}),[])})(),t=Va(),n=function(){const e=u(Ss);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}(),o=ja(Ns),r=l(()=>{const e=e=>t.getState().nodeLookup.get(e),o=e=>{n.nodeQueue.push(e)},r=e=>{n.edgeQueue.push(e)},i=e=>{const{nodeLookup:n,nodeOrigin:o}=t.getState(),r=xs(e)?e:n.get(e.id),i=r.parentId?oi(r.position,r.measured,r.parentId,n,o):r.position,a={...r,position:i,width:r.measured?.width??r.width,height:r.measured?.height??r.height};return $r(a)},a=(e,t,n={replace:!1})=>{o(o=>o.map(o=>{if(o.id===e){const e="function"==typeof t?t(o):t;return n.replace&&xs(e)?e:{...o,...e}}return o}))},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&&Sr(e)?e:{...o,...e}}return o}))};return{getNodes:()=>t.getState().nodes.map(e=>({...e})),getNode:t=>e(t)?.internals.userNode,getInternalNode:e,getEdges:()=>{const{edges:e=[]}=t.getState();return e.map(e=>({...e}))},getEdge:e=>t.getState().edgeLookup.get(e),setNodes:o,setEdges:r,addNodes:e=>{const t=Array.isArray(e)?e:[e];n.nodeQueue.push(e=>[...e,...t])},addEdges:e=>{const t=Array.isArray(e)?e:[e];n.edgeQueue.push(e=>[...e,...t])},toObject:()=>{const{nodes:e=[],edges:n=[],transform:o}=t.getState(),[r,i,a]=o;return{nodes:e.map(e=>({...e})),edges:n.map(e=>({...e})),viewport:{x:r,y:i,zoom:a}}},deleteElements:async({nodes:e=[],edges:n=[]})=>{const{nodes:o,edges:r,onNodesDelete:i,onEdgesDelete:a,triggerNodeChanges:s,triggerEdgeChanges:l,onDelete:c,onBeforeDelete:u}=t.getState(),{nodes:d,edges:f}=await Tr({nodesToRemove:e,edgesToRemove:n,nodes:o,edges:r,onBeforeDelete:u}),h=f.length>0,p=d.length>0;if(h){const e=f.map(ws);a?.(f),l(e)}if(p){const e=d.map(ws);i?.(d),s(e)}return(p||h)&&c?.({nodes:d,edges:f}),{deletedNodes:d,deletedEdges:f}},getIntersectingNodes:(e,n=!0,o)=>{const r=Zr(e),a=r?e:i(e),s=void 0!==o;return a?(o||t.getState().nodes).filter(o=>{const i=t.getState().nodeLookup.get(o.id);if(i&&!r&&(o.id===e.id||!i.internals.positionAbsolute))return!1;const l=$r(s?o:i),c=Yr(l,a);return n&&c>0||c>=l.width*l.height||c>=a.width*a.height}):[]},isNodeIntersecting:(e,t,n=!0)=>{const o=Zr(e)?e:i(e);if(!o)return!1;const r=Yr(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:n,nodeOrigin:o}=t.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):Or(n)?n:t.nodeLookup.get(n.id));const i=r?Hr(r,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return jr(e,i)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Br(n)})(e,{nodeLookup:n,nodeOrigin:o})},getHandleConnections:({type:e,id:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}-${e}${n?`-${n}`:""}`)?.values()??[]),getNodeConnections:({type:e,handleId:n,nodeId:o})=>Array.from(t.getState().connectionLookup.get(`${o}${e?n?`-${e}-${n}`:`-${e}`:""}`)?.values()??[]),fitView:async e=>{const o=t.getState().fitViewResolver??function(){let e,t;return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}();return t.setState({fitViewQueued:!0,fitViewOptions:e,fitViewResolver:o}),n.nodeQueue.push(e=>[...e]),o.promise}}},[]);return l(()=>({...r,...e,viewportInitialized:o}),[o])}const Ms=e=>e.selected,Ps="undefined"!=typeof window?window:void 0;const Is={position:"absolute",width:"100%",height:"100%",top:0,left:0},Ts=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib});function zs({onPaneContextMenu:t,zoomOnScroll:n=!0,zoomOnPinch:o=!0,panOnScroll:r=!1,panOnScrollSpeed:i=.5,panOnScrollMode:a=yr.Free,zoomOnDoubleClick:l=!0,panOnDrag:c=!0,defaultViewport:u,translateExtent:d,minZoom:p,maxZoom:g,zoomActivationKeyCode:m,preventScrolling:y=!0,children:v,noWheelClassName:b,noPanClassName:w,onViewportChange:x,isControlledViewport:_,paneClickDistance:E}){const k=Va(),S=h(null),{userSelectionActive:O,lib:N}=ja(Ts,Da),C=us(m),M=h();!function(e){const t=Va();f(()=>{const n=()=>{if(!e.current)return!1;const n=si(e.current);0!==n.height&&0!==n.width||t.getState().onError?.("004",or()),t.setState({width:n.width||500,height:n.height||500})};if(e.current){n(),window.addEventListener("resize",n);const t=new ResizeObserver(()=>n());return t.observe(e.current),()=>{window.removeEventListener("resize",n),t&&e.current&&t.unobserve(e.current)}}},[])}(S);const P=s(e=>{x?.({x:e[0],y:e[1],zoom:e[2]}),_||k.setState({transform:e})},[x,_]);return f(()=>{if(S.current){M.current=oa({domNode:S.current,minZoom:p,maxZoom:g,translateExtent:d,viewport:u,paneClickDistance:E,onDraggingChange:e=>k.setState({paneDragging:e}),onPanZoomStart:(e,t)=>{const{onViewportChangeStart:n,onMoveStart:o}=k.getState();o?.(e,t),n?.(t)},onPanZoom:(e,t)=>{const{onViewportChange:n,onMove:o}=k.getState();o?.(e,t),n?.(t)},onPanZoomEnd:(e,t)=>{const{onViewportChangeEnd:n,onMoveEnd:o}=k.getState();o?.(e,t),n?.(t)}});const{x:e,y:t,zoom:n}=M.current.getViewport();return k.setState({panZoom:M.current,transform:[e,t,n],domNode:S.current.closest(".react-flow")}),()=>{M.current?.destroy()}}},[]),f(()=>{M.current?.update({onPaneContextMenu:t,zoomOnScroll:n,zoomOnPinch:o,panOnScroll:r,panOnScrollSpeed:i,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:c,zoomActivationKeyPressed:C,preventScrolling:y,noPanClassName:w,userSelectionActive:O,noWheelClassName:b,lib:N,onTransformChange:P})},[t,n,o,r,i,a,l,c,C,y,w,O,b,N,P]),e("div",{className:"react-flow__renderer",ref:S,style:Is,children:v})}const Ds=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function As(){const{userSelectionActive:t,userSelectionRect:n}=ja(Ds,Da);return t&&n?e("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 Ls=(e,t)=>n=>{n.target===t.current&&e?.(n)},Rs=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function js({isSelecting:n,selectionKeyPressed:o,selectionMode:r=vr.Full,panOnDrag:i,selectionOnDrag:a,onSelectionStart:s,onSelectionEnd:l,onPaneClick:c,onPaneContextMenu:u,onPaneScroll:d,onPaneMouseEnter:f,onPaneMouseMove:p,onPaneMouseLeave:g,children:m}){const y=Va(),{userSelectionActive:v,elementsSelectable:b,dragging:w,connectionInProgress:x}=ja(Rs,Da),_=b&&(n||v),E=h(null),k=h(),S=h(new Set),O=h(new Set),N=h(!1),C=h(!1),M=e=>{N.current||x?N.current=!1:(c?.(e),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1}))},P=d?e=>d(e):void 0,I=!0===i||Array.isArray(i)&&i.includes(0);return t("div",{className:le(["react-flow__pane",{draggable:I,dragging:w,selection:n}]),onClick:_?void 0:Ls(M,E),onContextMenu:Ls(e=>{Array.isArray(i)&&i?.includes(2)?e.preventDefault():u?.(e)},E),onWheel:Ls(P,E),onPointerEnter:_?void 0:f,onPointerDown:_?e=>{const{resetSelectedElements:t,domNode:o}=y.getState();if(k.current=o?.getBoundingClientRect(),!b||!n||0!==e.button||e.target!==E.current||!k.current)return;e.target?.setPointerCapture?.(e.pointerId),C.current=!0,N.current=!1;const{x:r,y:i}=fi(e.nativeEvent,k.current);t(),y.setState({userSelectionRect:{width:0,height:0,startX:r,startY:i,x:r,y:i}}),s?.(e)}:p,onPointerMove:_?e=>{const{userSelectionRect:t,transform:n,nodeLookup:o,edgeLookup:i,connectionLookup:a,triggerNodeChanges:s,triggerEdgeChanges:l,defaultEdgeOptions:c}=y.getState();if(!k.current||!t)return;N.current=!0;const{x:u,y:d}=fi(e.nativeEvent,k.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=S.current,m=O.current;S.current=new Set(Mr(o,p,n,r===vr.Partial,!0).map(e=>e.id)),O.current=new Set;const v=c?.selectable??!0;for(const e of S.current){const t=a.get(e);if(t)for(const{edgeId:e}of t.values()){const t=i.get(e);t&&(t.selectable??v)&&O.current.add(e)}}if(!ri(g,S.current)){s(vs(o,S.current,!0))}if(!ri(m,O.current)){l(vs(i,O.current))}y.setState({userSelectionRect:p,userSelectionActive:!0,nodesSelectionActive:!1})}:p,onPointerUp:_?e=>{if(0!==e.button||!C.current)return;e.target?.releasePointerCapture?.(e.pointerId);const{userSelectionRect:t}=y.getState();!v&&t&&e.target===E.current&&M?.(e),y.setState({userSelectionActive:!1,userSelectionRect:null,nodesSelectionActive:S.current.size>0}),l?.(e),(o||a)&&(N.current=!1),C.current=!1}:void 0,onPointerLeave:g,ref:E,style:Is,children:[m,e(As,{})]})}function Vs({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",ur(e))}function Bs({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:o,nodeId:i,isSelectable:a,nodeClickDistance:s}){const l=Va(),[c,u]=r(!1),d=h();return f(()=>{d.current=Fi({getStoreItems:()=>l.getState(),onNodeMouseDown:t=>{Vs({id:t,store:l,nodeRef:e})},onDragStart:()=>{u(!0)},onDragStop:()=>{u(!1)}})},[]),f(()=>{if(t)d.current?.destroy();else if(e.current)return d.current?.update({noDragClassName:n,handleSelector:o,domNode:e.current,isSelectable:a,nodeId:i,nodeClickDistance:s}),()=>{d.current?.destroy()}},[n,o,t,a,e,i]),c}function $s(){const e=Va();return s(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=Wr(t,r));const{position:i,positionAbsolute:s}=Ir({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 Hs=i(null),Fs=Hs.Provider;Hs.Consumer;const Ys=()=>u(Hs),Zs=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId});const Xs=a(_s(function({type:t="source",position:n=_r.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=Va(),v=Ys(),{connectOnClick:b,noPanClassName:w,rfId:x}=ja(Zs,Da),{connectingFrom:_,connectingTo:E,clickConnecting:k,isPossibleEndHandle:S,connectionInProcess:O,clickConnectionInProcess:N,valid:C}=ja(((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===mr.Strict?s?.type!==n:e!==s?.nodeId||t!==s?.id,connectionInProcess:!!s,clickConnectionInProcess:!!r,valid:u&&c}})(v,g,t),Da);v||y.getState().onError?.("010",lr());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 qr("006",ir()),t;let n;return n=Sr(e)?{...e}:{...e,id:wi(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=di(e.nativeEvent);if(i&&(t&&0===e.button||!t)){const t=y.getState();Gi.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("div",{"data-handleid":g,"data-nodeid":v,"data-handlepos":n,"data-id":`${x}-${v}-${g}-${t}`,className:le(["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:C,connectionindicator:r&&(!O||S)&&(O||N?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=li(e.target),p=o||l,{connection:m,isValid:b}=Gi.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 qs={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},Ws={input:function({data:o,isConnectable:r,sourcePosition:i=_r.Bottom}){return t(n,{children:[o?.label,e(Xs,{type:"source",position:i,isConnectable:r})]})},default:function({data:o,isConnectable:r,targetPosition:i=_r.Top,sourcePosition:a=_r.Bottom}){return t(n,{children:[e(Xs,{type:"target",position:i,isConnectable:r}),o?.label,e(Xs,{type:"source",position:a,isConnectable:r})]})},output:function({data:o,isConnectable:r,targetPosition:i=_r.Top}){return t(n,{children:[e(Xs,{type:"target",position:i,isConnectable:r}),o?.label]})},group:function(){return null}};const Gs=e=>{const{width:t,height:n,x:o,y:r}=Cr(e.nodeLookup,{filter:e=>!!e.selected});return{width:Xr(t)?t:null,height:Xr(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 Ks({onSelectionContextMenu:t,noPanClassName:n,disableKeyboardA11y:o}){const r=Va(),{width:i,height:a,transformString:s,userSelectionActive:l}=ja(Gs,Da),c=$s(),u=h(null);if(f(()=>{o||u.current?.focus({preventScroll:!0})},[o]),Bs({nodeRef:u}),l||!i||!a)return null;const d=t?e=>{const n=r.getState().nodes.filter(e=>e.selected);t(e,n)}:void 0;return e("div",{className:le(["react-flow__nodesselection","react-flow__container",n]),style:{transform:s},children:e("div",{ref:u,className:"react-flow__nodesselection-rect",onContextMenu:d,tabIndex:o?void 0:-1,onKeyDown:o?void 0:e=>{Object.prototype.hasOwnProperty.call(qs,e.key)&&(e.preventDefault(),c({direction:qs[e.key],factor:e.shiftKey?4:1}))},style:{width:i,height:a}})})}const Us="undefined"!=typeof window?window:void 0,Qs=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Js({children:n,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,paneClickDistance:c,deleteKeyCode:u,selectionKeyCode:d,selectionOnDrag:h,selectionMode:p,onSelectionStart:g,onSelectionEnd:m,multiSelectionKeyCode:y,panActivationKeyCode:v,zoomActivationKeyCode:b,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:_,panOnScroll:E,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:O,panOnDrag:N,defaultViewport:C,translateExtent:M,minZoom:P,maxZoom:I,preventScrolling:T,onSelectionContextMenu:z,noWheelClassName:D,noPanClassName:A,disableKeyboardA11y:L,onViewportChange:R,isControlledViewport:j}){const{nodesSelectionActive:V,userSelectionActive:B}=ja(Qs),$=us(d,{target:Us}),H=us(v,{target:Us}),F=H||N,Y=H||E,Z=h&&!0!==F,X=$||B||Z;return function({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=Va(),{deleteElements:o}=Cs(),r=us(e,{actInsideInputWithModifier:!1}),i=us(t,{target:Ps});f(()=>{if(r){const{edges:e,nodes:t}=n.getState();o({nodes:t.filter(Ms),edges:e.filter(Ms)}),n.setState({nodesSelectionActive:!1})}},[r]),f(()=>{n.setState({multiSelectionActive:i})},[i])}({deleteKeyCode:u,multiSelectionKeyCode:y}),e(zs,{onPaneContextMenu:s,elementsSelectable:w,zoomOnScroll:x,zoomOnPinch:_,panOnScroll:Y,panOnScrollSpeed:k,panOnScrollMode:S,zoomOnDoubleClick:O,panOnDrag:!$&&F,defaultViewport:C,translateExtent:M,minZoom:P,maxZoom:I,zoomActivationKeyCode:b,preventScrolling:T,noWheelClassName:D,noPanClassName:A,onViewportChange:R,isControlledViewport:j,paneClickDistance:c,children:t(js,{onSelectionStart:g,onSelectionEnd:m,onPaneClick:o,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:s,onPaneScroll:l,panOnDrag:F,isSelecting:!!X,selectionMode:p,selectionKeyPressed:$,selectionOnDrag:Z,children:[n,V&&e(Ks,{onSelectionContextMenu:z,noPanClassName:A,disableKeyboardA11y:L})]})})}Js.displayName="FlowRenderer";const el=a(Js);function tl(e){return ja(s((e=>t=>e?Mr(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]),Da)}const nl=e=>e.updateNodeInternals;function ol({id:t,onClick:n,onMouseEnter:o,onMouseMove:r,onMouseLeave:i,onContextMenu:a,onDoubleClick:s,nodesDraggable:l,elementsSelectable:c,nodesConnectable:u,nodesFocusable:d,resizeObserver:p,noDragClassName:g,noPanClassName:m,disableKeyboardA11y:y,rfId:v,nodeTypes:b,nodeClickDistance:w,onError:x}){const{node:_,internals:E,isParent:k}=ja(e=>{const n=e.nodeLookup.get(t),o=e.parentLookup.has(t);return{node:n,internals:n.internals,isParent:o}},Da);let S=_.type||"default",O=b?.[S]||Ws[S];void 0===O&&(x?.("003",nr(S)),S="default",O=b?.default||Ws.default);const N=!!(_.draggable||l&&void 0===_.draggable),C=!!(_.selectable||c&&void 0===_.selectable),M=!!(_.connectable||u&&void 0===_.connectable),P=!!(_.focusable||d&&void 0===_.focusable),I=Va(),T=ni(_),z=function({node:e,nodeType:t,hasDimensions:n,resizeObserver:o}){const r=Va(),i=h(null),a=h(null),s=h(e.sourcePosition),l=h(e.targetPosition),c=h(t),u=n&&!!e.internals.handleBounds;return f(()=>{!i.current||e.hidden||u&&a.current===i.current||(a.current&&o?.unobserve(a.current),o?.observe(i.current),a.current=i.current)},[u,e.hidden]),f(()=>()=>{a.current&&(o?.unobserve(a.current),a.current=null)},[]),f(()=>{if(i.current){const n=c.current!==t,o=s.current!==e.sourcePosition,a=l.current!==e.targetPosition;(n||o||a)&&(c.current=t,s.current=e.sourcePosition,l.current=e.targetPosition,r.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}({node:_,nodeType:S,hasDimensions:T,resizeObserver:p}),D=Bs({nodeRef:z,disabled:_.hidden||!N,noDragClassName:g,handleSelector:_.dragHandle,nodeId:t,isSelectable:C,nodeClickDistance:w}),A=$s();if(_.hidden)return null;const L=ti(_),R=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}}(_),j=C||N||n||o||r||i,V=o?e=>o(e,{...E.userNode}):void 0,B=r?e=>r(e,{...E.userNode}):void 0,$=i?e=>i(e,{...E.userNode}):void 0,H=a?e=>a(e,{...E.userNode}):void 0,F=s?e=>s(e,{...E.userNode}):void 0;return e("div",{className:le(["react-flow__node",`react-flow__node-${S}`,{[m]:N},_.className,{selected:_.selected,selectable:C,parent:k,draggable:N,dragging:D}]),ref:z,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:j?"all":"none",visibility:T?"visible":"hidden",..._.style,...R},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:V,onMouseMove:B,onMouseLeave:$,onContextMenu:H,onClick:e=>{const{selectNodesOnDrag:o,nodeDragThreshold:r}=I.getState();C&&(!o||!N||r>0)&&Vs({id:t,store:I,nodeRef:z}),n&&n(e,{...E.userNode})},onDoubleClick:F,onKeyDown:P?e=>{if(!ui(e.nativeEvent)&&!y)if(pr.includes(e.key)&&C){const n="Escape"===e.key;Vs({id:t,store:I,unselect:n,nodeRef:z})}else if(N&&_.selected&&Object.prototype.hasOwnProperty.call(qs,e.key)){e.preventDefault();const{ariaLabelConfig:t}=I.getState();I.setState({ariaLiveMessage:t["node.a11yDescription.ariaLiveMessage"]({direction:e.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),A({direction:qs[e.key],factor:e.shiftKey?4:1})}}:void 0,tabIndex:P?0:void 0,onFocus:P?()=>{if(y||!z.current?.matches(":focus-visible"))return;const{transform:e,width:n,height:o,autoPanOnNodeFocus:r,setCenter:i}=I.getState();if(!r)return;Mr(new Map([[t,_]]),{x:0,y:0,width:n,height:o},e,!0).length>0||i(_.position.x+L.width/2,_.position.y+L.height/2,{zoom:e[2]})}:void 0,role:_.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":y?void 0:`${Ha}-${v}`,"aria-label":_.ariaLabel,..._.domAttributes,children:e(Fs,{value:t,children:e(O,{id:t,data:_.data,type:S,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:_.selected??!1,selectable:C,draggable:N,deletable:_.deletable??!0,isConnectable:M,sourcePosition:_.sourcePosition,targetPosition:_.targetPosition,dragging:D,dragHandle:_.dragHandle,zIndex:E.z,parentId:_.parentId,...L})})})}const rl=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function il(t){const{nodesDraggable:n,nodesConnectable:o,nodesFocusable:i,elementsSelectable:a,onError:s}=ja(rl,Da),l=tl(t.onlyRenderVisibleElements),c=function(){const e=ja(nl),[t]=r(()=>"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 f(()=>()=>{t?.disconnect()},[t]),t}();return e("div",{className:"react-flow__nodes",style:Is,children:l.map(r=>e(ol,{id:r,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:c,nodesDraggable:n,nodesConnectable:o,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:t.nodeClickDistance,onError:s},r))})}il.displayName="NodeRenderer";const al=a(il);const sl={[xr.Arrow]:({color:t="none",strokeWidth:n=1})=>e("polyline",{style:{stroke:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),[xr.ArrowClosed]:({color:t="none",strokeWidth:n=1})=>e("polyline",{style:{stroke:t,fill:t,strokeWidth:n},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})};const ll=({id:t,type:n,color:o,width:r=12.5,height:i=12.5,markerUnits:a="strokeWidth",strokeWidth:s,orient:c="auto-start-reverse"})=>{const u=function(e){const t=Va();return l(()=>Object.prototype.hasOwnProperty.call(sl,e)?sl[e]:(t.getState().onError?.("009",ar(e)),null),[e])}(n);return u?e("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${i}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:c,refX:"0",refY:"0",children:e(u,{color:o,strokeWidth:s})}):null},cl=({defaultColor:t,rfId:n})=>{const o=ja(e=>e.edges),r=ja(e=>e.defaultEdgeOptions),i=l(()=>{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=Pi(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))}(o,{id:n,defaultColor:t,defaultMarkerStart:r?.markerStart,defaultMarkerEnd:r?.markerEnd});return e},[o,r,n,t]);return i.length?e("svg",{className:"react-flow__marker","aria-hidden":"true",children:e("defs",{children:i.map(t=>e(ll,{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};cl.displayName="MarkerDefinitions";var ul=a(cl);function dl({x:n,y:o,label:i,labelStyle:a,labelShowBg:s=!0,labelBgStyle:l,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:p,...g}){const[m,y]=r({x:1,y:0,width:0,height:0}),v=le(["react-flow__edge-textwrapper",p]),b=h(null);return f(()=>{if(b.current){const e=b.current.getBBox();y({x:e.x,y:e.y,width:e.width,height:e.height})}},[i]),i?t("g",{transform:`translate(${n-m.width/2} ${o-m.height/2})`,className:v,visibility:m.width?"visible":"hidden",...g,children:[s&&e("rect",{width:m.width+2*c[0],x:-c[0],y:-c[1],height:m.height+2*c[1],className:"react-flow__edge-textbg",style:l,rx:u,ry:u}),e("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:b,style:a,children:i}),d]}):null}dl.displayName="EdgeText";const fl=a(dl);function hl({path:o,labelX:r,labelY:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:f=20,...h}){return t(n,{children:[e("path",{...h,d:o,fill:"none",className:le(["react-flow__edge-path",h.className])}),f&&e("path",{d:o,fill:"none",strokeOpacity:0,strokeWidth:f,className:"react-flow__edge-interaction"}),a&&Xr(r)&&Xr(i)?e(fl,{x:r,y:i,label:a,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function pl({pos:e,x1:t,y1:n,x2:o,y2:r}){return e===_r.Left||e===_r.Right?[.5*(t+o),n]:[t,.5*(n+r)]}function gl({sourceX:e,sourceY:t,sourcePosition:n=_r.Bottom,targetX:o,targetY:r,targetPosition:i=_r.Top}){const[a,s]=pl({pos:n,x1:e,y1:t,x2:o,y2:r}),[l,c]=pl({pos:i,x1:o,y1:r,x2:e,y2:t}),[u,d,f,h]=pi({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 ml(t){return a(({id:n,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]=gl({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l}),_=t.isInternal?void 0:n;return e(hl,{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 yl=ml({isInternal:!1}),vl=ml({isInternal:!0});function bl(t){return a(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,label:s,labelStyle:l,labelShowBg:c,labelBgStyle:u,labelBgPadding:d,labelBgBorderRadius:f,style:h,sourcePosition:p=_r.Bottom,targetPosition:g=_r.Top,markerEnd:m,markerStart:y,pathOptions:v,interactionWidth:b})=>{const[w,x,_]=Si({sourceX:o,sourceY:r,sourcePosition:p,targetX:i,targetY:a,targetPosition:g,borderRadius:v?.borderRadius,offset:v?.offset,stepPosition:v?.stepPosition}),E=t.isInternal?void 0:n;return e(hl,{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})})}yl.displayName="SimpleBezierEdge",vl.displayName="SimpleBezierEdgeInternal";const wl=bl({isInternal:!1}),xl=bl({isInternal:!0});function _l(t){return a(({id:n,...o})=>{const r=t.isInternal?void 0:n;return e(wl,{...o,id:r,pathOptions:l(()=>({borderRadius:0,offset:o.pathOptions?.offset}),[o.pathOptions?.offset])})})}wl.displayName="SmoothStepEdge",xl.displayName="SmoothStepEdgeInternal";const El=_l({isInternal:!1}),kl=_l({isInternal:!0});function Sl(t){return a(({id:n,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]=xi({sourceX:o,sourceY:r,targetX:i,targetY:a}),w=t.isInternal?void 0:n;return e(hl,{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})})}El.displayName="StepEdge",kl.displayName="StepEdgeInternal";const Ol=Sl({isInternal:!1}),Nl=Sl({isInternal:!0});function Cl(t){return a(({id:n,sourceX:o,sourceY:r,targetX:i,targetY:a,sourcePosition:s=_r.Bottom,targetPosition:l=_r.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,_]=yi({sourceX:o,sourceY:r,sourcePosition:s,targetX:i,targetY:a,targetPosition:l,curvature:v?.curvature}),E=t.isInternal?void 0:n;return e(hl,{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})})}Ol.displayName="StraightEdge",Nl.displayName="StraightEdgeInternal";const Ml=Cl({isInternal:!1}),Pl=Cl({isInternal:!0});Ml.displayName="BezierEdge",Pl.displayName="BezierEdgeInternal";const Il={default:Pl,straight:Nl,step:kl,smoothstep:xl,simplebezier:vl},Tl={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},zl=(e,t,n)=>n===_r.Left?e-t:n===_r.Right?e+t:e,Dl=(e,t,n)=>n===_r.Top?e-t:n===_r.Bottom?e+t:e,Al="react-flow__edgeupdater";function Ll({position:t,centerX:n,centerY:o,radius:r=10,onMouseDown:i,onMouseEnter:a,onMouseOut:s,type:l}){return e("circle",{onMouseDown:i,onMouseEnter:a,onMouseOut:s,className:le([Al,`${Al}-${l}`]),cx:zl(n,r,t),cy:Dl(o,r,t),r:r,stroke:"transparent",fill:"transparent"})}function Rl({isReconnectable:o,reconnectRadius:r,edge:i,sourceX:a,sourceY:s,targetX:l,targetY:c,sourcePosition:u,targetPosition:d,onReconnect:f,onReconnectStart:h,onReconnectEnd:p,setReconnecting:g,setUpdateHover:m}){const y=Va(),v=(e,t)=>{if(0!==e.button)return;const{autoPanOnConnect:n,domNode:o,isValidConnection:r,connectionMode:a,connectionRadius:s,lib:l,onConnectStart:c,onConnectEnd:u,cancelConnection:d,nodeLookup:m,rfId:v,panBy:b,updateConnection:w}=y.getState(),x="target"===t.type;Gi.onPointerDown(e.nativeEvent,{autoPanOnConnect:n,connectionMode:a,connectionRadius:s,domNode:o,handleId:t.id,nodeId:t.nodeId,nodeLookup:m,isTarget:x,edgeUpdaterType:t.type,lib:l,flowId:v,cancelConnection:d,panBy:b,isValidConnection:r,onConnect:e=>f?.(i,e),onConnectStart:(n,o)=>{g(!0),h?.(e,i,t.type),c?.(n,o)},onConnectEnd:u,onReconnectEnd:(e,n)=>{g(!1),p?.(e,i,t.type,n)},updateConnection:w,getTransform:()=>y.getState().transform,getFromHandle:()=>y.getState().connection.fromHandle,dragThreshold:y.getState().connectionDragThreshold})},b=()=>m(!0),w=()=>m(!1);return t(n,{children:[(!0===o||"source"===o)&&e(Ll,{position:u,centerX:a,centerY:s,radius:r,onMouseDown:e=>v(e,{nodeId:i.target,id:i.targetHandle??null,type:"target"}),onMouseEnter:b,onMouseOut:w,type:"source"}),(!0===o||"target"===o)&&e(Ll,{position:d,centerX:l,centerY:c,radius:r,onMouseDown:e=>v(e,{nodeId:i.source,id:i.sourceHandle??null,type:"source"}),onMouseEnter:b,onMouseOut:w,type:"target"})]})}function jl({id:n,edgesFocusable:o,edgesReconnectable:i,elementsSelectable:a,onClick:c,onDoubleClick:u,onContextMenu:d,onMouseEnter:f,onMouseMove:p,onMouseLeave:g,reconnectRadius:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:b,rfId:w,edgeTypes:x,noPanClassName:_,onError:E,disableKeyboardA11y:k}){let S=ja(e=>e.edgeLookup.get(n));const O=ja(e=>e.defaultEdgeOptions);S=O?{...O,...S}:S;let N=S.type||"default",C=x?.[N]||Il[N];void 0===C&&(E?.("011",cr(N)),N="default",C=x?.default||Il.default);const M=!!(S.focusable||o&&void 0===S.focusable),P=void 0!==y&&(S.reconnectable||i&&void 0===S.reconnectable),I=!!(S.selectable||a&&void 0===S.selectable),T=h(null),[z,D]=r(!1),[A,L]=r(!1),R=Va(),{zIndex:j,sourceX:V,sourceY:B,targetX:$,targetY:H,sourcePosition:F,targetPosition:Y}=ja(s(e=>{const t=e.nodeLookup.get(S.source),o=e.nodeLookup.get(S.target);if(!t||!o)return{zIndex:S.zIndex,...Tl};const r=function(e){const{sourceNode:t,targetNode:n}=e;if(!Oi(t)||!Oi(n))return null;const o=t.internals.handleBounds||Ni(t.handles),r=n.internals.handleBounds||Ni(n.handles),i=Mi(o?.source??[],e.sourceHandle),a=Mi(e.connectionMode===mr.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!a)return e.onError?.("008",sr(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const s=i?.position||_r.Bottom,l=a?.position||_r.Top,c=Ci(t,i,s),u=Ci(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:S.sourceHandle||null,targetHandle:S.targetHandle||null,connectionMode:e.connectionMode,onError:E}),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:S.selected,zIndex:S.zIndex,sourceNode:t,targetNode:o,elevateOnSelect:e.elevateEdgesOnSelect});return{zIndex:i,...r||Tl}},[S.source,S.target,S.sourceHandle,S.targetHandle,S.selected,S.zIndex]),Da),Z=l(()=>S.markerStart?`url('#${Pi(S.markerStart,w)}')`:void 0,[S.markerStart,w]),X=l(()=>S.markerEnd?`url('#${Pi(S.markerEnd,w)}')`:void 0,[S.markerEnd,w]);if(S.hidden||null===V||null===B||null===$||null===H)return null;const q=u?e=>{u(e,{...S})}:void 0,W=d?e=>{d(e,{...S})}:void 0,G=f?e=>{f(e,{...S})}:void 0,K=p?e=>{p(e,{...S})}:void 0,U=g?e=>{g(e,{...S})}:void 0;return e("svg",{style:{zIndex:j},children:t("g",{className:le(["react-flow__edge",`react-flow__edge-${N}`,S.className,_,{selected:S.selected,animated:S.animated,inactive:!I&&!c,updating:z,selectable:I}]),onClick:e=>{const{addSelectedEdges:t,unselectNodesAndEdges:o,multiSelectionActive:r}=R.getState();I&&(R.setState({nodesSelectionActive:!1}),S.selected&&r?(o({nodes:[],edges:[S]}),T.current?.blur()):t([n])),c&&c(e,S)},onDoubleClick:q,onContextMenu:W,onMouseEnter:G,onMouseMove:K,onMouseLeave:U,onKeyDown:M?e=>{if(!k&&pr.includes(e.key)&&I){const{unselectNodesAndEdges:t,addSelectedEdges:o}=R.getState();"Escape"===e.key?(T.current?.blur(),t({edges:[S]})):o([n])}}:void 0,tabIndex:M?0:void 0,role:S.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":n,"data-testid":`rf__edge-${n}`,"aria-label":null===S.ariaLabel?void 0:S.ariaLabel||`Edge from ${S.source} to ${S.target}`,"aria-describedby":M?`${Fa}-${w}`:void 0,ref:T,...S.domAttributes,children:[!A&&e(C,{id:n,source:S.source,target:S.target,type:S.type,selected:S.selected,animated:S.animated,selectable:I,deletable:S.deletable??!0,label:S.label,labelStyle:S.labelStyle,labelShowBg:S.labelShowBg,labelBgStyle:S.labelBgStyle,labelBgPadding:S.labelBgPadding,labelBgBorderRadius:S.labelBgBorderRadius,sourceX:V,sourceY:B,targetX:$,targetY:H,sourcePosition:F,targetPosition:Y,data:S.data,style:S.style,sourceHandleId:S.sourceHandle,targetHandleId:S.targetHandle,markerStart:Z,markerEnd:X,pathOptions:"pathOptions"in S?S.pathOptions:void 0,interactionWidth:S.interactionWidth}),P&&e(Rl,{edge:S,isReconnectable:P,reconnectRadius:m,onReconnect:y,onReconnectStart:v,onReconnectEnd:b,sourceX:V,sourceY:B,targetX:$,targetY:H,sourcePosition:F,targetPosition:Y,setUpdateHover:D,setReconnecting:L})]})})}const Vl=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Bl({defaultMarkerColor:n,onlyRenderVisibleElements:o,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:l,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:f,onEdgeClick:h,reconnectRadius:p,onEdgeDoubleClick:g,onReconnectStart:m,onReconnectEnd:y,disableKeyboardA11y:v}){const{edgesFocusable:b,edgesReconnectable:w,elementsSelectable:x,onError:_}=ja(Vl,Da),E=ja(s(e=>{if(!k)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&&bi({sourceNode:o,targetNode:r,width:e.width,height:e.height,transform:e.transform})&&t.push(n.id)}return t},[k=o]),Da);var k;return t("div",{className:"react-flow__edges",children:[e(ul,{defaultColor:n,rfId:r}),E.map(t=>e(jl,{id:t,edgesFocusable:b,edgesReconnectable:w,elementsSelectable:x,noPanClassName:a,onReconnect:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:f,onClick:h,reconnectRadius:p,onDoubleClick:g,onReconnectStart:m,onReconnectEnd:y,rfId:r,onError:_,edgeTypes:i,disableKeyboardA11y:v},t))]})}Bl.displayName="EdgeRenderer";const $l=a(Bl),Hl=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Fl({children:t}){const n=ja(Hl);return e("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:n},children:t})}const Yl=e=>e.panZoom?.syncViewport;function Zl(e){return e.connection.inProgress?{...e.connection,to:Gr(e.connection.to,e.transform)}:{...e.connection}}function Xl(e){return ja(Zl,Da)}const ql=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Wl({containerStyle:t,style:n,type:o,component:r}){const{nodesConnectable:i,width:a,height:s,isValid:l,inProgress:c}=ja(ql,Da);return!!(a&&i&&c)?e("svg",{style:t,width:a,height:s,className:"react-flow__connectionline react-flow__container",children:e("g",{className:le(["react-flow__connection",kr(l)]),children:e(Gl,{style:n,type:o,CustomComponent:r,isValid:l})})}):null}const Gl=({style:t,type:n=wr.Bezier,CustomComponent:o,isValid:r})=>{const{inProgress:i,from:a,fromNode:s,fromHandle:l,fromPosition:c,to:u,toNode:d,toHandle:f,toPosition:h}=Xl();if(!i)return;if(o)return e(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:kr(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 wr.Bezier:[p]=yi(g);break;case wr.SimpleBezier:[p]=gl(g);break;case wr.Step:[p]=Si({...g,borderRadius:0});break;case wr.SmoothStep:[p]=Si(g);break;default:[p]=xi(g)}return e("path",{d:p,fill:"none",className:"react-flow__connection-path",style:t})};Gl.displayName="ConnectionLine";const Kl={};function Ul(e=Kl){const t=h(e),n=Va();f(()=>{if("development"===process.env.NODE_ENV){const o=new Set([...Object.keys(t.current),...Object.keys(e)]);for(const r of o)if(t.current[r]!==e[r]){n.getState().onError?.("002",tr());break}t.current=e}},[e])}function Ql({nodeTypes:n,edgeTypes:o,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:s,onEdgeDoubleClick:l,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:m,onSelectionEnd:y,connectionLineType:v,connectionLineStyle:b,connectionLineComponent:w,connectionLineContainerStyle:x,selectionKeyCode:_,selectionOnDrag:E,selectionMode:k,multiSelectionKeyCode:S,panActivationKeyCode:O,zoomActivationKeyCode:N,deleteKeyCode:C,onlyRenderVisibleElements:M,elementsSelectable:P,defaultViewport:I,translateExtent:T,minZoom:z,maxZoom:D,preventScrolling:A,defaultMarkerColor:L,zoomOnScroll:R,zoomOnPinch:j,panOnScroll:V,panOnScrollSpeed:B,panOnScrollMode:$,zoomOnDoubleClick:H,panOnDrag:F,onPaneClick:Y,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:q,onPaneScroll:W,onPaneContextMenu:G,paneClickDistance:K,nodeClickDistance:U,onEdgeContextMenu:Q,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:te,reconnectRadius:ne,onReconnect:oe,onReconnectStart:re,onReconnectEnd:ie,noDragClassName:ae,noWheelClassName:se,noPanClassName:le,disableKeyboardA11y:ce,nodeExtent:ue,rfId:de,viewport:fe,onViewportChange:he}){return Ul(n),Ul(o),function(){const e=Va(),t=h(!1);f(()=>{if("development"===process.env.NODE_ENV&&!t.current){const n=document.querySelector(".react-flow__pane");n&&"1"!==window.getComputedStyle(n).zIndex&&e.getState().onError?.("013",dr("react")),t.current=!0}},[])}(),function(e){const t=Cs(),n=h(!1);f(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}(r),function(e){const t=ja(Yl),n=Va();f(()=>{e&&(t?.(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t])}(fe),e(el,{onPaneClick:Y,onPaneMouseEnter:Z,onPaneMouseMove:X,onPaneMouseLeave:q,onPaneContextMenu:G,onPaneScroll:W,paneClickDistance:K,deleteKeyCode:C,selectionKeyCode:_,selectionOnDrag:E,selectionMode:k,onSelectionStart:m,onSelectionEnd:y,multiSelectionKeyCode:S,panActivationKeyCode:O,zoomActivationKeyCode:N,elementsSelectable:P,zoomOnScroll:R,zoomOnPinch:j,zoomOnDoubleClick:H,panOnScroll:V,panOnScrollSpeed:B,panOnScrollMode:$,panOnDrag:F,defaultViewport:I,translateExtent:T,minZoom:z,maxZoom:D,onSelectionContextMenu:g,preventScrolling:A,noDragClassName:ae,noWheelClassName:se,noPanClassName:le,disableKeyboardA11y:ce,onViewportChange:he,isControlledViewport:!!fe,children:t(Fl,{children:[e($l,{edgeTypes:o,onEdgeClick:a,onEdgeDoubleClick:l,onReconnect:oe,onReconnectStart:re,onReconnectEnd:ie,onlyRenderVisibleElements:M,onEdgeContextMenu:Q,onEdgeMouseEnter:J,onEdgeMouseMove:ee,onEdgeMouseLeave:te,reconnectRadius:ne,defaultMarkerColor:L,noPanClassName:le,disableKeyboardA11y:ce,rfId:de}),e(Wl,{style:b,type:v,component:w,containerStyle:x}),e("div",{className:"react-flow__edgelabel-renderer"}),e(al,{nodeTypes:n,onNodeClick:i,onNodeDoubleClick:s,onNodeMouseEnter:c,onNodeMouseMove:u,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:U,onlyRenderVisibleElements:M,noPanClassName:le,noDragClassName:ae,disableKeyboardA11y:ce,nodeExtent:ue,rfId:de}),e("div",{className:"react-flow__viewport-portal"})]})})}Ql.displayName="GraphView";const Jl=a(Ql),ec=({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??hr;Vi(p,g,m);const w=Di(y,f,h,{nodeOrigin:v,nodeExtent:b,elevateNodesOnSelect:!1});let x=[0,0,1];if(a&&r&&i){const e=Cr(f,{filter:e=>!(!e.width&&!e.initialWidth||!e.height&&!e.initialHeight)}),{x:t,y:n,zoom:o}=Qr(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:hr,nodeExtent:b,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:mr.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:{...br},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:qr,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:gr}},tc=({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 Pr({nodes:e,width:r,height:i,panZoom:t,minZoom:a,maxZoom:s},n),o?.resolve(!0),f({fitViewResolver:null}))}return{...ec({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=Di(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();Vi(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=si(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=ei(e.extent)?e.extent:i;let{positionAbsolute:p}=e.internals;e.parentId&&"parent"===e.extent?p=Ar(p,a,t.get(e.parentId)):h&&(p=Dr(p,h,a));const g={...e,measured:a,internals:{...e.internals,positionAbsolute:p,handleBounds:{source:hi("source",o.nodeElement,f,u,e.id),target:hi("target",o.nodeElement,f,u,e.id)}}};t.set(e.id,g),e.parentId&&Ai(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:$r(g,r)}))}}if(d.length>0){const e=Ri(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=zi(Ii,n);for(const n of e.values())if(n.parentId)Ai(n,e,t,o);else{const e=Nr(n,o.nodeOrigin),t=ei(n.extent)?n.extent:o.nodeExtent,r=Dr(e,t,ti(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=Ri(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(gs(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(ms(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=>ys(e,!0))):(r(vs(o,new Set([...e]),!0)),i(vs(n)))},addSelectedEdges:e=>{const{multiSelectionActive:t,edgeLookup:n,nodeLookup:o,triggerNodeChanges:r,triggerEdgeChanges:i}=h();t?i(e.map(e=>ys(e,!0))):(i(vs(n,new Set([...e]))),r(vs(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),ys(e.id,!1)}),c=s.map(e=>ys(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,ys(t.id,!1)]:e,[]),a=e.reduce((e,t)=>t.selected?[...e,ys(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]||(Di(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:{...br}})},updateConnection:e=>{f({connection:e})},reset:()=>f({...ec()})}},h=Object.is,f?za(f,h):za;var f,h};function nc({initialNodes:t,initialEdges:n,defaultNodes:o,defaultEdges:i,initialWidth:a,initialHeight:s,initialMinZoom:l,initialMaxZoom:c,initialFitViewOptions:u,fitView:d,nodeOrigin:f,nodeExtent:h,children:p}){const[g]=r(()=>tc({nodes:t,edges:n,defaultNodes:o,defaultEdges:i,width:a,height:s,fitView:d,minZoom:l,maxZoom:c,fitViewOptions:u,nodeOrigin:f,nodeExtent:h}));return e(La,{value:g,children:e(Os,{children:p})})}function oc({children:t,nodes:o,edges:r,defaultNodes:i,defaultEdges:a,width:s,height:l,fitView:c,fitViewOptions:d,minZoom:f,maxZoom:h,nodeOrigin:p,nodeExtent:g}){return u(Aa)?e(n,{children:t}):e(nc,{initialNodes:o,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:s,initialHeight:l,fitView:c,initialFitViewOptions:d,initialMinZoom:f,initialMaxZoom:h,nodeOrigin:p,nodeExtent:g,children:t})}const rc={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};var ic,ac=_s(function({nodes:n,edges:o,defaultNodes:i,defaultEdges:a,className:l,nodeTypes:c,edgeTypes:u,onNodeClick:d,onEdgeClick:h,onInit:p,onMove:g,onMoveStart:m,onMoveEnd:y,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:_,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:S,onNodeContextMenu:O,onNodeDoubleClick:N,onNodeDragStart:C,onNodeDrag:M,onNodeDragStop:P,onNodesDelete:I,onEdgesDelete:T,onDelete:z,onSelectionChange:D,onSelectionDragStart:A,onSelectionDrag:L,onSelectionDragStop:R,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:B,onBeforeDelete:$,connectionMode:H,connectionLineType:F=wr.Bezier,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:X,deleteKeyCode:q="Backspace",selectionKeyCode:W="Shift",selectionOnDrag:G=!1,selectionMode:K=vr.Full,panActivationKeyCode:U="Space",multiSelectionKeyCode:Q=(Jr()?"Meta":"Control"),zoomActivationKeyCode:J=(Jr()?"Meta":"Control"),snapToGrid:ee,snapGrid:te,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:oe,nodesDraggable:re,autoPanOnNodeFocus:ie,nodesConnectable:ae,nodesFocusable:se,nodeOrigin:ce=ns,edgesFocusable:ue,edgesReconnectable:de,elementsSelectable:fe=!0,defaultViewport:he=os,minZoom:pe=.5,maxZoom:ge=2,translateExtent:me=hr,preventScrolling:ye=!0,nodeExtent:ve,defaultMarkerColor:be="#b1b1b7",zoomOnScroll:we=!0,zoomOnPinch:xe=!0,panOnScroll:_e=!1,panOnScrollSpeed:Ee=.5,panOnScrollMode:ke=yr.Free,zoomOnDoubleClick:Se=!0,panOnDrag:Oe=!0,onPaneClick:Ne,onPaneMouseEnter:Ce,onPaneMouseMove:Me,onPaneMouseLeave:Pe,onPaneScroll:Ie,onPaneContextMenu:Te,paneClickDistance:ze=0,nodeClickDistance:De=0,children:Ae,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Be,onEdgeMouseEnter:$e,onEdgeMouseMove:He,onEdgeMouseLeave:Fe,reconnectRadius:Ye=10,onNodesChange:Ze,onEdgesChange:Xe,noDragClassName:qe="nodrag",noWheelClassName:We="nowheel",noPanClassName:Ge="nopan",fitView:Ke,fitViewOptions:Ue,connectOnClick:Qe,attributionPosition:Je,proOptions:et,defaultEdgeOptions:tt,elevateNodesOnSelect:nt,elevateEdgesOnSelect:ot,disableKeyboardA11y:rt=!1,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,connectionRadius:lt,isValidConnection:ct,onError:ut,style:dt,id:ft,nodeDragThreshold:ht,connectionDragThreshold:pt,viewport:gt,onViewportChange:mt,width:yt,height:vt,colorMode:bt="light",debug:wt,onScroll:xt,ariaLabelConfig:_t,...Et},kt){const St=ft||"1",Ot=function(e){const[t,n]=r("system"===e?null:e);return f(()=>{if("system"!==e)return void n(e);const t=ls(),o=()=>n(t?.matches?"dark":"light");return o(),t?.addEventListener("change",o),()=>{t?.removeEventListener("change",o)}},[e]),null!==t?t:ls()?.matches?"dark":"light"}(bt),Nt=s(e=>{e.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),xt?.(e)},[xt]);return e("div",{"data-testid":"rf__wrapper",...Et,onScroll:Nt,style:{...dt,...rc},ref:kt,className:le(["react-flow",l,Ot]),id:ft,role:"application",children:t(oc,{nodes:n,edges:o,width:yt,height:vt,fitView:Ke,fitViewOptions:Ue,minZoom:pe,maxZoom:ge,nodeOrigin:ce,nodeExtent:ve,children:[e(Jl,{onInit:p,onNodeClick:d,onEdgeClick:h,onNodeMouseEnter:E,onNodeMouseMove:k,onNodeMouseLeave:S,onNodeContextMenu:O,onNodeDoubleClick:N,nodeTypes:c,edgeTypes:u,connectionLineType:F,connectionLineStyle:Y,connectionLineComponent:Z,connectionLineContainerStyle:X,selectionKeyCode:W,selectionOnDrag:G,selectionMode:K,deleteKeyCode:q,multiSelectionKeyCode:Q,panActivationKeyCode:U,zoomActivationKeyCode:J,onlyRenderVisibleElements:ne,defaultViewport:he,translateExtent:me,minZoom:pe,maxZoom:ge,preventScrolling:ye,zoomOnScroll:we,zoomOnPinch:xe,zoomOnDoubleClick:Se,panOnScroll:_e,panOnScrollSpeed:Ee,panOnScrollMode:ke,panOnDrag:Oe,onPaneClick:Ne,onPaneMouseEnter:Ce,onPaneMouseMove:Me,onPaneMouseLeave:Pe,onPaneScroll:Ie,onPaneContextMenu:Te,paneClickDistance:ze,nodeClickDistance:De,onSelectionContextMenu:j,onSelectionStart:V,onSelectionEnd:B,onReconnect:Le,onReconnectStart:Re,onReconnectEnd:je,onEdgeContextMenu:Ve,onEdgeDoubleClick:Be,onEdgeMouseEnter:$e,onEdgeMouseMove:He,onEdgeMouseLeave:Fe,reconnectRadius:Ye,defaultMarkerColor:be,noDragClassName:qe,noWheelClassName:We,noPanClassName:Ge,rfId:St,disableKeyboardA11y:rt,nodeExtent:ve,viewport:gt,onViewportChange:mt}),e(ss,{nodes:n,edges:o,defaultNodes:i,defaultEdges:a,onConnect:v,onConnectStart:b,onConnectEnd:w,onClickConnectStart:x,onClickConnectEnd:_,nodesDraggable:re,autoPanOnNodeFocus:ie,nodesConnectable:ae,nodesFocusable:se,edgesFocusable:ue,edgesReconnectable:de,elementsSelectable:fe,elevateNodesOnSelect:nt,elevateEdgesOnSelect:ot,minZoom:pe,maxZoom:ge,nodeExtent:ve,onNodesChange:Ze,onEdgesChange:Xe,snapToGrid:ee,snapGrid:te,connectionMode:H,translateExtent:me,connectOnClick:Qe,defaultEdgeOptions:tt,fitView:Ke,fitViewOptions:Ue,onNodesDelete:I,onEdgesDelete:T,onDelete:z,onNodeDragStart:C,onNodeDrag:M,onNodeDragStop:P,onSelectionDrag:L,onSelectionDragStart:A,onSelectionDragStop:R,onMove:g,onMoveStart:m,onMoveEnd:y,noPanClassName:Ge,nodeOrigin:ce,rfId:St,autoPanOnConnect:it,autoPanOnNodeDrag:at,autoPanSpeed:st,onError:ut,connectionRadius:lt,isValidConnection:ct,selectNodesOnDrag:oe,nodeDragThreshold:ht,connectionDragThreshold:pt,onBeforeDelete:$,paneClickDistance:ze,debug:wt,ariaLabelConfig:_t}),e(ts,{onSelectionChange:D}),Ae,e(Ga,{proOptions:et,position:Je}),e(qa,{rfId:St,disableKeyboardA11y:rt})]})})});function sc({dimensions:t,lineWidth:n,variant:o,className:r}){return e("path",{strokeWidth:n,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:le(["react-flow__background-pattern",o,r])})}function lc({radius:t,className:n}){return e("circle",{cx:t,cy:t,r:t,className:le(["react-flow__background-pattern","dots",n])})}!function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"}(ic||(ic={}));const cc={[ic.Dots]:1,[ic.Lines]:1,[ic.Cross]:6},uc=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function dc({id:n,variant:o=ic.Dots,gap:r=20,size:i,lineWidth:a=1,offset:s=0,color:l,bgColor:c,style:u,className:d,patternClassName:f}){const p=h(null),{transform:g,patternId:m}=ja(uc,Da),y=i||cc[o],v=o===ic.Dots,b=o===ic.Cross,w=Array.isArray(r)?r:[r,r],x=[w[0]*g[2]||1,w[1]*g[2]||1],_=y*g[2],E=Array.isArray(s)?s:[s,s],k=b?[_,_]:x,S=[E[0]*g[2]||1+k[0]/2,E[1]*g[2]||1+k[1]/2],O=`${m}${n||""}`;return t("svg",{className:le(["react-flow__background",d]),style:{...u,...Is,"--xy-background-color-props":c,"--xy-background-pattern-color-props":l},ref:p,"data-testid":"rf__background",children:[e("pattern",{id:O,x:g[0]%x[0],y:g[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${S[0]},-${S[1]})`,children:v?e(lc,{radius:_/2,className:f}):e(sc,{dimensions:k,lineWidth:a,variant:o,className:f})}),e("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}dc.displayName="Background";const fc=a(dc);function hc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:e("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function pc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:e("path",{d:"M0 0h32v4.2H0z"})})}function gc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:e("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 mc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e("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 yc(){return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:e("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 vc({children:t,className:n,...o}){return e("button",{type:"button",className:le(["react-flow__controls-button",n]),...o,children:t})}const bc=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function wc({style:o,showZoom:r=!0,showFitView:i=!0,showInteractive:a=!0,fitViewOptions:s,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:d,className:f,children:h,position:p="bottom-left",orientation:g="vertical","aria-label":m}){const y=Va(),{isInteractive:v,minZoomReached:b,maxZoomReached:w,ariaLabelConfig:x}=ja(bc,Da),{zoomIn:_,zoomOut:E,fitView:k}=Cs();return t(Wa,{className:le(["react-flow__controls","horizontal"===g?"horizontal":"vertical",f]),position:p,style:o,"data-testid":"rf__controls","aria-label":m??x["controls.ariaLabel"],children:[r&&t(n,{children:[e(vc,{onClick:()=>{_(),l?.()},className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:w,children:e(hc,{})}),e(vc,{onClick:()=>{E(),c?.()},className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:b,children:e(pc,{})})]}),i&&e(vc,{className:"react-flow__controls-fitview",onClick:()=>{k(s),u?.()},title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:e(gc,{})}),a&&e(vc,{className:"react-flow__controls-interactive",onClick:()=>{y.setState({nodesDraggable:!v,nodesConnectable:!v,elementsSelectable:!v}),d?.(!v)},title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:e(v?yc:mc,{})}),h]})}wc.displayName="Controls";const xc=a(wc);const _c=a(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("rect",{className:le(["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})}),Ec=e=>e.nodes.map(e=>e.id),kc=e=>e instanceof Function?e:()=>e;const Sc=a(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}=ja(e=>{const{internals:n}=e.nodeLookup.get(t),o=n.userNode,{x:r,y:i}=n.positionAbsolute,{width:a,height:s}=ti(o);return{node:o,x:r,y:i,width:a,height:s}},Da);return u&&!u.hidden&&ni(u)?e(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 Oc=a(function({nodeStrokeColor:t,nodeColor:o,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:s=_c,onClick:l}){const c=ja(Ec,Da),u=kc(o),d=kc(t),f=kc(r),h="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision";return e(n,{children:c.map(t=>e(Sc,{id:t,nodeColorFunc:u,nodeStrokeColorFunc:d,nodeClassNameFunc:f,nodeBorderRadius:i,nodeStrokeWidth:a,NodeComponent:s,onClick:l,shapeRendering:h},t))})});const Nc=e=>!e.hidden,Cc=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?Fr(Cr(e.nodeLookup,{filter:Nc}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}};function Mc({style:n,className:o,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:p,maskStrokeColor:g,maskStrokeWidth:m,position:y="bottom-right",onClick:v,onNodeClick:b,pannable:w=!1,zoomable:x=!1,ariaLabel:_,inversePan:E,zoomStep:k=10,offsetScale:S=5}){const O=Va(),N=h(null),{boundingRect:C,viewBB:M,rfId:P,panZoom:I,translateExtent:T,flowWidth:z,flowHeight:D,ariaLabelConfig:A}=ja(Cc,Da),L=n?.width??200,R=n?.height??150,j=C.width/L,V=C.height/R,B=Math.max(j,V),$=B*L,H=B*R,F=S*B,Y=C.x-($-C.width)/2-F,Z=C.y-(H-C.height)/2-F,X=$+2*F,q=H+2*F,W=`react-flow__minimap-desc-${P}`,G=h(0),K=h();G.current=B,f(()=>{if(N.current&&I)return K.current=function({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Ot(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=Jo().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:Nt}}({domNode:N.current,panZoom:I,getTransform:()=>O.getState().transform,getViewScale:()=>G.current}),()=>{K.current?.destroy()}},[I]),f(()=>{K.current?.update({translateExtent:T,width:z,height:D,inversePan:E,pannable:w,zoomStep:k,zoomable:x})},[w,x,E,k,T,z,D]);const U=v?e=>{const[t,n]=K.current?.pointer(e)||[0,0];v(e,{x:t,y:n})}:void 0,Q=b?s((e,t)=>{const n=O.getState().nodeLookup.get(t).internals.userNode;b(e,n)},[]):void 0,J=_??A["minimap.ariaLabel"];return e(Wa,{position:y,style:{...n,"--xy-minimap-background-color-props":"string"==typeof d?d:void 0,"--xy-minimap-mask-background-color-props":"string"==typeof p?p:void 0,"--xy-minimap-mask-stroke-color-props":"string"==typeof g?g:void 0,"--xy-minimap-mask-stroke-width-props":"number"==typeof m?m*B: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 c?c:void 0},className:le(["react-flow__minimap",o]),"data-testid":"rf__minimap",children:t("svg",{width:L,height:R,viewBox:`${Y} ${Z} ${X} ${q}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":W,ref:N,onClick:U,children:[J&&e("title",{id:W,children:J}),e(Oc,{onClick:Q,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:c,nodeComponent:u}),e("path",{className:"react-flow__minimap-mask",d:`M${Y-F},${Z-F}h${X+2*F}v${q+2*F}h${-X-2*F}z\n M${M.x},${M.y}h${M.width}v${M.height}h${-M.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Mc.displayName="MiniMap",a(Mc);const Pc={[ra.Line]:"right",[ra.Handle]:"bottom-right"};a(function({nodeId:t,position:n,variant:o=ra.Handle,className:r,style:i,children:a,color:l,minWidth:c=10,minHeight:u=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:m,autoScale:y=!0,shouldResize:v,onResizeStart:b,onResize:w,onResizeEnd:x}){const _=Ys(),E="string"==typeof t?t:_,k=Va(),S=h(null),O=o===ra.Handle,N=ja(s((C=O&&y,e=>C?`${Math.max(1/e.transform[2],1)}`:void 0),[O,y]),Da);var C;const M=h(null),P=n??Pc[o];f(()=>{if(S.current&&E)return M.current||(M.current=fa({domNode:S.current,nodeId:E,getStoreItems:()=>{const{nodeLookup:e,transform:t,snapGrid:n,snapToGrid:o,nodeOrigin:r,domNode:i}=k.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}=k.getState(),a=[],s={x:e.x,y:e.y},l=o.get(E);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=Ri([{id:l.id,parentId:l.parentId,rect:{width:n,height:c,...oi({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:E,type:"position",position:{...s}};a.push(e)}if(void 0!==e.width&&void 0!==e.height){const t={id:E,type:"dimensions",resizing:!0,setAttributes:!m||("horizontal"===m?"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:E,type:"dimensions",resizing:!1,dimensions:{width:e,height:t}};k.getState().triggerNodeChanges([n])}})),M.current.update({controlPosition:P,boundaries:{minWidth:c,minHeight:u,maxWidth:d,maxHeight:p},keepAspectRatio:g,resizeDirection:m,onResizeStart:b,onResize:w,onResizeEnd:x,shouldResize:v}),()=>{M.current?.destroy()}},[P,c,u,d,p,g,b,w,x,v]);const I=P.split("-");return e("div",{className:le(["react-flow__resize-control","nodrag",...I,o,r]),ref:S,style:{...i,scale:N,...l&&{[O?"backgroundColor":"borderColor"]:l}},children:a})});var Ic,Tc,zc,Dc,Ac,Lc,Rc,jc,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,Nu,Cu,Mu,Pu,Iu,Tu,zu,Du,Au,Lu,Ru,ju,Vu,Bu,$u,Hu,Fu,Yu,Zu,Xu,qu,Wu,Gu,Ku,Uu,Qu,Ju,ed,td,nd,od,rd,id,ad,sd,ld,cd,ud,dd,fd,hd,pd,gd,md;function yd(){if(Tc)return Ic;Tc=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 Ic=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))}},Ic}function vd(){return Lc?Ac:(Lc=1,Ac={Graph:yd(),version:Dc?zc:(Dc=1,zc="2.2.4")})}function bd(){if(jc)return Rc;jc=1;var e=yd();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 Rc={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 wd(){if(Bc)return Vc;return Bc=1,Vc=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},Vc}function xd(){if(Hc)return $c;Hc=1;return $c=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}},$c}function _d(){if(Yc)return Fc;Yc=1;var e=xd();Fc=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 Fc}function Ed(){if(Xc)return Zc;Xc=1;var e=_d();return Zc=function(t,n,o){return t.nodes().reduce(function(r,i){return r[i]=e(t,i,n,o),r},{})},Zc}function kd(){if(Wc)return qc;return Wc=1,qc=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},qc}function Sd(){if(Kc)return Gc;Kc=1;var e=kd();return Gc=function(t){return e(t).filter(function(e){return e.length>1||1===e.length&&t.hasEdge(e[0],e[0])})}}function Od(){if(Qc)return Uc;Qc=1,Uc=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 Uc}function Nd(){if(eu)return Jc;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}eu=1;class t extends Error{constructor(){super(...arguments)}}return Jc=e,e.CycleException=t,Jc}function Cd(){if(nu)return tu;nu=1;var e=Nd();return tu=function(t){try{e(t)}catch(t){if(t instanceof e.CycleException)return!1;throw t}return!0}}function Md(){if(ru)return ou;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 ru=1,ou=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},ou}function Pd(){if(au)return iu;au=1;var e=Md();return iu=function(t,n){return e(t,n,"post")}}function Id(){if(lu)return su;lu=1;var e=Md();return su=function(t,n){return e(t,n,"pre")}}function Td(){if(uu)return cu;uu=1;var e=yd(),t=xd();return cu=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},cu}function zd(){if(pu)return hu;pu=1;var e=vd();return hu={Graph:e.Graph,json:bd(),alg:fu?du:(fu=1,du={components:wd(),dijkstra:_d(),dijkstraAll:Ed(),findCycles:Sd(),floydWarshall:Od(),isAcyclic:Cd(),postorder:Pd(),preorder:Id(),prim:Td(),tarjan:kd(),topsort:Nd()}),version:e.version}}function Dd(){if(vu)return yu;vu=1;let e=zd().Graph,t=function(){if(mu)return gu;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 mu=1,gu=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(", ")+"]"}}}();yu=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 yu}function Ad(){if(wu)return bu;wu=1;let e=zd().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}bu={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 bu}function Ld(){if(_u)return xu;_u=1;let e=Dd(),t=Ad().uniqueId;return xu={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)}})}},xu}function Rd(){if(ku)return Eu;ku=1;let e=Ad();return Eu={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)})}},Eu}function jd(){if(Ou)return Su;Ou=1;const{applyWithChunking:e}=Ad();return Su={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}},Su}function Vd(){if(Cu)return Nu;Cu=1;var e=zd().Graph,t=jd().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 Nu=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},Nu}function Bd(){if(Pu)return Mu;Pu=1;var e=Vd(),t=jd().slack,n=jd().longestPath,o=zd().alg.preorder,r=zd().alg.postorder,i=Ad().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 Mu=a,a.initLowLimValues=c,a.initCutValues=s,a.calcCutValue=l,a.leaveEdge=d,a.enterEdge=f,a.exchangeEdges=h,Mu}function $d(){if(Tu)return Iu;Tu=1;var e=jd().longestPath,t=Vd(),n=Bd();Iu=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 Iu}function Hd(){if(Du)return zu;return Du=1,zu=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]}})},zu}function Fd(){if(Lu)return Au;Lu=1;let e=Ad();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 Au={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)})}},Au}function Yd(){if(Bu)return Vu;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 Bu=1,Vu={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))}},Vu}function Zd(){if(Wu)return qu;Wu=1;let e=Ad();return qu=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 Xd(){if(Qu)return Uu;Qu=1;let e=(Xu||(Xu=1,Zu=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}})}),Zu),t=Zd(),n=function(){if(Ku)return Gu;Ku=1;let e=Ad();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 Gu=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 Uu=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},Uu}function qd(){if(ed)return Ju;ed=1;let e=zd().Graph,t=Ad();return Ju=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},Ju}function Wd(){if(rd)return od;rd=1;let e=function(){if(Hu)return $u;Hu=1;let e=Ad();return $u=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},$u}(),t=function(){if(Yu)return Fu;Yu=1;let e=Ad().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 Fu=function(e,n){let o=0;for(let r=1;r<n.length;++r)o+=t(e,n[r-1],n[r]);return o},Fu}(),n=Xd(),o=qd(),r=(nd||(nd=1,td=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}})}),td),i=zd().Graph,a=Ad();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 od=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)},od}function Gd(){if(ad)return id;ad=1;let e=zd().Graph,t=Ad();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 id={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 Kd(){if(ld)return sd;ld=1;let e=Ad(),t=Gd().positionX;return sd=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)},sd}function Ud(){if(ud)return cd;ud=1;let e=Ld(),t=Rd(),n=$d(),o=Ad().normalizeRanks,r=Hd(),i=Ad().removeEmptyRanks,a=Fd(),s=function(){if(ju)return Ru;ju=1;let e=Ad();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 Ru=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)}})},Ru}(),l=Yd(),c=Wd(),u=Kd(),d=Ad(),f=zd().Graph;cd=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 cd}function Qd(){if(fd)return dd;fd=1;let e=Ad(),t=zd().Graph;return dd={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}},dd}v("/* 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 Jd=b(md?gd:(md=1,gd={graphlib:zd(),layout:Ud(),debug:Qd(),util:{time:Ad().time,notime:Ad().notime},version:pd?hd:(pd=1,hd="1.1.5")})),ef={type:xr.ArrowClosed,width:20,height:20,color:"#FF0072"},tf={strokeWidth:2,stroke:"#FF0072"},nf=function(t){var n=t.tree,o=Cs().fitView,i=function(e){const[t,n]=r(e),o=s(e=>n(t=>gs(e,t)),[]);return[t,n,o]}([]),a=ie(i,3),l=a[0],c=a[1],u=a[2],d=function(e){const[t,n]=r(e),o=s(e=>n(t=>ms(e,t)),[]);return[t,n,o]}([]),h=ie(d,3),p=h[0],g=h[1],m=h[2];return f(function(){if(n){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:ef,style:tf};n.push(l)}o.push(a)})}),{nodes:o,edges:n}}(n.data,null!==(e=n.animated)&&void 0!==e&&e),r=function(e,t,n){var o=(new Jd.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,re(re({},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}))}),Jd.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 re(re({},e),{},{position:{x:s,y:l}})}),edges:t}}(t.nodes,t.edges,{direction:n.orientation});c(ae(r.nodes)),g(ae(r.edges)),o()}},[n]),e(ac,{nodes:l,edges:p,onNodesChange:u,onEdgesChange:m,colorMode:"dark",fitView:!0,children:e(xc,{})})},of=function(t){var n=t.treeInfo,o=ie(r(),2),i=o[0],a=o[1];return f(function(){a(n)},[n]),e(nc,{children:e(nf,{tree:i})})};v(".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 rf=["color","size","title","className"];function af(){return af=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},af.apply(null,arguments)}var sf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,rf);return o.createElement("svg",af({ref:t,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?o.createElement("title",null,l):null,o.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"}))});sf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var lf=["color","size","title","className"];function cf(){return cf=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},cf.apply(null,arguments)}var uf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,lf);return o.createElement("svg",cf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});uf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var df=["color","size","title","className"];function ff(){return ff=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},ff.apply(null,arguments)}var hf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,df);return o.createElement("svg",ff({ref:t,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?o.createElement("title",null,l):null,o.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"}))});hf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var pf=["color","size","title","className"];function gf(){return gf=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},gf.apply(null,arguments)}var mf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,pf);return o.createElement("svg",gf({ref:t,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?o.createElement("title",null,l):null,o.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"}),o.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"}))});mf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var yf=["color","size","title","className"];function vf(){return vf=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},vf.apply(null,arguments)}var bf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,yf);return o.createElement("svg",vf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});bf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var wf=["color","size","title","className"];function xf(){return xf=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},xf.apply(null,arguments)}var _f=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,wf);return o.createElement("svg",xf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});_f.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var Ef=["color","size","title","className"];function kf(){return kf=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},kf.apply(null,arguments)}var Sf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",kf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});Sf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var Of=["color","size","title","className"];function Nf(){return Nf=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},Nf.apply(null,arguments)}var Cf=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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 o.createElement("svg",Nf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});Cf.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};var Mf=["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 If=c(function(e,t){var n=e.color,r=void 0===n?"currentColor":n,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,Mf);return o.createElement("svg",Pf({ref:t,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?o.createElement("title",null,l):null,o.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"}))});If.propTypes={color:W.string,size:W.oneOfType([W.string,W.number]),title:W.string,className:W.string};v('.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 Tf=function(n){var o=n.id,r=n.parentId,i=n.node,a=m({id:o,data:{type:"FileTreeNode",parentId:r,node:i,preview:e(zf,{node:i})}}),l=a.attributes,c=a.listeners,u=a.setNodeRef;a.transform;var d=$f().selectNode,f=s(function(){d(i)},[d]);return t("div",re(re(re({className:"file-node-row",ref:u},c),l),{},{style:function(){var e={};return i.selected&&(e.backgroundColor="#00426b"),e}(),onClick:f,children:[e("div",{className:"indent",style:{width:20*i.level+"px"}}),"folder"===i.type?e("span",{className:"folder-icon",children:i.collapsed?e(hf,{}):e(uf,{})}):e("span",{className:"file-icon",children:function(){switch(i.name.split(".").pop()){case"js":return e(_f,{color:"#f1e05a"});case"json":return e(sf,{color:"#fffb00"});case"scss":return e(Cf,{color:"#f12727"});case"py":return e(Sf,{color:"#686affbd"});default:return e(mf,{color:"#ffffff"})}}()}),e("span",{className:"file-name",children:i.name})]}))},zf=function(t){var n=t.node;return e("div",{className:"file-node-row",children:e("span",{className:"file-name",children:n.name})})};v("");var Df=function(t){ne(t);var o=ie(r([]),2),i=o[0],a=o[1],s=$f().state;f(function(){var e;l(null!==(e=s.collapsedTree)&&void 0!==e?e:[])},[s.collapsedTree]);var l=function(t,n){var o=[];t.forEach(function(t){o.push(e(Tf,{parentId:n,node:t,id:"tree-node-"+t.uid},n+"-"+t.uid))}),a(o)};return e(n,{children:i})},Af=i(),Lf=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(Lf(r.children,t+1)))}return n},Rf=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},jf={uid:crypto.randomUUID(),tree:{},flattenedTree:[],selectedNode:null,collapsedTree:[]},Vf=function(e,t){switch(t.type){case"ADD_FILE_TREE":var n=function(e){return e.forEach(function(e){e.collapsed=!1}),e}(Lf(ae(t.payload))),o=Rf(n);return re(re({},e),{},{tree:t.payload,flattenedTree:n,collapsedTree:o});case"SELECT_NODE":var r=e.flattenedTree.map(function(e){return e.uid===t.payload.uid?re(re({},e),{},{selected:!0,collapsed:!e.collapsed}):re(re({},e),{},{selected:!1})});return re(re({},e),{},{flattenedTree:r,collapsedTree:Rf(r),selectedNode:t.payload});case"RESET_STATE":return jf;default:return e}},Bf=c(function(t,n){var o=t.onSelectFile,r=ie(p(Vf,jf),2),i=r[0],a=r[1],c=s(function(e){a({type:"RESET_STATE"}),a({type:"ADD_FILE_TREE",payload:e})},[]);f(function(){i.selectedNode&&"file"===i.selectedNode.type&&o(i.selectedNode)},[i.selectedNode]);var u=s(function(e){a({type:"SELECT_NODE",payload:e})},[]),d=l(function(){return{state:i,addFileTree:c,selectNode:u}},[i,c,u]);return g(n,function(){return d},[d]),e(Af.Provider,{value:d,children:e("div",{className:"file-browser",children:e(Df,{})})})});function $f(){var e=u(Af);if(!e)throw new Error("useFileBrowser must be used inside <FileBrowser>");return e}Bf.displayName="FileBrowser";function Hf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ff(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 Yf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ff(Object(n),!0).forEach(function(t){Hf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ff(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Zf(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 Xf(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 qf(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Wf(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 Gf(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Wf(Object(n),!0).forEach(function(t){qf(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Wf(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Kf(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 Uf(e){return{}.toString.call(e).includes("Object")}function Qf(e){return"function"==typeof e}v('.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 Jf=Kf(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"}),eh={changes:function(e,t){return Uf(t)||Jf("changeType"),Object.keys(t).some(function(t){return!function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(e,t)})&&Jf("changeField"),t},selector:function(e){Qf(e)||Jf("selectorType")},handler:function(e){Qf(e)||Uf(e)||Jf("handlerType"),Uf(e)&&Object.values(e).some(function(e){return!Qf(e)})&&Jf("handlersType")},initial:function(e){var t;e||Jf("initialIsRequired"),Uf(e)||Jf("initialType"),t=e,Object.keys(t).length||Jf("initialContent")}};function th(e,t){return Qf(t)?t(e.current):t}function nh(e,t){return e.current=Gf(Gf({},e.current),t),t}function oh(e,t,n){return Qf(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 rh={create:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};eh.initial(e),eh.handler(t);var n={current:e},o=Kf(oh)(n,t),r=Kf(nh)(n),i=Kf(eh.changes)(e),a=Kf(th)(n);return[function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(e){return e};return eh.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 ih,ah={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 "},sh=(ih=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>=ih.length?ih.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))}})(ah),lh={config:function(e){var t;return e||sh("configIsRequired"),t=e,{}.toString.call(t).includes("Object")||sh("configType"),e.urls?(console.warn(ah.deprecation),{paths:{vs:e.urls.monacoBase}}):e}};function ch(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],ch(e[n],t[n]))}),Yf(Yf({},e),t)}var uh={type:"cancelation",msg:"operation is manually canceled"};function dh(e){var t=!1,n=new Promise(function(n,o){e.then(function(e){return t?o(uh):n(e)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var fh,hh,ph=rh.create({config:{paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.52.2/min/vs"}},isInitialized:!1,resolve:null,reject:null,monaco:null}),gh=(hh=2,function(e){if(Array.isArray(e))return e}(fh=ph)||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}}(fh,hh)||function(e,t){if(e){if("string"==typeof e)return Xf(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)?Xf(e,t):void 0}}(fh,hh)||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.")}()),mh=gh[0],yh=gh[1];function vh(e){return document.body.appendChild(e)}function bh(e){var t,n,o=mh(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 wh(){var e=mh(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){xh(t),e.resolve(t)},function(t){e.reject(t)})}function xh(e){mh().monaco||yh({monaco:e})}var _h=new Promise(function(e,t){return yh({resolve:e,reject:t})}),Eh={config:function(e){var t=lh.config(e),n=t.monaco,o=Zf(t,["monaco"]);yh(function(e){return{config:ch(e.config,o),monaco:n}})},init:function(){var e=mh(function(e){return{monaco:e.monaco,isInitialized:e.isInitialized,resolve:e.resolve}});if(!e.isInitialized){if(yh({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),dh(_h);if(window.monaco&&window.monaco.editor)return xh(window.monaco),e.resolve(window.monaco),dh(_h);!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)}}(vh,bh)(wh)}return dh(_h)},__getMonacoInstance:function(){return mh(function(e){return e.monaco})}},kh={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Sh={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}};var Oh=function({children:e}){return o.createElement("div",{style:Sh.container},e)};var Nh=a(function({width:e,height:t,isEditorReady:n,loading:r,_ref:i,className:a,wrapperProps:s}){return o.createElement("section",{style:{...kh.wrapper,width:e,height:t},...s},!n&&o.createElement(Oh,null,r),o.createElement("div",{ref:i,style:{...kh.fullWidth,...!n&&kh.hide},className:a}))});var Ch=function(e){f(e,[])};var Mh=function(e,t,n=!0){let o=h(!0);f(o.current||!n?()=>{o.current=!1}:e,t)};function Ph(){}function Ih(e,t,n,o){return function(e,t){return e.editor.getModel(Th(e,t))}(e,o)||function(e,t,n,o){return e.editor.createModel(t,n,o?Th(e,o):void 0)}(e,t,n,o)}function Th(e,t){return e.Uri.parse(t)}var zh=function({original:e,modified:t,language:n,originalLanguage:i,modifiedLanguage:a,originalModelPath:l,modifiedModelPath:c,keepCurrentOriginalModel:u=!1,keepCurrentModifiedModel:d=!1,theme:p="light",loading:g="Loading...",options:m={},height:y="100%",width:v="100%",className:b,wrapperProps:w={},beforeMount:x=Ph,onMount:_=Ph}){let[E,k]=r(!1),[S,O]=r(!0),N=h(null),C=h(null),M=h(null),P=h(_),I=h(x),T=h(!1);Ch(()=>{let e=Eh.init();return e.then(e=>(C.current=e)&&O(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>N.current?function(){let e=N.current?.getModel();u||e?.original?.dispose(),d||e?.modified?.dispose(),N.current?.dispose()}():e.cancel()}),Mh(()=>{if(N.current&&C.current){let t=N.current.getOriginalEditor(),o=Ih(C.current,e||"",i||n||"text",l||"");o!==t.getModel()&&t.setModel(o)}},[l],E),Mh(()=>{if(N.current&&C.current){let e=N.current.getModifiedEditor(),o=Ih(C.current,t||"",a||n||"text",c||"");o!==e.getModel()&&e.setModel(o)}},[c],E),Mh(()=>{let e=N.current.getModifiedEditor();e.getOption(C.current.editor.EditorOption.readOnly)?e.setValue(t||""):t!==e.getValue()&&(e.executeEdits("",[{range:e.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),e.pushUndoStop())},[t],E),Mh(()=>{N.current?.getModel()?.original.setValue(e||"")},[e],E),Mh(()=>{let{original:e,modified:t}=N.current.getModel();C.current.editor.setModelLanguage(e,i||n||"text"),C.current.editor.setModelLanguage(t,a||n||"text")},[n,i,a],E),Mh(()=>{C.current?.editor.setTheme(p)},[p],E),Mh(()=>{N.current?.updateOptions(m)},[m],E);let z=s(()=>{if(!C.current)return;I.current(C.current);let o=Ih(C.current,e||"",i||n||"text",l||""),r=Ih(C.current,t||"",a||n||"text",c||"");N.current?.setModel({original:o,modified:r})},[n,t,a,e,i,l,c]),D=s(()=>{!T.current&&M.current&&(N.current=C.current.editor.createDiffEditor(M.current,{automaticLayout:!0,...m}),z(),C.current?.editor.setTheme(p),k(!0),T.current=!0)},[m,p,z]);return f(()=>{E&&P.current(N.current,C.current)},[E]),f(()=>{!S&&!E&&D()},[S,E,D]),o.createElement(Nh,{width:v,height:y,isEditorReady:E,loading:g,_ref:M,className:b,wrapperProps:w})};a(zh);var Dh=function(e){let t=h();return f(()=>{t.current=e},[e]),t.current},Ah=new Map;var Lh=function({defaultValue:e,defaultLanguage:t,defaultPath:n,value:i,language:a,path:l,theme:c="light",line:u,loading:d="Loading...",options:p={},overrideServices:g={},saveViewState:m=!0,keepCurrentModel:y=!1,width:v="100%",height:b="100%",className:w,wrapperProps:x={},beforeMount:_=Ph,onMount:E=Ph,onChange:k,onValidate:S=Ph}){let[O,N]=r(!1),[C,M]=r(!0),P=h(null),I=h(null),T=h(null),z=h(E),D=h(_),A=h(),L=h(i),R=Dh(l),j=h(!1),V=h(!1);Ch(()=>{let e=Eh.init();return e.then(e=>(P.current=e)&&M(!1)).catch(e=>"cancelation"!==e?.type&&console.error("Monaco initialization: error:",e)),()=>I.current?(A.current?.dispose(),y?m&&Ah.set(l,I.current.saveViewState()):I.current.getModel()?.dispose(),void I.current.dispose()):e.cancel()}),Mh(()=>{let o=Ih(P.current,e||i||"",t||a||"",l||n||"");o!==I.current?.getModel()&&(m&&Ah.set(R,I.current?.saveViewState()),I.current?.setModel(o),m&&I.current?.restoreViewState(Ah.get(l)))},[l],O),Mh(()=>{I.current?.updateOptions(p)},[p],O),Mh(()=>{!I.current||void 0===i||(I.current.getOption(P.current.editor.EditorOption.readOnly)?I.current.setValue(i):i!==I.current.getValue()&&(V.current=!0,I.current.executeEdits("",[{range:I.current.getModel().getFullModelRange(),text:i,forceMoveMarkers:!0}]),I.current.pushUndoStop(),V.current=!1))},[i],O),Mh(()=>{let e=I.current?.getModel();e&&a&&P.current?.editor.setModelLanguage(e,a)},[a],O),Mh(()=>{void 0!==u&&I.current?.revealLine(u)},[u],O),Mh(()=>{P.current?.editor.setTheme(c)},[c],O);let B=s(()=>{if(T.current&&P.current&&!j.current){D.current(P.current);let o=l||n,r=Ih(P.current,i||e||"",t||a||"",o||"");I.current=P.current?.editor.create(T.current,{model:r,automaticLayout:!0,...p},g),m&&I.current.restoreViewState(Ah.get(o)),P.current.editor.setTheme(c),void 0!==u&&I.current.revealLine(u),N(!0),j.current=!0}},[e,t,n,i,a,l,p,g,m,c,u]);return f(()=>{O&&z.current(I.current,P.current)},[O]),f(()=>{!C&&!O&&B()},[C,O,B]),L.current=i,f(()=>{O&&k&&(A.current?.dispose(),A.current=I.current?.onDidChangeModelContent(e=>{V.current||k(I.current.getValue(),e)}))},[O,k]),f(()=>{if(O){let e=P.current.editor.onDidChangeMarkers(e=>{let t=I.current.getModel()?.uri;if(t&&e.find(e=>e.path===t.path)){let e=P.current.editor.getModelMarkers({resource:t});S?.(e)}});return()=>{e?.dispose()}}return()=>{}},[O,S]),o.createElement(Nh,{width:v,height:b,isEditorReady:O,loading:d,_ref:T,className:w,wrapperProps:x})},Rh=a(Lh);v(".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 jh=function(t){ne(t);var n=Gh().state,o=ie(r("Loading content..."),2),i=o[0],a=o[1],s=ie(r(!1),2),l=s[0],c=s[1],u=h(null),d=h(),p=h(null),g=h(0);f(function(){n.activeTab?(a(n.activeTab.content),c(!0)):c(!1)},[n.activeTab]),f(function(){d.current=i,null!=u&&u.current&&void 0!==d.current&&null!==d.current&&u.current.setValue(d.current)},[i]);var m=function(e,t){u.current=e,null!=d&&d.current&&u.current.setValue(d.current),u.current.layout()},y={fontSize:"13px",minimap:{enabled:!1},padding:{top:10},renderWhitespace:"none",wordWrap:"on",scrollBeyondLastLine:!1,readOnly:!0,automaticLayout:!1};f(function(){if(p.current){var e=new ResizeObserver(function(){cancelAnimationFrame(g.current),g.current=requestAnimationFrame(function(){var e;null===(e=u.current)||void 0===e||e.layout()})});return e.observe(p.current),function(){cancelAnimationFrame(g.current),e.disconnect()}}},[]);return e("div",{className:"editor-container",ref:p,children:l?e(Rh,{defaultLanguage:"python",defaultValue:i,onMount:m,theme:"vs-dark",options:y}):e("div",{className:"no-tab",children:"Select file or drag and drop to view."})})};jh.propTypes={editorContent:W.string};v(".gutter {\n min-width: 2px;\n height: 35px;\n width: 2px;\n}");var Vh=function(t){var n=t.id,o=t.index,r=t.parentId,i=y({id:n,data:{type:"EditorTabGutter",parentId:r,index:o}}),a=i.setNodeRef,s=i.isOver;return e("div",{className:"gutter",ref:a,style:{backgroundColor:s?"#FFFFFF":"#222425"}})};Vh.propTypes={id:W.string.isRequired,parentId:W.string.isRequired,index:W.number.isRequired};v(".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 Bh="#1e1e1e",$h="#FFFFFF",Hh=function(n){var o=n.id,i=n.parentId,a=n.node,s=ie(r(),2),l=s[0],c=s[1],u=Gh(),d=u.selectTab,h=u.closeTab,p=u.state,g=m({id:o,data:{type:"EditorTab",parentId:i,node:a,preview:e(Fh,{node:a})}}),y=g.attributes,v=g.listeners,b=g.setNodeRef;g.transform,f(function(){w(p.activeTab&&p.activeTab.uid===a.uid)},[p.activeTab]);var w=function(e){c({backgroundColor:e?Bh:"#2d2d2d",color:e?$h:"#969690"})};return e("div",re(re(re({ref:b,style:l,id:o,onMouseDown:function(e){e.stopPropagation(),1===e.button?h(a.uid):d(a.uid)},className:"tab"},v),y),{},{children:t("div",{className:"tab-content",children:[e("div",{className:"icon",children:e(bf,{size:14,style:{pointerEvents:"none"}})}),e("div",{className:"tab-name",children:e("span",{children:a.name})}),e("div",{className:"close-icon",onMouseDown:function(e){e.stopPropagation(),h(a.uid)},children:e(If,{size:18})})]})}))};Hh.propTypes={id:W.string.isRequired,parentId:W.string.isRequired,node:W.shape({name:W.string.isRequired}).isRequired};var Fh=function(n){var o=n.node;return e("div",{className:"tab",style:{backgroundColor:Bh,color:$h,opacity:.5},children:t("div",{className:"tab-content",children:[e("div",{className:"icon",children:e(bf,{size:14,style:{pointerEvents:"none"}})}),e("div",{className:"tab-name",children:e("span",{children:o.name})}),e("div",{className:"close-icon",children:e(If,{size:18})})]})})};v(".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 Yh=function(){var t=Gh().state,n=ie(r(),2),o=n[0],i=n[1];f(function(){var e;(null===(e=t.tabs)||void 0===e?void 0:e.length)>=0&&null!=t.parentTabGroupId&&a(t.tabs,t.parentTabGroupId)},[t.tabs,t.parentTabGroupId]);var a=function(t,n){var o=[];t.forEach(function(t,r){o.push(e(Vh,{id:n+"-"+r,index:r,parentId:n},t.uid+"-gutter")),o.push(e(Hh,{id:n+"-"+t.uid,parentId:n,node:t},t.uid))}),o.push(e(Vh,{id:n+"-"+t.length,index:t.length,parentId:n},"last-gutter")),i(o)};return e("div",{className:"tabs-container",style:{background:"#222425"},children:o})},Zh=i(),Xh={uid:crypto.randomUUID(),tabs:[],activeTab:null,parentTabGroupId:null},qh=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")),re(re({},e),{},{activeTab:i});var a=ae(e.tabs);return void 0!==r&&r<e.tabs.length?a.splice(r,0,o):a.push(o),re(re({},e),{},{tabs:a,activeTab:o});case"SET_PARENT_TAB_GROUP_ID":return re(re({},e),{},{parentTabGroupId:t.payload});case"SELECT_TAB":var s=e.tabs.find(function(e){return e.uid===t.payload});return s?re(re({},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=ae(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),re(re({},e),{},{tabs:c,activeTab:u});case"MOVE_TAB":var f=ae(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=ie(f.splice(m,1),1)[0],v=m<g?g-1:g;return f.splice(v,0,y),re(re({},e),{},{tabs:f});case"RESET_STATE":return Xh;default:return e}},Wh=c(function(n,o){ne(n);var r=ie(p(qh,Xh),2),i=r[0],a=r[1],c=s(function(e){a({type:"SELECT_TAB",payload:e})},[]),u=s(function(e){a({type:"CLOSE_TAB",payload:e})},[]),d=s(function(e,t){a({type:"MOVE_TAB",payload:{tabId:e,newIndex:t}})},[]),f=s(function(e,t){a({type:"ADD_TAB",payload:{tab:e,index:t}})},[]),h=s(function(e){a({type:"RESET_STATE"}),a({type:"SET_PARENT_TAB_GROUP_ID",payload:e})},[]),m=l(function(){return{state:i,addTab:f,setTabGroupId:h,selectTab:c,closeTab:u,moveTab:d}},[i,f,c,u,d,h]);return g(o,function(){return m},[m]),e(Zh.Provider,{value:m,children:t("div",{className:"editorContainer",children:[e("div",{className:"tabContainer",children:e(Yh,{})}),e("div",{className:"monacoContainer",children:e(jh,{})})]})})});function Gh(){var e=u(Zh);if(!e)throw new Error("useEditor must be used inside <Editor>");return e}Wh.displayName="Editor";var Kh={bezier:Ml},Uh=function(n){var o=n.activeTool,i=n.onBehaviorSelect,a=n.onAddBehavior,l=n.onAddEdge,c=n.initialElements,u=Cs().screenToFlowPosition,d=ie(r([]),2),h=d[0],p=d[1],g=ie(r([]),2),m=g[0],y=g[1],v=ie(r(null),2),b=v[0],w=v[1];f(function(){if(c){var e=function(e,t,n){var o=(new Jd.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,re(re({},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}))}),Jd.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 re(re({},e),{},{position:{x:s,y:l}})}),edges:t}}(c.nodes,c.edges,{direction:"TB"});p(ae(e.nodes)),y(ae(e.edges))}},[c]);var x=s(function(e){p(function(t){return gs(e,t)})},[]),_=s(function(e){y(function(t){return ms(e,t)})},[]);f(function(){console.log("Active Tool:",o)},[o]);var E=s(function(e){var t=u({x:e.clientX,y:e.clientY});"drop"===o&&w({id:"ghost",position:{x:t.x-75,y:t.y-20},data:{label:"Behavior"},draggable:!1,selectable:!1,style:{opacity:.5,pointerEvents:"none",width:150,height:40}})},[o]),k=s(function(){w(null)},[]),S=s(function(e,t){if("drop"===o){if(!b)return;p(function(e){return[].concat(ae(e),[re(re({},b),{},{draggable:!0,selectable:!0,id:crypto.randomUUID(),style:{}})])}),a(b),w(null)}},[b,o,a]),O=s(function(e,t){"delete"===o&&(p(function(e){return e.filter(function(e){return e.id!==t.id})}),y(function(e){return e.filter(function(e){return e.source!==t.id&&e.target!==t.id})}))},[o,i]),N=s(function(e,t){"delete"===o&&y(function(e){return e.filter(function(e){return e.id!==t.id})})},[o]),C=s(function(e){e.nodes.length>0&&i(e.nodes[0])},[i]),M=s(function(e){var t=re(re({},e),{},{id:crypto.randomUUID(),type:"smoothstep",animated:!0});y(function(e){return[].concat(ae(e),[t])}),l(t)},[o,l]);return t(ac,{nodes:b?[].concat(ae(h),[b]):h,edges:m,onPaneMouseMove:E,onPaneMouseLeave:k,onPaneClick:S,onConnect:M,onNodesChange:x,onEdgesChange:_,onNodeClick:O,onEdgeClick:N,colorMode:"dark",edgeTypes:Kh,onSelectionChange:C,fitView:!0,children:[e(fc,{}),e(xc,{})]})},Qh=function(t){var n=t.activeTool,o=t.onBehaviorSelect,i=t.onAddBehavior,a=t.onAddEdge,s=t.design,l=ie(r(null),2),c=l[0],u=l[1];return f(function(){s&&u(function(e){var t=[],n=[];return e.nodes.forEach(function(e){n.push({id:e.behavior.uid,type:"default",data:{label:e.behavior.name},position:{x:10,y:10}}),e.goToBehaviors.forEach(function(n){t.push({id:"".concat(e.behavior.uid,"->").concat(n.uid),type:"bezier",source:e.behavior.uid,target:n.uid,animated:!0})})}),{nodes:n,edges:t}}(s))},[s]),e(nc,{children:e(Uh,{initialElements:c,activeTool:n,onBehaviorSelect:o,onAddBehavior:i,onAddEdge:a})})};export{Qh as BehavioralGraphBuilder,Wh as Editor,Bf as FileBrowser,of as FlowDiagram,J as StackList,Gh as useEditor,$f as useFileBrowser};
|
|
42
42
|
//# sourceMappingURL=index.js.map
|