dot-studio 0.0.1 → 0.0.3
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/README.md +20 -200
- package/client/assets/ActFrame-BYOBkLYW.js +1 -0
- package/client/assets/ActFrame-C_WEt6bv.css +1 -0
- package/client/assets/ActInspectorPanel-C3VlS7tB.js +1 -0
- package/client/assets/ActInspectorPanel-CE6s6GYv.css +1 -0
- package/client/assets/AssistantChat-BOyW0K79.js +1 -0
- package/client/assets/AssistantChat-DoVmHvMJ.css +1 -0
- package/client/assets/CanvasTerminalFrame-BC-79q9U.css +1 -0
- package/client/assets/CanvasTerminalFrame-DxKbexK6.js +4 -0
- package/client/assets/CanvasTrackingFrame-DumxhNwg.js +1 -0
- package/client/assets/CanvasTrackingFrame-G4rRrfne.css +1 -0
- package/client/assets/CanvasWindowFrame-ziJeVfHG.js +1 -0
- package/client/assets/DanceBundleEditorFrame-CH8VDUMK.js +1 -0
- package/client/assets/DanceBundleEditorFrame-DaLqMflT.css +1 -0
- package/client/assets/MarkdownEditorFrame-DVecIZpZ.css +1 -0
- package/client/assets/MarkdownEditorFrame-Dwpgs2GX.js +2 -0
- package/client/assets/MarkdownRenderer-Cz8A4AgP.js +1 -0
- package/client/assets/PublishModal-DUlHz0fT.js +1 -0
- package/client/assets/TodoDock-DcVf7zQG.js +1 -0
- package/client/assets/WorkspaceToolbar-CXYi_sMD.js +2 -0
- package/client/assets/WorkspaceToolbar-CiQvVocC.css +1 -0
- package/client/assets/chat-message-visibility-YwJ-AQno.js +11 -0
- package/client/assets/dnd-vendor-CIAZE2P2.js +5 -0
- package/client/assets/flow-vendor-BZV40eAE.css +1 -0
- package/client/assets/flow-vendor-C868rU-6.js +23 -0
- package/client/assets/icon-vendor-I2JVIi1s.js +501 -0
- package/client/assets/index-BMY4hrBP.js +3 -0
- package/client/assets/index-C-vnj9y3.js +1 -0
- package/client/assets/index-C9HTqfZw.css +1 -0
- package/client/assets/index-CWrv6O3o.js +64 -0
- package/client/assets/index-DMS12-Q2.js +8 -0
- package/client/assets/index-Dn7t_Y7G.js +1 -0
- package/client/assets/index-p-wk7iGH.css +1 -0
- package/client/assets/markdown-vendor-BSTcku12.css +10 -0
- package/client/assets/markdown-vendor-DnTJ9hmR.js +35 -0
- package/client/assets/participant-labels-Cf3qP3GB.js +1 -0
- package/client/assets/queries-Dm1jEHfc.js +1 -0
- package/client/assets/query-vendor-_taqgrbn.js +1 -0
- package/client/assets/react-vendor-DzpMUNDT.js +49 -0
- package/client/assets/settings-utils-l7KCS3Ev.js +1 -0
- package/client/assets/terminal-vendor-6GBZ9nXN.css +32 -0
- package/client/assets/terminal-vendor-D0xRnmbI.js +112 -0
- package/client/index.html +13 -3
- package/dist/cli.js +25 -3
- package/dist/server/app.js +72 -0
- package/dist/server/index.js +2 -62
- package/dist/server/lib/act-session-policy.js +31 -0
- package/dist/server/lib/chat-session.js +101 -0
- package/dist/server/lib/config.js +18 -4
- package/dist/server/lib/dot-authoring.js +171 -102
- package/dist/server/lib/dot-loader.js +9 -8
- package/dist/server/lib/dot-login.js +8 -190
- package/dist/server/lib/dot-source.js +11 -0
- package/dist/server/lib/model-catalog.js +74 -15
- package/dist/server/lib/opencode-auth.js +4 -1
- package/dist/server/lib/opencode-errors.js +70 -38
- package/dist/server/lib/opencode-sidecar.js +5 -2
- package/dist/server/lib/project-config.js +8 -0
- package/dist/server/lib/runtime-tools.js +46 -8
- package/dist/server/lib/safe-mode.js +410 -0
- package/dist/server/lib/session-execution.js +81 -0
- package/dist/server/lib/sse.js +22 -0
- package/dist/server/routes/act-runtime-threads.js +156 -0
- package/dist/server/routes/act-runtime-tools.js +157 -0
- package/dist/server/routes/act-runtime.js +7 -0
- package/dist/server/routes/adapter.js +32 -0
- package/dist/server/routes/assets-collection.js +16 -0
- package/dist/server/routes/assets-detail.js +38 -0
- package/dist/server/routes/assets.js +4 -158
- package/dist/server/routes/chat-messages.js +104 -0
- package/dist/server/routes/chat-sessions.js +104 -0
- package/dist/server/routes/chat-stream.js +15 -0
- package/dist/server/routes/chat.js +6 -353
- package/dist/server/routes/compile.js +5 -91
- package/dist/server/routes/dot-assets.js +77 -0
- package/dist/server/routes/dot-core.js +62 -0
- package/dist/server/routes/dot-performer.js +80 -0
- package/dist/server/routes/dot.js +6 -267
- package/dist/server/routes/drafts-collection.js +40 -0
- package/dist/server/routes/drafts-dance-bundle.js +113 -0
- package/dist/server/routes/drafts-item.js +86 -0
- package/dist/server/routes/drafts.js +9 -0
- package/dist/server/routes/health.js +18 -33
- package/dist/server/routes/opencode-core.js +120 -0
- package/dist/server/routes/opencode-file.js +67 -0
- package/dist/server/routes/opencode-mcp.js +74 -0
- package/dist/server/routes/opencode-provider.js +41 -0
- package/dist/server/routes/opencode.js +8 -418
- package/dist/server/routes/route-errors.js +10 -0
- package/dist/server/routes/safe-actions.js +60 -0
- package/dist/server/routes/safe-summary.js +20 -0
- package/dist/server/routes/safe.js +7 -0
- package/dist/server/routes/workspaces.js +47 -0
- package/dist/server/services/act-runtime/act-context-builder.js +81 -0
- package/dist/server/services/act-runtime/act-runtime-service.js +313 -0
- package/dist/server/services/act-runtime/act-runtime-utils.js +10 -0
- package/dist/server/services/act-runtime/act-tool-projection.js +26 -0
- package/dist/server/services/act-runtime/act-tools.js +151 -0
- package/dist/server/services/act-runtime/board-persistence.js +38 -0
- package/dist/server/services/act-runtime/event-logger.js +73 -0
- package/dist/server/services/act-runtime/event-router.js +102 -0
- package/dist/server/services/act-runtime/mailbox.js +149 -0
- package/dist/server/services/act-runtime/safety-guard.js +162 -0
- package/dist/server/services/act-runtime/session-queue.js +114 -0
- package/dist/server/services/act-runtime/thread-manager.js +351 -0
- package/dist/server/services/act-runtime/wake-cascade.js +306 -0
- package/dist/server/services/act-runtime/wake-evaluator.js +43 -0
- package/dist/server/services/act-runtime/wake-performer-resolver.js +68 -0
- package/dist/server/services/act-runtime/wake-prompt-builder.js +77 -0
- package/dist/server/services/adapter-view-service.js +6 -0
- package/dist/server/services/asset-service.js +366 -0
- package/dist/server/services/chat-event-stream-service.js +157 -0
- package/dist/server/services/chat-service.js +207 -0
- package/dist/server/services/chat-session-service.js +203 -0
- package/dist/server/services/compile-service.js +4 -0
- package/dist/server/services/dance-bundle-service.js +222 -0
- package/dist/server/services/dot-add-service.js +59 -0
- package/dist/server/services/dot-service.js +178 -0
- package/dist/server/services/draft-service.js +367 -0
- package/dist/server/services/opencode-projection/dance-compiler.js +164 -0
- package/dist/server/services/opencode-projection/performer-compiler.js +195 -0
- package/dist/server/services/opencode-projection/preview-service.js +31 -0
- package/dist/server/services/opencode-projection/projection-manifest.js +98 -0
- package/dist/server/services/opencode-projection/stage-projection-service.js +188 -0
- package/dist/server/services/opencode-service.js +338 -0
- package/dist/server/services/safe-service.js +33 -0
- package/dist/server/services/studio-assistant/assistant-service.js +172 -0
- package/dist/server/services/studio-service.js +69 -0
- package/dist/server/services/workspace-service.js +224 -0
- package/dist/server/terminal.js +57 -11
- package/dist/shared/act-types.js +4 -0
- package/dist/shared/adapter-view.js +1 -0
- package/dist/shared/asset-contracts.js +1 -0
- package/dist/shared/assistant-actions.js +1 -0
- package/dist/shared/chat-contracts.js +1 -0
- package/dist/shared/dot-contracts.js +1 -0
- package/dist/shared/dot-types.js +4 -0
- package/dist/shared/draft-contracts.js +2 -0
- package/dist/shared/model-types.js +2 -0
- package/dist/shared/performer-mcp-portability.js +10 -0
- package/dist/shared/safe-mode.js +1 -0
- package/dist/shared/session-metadata.js +4 -3
- package/package.json +7 -4
- package/client/assets/index-C2eIILoa.css +0 -41
- package/client/assets/index-DUPZ_Lw5.js +0 -616
- package/dist/server/lib/act-runtime.js +0 -1282
- package/dist/server/lib/prompt.js +0 -222
- package/dist/server/routes/stages.js +0 -137
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import{a as wo,g as ca,R as ua,r as D,j as P,b as la}from"./react-vendor-DzpMUNDT.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,r;n<e.length;n++)(r=ie(e[n]))!==""&&(t+=(t&&" ")+r);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var fa={value:()=>{}};function Zt(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Tt(n)}function Tt(e){this._=e}function da(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Tt.prototype=Zt.prototype={constructor:Tt,on:function(e,t){var n=this._,r=da(e+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(e=r[i]).type)&&(o=ha(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(o=(e=r[i]).type)n[o]=fr(n[o],e.name,t);else if(t==null)for(o in n)n[o]=fr(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Tt(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function ha(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function fr(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=fa,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Nn="http://www.w3.org/1999/xhtml";const dr={svg:"http://www.w3.org/2000/svg",xhtml:Nn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Kt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),dr.hasOwnProperty(t)?{space:dr[t],local:e}:e}function ga(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Nn&&t.documentElement.namespaceURI===Nn?t.createElement(e):t.createElementNS(n,e)}}function pa(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function vo(e){var t=Kt(e);return(t.local?pa:ga)(t)}function ma(){}function Vn(e){return e==null?ma:function(){return this.querySelector(e)}}function ya(e){typeof e!="function"&&(e=Vn(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=new Array(s),c,l,d=0;d<s;++d)(c=i[d])&&(l=e.call(c,c.__data__,d,i))&&("__data__"in c&&(l.__data__=c.__data__),a[d]=l);return new ue(r,this._parents)}function xa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function wa(){return[]}function bo(e){return e==null?wa:function(){return this.querySelectorAll(e)}}function va(e){return function(){return xa(e.apply(this,arguments))}}function ba(e){typeof e=="function"?e=va(e):e=bo(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(r.push(e.call(c,c.__data__,l,s)),o.push(c));return new ue(r,o)}function _o(e){return function(){return this.matches(e)}}function Eo(e){return function(t){return t.matches(e)}}var _a=Array.prototype.find;function Ea(e){return function(){return _a.call(this.children,e)}}function Sa(){return this.firstElementChild}function Na(e){return this.select(e==null?Sa:Ea(typeof e=="function"?e:Eo(e)))}var Ma=Array.prototype.filter;function Ca(){return Array.from(this.children)}function Ia(e){return function(){return Ma.call(this.children,e)}}function Aa(e){return this.selectAll(e==null?Ca:Ia(typeof e=="function"?e:Eo(e)))}function ka(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ue(r,this._parents)}function So(e){return new Array(e.length)}function $a(){return new ue(this._enter||this._groups.map(So),this._parents)}function Rt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Rt.prototype={constructor:Rt,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)}};function Pa(e){return function(){return e}}function Ta(e,t,n,r,o,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],r[s]=a):n[s]=new Rt(e,i[s]);for(;s<c;++s)(a=t[s])&&(o[s]=a)}function za(e,t,n,r,o,i,s){var a,c,l=new Map,d=t.length,u=i.length,f=new Array(d),h;for(a=0;a<d;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?o[a]=c:l.set(h,c));for(a=0;a<u;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(r[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Rt(e,i[a]);for(a=0;a<d;++a)(c=t[a])&&l.get(f[a])===c&&(o[a]=c)}function Da(e){return e.__data__}function La(e,t){if(!arguments.length)return Array.from(this,Da);var n=t?za:Ta,r=this._parents,o=this._groups;typeof e!="function"&&(e=Pa(e));for(var i=o.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var d=r[l],u=o[l],f=u.length,h=Ha(e.call(d,d&&d.__data__,l,r)),g=h.length,y=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(f);n(d,u,y,x,m,h,t);for(var b=0,p=0,w,N;b<g;++b)if(w=y[b]){for(b>=p&&(p=b+1);!(N=x[p])&&++p<g;);w._next=N||null}}return s=new ue(s,r),s._enter=a,s._exit=c,s}function Ha(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ra(){return new ue(this._exit||this._groups.map(So),this._parents)}function Va(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Ba(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),c=0;c<s;++c)for(var l=n[c],d=r[c],u=l.length,f=a[c]=new Array(u),h,g=0;g<u;++g)(h=l[g]||d[g])&&(f[g]=h);for(;c<o;++c)a[c]=n[c];return new ue(a,this._parents)}function Fa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],s;--o>=0;)(s=r[o])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function Oa(e){e||(e=ja);function t(u,f){return u&&f?e(u.__data__,f.__data__):!u-!f}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var s=n[i],a=s.length,c=o[i]=new Array(a),l,d=0;d<a;++d)(l=s[d])&&(c[d]=l);c.sort(t)}return new ue(o,this._parents).order()}function ja(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Xa(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ya(){return Array.from(this)}function Wa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function qa(){let e=0;for(const t of this)++e;return e}function Ga(){return!this.node()}function Ua(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&e.call(a,a.__data__,i,o);return this}function Za(e){return function(){this.removeAttribute(e)}}function Ka(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qa(e,t){return function(){this.setAttribute(e,t)}}function Ja(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ec(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function tc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function nc(e,t){var n=Kt(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Ka:Za:typeof t=="function"?n.local?tc:ec:n.local?Ja:Qa)(n,t))}function No(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rc(e){return function(){this.style.removeProperty(e)}}function oc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ic(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function sc(e,t,n){return arguments.length>1?this.each((t==null?rc:typeof t=="function"?ic:oc)(e,t,n??"")):Ye(this.node(),e)}function Ye(e,t){return e.style.getPropertyValue(t)||No(e).getComputedStyle(e,null).getPropertyValue(t)}function ac(e){return function(){delete this[e]}}function cc(e,t){return function(){this[e]=t}}function uc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function lc(e,t){return arguments.length>1?this.each((t==null?ac:typeof t=="function"?uc:cc)(e,t)):this.node()[e]}function Mo(e){return e.trim().split(/^|\s+/)}function Bn(e){return e.classList||new Co(e)}function Co(e){this._node=e,this._names=Mo(e.getAttribute("class")||"")}Co.prototype={add:function(e){var t=this._names.indexOf(e);t<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}};function Io(e,t){for(var n=Bn(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function Ao(e,t){for(var n=Bn(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function fc(e){return function(){Io(this,e)}}function dc(e){return function(){Ao(this,e)}}function hc(e,t){return function(){(t.apply(this,arguments)?Io:Ao)(this,e)}}function gc(e,t){var n=Mo(e+"");if(arguments.length<2){for(var r=Bn(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?hc:t?fc:dc)(n,t))}function pc(){this.textContent=""}function mc(e){return function(){this.textContent=e}}function yc(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function xc(e){return arguments.length?this.each(e==null?pc:(typeof e=="function"?yc:mc)(e)):this.node().textContent}function wc(){this.innerHTML=""}function vc(e){return function(){this.innerHTML=e}}function bc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function _c(e){return arguments.length?this.each(e==null?wc:(typeof e=="function"?bc:vc)(e)):this.node().innerHTML}function Ec(){this.nextSibling&&this.parentNode.appendChild(this)}function Sc(){return this.each(Ec)}function Nc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Mc(){return this.each(Nc)}function Cc(e){var t=typeof e=="function"?e:vo(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Ic(){return null}function Ac(e,t){var n=typeof e=="function"?e:vo(e),r=t==null?Ic:typeof t=="function"?t:Vn(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function kc(){var e=this.parentNode;e&&e.removeChild(this)}function $c(){return this.each(kc)}function Pc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Tc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function zc(e){return this.select(e?Tc:Pc)}function Dc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Lc(e){return function(t){e.call(this,t,this.__data__)}}function Hc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Rc(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Vc(e,t,n){return function(){var r=this.__on,o,i=Lc(t);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}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 Bc(e,t,n){var r=Hc(e+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,d;c<l;++c)for(o=0,d=a[c];o<i;++o)if((s=r[o]).type===d.type&&s.name===d.name)return d.value}return}for(a=t?Vc:Rc,o=0;o<i;++o)this.each(a(r[o],t,n));return this}function ko(e,t,n){var r=No(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Fc(e,t){return function(){return ko(this,e,t)}}function Oc(e,t){return function(){return ko(this,e,t.apply(this,arguments))}}function jc(e,t){return this.each((typeof t=="function"?Oc:Fc)(e,t))}function*Xc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var $o=[null];function ue(e,t){this._groups=e,this._parents=t}function mt(){return new ue([[document.documentElement]],$o)}function Yc(){return this}ue.prototype=mt.prototype={constructor:ue,select:ya,selectAll:ba,selectChild:Na,selectChildren:Aa,filter:ka,data:La,enter:$a,exit:Ra,join:Va,merge:Ba,selection:Yc,order:Fa,sort:Oa,call:Xa,nodes:Ya,node:Wa,size:qa,empty:Ga,each:Ua,attr:nc,style:sc,property:lc,classed:gc,text:xc,html:_c,raise:Sc,lower:Mc,append:Cc,insert:Ac,remove:$c,clone:zc,datum:Dc,on:Bc,dispatch:jc,[Symbol.iterator]:Xc};function ce(e){return typeof e=="string"?new ue([[document.querySelector(e)]],[document.documentElement]):new ue([[e]],$o)}function Wc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function le(e,t){if(e=Wc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}const qc={passive:!1},at={capture:!0,passive:!1};function dn(e){e.stopImmediatePropagation()}function je(e){e.preventDefault(),e.stopImmediatePropagation()}function Po(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",je,at);"onselectstart"in t?n.on("selectstart.drag",je,at):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function To(e,t){var n=e.document.documentElement,r=ce(e).on("dragstart.drag",null);t&&(r.on("click.drag",je,at),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const St=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:c,dy:l,dispatch:d}){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:r,enumerable:!0,configurable:!0},identifier:{value:o,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:d}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function Gc(e){return!e.ctrlKey&&!e.button}function Uc(){return this.parentNode}function Zc(e,t){return t??{x:e.x,y:e.y}}function Kc(){return navigator.maxTouchPoints||"ontouchstart"in this}function zo(){var e=Gc,t=Uc,n=Zc,r=Kc,o={},i=Zt("start","drag","end"),s=0,a,c,l,d,u=0;function f(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",x).on("touchmove.drag",m,qc).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(d||!e.call(this,w,N))){var _=p(this,t.call(this,w,N),w,N,"mouse");_&&(ce(w.view).on("mousemove.drag",g,at).on("mouseup.drag",y,at),Po(w.view),dn(w),l=!1,a=w.clientX,c=w.clientY,_("start",w))}}function g(w){if(je(w),!l){var N=w.clientX-a,_=w.clientY-c;l=N*N+_*_>u}o.mouse("drag",w)}function y(w){ce(w.view).on("mousemove.drag mouseup.drag",null),To(w.view,l),je(w),o.mouse("end",w)}function x(w,N){if(e.call(this,w,N)){var _=w.changedTouches,M=t.call(this,w,N),T=_.length,z,B;for(z=0;z<T;++z)(B=p(this,M,w,N,_[z].identifier,_[z]))&&(dn(w),B("start",w,_[z]))}}function m(w){var N=w.changedTouches,_=N.length,M,T;for(M=0;M<_;++M)(T=o[N[M].identifier])&&(je(w),T("drag",w,N[M]))}function b(w){var N=w.changedTouches,_=N.length,M,T;for(d&&clearTimeout(d),d=setTimeout(function(){d=null},500),M=0;M<_;++M)(T=o[N[M].identifier])&&(dn(w),T("end",w,N[M]))}function p(w,N,_,M,T,z){var B=i.copy(),I=le(z||_,N),$,V,v;if((v=n.call(w,new Mn("beforestart",{sourceEvent:_,target:f,identifier:T,active:s,x:I[0],y:I[1],dx:0,dy:0,dispatch:B}),M))!=null)return $=v.x-I[0]||0,V=v.y-I[1]||0,function A(E,k,C){var S=I,L;switch(E){case"start":o[T]=A,L=s++;break;case"end":delete o[T],--s;case"drag":I=le(C||k,N),L=s;break}B.call(E,w,new Mn(E,{sourceEvent:k,subject:v,target:f,identifier:T,active:L,x:I[0]+$,y:I[1]+V,dx:I[0]-S[0],dy:I[1]-S[1],dispatch:B}),M)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:St(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:St(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:St(w),f):n},f.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:St(!!w),f):r},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,f):Math.sqrt(u)},f}function Fn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Do(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function yt(){}var ct=.7,Vt=1/ct,Xe="\\s*([+-]?\\d+)\\s*",ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Qc=/^#([0-9a-f]{3,8})$/,Jc=new RegExp(`^rgb\\(${Xe},${Xe},${Xe}\\)$`),eu=new RegExp(`^rgb\\(${me},${me},${me}\\)$`),tu=new RegExp(`^rgba\\(${Xe},${Xe},${Xe},${ut}\\)$`),nu=new RegExp(`^rgba\\(${me},${me},${me},${ut}\\)$`),ru=new RegExp(`^hsl\\(${ut},${me},${me}\\)$`),ou=new RegExp(`^hsla\\(${ut},${me},${me},${ut}\\)$`),hr={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};Fn(yt,ze,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:gr,formatHex:gr,formatHex8:iu,formatHsl:su,formatRgb:pr,toString:pr});function gr(){return this.rgb().formatHex()}function iu(){return this.rgb().formatHex8()}function su(){return Lo(this).formatHsl()}function pr(){return this.rgb().formatRgb()}function ze(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Qc.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?mr(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Nt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Nt(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Jc.exec(e))?new ae(t[1],t[2],t[3],1):(t=eu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=tu.exec(e))?Nt(t[1],t[2],t[3],t[4]):(t=nu.exec(e))?Nt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ru.exec(e))?wr(t[1],t[2]/100,t[3]/100,1):(t=ou.exec(e))?wr(t[1],t[2]/100,t[3]/100,t[4]):hr.hasOwnProperty(e)?mr(hr[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function mr(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Nt(e,t,n,r){return r<=0&&(e=t=n=NaN),new ae(e,t,n,r)}function au(e){return e instanceof yt||(e=ze(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Cn(e,t,n,r){return arguments.length===1?au(e):new ae(e,t,n,r??1)}function ae(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}Fn(ae,Cn,Do(yt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ct:Math.pow(ct,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Pe(this.r),Pe(this.g),Pe(this.b),Bt(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:yr,formatHex:yr,formatHex8:cu,formatRgb:xr,toString:xr}));function yr(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}`}function cu(){return`#${$e(this.r)}${$e(this.g)}${$e(this.b)}${$e((isNaN(this.opacity)?1:this.opacity)*255)}`}function xr(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Pe(this.r)}, ${Pe(this.g)}, ${Pe(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Pe(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function $e(e){return e=Pe(e),(e<16?"0":"")+e.toString(16)}function wr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,r)}function Lo(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof yt||(e=ze(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,o=Math.min(t,n,r),i=Math.max(t,n,r),s=NaN,a=i-o,c=(i+o)/2;return a?(t===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+o:2-i-o,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function uu(e,t,n,r){return arguments.length===1?Lo(e):new fe(e,t,n,r??1)}function fe(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}Fn(fe,uu,Do(yt,{brighter(e){return e=e==null?Vt:Math.pow(Vt,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ct:Math.pow(ct,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,o=2*n-r;return new ae(hn(e>=240?e-240:e+120,o,r),hn(e,o,r),hn(e<120?e+240:e-120,o,r),this.opacity)},clamp(){return new fe(vr(this.h),Mt(this.s),Mt(this.l),Bt(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=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${vr(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function vr(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function hn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const On=e=>()=>e;function lu(e,t){return function(n){return e+n*t}}function fu(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(r){return Math.pow(e+r*t,n)}}function du(e){return(e=+e)==1?Ho:function(t,n){return n-t?fu(t,n,e):On(isNaN(t)?n:t)}}function Ho(e,t){var n=t-e;return n?lu(e,n):On(isNaN(e)?t:e)}const Ft=(function e(t){var n=du(t);function r(o,i){var s=n((o=Cn(o)).r,(i=Cn(i)).r),a=n(o.g,i.g),c=n(o.b,i.b),l=Ho(o.opacity,i.opacity);return function(d){return o.r=s(d),o.g=a(d),o.b=c(d),o.opacity=l(d),o+""}}return r.gamma=e,r})(1);function hu(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,r=t.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=e[o]*(1-i)+t[o]*i;return r}}function gu(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function pu(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=it(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function mu(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function pe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yu(e,t){var n={},r={},o;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(o in t)o in e?n[o]=it(e[o],t[o]):r[o]=t[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var In=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,gn=new RegExp(In.source,"g");function xu(e){return function(){return e}}function wu(e){return function(t){return e(t)+""}}function Ro(e,t){var n=In.lastIndex=gn.lastIndex=0,r,o,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(r=In.exec(e))&&(o=gn.exec(t));)(i=o.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(r=r[0])===(o=o[0])?a[s]?a[s]+=o:a[++s]=o:(a[++s]=null,c.push({i:s,x:pe(r,o)})),n=gn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?wu(c[0].x):xu(t):(t=c.length,function(l){for(var d=0,u;d<t;++d)a[(u=c[d]).i]=u.x(l);return a.join("")})}function it(e,t){var n=typeof t,r;return t==null||n==="boolean"?On(t):(n==="number"?pe:n==="string"?(r=ze(t))?(t=r,Ft):Ro:t instanceof ze?Ft:t instanceof Date?mu:gu(t)?hu:Array.isArray(t)?pu:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?yu:pe)(e,t)}var br=180/Math.PI,An={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vo(e,t,n,r,o,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*r)&&(n-=e*c,r-=t*c),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,c/=a),e*r<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(t,e)*br,skewX:Math.atan(c)*br,scaleX:s,scaleY:a}}var Ct;function vu(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?An:Vo(t.a,t.b,t.c,t.d,t.e,t.f)}function bu(e){return e==null||(Ct||(Ct=document.createElementNS("http://www.w3.org/2000/svg","g")),Ct.setAttribute("transform",e),!(e=Ct.transform.baseVal.consolidate()))?An:(e=e.matrix,Vo(e.a,e.b,e.c,e.d,e.e,e.f))}function Bo(e,t,n,r){function o(l){return l.length?l.pop()+" ":""}function i(l,d,u,f,h,g){if(l!==u||d!==f){var y=h.push("translate(",null,t,null,n);g.push({i:y-4,x:pe(l,u)},{i:y-2,x:pe(d,f)})}else(u||f)&&h.push("translate("+u+t+f+n)}function s(l,d,u,f){l!==d?(l-d>180?d+=360:d-l>180&&(l+=360),f.push({i:u.push(o(u)+"rotate(",null,r)-2,x:pe(l,d)})):d&&u.push(o(u)+"rotate("+d+r)}function a(l,d,u,f){l!==d?f.push({i:u.push(o(u)+"skewX(",null,r)-2,x:pe(l,d)}):d&&u.push(o(u)+"skewX("+d+r)}function c(l,d,u,f,h,g){if(l!==u||d!==f){var y=h.push(o(h)+"scale(",null,",",null,")");g.push({i:y-4,x:pe(l,u)},{i:y-2,x:pe(d,f)})}else(u!==1||f!==1)&&h.push(o(h)+"scale("+u+","+f+")")}return function(l,d){var u=[],f=[];return l=e(l),d=e(d),i(l.translateX,l.translateY,d.translateX,d.translateY,u,f),s(l.rotate,d.rotate,u,f),a(l.skewX,d.skewX,u,f),c(l.scaleX,l.scaleY,d.scaleX,d.scaleY,u,f),l=d=null,function(h){for(var g=-1,y=f.length,x;++g<y;)u[(x=f[g]).i]=x.x(h);return u.join("")}}}var _u=Bo(vu,"px, ","px)","deg)"),Eu=Bo(bu,", ",")",")"),Su=1e-12;function _r(e){return((e=Math.exp(e))+1/e)/2}function Nu(e){return((e=Math.exp(e))-1/e)/2}function Mu(e){return((e=Math.exp(2*e))-1)/(e+1)}const zt=(function e(t,n,r){function o(i,s){var a=i[0],c=i[1],l=i[2],d=s[0],u=s[1],f=s[2],h=d-a,g=u-c,y=h*h+g*g,x,m;if(y<Su)m=Math.log(f/l)/t,x=function(M){return[a+M*h,c+M*g,l*Math.exp(t*M*m)]};else{var b=Math.sqrt(y),p=(f*f-l*l+r*y)/(2*l*n*b),w=(f*f-l*l-r*y)/(2*f*n*b),N=Math.log(Math.sqrt(p*p+1)-p),_=Math.log(Math.sqrt(w*w+1)-w);m=(_-N)/t,x=function(M){var T=M*m,z=_r(N),B=l/(n*b)*(z*Mu(t*T+N)-Nu(N));return[a+B*h,c+B*g,l*z/_r(t*T+N)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},o})(Math.SQRT2,2,4);var We=0,rt=0,tt=0,Fo=1e3,Ot,ot,jt=0,De=0,Qt=0,lt=typeof performance=="object"&&performance.now?performance:Date,Oo=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function jn(){return De||(Oo(Cu),De=lt.now()+Qt)}function Cu(){De=0}function Xt(){this._call=this._time=this._next=null}Xt.prototype=jo.prototype={constructor:Xt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?jn():+n)+(t==null?0:+t),!this._next&&ot!==this&&(ot?ot._next=this:Ot=this,ot=this),this._call=e,this._time=n,kn()},stop:function(){this._call&&(this._call=null,this._time=1/0,kn())}};function jo(e,t,n){var r=new Xt;return r.restart(e,t,n),r}function Iu(){jn(),++We;for(var e=Ot,t;e;)(t=De-e._time)>=0&&e._call.call(void 0,t),e=e._next;--We}function Er(){De=(jt=lt.now())+Qt,We=rt=0;try{Iu()}finally{We=0,ku(),De=0}}function Au(){var e=lt.now(),t=e-jt;t>Fo&&(Qt-=t,jt=e)}function ku(){for(var e,t=Ot,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Ot=n);ot=e,kn(r)}function kn(e){if(!We){rt&&(rt=clearTimeout(rt));var t=e-De;t>24?(e<1/0&&(rt=setTimeout(Er,e-lt.now()-Qt)),tt&&(tt=clearInterval(tt))):(tt||(jt=lt.now(),tt=setInterval(Au,Fo)),We=1,Oo(Er))}}function Sr(e,t,n){var r=new Xt;return t=t==null?0:+t,r.restart(o=>{r.stop(),e(o+t)},t,n),r}var $u=Zt("start","end","cancel","interrupt"),Pu=[],Xo=0,Nr=1,$n=2,Dt=3,Mr=4,Pn=5,Lt=6;function Jt(e,t,n,r,o,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Tu(e,n,{name:t,index:r,group:o,on:$u,tween:Pu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Xo})}function Xn(e,t){var n=ge(e,t);if(n.state>Xo)throw new Error("too late; already scheduled");return n}function xe(e,t){var n=ge(e,t);if(n.state>Dt)throw new Error("too late; already running");return n}function ge(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Tu(e,t,n){var r=e.__transition,o;r[t]=n,n.timer=jo(i,0,n.time);function i(l){n.state=Nr,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var d,u,f,h;if(n.state!==Nr)return c();for(d in r)if(h=r[d],h.name===n.name){if(h.state===Dt)return Sr(s);h.state===Mr?(h.state=Lt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete r[d]):+d<t&&(h.state=Lt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete r[d])}if(Sr(function(){n.state===Dt&&(n.state=Mr,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=$n,n.on.call("start",e,e.__data__,n.index,n.group),n.state===$n){for(n.state=Dt,o=new Array(f=n.tween.length),d=0,u=-1;d<f;++d)(h=n.tween[d].value.call(e,e.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(l){for(var d=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Pn,1),u=-1,f=o.length;++u<f;)o[u].call(e,d);n.state===Pn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Lt,n.timer.stop(),delete r[t];for(var l in r)return;delete e.__transition}}function Ht(e,t){var n=e.__transition,r,o,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((r=n[s]).name!==t){i=!1;continue}o=r.state>$n&&r.state<Pn,r.state=Lt,r.timer.stop(),r.on.call(o?"interrupt":"cancel",e,e.__data__,r.index,r.group),delete n[s]}i&&delete e.__transition}}function zu(e){return this.each(function(){Ht(this,e)})}function Du(e,t){var n,r;return function(){var o=xe(this,e),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===t){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function Lu(e,t,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=xe(this,e),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:t,value:n},c=0,l=o.length;c<l;++c)if(o[c].name===t){o[c]=a;break}c===l&&o.push(a)}i.tween=o}}function Hu(e,t){var n=this._id;if(e+="",arguments.length<2){for(var r=ge(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===e)return s.value;return null}return this.each((t==null?Du:Lu)(n,e,t))}function Yn(e,t,n){var r=e._id;return e.each(function(){var o=xe(this,r);(o.value||(o.value={}))[t]=n.apply(this,arguments)}),function(o){return ge(o,r).value[t]}}function Yo(e,t){var n;return(typeof t=="number"?pe:t instanceof ze?Ft:(n=ze(t))?(t=n,Ft):Ro)(e,t)}function Ru(e){return function(){this.removeAttribute(e)}}function Vu(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bu(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttribute(e);return s===o?null:s===r?i:i=t(r=s,n)}}function Fu(e,t,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===o?null:s===r?i:i=t(r=s,n)}}function Ou(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function ju(e,t,n){var r,o,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a)))}}function Xu(e,t){var n=Kt(e),r=n==="transform"?Eu:Yo;return this.attrTween(e,typeof t=="function"?(n.local?ju:Ou)(n,r,Yn(this,"attr."+e,t)):t==null?(n.local?Vu:Ru)(n):(n.local?Fu:Bu)(n,r,t))}function Yu(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Wu(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function qu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Wu(e,i)),n}return o._value=t,o}function Gu(e,t){var n,r;function o(){var i=t.apply(this,arguments);return i!==r&&(n=(r=i)&&Yu(e,i)),n}return o._value=t,o}function Uu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var r=Kt(e);return this.tween(n,(r.local?qu:Gu)(r,t))}function Zu(e,t){return function(){Xn(this,e).delay=+t.apply(this,arguments)}}function Ku(e,t){return t=+t,function(){Xn(this,e).delay=t}}function Qu(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Zu:Ku)(t,e)):ge(this.node(),t).delay}function Ju(e,t){return function(){xe(this,e).duration=+t.apply(this,arguments)}}function el(e,t){return t=+t,function(){xe(this,e).duration=t}}function tl(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Ju:el)(t,e)):ge(this.node(),t).duration}function nl(e,t){if(typeof t!="function")throw new Error;return function(){xe(this,e).ease=t}}function rl(e){var t=this._id;return arguments.length?this.each(nl(t,e)):ge(this.node(),t).ease}function ol(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;xe(this,e).ease=n}}function il(e){if(typeof e!="function")throw new Error;return this.each(ol(this._id,e))}function sl(e){typeof e!="function"&&(e=_o(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],s=i.length,a=r[o]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new _e(r,this._parents,this._name,this._id)}function al(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,r=t.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var c=t[a],l=n[a],d=c.length,u=s[a]=new Array(d),f,h=0;h<d;++h)(f=c[h]||l[h])&&(u[h]=f);for(;a<r;++a)s[a]=t[a];return new _e(s,this._parents,this._name,this._id)}function cl(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function ul(e,t,n){var r,o,i=cl(t)?Xn:xe;return function(){var s=i(this,e),a=s.on;a!==r&&(o=(r=a).copy()).on(t,n),s.on=o}}function ll(e,t){var n=this._id;return arguments.length<2?ge(this.node(),n).on.on(e):this.each(ul(n,e,t))}function fl(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function dl(){return this.on("end.remove",fl(this._id))}function hl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Vn(e));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],c=a.length,l=i[s]=new Array(c),d,u,f=0;f<c;++f)(d=a[f])&&(u=e.call(d,d.__data__,f,a))&&("__data__"in d&&(u.__data__=d.__data__),l[f]=u,Jt(l[f],t,n,f,l,ge(d,n)));return new _e(i,this._parents,t,n)}function gl(e){var t=this._name,n=this._id;typeof e!="function"&&(e=bo(e));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var c=r[a],l=c.length,d,u=0;u<l;++u)if(d=c[u]){for(var f=e.call(d,d.__data__,u,c),h,g=ge(d,n),y=0,x=f.length;y<x;++y)(h=f[y])&&Jt(h,t,n,y,f,g);i.push(f),s.push(d)}return new _e(i,s,t,n)}var pl=mt.prototype.constructor;function ml(){return new pl(this._groups,this._parents)}function yl(e,t){var n,r,o;return function(){var i=Ye(this,e),s=(this.style.removeProperty(e),Ye(this,e));return i===s?null:i===n&&s===r?o:o=t(n=i,r=s)}}function Wo(e){return function(){this.style.removeProperty(e)}}function xl(e,t,n){var r,o=n+"",i;return function(){var s=Ye(this,e);return s===o?null:s===r?i:i=t(r=s,n)}}function wl(e,t,n){var r,o,i;return function(){var s=Ye(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ye(this,e))),s===c?null:s===r&&c===o?i:(o=c,i=t(r=s,a))}}function vl(e,t){var n,r,o,i="style."+t,s="end."+i,a;return function(){var c=xe(this,e),l=c.on,d=c.value[i]==null?a||(a=Wo(t)):void 0;(l!==n||o!==d)&&(r=(n=l).copy()).on(s,o=d),c.on=r}}function bl(e,t,n){var r=(e+="")=="transform"?_u:Yo;return t==null?this.styleTween(e,yl(e,r)).on("end.style."+e,Wo(e)):typeof t=="function"?this.styleTween(e,wl(e,r,Yn(this,"style."+e,t))).each(vl(this._id,e)):this.styleTween(e,xl(e,r,t),n).on("end.style."+e,null)}function _l(e,t,n){return function(r){this.style.setProperty(e,t.call(this,r),n)}}function El(e,t,n){var r,o;function i(){var s=t.apply(this,arguments);return s!==o&&(r=(o=s)&&_l(e,s,n)),r}return i._value=t,i}function Sl(e,t,n){var r="style."+(e+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;return this.tween(r,El(e,t,n??""))}function Nl(e){return function(){this.textContent=e}}function Ml(e){return function(){var t=e(this);this.textContent=t??""}}function Cl(e){return this.tween("text",typeof e=="function"?Ml(Yn(this,"text",e)):Nl(e==null?"":e+""))}function Il(e){return function(t){this.textContent=e.call(this,t)}}function Al(e){var t,n;function r(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&Il(o)),t}return r._value=e,r}function kl(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,Al(e))}function $l(){for(var e=this._name,t=this._id,n=qo(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var d=ge(c,t);Jt(c,e,n,l,s,{time:d.time+d.delay+d.duration,delay:0,duration:d.duration,ease:d.ease})}return new _e(r,this._parents,e,n)}function Pl(){var e,t,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--o===0&&i()}};n.each(function(){var l=xe(this,r),d=l.on;d!==e&&(t=(e=d).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),o===0&&i()})}var Tl=0;function _e(e,t,n,r){this._groups=e,this._parents=t,this._name=n,this._id=r}function qo(){return++Tl}var ve=mt.prototype;_e.prototype={constructor:_e,select:hl,selectAll:gl,selectChild:ve.selectChild,selectChildren:ve.selectChildren,filter:sl,merge:al,selection:ml,transition:$l,call:ve.call,nodes:ve.nodes,node:ve.node,size:ve.size,empty:ve.empty,each:ve.each,on:ll,attr:Xu,attrTween:Uu,style:bl,styleTween:Sl,text:Cl,textTween:kl,remove:dl,tween:Hu,delay:Qu,duration:tl,ease:rl,easeVarying:il,end:Pl,[Symbol.iterator]:ve[Symbol.iterator]};function zl(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Dl={time:null,delay:0,duration:250,ease:zl};function Ll(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function Hl(e){var t,n;e instanceof _e?(t=e._id,e=e._name):(t=qo(),(n=Dl).time=jn(),e=e==null?null:e+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&Jt(c,e,t,l,s,n||Ll(c,t));return new _e(r,this._parents,e,t)}mt.prototype.interrupt=zu;mt.prototype.transition=Hl;const It=e=>()=>e;function Rl(e,{sourceEvent:t,target:n,transform:r,dispatch:o}){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:r,enumerable:!0,configurable:!0},_:{value:o}})}function be(e,t,n){this.k=e,this.x=t,this.y=n}be.prototype={constructor:be,scale:function(e){return e===1?this:new be(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new be(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 en=new be(1,0,0);Go.prototype=be.prototype;function Go(e){for(;!e.__zoom;)if(!(e=e.parentNode))return en;return e.__zoom}function pn(e){e.stopImmediatePropagation()}function nt(e){e.preventDefault(),e.stopImmediatePropagation()}function Vl(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Bl(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.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 Cr(){return this.__zoom||en}function Fl(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Ol(){return navigator.maxTouchPoints||"ontouchstart"in this}function jl(e,t,n){var r=e.invertX(t[0][0])-n[0][0],o=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(o>r?(r+o)/2:Math.min(0,r)||Math.max(0,o),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Uo(){var e=Vl,t=Bl,n=jl,r=Fl,o=Ol,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=zt,l=Zt("start","zoom","end"),d,u,f,h=500,g=150,y=0,x=10;function m(v){v.property("__zoom",Cr).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",z).on("dblclick.zoom",B).filter(o).on("touchstart.zoom",I).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",V).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(v,A,E,k){var C=v.selection?v.selection():v;C.property("__zoom",Cr),v!==C?N(v,A,E,k):C.interrupt().each(function(){_(this,arguments).event(k).start().zoom(null,typeof A=="function"?A.apply(this,arguments):A).end()})},m.scaleBy=function(v,A,E,k){m.scaleTo(v,function(){var C=this.__zoom.k,S=typeof A=="function"?A.apply(this,arguments):A;return C*S},E,k)},m.scaleTo=function(v,A,E,k){m.transform(v,function(){var C=t.apply(this,arguments),S=this.__zoom,L=E==null?w(C):typeof E=="function"?E.apply(this,arguments):E,R=S.invert(L),H=typeof A=="function"?A.apply(this,arguments):A;return n(p(b(S,H),L,R),C,s)},E,k)},m.translateBy=function(v,A,E,k){m.transform(v,function(){return n(this.__zoom.translate(typeof A=="function"?A.apply(this,arguments):A,typeof E=="function"?E.apply(this,arguments):E),t.apply(this,arguments),s)},null,k)},m.translateTo=function(v,A,E,k,C){m.transform(v,function(){var S=t.apply(this,arguments),L=this.__zoom,R=k==null?w(S):typeof k=="function"?k.apply(this,arguments):k;return n(en.translate(R[0],R[1]).scale(L.k).translate(typeof A=="function"?-A.apply(this,arguments):-A,typeof E=="function"?-E.apply(this,arguments):-E),S,s)},k,C)};function b(v,A){return A=Math.max(i[0],Math.min(i[1],A)),A===v.k?v:new be(A,v.x,v.y)}function p(v,A,E){var k=A[0]-E[0]*v.k,C=A[1]-E[1]*v.k;return k===v.x&&C===v.y?v:new be(v.k,k,C)}function w(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function N(v,A,E,k){v.on("start.zoom",function(){_(this,arguments).event(k).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(k).end()}).tween("zoom",function(){var C=this,S=arguments,L=_(C,S).event(k),R=t.apply(C,S),H=E==null?w(R):typeof E=="function"?E.apply(C,S):E,O=Math.max(R[1][0]-R[0][0],R[1][1]-R[0][1]),j=C.__zoom,Y=typeof A=="function"?A.apply(C,S):A,U=c(j.invert(H).concat(O/j.k),Y.invert(H).concat(O/Y.k));return function(q){if(q===1)q=Y;else{var F=U(q),W=O/F[2];q=new be(W,H[0]-F[0]*W,H[1]-F[1]*W)}L.zoom(null,q)}})}function _(v,A,E){return!E&&v.__zooming||new M(v,A)}function M(v,A){this.that=v,this.args=A,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,A),this.taps=0}M.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,A){return this.mouse&&v!=="mouse"&&(this.mouse[1]=A.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=A.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=A.invert(this.touch1[0])),this.that.__zoom=A,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var A=ce(this.that).datum();l.call(v,this.that,new Rl(v,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),A)}};function T(v,...A){if(!e.apply(this,arguments))return;var E=_(this,A).event(v),k=this.__zoom,C=Math.max(i[0],Math.min(i[1],k.k*Math.pow(2,r.apply(this,arguments)))),S=le(v);if(E.wheel)(E.mouse[0][0]!==S[0]||E.mouse[0][1]!==S[1])&&(E.mouse[1]=k.invert(E.mouse[0]=S)),clearTimeout(E.wheel);else{if(k.k===C)return;E.mouse=[S,k.invert(S)],Ht(this),E.start()}nt(v),E.wheel=setTimeout(L,g),E.zoom("mouse",n(p(b(k,C),E.mouse[0],E.mouse[1]),E.extent,s));function L(){E.wheel=null,E.end()}}function z(v,...A){if(f||!e.apply(this,arguments))return;var E=v.currentTarget,k=_(this,A,!0).event(v),C=ce(v.view).on("mousemove.zoom",H,!0).on("mouseup.zoom",O,!0),S=le(v,E),L=v.clientX,R=v.clientY;Po(v.view),pn(v),k.mouse=[S,this.__zoom.invert(S)],Ht(this),k.start();function H(j){if(nt(j),!k.moved){var Y=j.clientX-L,U=j.clientY-R;k.moved=Y*Y+U*U>y}k.event(j).zoom("mouse",n(p(k.that.__zoom,k.mouse[0]=le(j,E),k.mouse[1]),k.extent,s))}function O(j){C.on("mousemove.zoom mouseup.zoom",null),To(j.view,k.moved),nt(j),k.event(j).end()}}function B(v,...A){if(e.apply(this,arguments)){var E=this.__zoom,k=le(v.changedTouches?v.changedTouches[0]:v,this),C=E.invert(k),S=E.k*(v.shiftKey?.5:2),L=n(p(b(E,S),k,C),t.apply(this,A),s);nt(v),a>0?ce(this).transition().duration(a).call(N,L,k,v):ce(this).call(m.transform,L,k,v)}}function I(v,...A){if(e.apply(this,arguments)){var E=v.touches,k=E.length,C=_(this,A,v.changedTouches.length===k).event(v),S,L,R,H;for(pn(v),L=0;L<k;++L)R=E[L],H=le(R,this),H=[H,this.__zoom.invert(H),R.identifier],C.touch0?!C.touch1&&C.touch0[2]!==H[2]&&(C.touch1=H,C.taps=0):(C.touch0=H,S=!0,C.taps=1+!!d);d&&(d=clearTimeout(d)),S&&(C.taps<2&&(u=H[0],d=setTimeout(function(){d=null},h)),Ht(this),C.start())}}function $(v,...A){if(this.__zooming){var E=_(this,A).event(v),k=v.changedTouches,C=k.length,S,L,R,H;for(nt(v),S=0;S<C;++S)L=k[S],R=le(L,this),E.touch0&&E.touch0[2]===L.identifier?E.touch0[0]=R:E.touch1&&E.touch1[2]===L.identifier&&(E.touch1[0]=R);if(L=E.that.__zoom,E.touch1){var O=E.touch0[0],j=E.touch0[1],Y=E.touch1[0],U=E.touch1[1],q=(q=Y[0]-O[0])*q+(q=Y[1]-O[1])*q,F=(F=U[0]-j[0])*F+(F=U[1]-j[1])*F;L=b(L,Math.sqrt(q/F)),R=[(O[0]+Y[0])/2,(O[1]+Y[1])/2],H=[(j[0]+U[0])/2,(j[1]+U[1])/2]}else if(E.touch0)R=E.touch0[0],H=E.touch0[1];else return;E.zoom("touch",n(p(L,R,H),E.extent,s))}}function V(v,...A){if(this.__zooming){var E=_(this,A).event(v),k=v.changedTouches,C=k.length,S,L;for(pn(v),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),S=0;S<C;++S)L=k[S],E.touch0&&E.touch0[2]===L.identifier?delete E.touch0:E.touch1&&E.touch1[2]===L.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(L=le(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<x)){var R=ce(this).on("dblclick.zoom");R&&R.apply(this,arguments)}}}return m.wheelDelta=function(v){return arguments.length?(r=typeof v=="function"?v:It(+v),m):r},m.filter=function(v){return arguments.length?(e=typeof v=="function"?v:It(!!v),m):e},m.touchable=function(v){return arguments.length?(o=typeof v=="function"?v:It(!!v),m):o},m.extent=function(v){return arguments.length?(t=typeof v=="function"?v:It([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),m):t},m.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],m):[i[0],i[1]]},m.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(v){return arguments.length?(n=v,m):n},m.duration=function(v){return arguments.length?(a=+v,m):a},m.interpolate=function(v){return arguments.length?(c=v,m):c},m.on=function(){var v=l.on.apply(l,arguments);return v===l?m:v},m.clickDistance=function(v){return arguments.length?(y=(v=+v)*v,m):Math.sqrt(y)},m.tapDistance=function(v){return arguments.length?(x=+v,m):x},m}const ye={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:r}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012: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.`,error013:(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.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},ft=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Zo=["Enter"," ","Escape"],Ko={"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 qe;(function(e){e.Strict="strict",e.Loose="loose"})(qe||(qe={}));var Te;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Te||(Te={}));var dt;(function(e){e.Partial="partial",e.Full="full"})(dt||(dt={}));const Qo={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ce;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ce||(Ce={}));var Yt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Yt||(Yt={}));var X;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(X||(X={}));const Ir={[X.Left]:X.Right,[X.Right]:X.Left,[X.Top]:X.Bottom,[X.Bottom]:X.Top};function Jo(e){return e===null?null:e?"valid":"invalid"}const ei=e=>"id"in e&&"source"in e&&"target"in e,Xl=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),xt=(e,t=[0,0])=>{const{width:n,height:r}=Ee(e),o=e.origin??t,i=n*o[0],s=r*o[1];return{x:e.position.x-i,y:e.position.y-s}},Yl=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((r,o)=>{const i=typeof o=="string";let s=!t.nodeLookup&&!i?o:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(o):Wn(o)?o:t.nodeLookup.get(o.id));const a=s?Wt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return tn(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return nn(n)},wt=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return e.forEach(o=>{(t.filter===void 0||t.filter(o))&&(n=tn(n,Wt(o)),r=!0)}),r?nn(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...bt(t,[n,r,o]),width:t.width/o,height:t.height/o},c=[];for(const l of e.values()){const{measured:d,selectable:u=!0,hidden:f=!1}=l;if(s&&!u||f)continue;const h=d.width??l.width??l.initialWidth??null,g=d.height??l.height??l.initialHeight??null,y=ht(a,Ue(l)),x=(h??0)*(g??0),m=i&&y>0;(!l.internals.handleBounds||m||y>=x||l.dragging)&&c.push(l)}return c},Wl=(e,t)=>{const n=new Set;return e.forEach(r=>{n.add(r.id)}),t.filter(r=>n.has(r.source)||n.has(r.target))};function ql(e,t){const n=new Map,r=t!=null&&t.nodes?new Set(t.nodes.map(o=>o.id)):null;return e.forEach(o=>{o.measured.width&&o.measured.height&&((t==null?void 0:t.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function Gl({nodes:e,width:t,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const a=ql(e,s),c=wt(a),l=Gn(c,t,n,(s==null?void 0:s.minZoom)??o,(s==null?void 0:s.maxZoom)??i,(s==null?void 0:s.padding)??.1);return await r.setViewport(l,{duration:s==null?void 0:s.duration,ease:s==null?void 0:s.ease,interpolate:s==null?void 0:s.interpolate}),Promise.resolve(!0)}function ti({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},d=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",ye.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[c,l],[c+h,l+g]])}else a&&Ze(s.extent)&&(u=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Ze(u)?Le(t,u,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",ye.error015())),{position:{x:f.x-c+(s.measured.width??0)*d[0],y:f.y-l+(s.measured.height??0)*d[1]},positionAbsolute:f}}async function Ul({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(y=>y.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=r.filter(f=>f.deletable!==!1),d=Wl(s,c);for(const f of c)a.has(f.id)&&!d.find(g=>g.id===f.id)&&d.push(f);if(!o)return{edges:d,nodes:s};const u=await o({nodes:s,edges:d});return typeof u=="boolean"?u?{edges:d,nodes:s}:{edges:[],nodes:[]}:u}const Ge=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Le=(e={x:0,y:0},t,n)=>({x:Ge(e.x,t[0][0],t[1][0]-((n==null?void 0:n.width)??0)),y:Ge(e.y,t[0][1],t[1][1]-((n==null?void 0:n.height)??0))});function ni(e,t,n){const{width:r,height:o}=Ee(n),{x:i,y:s}=n.internals.positionAbsolute;return Le(e,[[i,s],[i+r,s+o]],t)}const Ar=(e,t,n)=>e<t?Ge(Math.abs(e-t),1,t)/t:e>n?-Ge(Math.abs(e-n),1,t)/t:0,ri=(e,t,n=15,r=40)=>{const o=Ar(e.x,r,t.width-r)*n,i=Ar(e.y,r,t.height-r)*n;return[o,i]},tn=(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)}),Tn=({x:e,y:t,width:n,height:r})=>({x:e,y:t,x2:e+n,y2:t+r}),nn=({x:e,y:t,x2:n,y2:r})=>({x:e,y:t,width:n-e,height:r-t}),Ue=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Wn(e)?e.internals.positionAbsolute:xt(e,t);return{x:n,y:r,width:((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0,height:((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0}},Wt=(e,t=[0,0])=>{var o,i;const{x:n,y:r}=Wn(e)?e.internals.positionAbsolute:xt(e,t);return{x:n,y:r,x2:n+(((o=e.measured)==null?void 0:o.width)??e.width??e.initialWidth??0),y2:r+(((i=e.measured)==null?void 0:i.height)??e.height??e.initialHeight??0)}},oi=(e,t)=>nn(tn(Tn(e),Tn(t))),ht=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),r=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*r)},kr=e=>de(e.width)&&de(e.height)&&de(e.x)&&de(e.y),de=e=>!isNaN(e)&&isFinite(e),Zl=(e,t)=>{},vt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),bt=({x:e,y:t},[n,r,o],i=!1,s=[1,1])=>{const a={x:(e-n)/o,y:(t-r)/o};return i?vt(a,s):a},qt=({x:e,y:t},[n,r,o])=>({x:e*o+n,y:t*o+r});function Be(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&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}function Kl(e,t,n){if(typeof e=="string"||typeof e=="number"){const r=Be(e,n),o=Be(e,t);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof e=="object"){const r=Be(e.top??e.y??0,n),o=Be(e.bottom??e.y??0,n),i=Be(e.left??e.x??0,t),s=Be(e.right??e.x??0,t);return{top:r,right:s,bottom:o,left:i,x:i+s,y:r+o}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Ql(e,t,n,r,o,i){const{x:s,y:a}=qt(e,[t,n,r]),{x:c,y:l}=qt({x:e.x+e.width,y:e.y+e.height},[t,n,r]),d=o-c,u=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(d),bottom:Math.floor(u)}}const Gn=(e,t,n,r,o,i)=>{const s=Kl(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),d=Ge(l,r,o),u=e.x+e.width/2,f=e.y+e.height/2,h=t/2-u*d,g=n/2-f*d,y=Ql(e,h,g,d,t,n),x={left:Math.min(y.left-s.left,0),top:Math.min(y.top-s.top,0),right:Math.min(y.right-s.right,0),bottom:Math.min(y.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:d}},gt=()=>{var e;return typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)==null?void 0:e.indexOf("Mac"))>=0};function Ze(e){return e!=null&&e!=="parent"}function Ee(e){var t,n;return{width:((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth??0,height:((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight??0}}function ii(e){var t,n;return(((t=e.measured)==null?void 0:t.width)??e.width??e.initialWidth)!==void 0&&(((n=e.measured)==null?void 0:n.height)??e.height??e.initialHeight)!==void 0}function si(e,t={width:0,height:0},n,r,o){const i={...e},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function $r(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Jl(){let e,t;return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}function ef(e){return{...Ko,...e||{}}}function st(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=he(e),a=bt({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:c,y:l}=n?vt(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Un=e=>({width:e.offsetWidth,height:e.offsetHeight}),ai=e=>{var t;return((t=e==null?void 0:e.getRootNode)==null?void 0:t.call(e))||(window==null?void 0:window.document)},tf=["INPUT","SELECT","TEXTAREA"];function ci(e){var r,o;const t=((o=(r=e.composedPath)==null?void 0:r.call(e))==null?void 0:o[0])||e.target;return(t==null?void 0:t.nodeType)!==1?!1:tf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ui=e=>"clientX"in e,he=(e,t)=>{var i,s;const n=ui(e),r=n?e.clientX:(i=e.touches)==null?void 0:i[0].clientX,o=n?e.clientY:(s=e.touches)==null?void 0:s[0].clientY;return{x:r-((t==null?void 0:t.left)??0),y:o-((t==null?void 0:t.top)??0)}},Pr=(e,t,n,r,o)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...Un(s)}})};function li({sourceX:e,sourceY:t,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+o*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+r*.125,d=Math.abs(c-e),u=Math.abs(l-t);return[c,l,d,u]}function At(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Tr({pos:e,x1:t,y1:n,x2:r,y2:o,c:i}){switch(e){case X.Left:return[t-At(t-r,i),n];case X.Right:return[t+At(r-t,i),n];case X.Top:return[t,n-At(n-o,i)];case X.Bottom:return[t,n+At(o-n,i)]}}function fi({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top,curvature:s=.25}){const[a,c]=Tr({pos:n,x1:e,y1:t,x2:r,y2:o,c:s}),[l,d]=Tr({pos:i,x1:r,y1:o,x2:e,y2:t,c:s}),[u,f,h,g]=li({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:d});return[`M${e},${t} C${a},${c} ${l},${d} ${r},${o}`,u,f,h,g]}function di({sourceX:e,sourceY:t,targetX:n,targetY:r}){const o=Math.abs(n-e)/2,i=n<e?n+o:n-o,s=Math.abs(r-t)/2,a=r<t?r+s:r-s;return[i,a,o,s]}function nf({sourceNode:e,targetNode:t,selected:n=!1,zIndex:r=0,elevateOnSelect:o=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const s=o&&n?r+1e3:r,a=Math.max(e.parentId||o&&e.selected?e.internals.z:0,t.parentId||o&&t.selected?t.internals.z:0);return s+a}function rf({sourceNode:e,targetNode:t,width:n,height:r,transform:o}){const i=tn(Wt(e),Wt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-o[0]/o[2],y:-o[1]/o[2],width:n/o[2],height:r/o[2]};return ht(s,nn(i))>0}const of=({source:e,sourceHandle:t,target:n,targetHandle:r})=>`xy-edge__${e}${t||""}-${n}${r||""}`,sf=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),af=(e,t,n={})=>{if(!e.source||!e.target)return t;const r=n.getEdgeId||of;let o;return ei(e)?o={...e}:o={...e,id:r(e)},sf(o,t)?t:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,t.concat(o))};function hi({sourceX:e,sourceY:t,targetX:n,targetY:r}){const[o,i,s,a]=di({sourceX:e,sourceY:t,targetX:n,targetY:r});return[`M ${e},${t}L ${n},${r}`,o,i,s,a]}const zr={[X.Left]:{x:-1,y:0},[X.Right]:{x:1,y:0},[X.Top]:{x:0,y:-1},[X.Bottom]:{x:0,y:1}},cf=({source:e,sourcePosition:t=X.Bottom,target:n})=>t===X.Left||t===X.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},Dr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function uf({source:e,sourcePosition:t=X.Bottom,target:n,targetPosition:r=X.Top,center:o,offset:i,stepPosition:s}){const a=zr[t],c=zr[r],l={x:e.x+a.x*i,y:e.y+a.y*i},d={x:n.x+c.x*i,y:n.y+c.y*i},u=cf({source:l,sourcePosition:t,target:d}),f=u.x!==0?"x":"y",h=u[f];let g=[],y,x;const m={x:0,y:0},b={x:0,y:0},[,,p,w]=di({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(y=o.x??l.x+(d.x-l.x)*s,x=o.y??(l.y+d.y)/2):(y=o.x??(l.x+d.x)/2,x=o.y??l.y+(d.y-l.y)*s);const _=[{x:y,y:l.y},{x:y,y:d.y}],M=[{x:l.x,y:x},{x:d.x,y:x}];a[f]===h?g=f==="x"?_:M:g=f==="x"?M:_}else{const _=[{x:l.x,y:d.y}],M=[{x:d.x,y:l.y}];if(f==="x"?g=a.x===h?M:_:g=a.y===h?_:M,t===r){const $=Math.abs(e[f]-n[f]);if($<=i){const V=Math.min(i-1,i-$);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*V:b[f]=(d[f]>n[f]?-1:1)*V}}if(t!==r){const $=f==="x"?"y":"x",V=a[f]===c[$],v=l[$]>d[$],A=l[$]<d[$];(a[f]===1&&(!V&&v||V&&A)||a[f]!==1&&(!V&&A||V&&v))&&(g=f==="x"?_:M)}const T={x:l.x+m.x,y:l.y+m.y},z={x:d.x+b.x,y:d.y+b.y},B=Math.max(Math.abs(T.x-g[0].x),Math.abs(z.x-g[0].x)),I=Math.max(Math.abs(T.y-g[0].y),Math.abs(z.y-g[0].y));B>=I?(y=(T.x+z.x)/2,x=g[0].y):(y=g[0].x,x=(T.y+z.y)/2)}return[[e,{x:l.x+m.x,y:l.y+m.y},...g,{x:d.x+b.x,y:d.y+b.y},n],y,x,p,w]}function lf(e,t,n,r){const o=Math.min(Dr(e,t)/2,Dr(t,n)/2,r),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,d=e.y<n.y?1:-1;return`L ${i+o*l},${s}Q ${i},${s} ${i},${s+o*d}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+o*c}Q ${i},${s} ${i+o*a},${s}`}function zn({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:d=.5}){const[u,f,h,g,y]=uf({source:{x:e,y:t},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:d});return[u.reduce((m,b,p)=>{let w="";return p>0&&p<u.length-1?w=lf(u[p-1],b,u[p+1],s):w=`${p===0?"M":"L"}${b.x} ${b.y}`,m+=w,m},""),f,h,g,y]}function Lr(e){var t;return e&&!!(e.internals.handleBounds||(t=e.handles)!=null&&t.length)&&!!(e.measured.width||e.width||e.initialWidth)}function ff(e){var u;const{sourceNode:t,targetNode:n}=e;if(!Lr(t)||!Lr(n))return null;const r=t.internals.handleBounds||Hr(t.handles),o=n.internals.handleBounds||Hr(n.handles),i=Rr((r==null?void 0:r.source)??[],e.sourceHandle),s=Rr(e.connectionMode===qe.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),e.targetHandle);if(!i||!s)return(u=e.onError)==null||u.call(e,"008",ye.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=(i==null?void 0:i.position)||X.Bottom,c=(s==null?void 0:s.position)||X.Top,l=He(t,i,a),d=He(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:d.x,targetY:d.y,sourcePosition:a,targetPosition:c}}function Hr(e){if(!e)return null;const t=[],n=[];for(const r of e)r.width=r.width??1,r.height=r.height??1,r.type==="source"?t.push(r):r.type==="target"&&n.push(r);return{source:t,target:n}}function He(e,t,n=X.Left,r=!1){const o=((t==null?void 0:t.x)??0)+e.internals.positionAbsolute.x,i=((t==null?void 0:t.y)??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??Ee(e);if(r)return{x:o+s/2,y:i+a/2};switch((t==null?void 0:t.position)??n){case X.Top:return{x:o+s/2,y:i};case X.Right:return{x:o+s,y:i+a/2};case X.Bottom:return{x:o+s/2,y:i+a};case X.Left:return{x:o,y:i+a/2}}}function Rr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Dn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(r=>`${r}=${e[r]}`).join("&")}`:""}function df(e,{id:t,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(c=>{if(c&&typeof c=="object"){const l=Dn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const gi=1e3,hf=10,Zn={nodeOrigin:[0,0],nodeExtent:ft,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},gf={...Zn,checkEquality:!0};function Kn(e,t){const n={...e};for(const r in t)t[r]!==void 0&&(n[r]=t[r]);return n}function pf(e,t,n){const r=Kn(Zn,n);for(const o of e.values())if(o.parentId)Jn(o,e,t,r);else{const i=xt(o,r.nodeOrigin),s=Ze(o.extent)?o.extent:r.nodeExtent,a=Le(i,s,Ee(o));o.internals.positionAbsolute=a}}function mf(e,t){if(!e.handles)return e.measured?t==null?void 0:t.internals.handleBounds:void 0;const n=[],r=[];for(const o of e.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:e.id,x:o.x,y:o.y,position:o.position,type:o.type};o.type==="source"?n.push(i):o.type==="target"&&r.push(i)}return{source:n,target:r}}function Qn(e){return e==="manual"}function Ln(e,t,n,r={}){var l,d;const o=Kn(gf,r),i={i:0},s=new Map(t),a=o!=null&&o.elevateNodesOnSelect&&!Qn(o.zIndexMode)?gi:0;let c=e.length>0;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(o.checkEquality&&u===(f==null?void 0:f.internals.userNode))t.set(u.id,f);else{const h=xt(u,o.nodeOrigin),g=Ze(u.extent)?u.extent:o.nodeExtent,y=Le(h,g,Ee(u));f={...o.defaults,...u,measured:{width:(l=u.measured)==null?void 0:l.width,height:(d=u.measured)==null?void 0:d.height},internals:{positionAbsolute:y,handleBounds:mf(u,f),z:pi(u,a,o.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),u.parentId&&Jn(f,t,n,r,i)}return c}function yf(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]]))}function Jn(e,t,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Kn(Zn,r),l=e.parentId,d=t.get(l);if(!d){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}yf(e,n),o&&!d.parentId&&d.internals.rootParentIndex===void 0&&c==="auto"&&(d.internals.rootParentIndex=++o.i,d.internals.z=d.internals.z+o.i*hf),o&&d.internals.rootParentIndex!==void 0&&(o.i=d.internals.rootParentIndex);const u=i&&!Qn(c)?gi:0,{x:f,y:h,z:g}=xf(e,d,s,a,u,c),{positionAbsolute:y}=e.internals,x=f!==y.x||h!==y.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:h}:y,z:g}})}function pi(e,t,n){const r=de(e.zIndex)?e.zIndex:0;return Qn(n)?r:r+(e.selected?t:0)}function xf(e,t,n,r,o,i){const{x:s,y:a}=t.internals.positionAbsolute,c=Ee(e),l=xt(e,n),d=Ze(e.extent)?Le(l,e.extent,c):l;let u=Le({x:s+d.x,y:a+d.y},r,c);e.extent==="parent"&&(u=ni(u,c,t));const f=pi(e,o,i),h=t.internals.z??0;return{x:u.x,y:u.y,z:h>=f?h+1:f}}function er(e,t,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of e){const c=t.get(a.parentId);if(!c)continue;const l=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Ue(c),d=oi(l,a.rect);i.set(a.parentId,{expandedRect:d,parent:c})}return i.size>0&&i.forEach(({expandedRect:a,parent:c},l)=>{var p;const d=c.internals.positionAbsolute,u=Ee(c),f=c.origin??r,h=a.x<d.x?Math.round(Math.abs(d.x-a.x)):0,g=a.y<d.y?Math.round(Math.abs(d.y-a.y)):0,y=Math.max(u.width,Math.round(a.width)),x=Math.max(u.height,Math.round(a.height)),m=(y-u.width)*f[0],b=(x-u.height)*f[1];(h>0||g>0||m||b)&&(o.push({id:l,type:"position",position:{x:c.position.x-h+m,y:c.position.y-g+b}}),(p=n.get(l))==null||p.forEach(w=>{e.some(N=>N.id===w.id)||o.push({id:w.id,type:"position",position:{x:w.position.x+h,y:w.position.y+g}})})),(u.width<a.width||u.height<a.height||h||g)&&o.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?f[0]*h-m:0),height:x+(g?f[1]*g-b:0)}})}),o}function wf(e,t,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],d=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(d.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const y=Un(h.nodeElement),x=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(x||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),p=Ze(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=ni(w,y,t.get(g.parentId)):p&&(w=Le(w,p,y));const N={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Pr("source",h.nodeElement,b,u,g.id),target:Pr("target",h.nodeElement,b,u,g.id)}}};t.set(g.id,N),g.parentId&&Jn(N,t,n,{nodeOrigin:o,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:Ue(N,o)}))}}if(f.length>0){const h=er(f,t,n,o);l.push(...h)}return{changes:l,updatedInternals:c}}async function vf({delta:e,panZoom:t,transform:n,translateExtent:r,width:o,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[o,i]],r),a=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(a)}function Vr(e,t,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,t)),s=`${o}-${e}`;const c=r.get(s)||new Map;if(r.set(s,c.set(n,t)),i){s=`${o}-${e}-${i}`;const l=r.get(s)||new Map;r.set(s,l.set(n,t))}}function mi(e,t,n){e.clear(),t.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,c={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},l=`${o}-${s}--${i}-${a}`,d=`${i}-${a}--${o}-${s}`;Vr("source",c,d,e,o,s),Vr("target",c,l,e,i,a),t.set(r.id,r)}}function yi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:yi(n,t):!1}function Br(e,t,n){var o;let r=e;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,t))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function bf(e,t,n,r){const o=new Map;for(const[i,s]of e)if((s.selected||s.id===r)&&(!s.parentId||!yi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&o.set(i,{id:i,position:a.position||{x:0,y:0},distance:{x:n.x-a.internals.positionAbsolute.x,y:n.y-a.internals.positionAbsolute.y},extent:a.extent,parentId:a.parentId,origin:a.origin,expandParent:a.expandParent,internals:{positionAbsolute:a.internals.positionAbsolute||{x:0,y:0}},measured:{width:a.measured.width??0,height:a.measured.height??0}})}return o}function mn({nodeId:e,dragItems:t,nodeLookup:n,dragging:r=!0}){var s,a,c;const o=[];for(const[l,d]of t){const u=(s=n.get(l))==null?void 0:s.internals.userNode;u&&o.push({...u,position:d.position,dragging:r})}if(!e)return[o[0],o];const i=(a=n.get(e))==null?void 0:a.internals.userNode;return[i?{...i,position:((c=t.get(e))==null?void 0:c.position)||i.position,dragging:r}:o[0],o]}function _f({dragItems:e,snapGrid:t,x:n,y:r}){const o=e.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=vt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Ef({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},d=null,u=!1,f=null,h=!1,g=!1,y=null;function x({noDragClassName:b,handleSelector:p,domNode:w,isSelectable:N,nodeId:_,nodeClickDistance:M=0}){f=ce(w);function T({x:$,y:V}){const{nodeLookup:v,nodeExtent:A,snapGrid:E,snapToGrid:k,nodeOrigin:C,onNodeDrag:S,onSelectionDrag:L,onError:R,updateNodePositions:H}=t();i={x:$,y:V};let O=!1;const j=a.size>1,Y=j&&A?Tn(wt(a)):null,U=j&&k?_f({dragItems:a,snapGrid:E,x:$,y:V}):null;for(const[q,F]of a){if(!v.has(q))continue;let W={x:$-F.distance.x,y:V-F.distance.y};k&&(W=U?{x:Math.round(W.x+U.x),y:Math.round(W.y+U.y)}:vt(W,E));let Q=null;if(j&&A&&!F.extent&&Y){const{positionAbsolute:G}=F.internals,te=G.x-Y.x+A[0][0],ne=G.x+F.measured.width-Y.x2+A[1][0],ee=G.y-Y.y+A[0][1],se=G.y+F.measured.height-Y.y2+A[1][1];Q=[[te,ee],[ne,se]]}const{position:K,positionAbsolute:Z}=ti({nodeId:q,nextPosition:W,nodeLookup:v,nodeExtent:Q||A,nodeOrigin:C,onError:R});O=O||F.position.x!==K.x||F.position.y!==K.y,F.position=K,F.internals.positionAbsolute=Z}if(g=g||O,!!O&&(H(a,!0),y&&(r||S||!_&&L))){const[q,F]=mn({nodeId:_,dragItems:a,nodeLookup:v});r==null||r(y,a,q,F),S==null||S(y,q,F),_||L==null||L(y,F)}}async function z(){if(!d)return;const{transform:$,panBy:V,autoPanSpeed:v,autoPanOnNodeDrag:A}=t();if(!A){c=!1,cancelAnimationFrame(s);return}const[E,k]=ri(l,d,v);(E!==0||k!==0)&&(i.x=(i.x??0)-E/$[2],i.y=(i.y??0)-k/$[2],await V({x:E,y:k})&&T(i)),s=requestAnimationFrame(z)}function B($){var j;const{nodeLookup:V,multiSelectionActive:v,nodesDraggable:A,transform:E,snapGrid:k,snapToGrid:C,selectNodesOnDrag:S,onNodeDragStart:L,onSelectionDragStart:R,unselectNodesAndEdges:H}=t();u=!0,(!S||!N)&&!v&&_&&((j=V.get(_))!=null&&j.selected||H()),N&&S&&_&&(e==null||e(_));const O=st($.sourceEvent,{transform:E,snapGrid:k,snapToGrid:C,containerBounds:d});if(i=O,a=bf(V,A,O,_),a.size>0&&(n||L||!_&&R)){const[Y,U]=mn({nodeId:_,dragItems:a,nodeLookup:V});n==null||n($.sourceEvent,a,Y,U),L==null||L($.sourceEvent,Y,U),_||R==null||R($.sourceEvent,U)}}const I=zo().clickDistance(M).on("start",$=>{const{domNode:V,nodeDragThreshold:v,transform:A,snapGrid:E,snapToGrid:k}=t();d=(V==null?void 0:V.getBoundingClientRect())||null,h=!1,g=!1,y=$.sourceEvent,v===0&&B($),i=st($.sourceEvent,{transform:A,snapGrid:E,snapToGrid:k,containerBounds:d}),l=he($.sourceEvent,d)}).on("drag",$=>{const{autoPanOnNodeDrag:V,transform:v,snapGrid:A,snapToGrid:E,nodeDragThreshold:k,nodeLookup:C}=t(),S=st($.sourceEvent,{transform:v,snapGrid:A,snapToGrid:E,containerBounds:d});if(y=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||_&&!C.has(_))&&(h=!0),!h){if(!c&&V&&u&&(c=!0,z()),!u){const L=he($.sourceEvent,d),R=L.x-l.x,H=L.y-l.y;Math.sqrt(R*R+H*H)>k&&B($)}(i.x!==S.xSnapped||i.y!==S.ySnapped)&&a&&u&&(l=he($.sourceEvent,d),T(S))}}).on("end",$=>{if(!(!u||h)&&(c=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:V,updateNodePositions:v,onNodeDragStop:A,onSelectionDragStop:E}=t();if(g&&(v(a,!1),g=!1),o||A||!_&&E){const[k,C]=mn({nodeId:_,dragItems:a,nodeLookup:V,dragging:!1});o==null||o($.sourceEvent,a,k,C),A==null||A($.sourceEvent,k,C),_||E==null||E($.sourceEvent,C)}}}).filter($=>{const V=$.target;return!$.button&&(!b||!Br(V,`.${b}`,w))&&(!p||Br(V,p,w))});f.call(I)}function m(){f==null||f.on(".drag",null)}return{update:x,destroy:m}}function Sf(e,t,n){const r=[],o={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())ht(o,Ue(i))>0&&r.push(i);return r}const Nf=250;function Mf(e,t,n,r){var a,c;let o=[],i=1/0;const s=Sf(e,n,t+Nf);for(const l of s){const d=[...((a=l.internals.handleBounds)==null?void 0:a.source)??[],...((c=l.internals.handleBounds)==null?void 0:c.target)??[]];for(const u of d){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:f,y:h}=He(l,u,u.position,!0),g=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));g>t||(g<i?(o=[{...u,x:f,y:h}],i=g):g===i&&o.push({...u,x:f,y:h}))}}if(!o.length)return null;if(o.length>1){const l=r.type==="source"?"target":"source";return o.find(d=>d.type===l)??o[0]}return o[0]}function xi(e,t,n,r,o,i=!1){var l,d,u;const s=r.get(e);if(!s)return null;const a=o==="strict"?(l=s.internals.handleBounds)==null?void 0:l[t]:[...((d=s.internals.handleBounds)==null?void 0:d.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],c=(n?a==null?void 0:a.find(f=>f.id===n):a==null?void 0:a[0])??null;return c&&i?{...c,...He(s,c,c.position,!0)}:c}function wi(e,t){return e||(t!=null&&t.classList.contains("target")?"target":t!=null&&t.classList.contains("source")?"source":null)}function Cf(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const vi=()=>!0;function If(e,{connectionMode:t,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:d,flowId:u,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:x,isValidConnection:m=vi,onReconnectEnd:b,updateConnection:p,getTransform:w,getFromHandle:N,autoPanSpeed:_,dragThreshold:M=1,handleDomNode:T}){const z=ai(e.target);let B=0,I;const{x:$,y:V}=he(e),v=wi(i,T),A=a==null?void 0:a.getBoundingClientRect();let E=!1;if(!A||!v)return;const k=xi(o,v,r,c,t);if(!k)return;let C=he(e,A),S=!1,L=null,R=!1,H=null;function O(){if(!d||!A)return;const[K,Z]=ri(C,A,_);f({x:K,y:Z}),B=requestAnimationFrame(O)}const j={...k,nodeId:o,type:v,position:k.position},Y=c.get(o);let q={inProgress:!0,isValid:null,from:He(Y,j,X.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:Y,to:C,toHandle:null,toPosition:Ir[j.position],toNode:null,pointer:C};function F(){E=!0,p(q),g==null||g(e,{nodeId:o,handleId:r,handleType:v})}M===0&&F();function W(K){if(!E){const{x:se,y:Se}=he(K),we=se-$,Ae=Se-V;if(!(we*we+Ae*Ae>M*M))return;F()}if(!N()||!j){Q(K);return}const Z=w();C=he(K,A),I=Mf(bt(C,Z,!1,[1,1]),n,c,j),S||(O(),S=!0);const G=bi(K,{handle:I,connectionMode:t,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:z,lib:l,flowId:u,nodeLookup:c});H=G.handleDomNode,L=G.connection,R=Cf(!!I,G.isValid);const te=c.get(o),ne=te?He(te,j,X.Left,!0):q.from,ee={...q,from:ne,isValid:R,to:G.toHandle&&R?qt({x:G.toHandle.x,y:G.toHandle.y},Z):C,toHandle:G.toHandle,toPosition:R&&G.toHandle?G.toHandle.position:Ir[j.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:C};p(ee),q=ee}function Q(K){if(!("touches"in K&&K.touches.length>0)){if(E){(I||H)&&L&&R&&(y==null||y(L));const{inProgress:Z,...G}=q,te={...G,toPosition:q.toHandle?q.toPosition:null};x==null||x(K,te),i&&(b==null||b(K,te))}h(),cancelAnimationFrame(B),S=!1,R=!1,L=null,H=null,z.removeEventListener("mousemove",W),z.removeEventListener("mouseup",Q),z.removeEventListener("touchmove",W),z.removeEventListener("touchend",Q)}}z.addEventListener("mousemove",W),z.addEventListener("mouseup",Q),z.addEventListener("touchmove",W),z.addEventListener("touchend",Q)}function bi(e,{handle:t,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=vi,nodeLookup:d}){const u=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t==null?void 0:t.nodeId}-${t==null?void 0:t.id}-${t==null?void 0:t.type}"]`):null,{x:h,y:g}=he(e),y=s.elementFromPoint(h,g),x=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const b=wi(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),_=x.classList.contains("connectableend");if(!p||!b)return m;const M={source:u?p:r,sourceHandle:u?w:o,target:u?r:p,targetHandle:u?o:w};m.connection=M;const z=N&&_&&(n===qe.Strict?u&&b==="source"||!u&&b==="target":p!==r||w!==o);m.isValid=z&&l(M),m.toHandle=xi(p,b,w,d,n,!0)}return m}const Hn={onPointerDown:If,isValid:bi};function Af({domNode:e,panZoom:t,getTransform:n,getViewScale:r}){const o=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:d=1,pannable:u=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=p.sourceEvent.ctrlKey&>()?10:1,_=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*d,M=w[2]*Math.pow(2,_*N);t.scaleTo(M)};let y=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(y=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],_=[N[0]-y[0],N[1]-y[1]];y=N;const M=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),T={x:w[0]-_[0]*M,y:w[1]-_[1]*M},z=[[0,0],[c,l]];t.setViewportConstrained({x:T.x,y:T.y,zoom:w[2]},z,a)},b=Uo().on("start",x).on("zoom",u?m:null).on("zoom.wheel",f?g:null);o.call(b,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:le}}const rn=e=>({x:e.x,y:e.y,zoom:e.k}),yn=({x:e,y:t,zoom:n})=>en.translate(e,t).scale(n),Fe=(e,t)=>e.target.closest(`.${t}`),_i=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),kf=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,xn=(e,t=0,n=kf,r=()=>{})=>{const o=typeof t=="number"&&t>0;return o||r(),o?e.transition().duration(t).ease(n).on("end",r):e},Ei=e=>{const t=e.ctrlKey&>()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function $f({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return d=>{if(Fe(d,t))return d.ctrlKey&&d.preventDefault(),!1;d.preventDefault(),d.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(d.ctrlKey&&s){const x=le(d),m=Ei(d),b=u*Math.pow(2,m);r.scaleTo(n,b,x,d);return}const f=d.deltaMode===1?20:1;let h=o===Te.Vertical?0:d.deltaX*f,g=o===Te.Horizontal?0:d.deltaY*f;!gt()&&d.shiftKey&&o!==Te.Vertical&&(h=d.deltaY*f,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const y=rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c==null||c(d,y),e.panScrollTimeout=setTimeout(()=>{l==null||l(d,y),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,a==null||a(d,y))}}function Pf({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!t&&i&&!r.ctrlKey,a=Fe(r,e);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function Tf({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=rn(r.transform);e.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,e.isZoomingOrPanning=!0,e.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&t(!0),n&&(n==null||n(r.sourceEvent,o))}}function zf({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;e.usedRightMouseButton=!!(n&&_i(t,e.mouseButton??0)),(s=i.sourceEvent)!=null&&s.sync||r([i.transform.x,i.transform.y,i.transform.k]),o&&!((a=i.sourceEvent)!=null&&a.internal)&&(o==null||o(i.sourceEvent,rn(i.transform)))}}function Df({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(e.isZoomingOrPanning=!1,i&&_i(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,r(!1),o)){const c=rn(s.transform);e.prevViewport=c,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,c)},n?150:0)}}}function Lf({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:d}){return u=>{var x;const f=e||t,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Fe(u,`${l}-flow__node`)||Fe(u,`${l}-flow__edge`)))return!0;if(!r&&!f&&!o&&!i&&!n||s||d&&!g||Fe(u,a)&&g||Fe(u,c)&&(!g||o&&g&&!e)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((x=u.touches)==null?void 0:x.length)>1)return u.preventDefault(),!1;if(!f&&!o&&!h&&g||!r&&(u.type==="mousedown"||u.type==="touchstart")||Array.isArray(r)&&!r.includes(u.button)&&u.type==="mousedown")return!1;const y=Array.isArray(r)&&r.includes(u.button)||!u.button||u.button<=1;return(!u.ctrlKey||g)&&y}}function Hf({domNode:e,minZoom:t,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},d=e.getBoundingClientRect(),u=Uo().scaleExtent([t,n]).translateExtent(r),f=ce(e).call(u);b({x:o.x,y:o.y,zoom:Ge(o.zoom,t,n)},[[0,0],[d.width,d.height]],r);const h=f.on("wheel.zoom"),g=f.on("dblclick.zoom");u.wheelDelta(Ei);function y(I,$){return f?new Promise(V=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?it:zt).transform(xn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function x({noWheelClassName:I,noPanClassName:$,onPaneContextMenu:V,userSelectionActive:v,panOnScroll:A,panOnDrag:E,panOnScrollMode:k,panOnScrollSpeed:C,preventScrolling:S,zoomOnPinch:L,zoomOnScroll:R,zoomOnDoubleClick:H,zoomActivationKeyPressed:O,lib:j,onTransformChange:Y,connectionInProgress:U,paneClickDistance:q,selectionOnDrag:F}){v&&!l.isZoomingOrPanning&&m();const W=A&&!O&&!v;u.clickDistance(F?1/0:!de(q)||q<0?0:q);const Q=W?$f({zoomPanValues:l,noWheelClassName:I,d3Selection:f,d3Zoom:u,panOnScrollMode:k,panOnScrollSpeed:C,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Pf({noWheelClassName:I,preventScrolling:S,d3ZoomHandler:h});if(f.on("wheel.zoom",Q,{passive:!1}),!v){const Z=Tf({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});u.on("start",Z);const G=zf({zoomPanValues:l,panOnDrag:E,onPaneContextMenu:!!V,onPanZoom:i,onTransformChange:Y});u.on("zoom",G);const te=Df({zoomPanValues:l,panOnDrag:E,panOnScroll:A,onPaneContextMenu:V,onPanZoomEnd:a,onDraggingChange:c});u.on("end",te)}const K=Lf({zoomActivationKeyPressed:O,panOnDrag:E,zoomOnScroll:R,panOnScroll:A,zoomOnDoubleClick:H,zoomOnPinch:L,userSelectionActive:v,noPanClassName:$,noWheelClassName:I,lib:j,connectionInProgress:U});u.filter(K),H?f.on("dblclick.zoom",g):f.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function b(I,$,V){const v=yn(I),A=u==null?void 0:u.constrain()(v,$,V);return A&&await y(A),new Promise(E=>E(A))}async function p(I,$){const V=yn(I);return await y(V,$),new Promise(v=>v(V))}function w(I){if(f){const $=yn(I),V=f.property("__zoom");(V.k!==I.zoom||V.x!==I.x||V.y!==I.y)&&(u==null||u.transform(f,$,null,{sync:!0}))}}function N(){const I=f?Go(f.node()):{x:0,y:0,k:1};return{x:I.x,y:I.y,zoom:I.k}}function _(I,$){return f?new Promise(V=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?it:zt).scaleTo(xn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function M(I,$){return f?new Promise(V=>{u==null||u.interpolate(($==null?void 0:$.interpolate)==="linear"?it:zt).scaleBy(xn(f,$==null?void 0:$.duration,$==null?void 0:$.ease,()=>V(!0)),I)}):Promise.resolve(!1)}function T(I){u==null||u.scaleExtent(I)}function z(I){u==null||u.translateExtent(I)}function B(I){const $=!de(I)||I<0?0:I;u==null||u.clickDistance($)}return{update:x,destroy:m,setViewport:p,setViewportConstrained:b,getViewport:N,scaleTo:_,scaleBy:M,setScaleExtent:T,setTranslateExtent:z,syncViewport:w,setClickDistance:B}}var Re;(function(e){e.Line="line",e.Handle="handle"})(Re||(Re={}));const Rf=["top-left","top-right","bottom-left","bottom-right"],Vf=["top","right","bottom","left"];function Bf({width:e,prevWidth:t,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=e-t,a=n-r,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Fr(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),r=e.includes("left"),o=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:r,affectsY:o}}function Ne(e,t){return Math.max(0,t-e)}function Me(e,t){return Math.max(0,e-t)}function kt(e,t,n){return Math.max(0,t-e,e-n)}function Or(e,t){return e?!t:t}function Ff(e,t,n,r,o,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:d,isVertical:u}=t,f=d&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:y,maxWidth:x,minHeight:m,maxHeight:b}=r,{x:p,y:w,width:N,height:_,aspectRatio:M}=e;let T=Math.floor(d?h-e.pointerX:0),z=Math.floor(u?g-e.pointerY:0);const B=N+(c?-T:T),I=_+(l?-z:z),$=-i[0]*N,V=-i[1]*_;let v=kt(B,y,x),A=kt(I,m,b);if(s){let C=0,S=0;c&&T<0?C=Ne(p+T+$,s[0][0]):!c&&T>0&&(C=Me(p+B+$,s[1][0])),l&&z<0?S=Ne(w+z+V,s[0][1]):!l&&z>0&&(S=Me(w+I+V,s[1][1])),v=Math.max(v,C),A=Math.max(A,S)}if(a){let C=0,S=0;c&&T>0?C=Me(p+T,a[0][0]):!c&&T<0&&(C=Ne(p+B,a[1][0])),l&&z>0?S=Me(w+z,a[0][1]):!l&&z<0&&(S=Ne(w+I,a[1][1])),v=Math.max(v,C),A=Math.max(A,S)}if(o){if(d){const C=kt(B/M,m,b)*M;if(v=Math.max(v,C),s){let S=0;!c&&!l||c&&!l&&f?S=Me(w+V+B/M,s[1][1])*M:S=Ne(w+V+(c?T:-T)/M,s[0][1])*M,v=Math.max(v,S)}if(a){let S=0;!c&&!l||c&&!l&&f?S=Ne(w+B/M,a[1][1])*M:S=Me(w+(c?T:-T)/M,a[0][1])*M,v=Math.max(v,S)}}if(u){const C=kt(I*M,y,x)/M;if(A=Math.max(A,C),s){let S=0;!c&&!l||l&&!c&&f?S=Me(p+I*M+$,s[1][0])/M:S=Ne(p+(l?z:-z)*M+$,s[0][0])/M,A=Math.max(A,S)}if(a){let S=0;!c&&!l||l&&!c&&f?S=Ne(p+I*M,a[1][0])/M:S=Me(p+(l?z:-z)*M,a[0][0])/M,A=Math.max(A,S)}}}z=z+(z<0?A:-A),T=T+(T<0?v:-v),o&&(f?B>I*M?z=(Or(c,l)?-T:T)/M:T=(Or(c,l)?-z:z)*M:d?(z=T/M,l=c):(T=z*M,c=l));const E=c?p+T:p,k=l?w+z:w;return{width:N+(c?-T:T),height:_+(l?-z:z),x:i[0]*T*(c?-1:1)+E,y:i[1]*z*(l?-1:1)+k}}const Si={width:0,height:0,x:0,y:0},Of={...Si,pointerX:0,pointerY:0,aspectRatio:1};function jf(e){return[[0,0],[e.measured.width,e.measured.height]]}function Xf(e,t,n){const r=t.position.x+e.position.x,o=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[r-a,o-c],[r+i-a,o+s-c]]}function Yf({domNode:e,nodeId:t,getStoreItems:n,onChange:r,onEnd:o}){const i=ce(e);let s={controlDirection:Fr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:d,keepAspectRatio:u,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:y,shouldResize:x}){let m={...Si},b={...Of};s={boundaries:d,resizeDirection:f,keepAspectRatio:u,controlDirection:Fr(l)};let p,w=null,N=[],_,M,T,z=!1;const B=zo().on("start",I=>{const{nodeLookup:$,transform:V,snapGrid:v,snapToGrid:A,nodeOrigin:E,paneDomNode:k}=n();if(p=$.get(t),!p)return;w=(k==null?void 0:k.getBoundingClientRect())??null;const{xSnapped:C,ySnapped:S}=st(I.sourceEvent,{transform:V,snapGrid:v,snapToGrid:A,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},b={...m,pointerX:C,pointerY:S,aspectRatio:m.width/m.height},_=void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(_=$.get(p.parentId),M=_&&p.extent==="parent"?jf(_):void 0),N=[],T=void 0;for(const[L,R]of $)if(R.parentId===t&&(N.push({id:L,position:{...R.position},extent:R.extent}),R.extent==="parent"||R.expandParent)){const H=Xf(R,p,R.origin??E);T?T=[[Math.min(H[0][0],T[0][0]),Math.min(H[0][1],T[0][1])],[Math.max(H[1][0],T[1][0]),Math.max(H[1][1],T[1][1])]]:T=H}h==null||h(I,{...m})}).on("drag",I=>{const{transform:$,snapGrid:V,snapToGrid:v,nodeOrigin:A}=n(),E=st(I.sourceEvent,{transform:$,snapGrid:V,snapToGrid:v,containerBounds:w}),k=[];if(!p)return;const{x:C,y:S,width:L,height:R}=m,H={},O=p.origin??A,{width:j,height:Y,x:U,y:q}=Ff(b,s.controlDirection,E,s.boundaries,s.keepAspectRatio,O,M,T),F=j!==L,W=Y!==R,Q=U!==C&&F,K=q!==S&&W;if(!Q&&!K&&!F&&!W)return;if((Q||K||O[0]===1||O[1]===1)&&(H.x=Q?U:m.x,H.y=K?q:m.y,m.x=H.x,m.y=H.y,N.length>0)){const ne=U-C,ee=q-S;for(const se of N)se.position={x:se.position.x-ne+O[0]*(j-L),y:se.position.y-ee+O[1]*(Y-R)},k.push(se)}if((F||W)&&(H.width=F&&(!s.resizeDirection||s.resizeDirection==="horizontal")?j:m.width,H.height=W&&(!s.resizeDirection||s.resizeDirection==="vertical")?Y:m.height,m.width=H.width,m.height=H.height),_&&p.expandParent){const ne=O[0]*(H.width??0);H.x&&H.x<ne&&(m.x=ne,b.x=b.x-(H.x-ne));const ee=O[1]*(H.height??0);H.y&&H.y<ee&&(m.y=ee,b.y=b.y-(H.y-ee))}const Z=Bf({width:m.width,prevWidth:L,height:m.height,prevHeight:R,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Z};(x==null?void 0:x(I,G))!==!1&&(z=!0,g==null||g(I,G),r(H,k))}).on("end",I=>{z&&(y==null||y(I,{...m}),o==null||o({...m}),z=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var wn={exports:{}},vn={},bn={exports:{}},_n={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var jr;function Wf(){if(jr)return _n;jr=1;var e=wo();function t(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(u,f){var h=f(),g=r({inst:{value:h,getSnapshot:f}}),y=g[0].inst,x=g[1];return i(function(){y.value=h,y.getSnapshot=f,c(y)&&x({inst:y})},[u,h,f]),o(function(){return c(y)&&x({inst:y}),u(function(){c(y)&&x({inst:y})})},[u]),s(h),h}function c(u){var f=u.getSnapshot;u=u.value;try{var h=f();return!n(u,h)}catch{return!0}}function l(u,f){return f()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return _n.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,_n}var Xr;function qf(){return Xr||(Xr=1,bn.exports=Wf()),bn.exports}/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Yr;function Gf(){if(Yr)return vn;Yr=1;var e=wo(),t=qf();function n(l,d){return l===d&&(l!==0||1/l===1/d)||l!==l&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return vn.useSyncExternalStoreWithSelector=function(l,d,u,f,h){var g=i(null);if(g.current===null){var y={hasValue:!1,value:null};g.current=y}else y=g.current;g=a(function(){function m(_){if(!b){if(b=!0,p=_,_=f(_),h!==void 0&&y.hasValue){var M=y.value;if(h(M,_))return w=M}return w=_}if(M=w,r(p,_))return M;var T=f(_);return h!==void 0&&h(M,T)?(p=_,M):(p=_,w=T)}var b=!1,p,w,N=u===void 0?null:u;return[function(){return m(d())},N===null?void 0:function(){return m(N())}]},[d,u,f,h]);var x=o(l,g[0],g[1]);return s(function(){y.hasValue=!0,y.value=x},[x]),c(x),x},vn}var Wr;function Uf(){return Wr||(Wr=1,wn.exports=Gf()),wn.exports}var Zf=Uf();const Kf=ca(Zf),Qf={},qr=e=>{let t;const n=new Set,r=(d,u)=>{const f=typeof d=="function"?d(t):d;if(!Object.is(f,t)){const h=t;t=u??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:d=>(n.add(d),()=>n.delete(d)),destroy:()=>{(Qf?"production":void 0)!=="production"&&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()}},l=t=e(r,o,c);return c},Jf=e=>e?qr(e):qr,{useDebugValue:ed}=ua,{useSyncExternalStoreWithSelector:td}=Kf,nd=e=>e;function Ni(e,t=nd,n){const r=td(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return ed(r),r}const Gr=(e,t)=>{const n=Jf(e),r=(o,i=t)=>Ni(n,o,i);return Object.assign(r,n),r},rd=(e,t)=>e?Gr(e,t):Gr;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[r,o]of e)if(!Object.is(o,t.get(r)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Object.is(e[r],t[r]))return!1;return!0}const on=D.createContext(null),od=on.Provider,Mi=ye.error001();function J(e,t){const n=D.useContext(on);if(n===null)throw new Error(Mi);return Ni(n,e,t)}function oe(){const e=D.useContext(on);if(e===null)throw new Error(Mi);return D.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Ur={display:"none"},id={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Ci="react-flow__node-desc",Ii="react-flow__edge-desc",sd="react-flow__aria-live",ad=e=>e.ariaLiveMessage,cd=e=>e.ariaLabelConfig;function ud({rfId:e}){const t=J(ad);return P.jsx("div",{id:`${sd}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:id,children:t})}function ld({rfId:e,disableKeyboardA11y:t}){const n=J(cd);return P.jsxs(P.Fragment,{children:[P.jsx("div",{id:`${Ci}-${e}`,style:Ur,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),P.jsx("div",{id:`${Ii}-${e}`,style:Ur,children:n["edge.a11yDescription.default"]}),!t&&P.jsx(ud,{rfId:e})]})}const sn=D.forwardRef(({position:e="top-left",children:t,className:n,style:r,...o},i)=>{const s=`${e}`.split("-");return P.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:r,ref:i,...o,children:t})});sn.displayName="Panel";function fd({proOptions:e,position:t="bottom-right"}){return e!=null&&e.hideAttribution?null:P.jsx(sn,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:P.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const dd=e=>{const t=[],n=[];for(const[,r]of e.nodeLookup)r.selected&&t.push(r.internals.userNode);for(const[,r]of e.edgeLookup)r.selected&&n.push(r);return{selectedNodes:t,selectedEdges:n}},$t=e=>e.id;function hd(e,t){return re(e.selectedNodes.map($t),t.selectedNodes.map($t))&&re(e.selectedEdges.map($t),t.selectedEdges.map($t))}function gd({onSelectionChange:e}){const t=oe(),{selectedNodes:n,selectedEdges:r}=J(dd,hd);return D.useEffect(()=>{const o={nodes:n,edges:r};e==null||e(o),t.getState().onSelectionChangeHandlers.forEach(i=>i(o))},[n,r,e]),null}const pd=e=>!!e.onSelectionChangeHandlers;function md({onSelectionChange:e}){const t=J(pd);return e||t?P.jsx(gd,{onSelectionChange:e}):null}const Ai=[0,0],yd={x:0,y:0,zoom:1},xd=["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","ariaLabelConfig","zIndexMode"],Zr=[...xd,"rfId"],wd=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}),Kr={translateExtent:ft,nodeOrigin:Ai,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function vd(e){const{setNodes:t,setEdges:n,setMinZoom:r,setMaxZoom:o,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=J(wd,re),l=oe();D.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{d.current=Kr,a()}),[]);const d=D.useRef(Kr);return D.useEffect(()=>{for(const u of Zr){const f=e[u],h=d.current[u];f!==h&&(typeof e[u]>"u"||(u==="nodes"?t(f):u==="edges"?n(f):u==="minZoom"?r(f):u==="maxZoom"?o(f):u==="translateExtent"?i(f):u==="nodeExtent"?s(f):u==="ariaLabelConfig"?l.setState({ariaLabelConfig:ef(f)}):u==="fitView"?l.setState({fitViewQueued:f}):u==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[u]:f})))}d.current=e},Zr.map(u=>e[u])),null}function Qr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function bd(e){var r;const[t,n]=D.useState(e==="system"?null:e);return D.useEffect(()=>{if(e!=="system"){n(e);return}const o=Qr(),i=()=>n(o!=null&&o.matches?"dark":"light");return i(),o==null||o.addEventListener("change",i),()=>{o==null||o.removeEventListener("change",i)}},[e]),t!==null?t:(r=Qr())!=null&&r.matches?"dark":"light"}const Jr=typeof document<"u"?document:null;function pt(e=null,t={target:Jr,actInsideInputWithModifier:!0}){const[n,r]=D.useState(!1),o=D.useRef(!1),i=D.useRef(new Set([])),[s,a]=D.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(u=>typeof u=="string").map(u=>u.replace("+",`
|
|
18
|
+
`).replace(`
|
|
19
|
+
|
|
20
|
+
`,`
|
|
21
|
+
+`).split(`
|
|
22
|
+
`)),d=l.reduce((u,f)=>u.concat(...f),[]);return[l,d]}return[[],[]]},[e]);return D.useEffect(()=>{const c=(t==null?void 0:t.target)??Jr,l=(t==null?void 0:t.actInsideInputWithModifier)??!0;if(e!==null){const d=h=>{var x,m;if(o.current=h.ctrlKey||h.metaKey||h.shiftKey||h.altKey,(!o.current||o.current&&!l)&&ci(h))return!1;const y=to(h.code,a);if(i.current.add(h[y]),eo(s,i.current,!1)){const b=((m=(x=h.composedPath)==null?void 0:x.call(h))==null?void 0:m[0])||h.target,p=(b==null?void 0:b.nodeName)==="BUTTON"||(b==null?void 0:b.nodeName)==="A";t.preventDefault!==!1&&(o.current||!p)&&h.preventDefault(),r(!0)}},u=h=>{const g=to(h.code,a);eo(s,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(h[g]),h.key==="Meta"&&i.current.clear(),o.current=!1},f=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",d),c==null||c.addEventListener("keyup",u),window.addEventListener("blur",f),window.addEventListener("contextmenu",f),()=>{c==null||c.removeEventListener("keydown",d),c==null||c.removeEventListener("keyup",u),window.removeEventListener("blur",f),window.removeEventListener("contextmenu",f)}}},[e,r]),n}function eo(e,t,n){return e.filter(r=>n||r.length===t.size).some(r=>r.every(o=>t.has(o)))}function to(e,t){return t.includes(e)?"code":"key"}const _d=()=>{const e=oe();return D.useMemo(()=>({zoomIn:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:n}=e.getState();return n?n.scaleBy(1/1.2,{duration:t==null?void 0:t.duration}):Promise.resolve(!1)},zoomTo:(t,n)=>{const{panZoom:r}=e.getState();return r?r.scaleTo(t,{duration:n==null?void 0:n.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,n)=>{const{transform:[r,o,i],panZoom:s}=e.getState();return s?(await s.setViewport({x:t.x??r,y:t.y??o,zoom:t.zoom??i},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,n,r]=e.getState().transform;return{x:t,y:n,zoom:r}},setCenter:async(t,n,r)=>e.getState().setCenter(t,n,r),fitBounds:async(t,n)=>{const{width:r,height:o,minZoom:i,maxZoom:s,panZoom:a}=e.getState(),c=Gn(t,r,o,i,s,(n==null?void 0:n.padding)??.1);return a?(await a.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,n={})=>{const{transform:r,snapGrid:o,snapToGrid:i,domNode:s}=e.getState();if(!s)return t;const{x:a,y:c}=s.getBoundingClientRect(),l={x:t.x-a,y:t.y-c},d=n.snapGrid??o,u=n.snapToGrid??i;return bt(l,r,u,d)},flowToScreenPosition:t=>{const{transform:n,domNode:r}=e.getState();if(!r)return t;const{x:o,y:i}=r.getBoundingClientRect(),s=qt(t,n);return{x:s.x+o,y:s.y+i}}}),[])};function ki(e,t){const n=[],r=new Map,o=[];for(const i of e)if(i.type==="add"){o.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const s=r.get(i.id);s?s.push(i):r.set(i.id,[i])}for(const i of t){const s=r.get(i.id);if(!s){n.push(i);continue}if(s[0].type==="remove")continue;if(s[0].type==="replace"){n.push({...s[0].item});continue}const a={...i};for(const c of s)Ed(c,a);n.push(a)}return o.length&&o.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function Ed(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function $i(e,t){return ki(e,t)}function Sd(e,t){return ki(e,t)}function ke(e,t){return{id:e,type:"select",selected:t}}function Oe(e,t=new Set,n=!1){const r=[];for(const[o,i]of e){const s=t.has(o);!(i.selected===void 0&&!s)&&i.selected!==s&&(n&&(i.selected=s),r.push(ke(i.id,s)))}return r}function no({items:e=[],lookup:t}){var o;const n=[],r=new Map(e.map(i=>[i.id,i]));for(const[i,s]of e.entries()){const a=t.get(s.id),c=((o=a==null?void 0:a.internals)==null?void 0:o.userNode)??a;c!==void 0&&c!==s&&n.push({id:s.id,item:s,type:"replace"}),c===void 0&&n.push({item:s,type:"add",index:i})}for(const[i]of t)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function ro(e){return{id:e.id,type:"remove"}}const oo=e=>Xl(e),Nd=e=>ei(e);function Pi(e){return D.forwardRef(e)}const Md=typeof window<"u"?D.useLayoutEffect:D.useEffect;function io(e){const[t,n]=D.useState(BigInt(0)),[r]=D.useState(()=>Cd(()=>n(o=>o+BigInt(1))));return Md(()=>{const o=r.get();o.length&&(e(o),r.reset())},[t]),r}function Cd(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:n=>{t.push(n),e()}}}const Ti=D.createContext(null);function Id({children:e}){const t=oe(),n=D.useCallback(a=>{const{nodes:c=[],setNodes:l,hasDefaultNodes:d,onNodesChange:u,nodeLookup:f,fitViewQueued:h,onNodesChangeMiddlewareMap:g}=t.getState();let y=c;for(const m of a)y=typeof m=="function"?m(y):m;let x=no({items:y,lookup:f});for(const m of g.values())x=m(x);d&&l(y),x.length>0?u==null||u(x):h&&window.requestAnimationFrame(()=>{const{fitViewQueued:m,nodes:b,setNodes:p}=t.getState();m&&p(b)})},[]),r=io(n),o=D.useCallback(a=>{const{edges:c=[],setEdges:l,hasDefaultEdges:d,onEdgesChange:u,edgeLookup:f}=t.getState();let h=c;for(const g of a)h=typeof g=="function"?g(h):g;d?l(h):u&&u(no({items:h,lookup:f}))},[]),i=io(o),s=D.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return P.jsx(Ti.Provider,{value:s,children:e})}function Ad(){const e=D.useContext(Ti);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const kd=e=>!!e.panZoom;function tr(){const e=_d(),t=oe(),n=Ad(),r=J(kd),o=D.useMemo(()=>{const i=u=>t.getState().nodeLookup.get(u),s=u=>{n.nodeQueue.push(u)},a=u=>{n.edgeQueue.push(u)},c=u=>{var m,b;const{nodeLookup:f,nodeOrigin:h}=t.getState(),g=oo(u)?u:f.get(u.id),y=g.parentId?si(g.position,g.measured,g.parentId,f,h):g.position,x={...g,position:y,width:((m=g.measured)==null?void 0:m.width)??g.width,height:((b=g.measured)==null?void 0:b.height)??g.height};return Ue(x)},l=(u,f,h={replace:!1})=>{s(g=>g.map(y=>{if(y.id===u){const x=typeof f=="function"?f(y):f;return h.replace&&oo(x)?x:{...y,...x}}return y}))},d=(u,f,h={replace:!1})=>{a(g=>g.map(y=>{if(y.id===u){const x=typeof f=="function"?f(y):f;return h.replace&&Nd(x)?x:{...y,...x}}return y}))};return{getNodes:()=>t.getState().nodes.map(u=>({...u})),getNode:u=>{var f;return(f=i(u))==null?void 0:f.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:u=[]}=t.getState();return u.map(f=>({...f}))},getEdge:u=>t.getState().edgeLookup.get(u),setNodes:s,setEdges:a,addNodes:u=>{const f=Array.isArray(u)?u:[u];n.nodeQueue.push(h=>[...h,...f])},addEdges:u=>{const f=Array.isArray(u)?u:[u];n.edgeQueue.push(h=>[...h,...f])},toObject:()=>{const{nodes:u=[],edges:f=[],transform:h}=t.getState(),[g,y,x]=h;return{nodes:u.map(m=>({...m})),edges:f.map(m=>({...m})),viewport:{x:g,y,zoom:x}}},deleteElements:async({nodes:u=[],edges:f=[]})=>{const{nodes:h,edges:g,onNodesDelete:y,onEdgesDelete:x,triggerNodeChanges:m,triggerEdgeChanges:b,onDelete:p,onBeforeDelete:w}=t.getState(),{nodes:N,edges:_}=await Ul({nodesToRemove:u,edgesToRemove:f,nodes:h,edges:g,onBeforeDelete:w}),M=_.length>0,T=N.length>0;if(M){const z=_.map(ro);x==null||x(_),b(z)}if(T){const z=N.map(ro);y==null||y(N),m(z)}return(T||M)&&(p==null||p({nodes:N,edges:_})),{deletedNodes:N,deletedEdges:_}},getIntersectingNodes:(u,f=!0,h)=>{const g=kr(u),y=g?u:c(u),x=h!==void 0;return y?(h||t.getState().nodes).filter(m=>{const b=t.getState().nodeLookup.get(m.id);if(b&&!g&&(m.id===u.id||!b.internals.positionAbsolute))return!1;const p=Ue(x?m:b),w=ht(p,y);return f&&w>0||w>=p.width*p.height||w>=y.width*y.height}):[]},isNodeIntersecting:(u,f,h=!0)=>{const y=kr(u)?u:c(u);if(!y)return!1;const x=ht(y,f);return h&&x>0||x>=f.width*f.height||x>=y.width*y.height},updateNode:l,updateNodeData:(u,f,h={replace:!1})=>{l(u,g=>{const y=typeof f=="function"?f(g):f;return h.replace?{...g,data:y}:{...g,data:{...g.data,...y}}},h)},updateEdge:d,updateEdgeData:(u,f,h={replace:!1})=>{d(u,g=>{const y=typeof f=="function"?f(g):f;return h.replace?{...g,data:y}:{...g,data:{...g.data,...y}}},h)},getNodesBounds:u=>{const{nodeLookup:f,nodeOrigin:h}=t.getState();return Yl(u,{nodeLookup:f,nodeOrigin:h})},getHandleConnections:({type:u,id:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}-${u}${f?`-${f}`:""}`))==null?void 0:g.values())??[])},getNodeConnections:({type:u,handleId:f,nodeId:h})=>{var g;return Array.from(((g=t.getState().connectionLookup.get(`${h}${u?f?`-${u}-${f}`:`-${u}`:""}`))==null?void 0:g.values())??[])},fitView:async u=>{const f=t.getState().fitViewResolver??Jl();return t.setState({fitViewQueued:!0,fitViewOptions:u,fitViewResolver:f}),n.nodeQueue.push(h=>[...h]),f.promise}}},[]);return D.useMemo(()=>({...o,...e,viewportInitialized:r}),[r])}const so=e=>e.selected,$d=typeof window<"u"?window:void 0;function Pd({deleteKeyCode:e,multiSelectionKeyCode:t}){const n=oe(),{deleteElements:r}=tr(),o=pt(e,{actInsideInputWithModifier:!1}),i=pt(t,{target:$d});D.useEffect(()=>{if(o){const{edges:s,nodes:a}=n.getState();r({nodes:a.filter(so),edges:s.filter(so)}),n.setState({nodesSelectionActive:!1})}},[o]),D.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Td(e){const t=oe();D.useEffect(()=>{const n=()=>{var o,i,s,a;if(!e.current||!(((i=(o=e.current).checkVisibility)==null?void 0:i.call(o))??!0))return!1;const r=Un(e.current);(r.height===0||r.width===0)&&((a=(s=t.getState()).onError)==null||a.call(s,"004",ye.error004())),t.setState({width:r.width||500,height:r.height||500})};if(e.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(e.current),()=>{window.removeEventListener("resize",n),r&&e.current&&r.unobserve(e.current)}}},[])}const an={position:"absolute",width:"100%",height:"100%",top:0,left:0},zd=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function Dd({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:o=.5,panOnScrollMode:i=Te.Free,zoomOnDoubleClick:s=!0,panOnDrag:a=!0,defaultViewport:c,translateExtent:l,minZoom:d,maxZoom:u,zoomActivationKeyCode:f,preventScrolling:h=!0,children:g,noWheelClassName:y,noPanClassName:x,onViewportChange:m,isControlledViewport:b,paneClickDistance:p,selectionOnDrag:w}){const N=oe(),_=D.useRef(null),{userSelectionActive:M,lib:T,connectionInProgress:z}=J(zd,re),B=pt(f),I=D.useRef();Td(_);const $=D.useCallback(V=>{m==null||m({x:V[0],y:V[1],zoom:V[2]}),b||N.setState({transform:V})},[m,b]);return D.useEffect(()=>{if(_.current){I.current=Hf({domNode:_.current,minZoom:d,maxZoom:u,translateExtent:l,viewport:c,onDraggingChange:E=>N.setState(k=>k.paneDragging===E?k:{paneDragging:E}),onPanZoomStart:(E,k)=>{const{onViewportChangeStart:C,onMoveStart:S}=N.getState();S==null||S(E,k),C==null||C(k)},onPanZoom:(E,k)=>{const{onViewportChange:C,onMove:S}=N.getState();S==null||S(E,k),C==null||C(k)},onPanZoomEnd:(E,k)=>{const{onViewportChangeEnd:C,onMoveEnd:S}=N.getState();S==null||S(E,k),C==null||C(k)}});const{x:V,y:v,zoom:A}=I.current.getViewport();return N.setState({panZoom:I.current,transform:[V,v,A],domNode:_.current.closest(".react-flow")}),()=>{var E;(E=I.current)==null||E.destroy()}}},[]),D.useEffect(()=>{var V;(V=I.current)==null||V.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:o,panOnScrollMode:i,zoomOnDoubleClick:s,panOnDrag:a,zoomActivationKeyPressed:B,preventScrolling:h,noPanClassName:x,userSelectionActive:M,noWheelClassName:y,lib:T,onTransformChange:$,connectionInProgress:z,selectionOnDrag:w,paneClickDistance:p})},[e,t,n,r,o,i,s,a,B,h,x,M,y,T,$,z,w,p]),P.jsx("div",{className:"react-flow__renderer",ref:_,style:an,children:g})}const Ld=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function Hd(){const{userSelectionActive:e,userSelectionRect:t}=J(Ld,re);return e&&t?P.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const En=(e,t)=>n=>{n.target===t.current&&(e==null||e(n))},Rd=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function Vd({isSelecting:e,selectionKeyPressed:t,selectionMode:n=dt.Full,panOnDrag:r,paneClickDistance:o,selectionOnDrag:i,onSelectionStart:s,onSelectionEnd:a,onPaneClick:c,onPaneContextMenu:l,onPaneScroll:d,onPaneMouseEnter:u,onPaneMouseMove:f,onPaneMouseLeave:h,children:g}){const y=oe(),{userSelectionActive:x,elementsSelectable:m,dragging:b,connectionInProgress:p}=J(Rd,re),w=m&&(e||x),N=D.useRef(null),_=D.useRef(),M=D.useRef(new Set),T=D.useRef(new Set),z=D.useRef(!1),B=C=>{if(z.current||p){z.current=!1;return}c==null||c(C),y.getState().resetSelectedElements(),y.setState({nodesSelectionActive:!1})},I=C=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){C.preventDefault();return}l==null||l(C)},$=d?C=>d(C):void 0,V=C=>{z.current&&(C.stopPropagation(),z.current=!1)},v=C=>{var Y,U;const{domNode:S}=y.getState();if(_.current=S==null?void 0:S.getBoundingClientRect(),!_.current)return;const L=C.target===N.current;if(!L&&!!C.target.closest(".nokey")||!e||!(i&&L||t)||C.button!==0||!C.isPrimary)return;(U=(Y=C.target)==null?void 0:Y.setPointerCapture)==null||U.call(Y,C.pointerId),z.current=!1;const{x:O,y:j}=he(C.nativeEvent,_.current);y.setState({userSelectionRect:{width:0,height:0,startX:O,startY:j,x:O,y:j}}),L||(C.stopPropagation(),C.preventDefault())},A=C=>{const{userSelectionRect:S,transform:L,nodeLookup:R,edgeLookup:H,connectionLookup:O,triggerNodeChanges:j,triggerEdgeChanges:Y,defaultEdgeOptions:U,resetSelectedElements:q}=y.getState();if(!_.current||!S)return;const{x:F,y:W}=he(C.nativeEvent,_.current),{startX:Q,startY:K}=S;if(!z.current){const ee=t?0:o;if(Math.hypot(F-Q,W-K)<=ee)return;q(),s==null||s(C)}z.current=!0;const Z={startX:Q,startY:K,x:F<Q?F:Q,y:W<K?W:K,width:Math.abs(F-Q),height:Math.abs(W-K)},G=M.current,te=T.current;M.current=new Set(qn(R,Z,L,n===dt.Partial,!0).map(ee=>ee.id)),T.current=new Set;const ne=(U==null?void 0:U.selectable)??!0;for(const ee of M.current){const se=O.get(ee);if(se)for(const{edgeId:Se}of se.values()){const we=H.get(Se);we&&(we.selectable??ne)&&T.current.add(Se)}}if(!$r(G,M.current)){const ee=Oe(R,M.current,!0);j(ee)}if(!$r(te,T.current)){const ee=Oe(H,T.current);Y(ee)}y.setState({userSelectionRect:Z,userSelectionActive:!0,nodesSelectionActive:!1})},E=C=>{var S,L;C.button===0&&((L=(S=C.target)==null?void 0:S.releasePointerCapture)==null||L.call(S,C.pointerId),!x&&C.target===N.current&&y.getState().userSelectionRect&&(B==null||B(C)),y.setState({userSelectionActive:!1,userSelectionRect:null}),z.current&&(a==null||a(C),y.setState({nodesSelectionActive:M.current.size>0})))},k=r===!0||Array.isArray(r)&&r.includes(0);return P.jsxs("div",{className:ie(["react-flow__pane",{draggable:k,dragging:b,selection:e}]),onClick:w?void 0:En(B,N),onContextMenu:En(I,N),onWheel:En($,N),onPointerEnter:w?void 0:u,onPointerMove:w?A:f,onPointerUp:w?E:void 0,onPointerDownCapture:w?v:void 0,onClickCapture:w?V:void 0,onPointerLeave:h,ref:N,style:an,children:[g,P.jsx(Hd,{})]})}function Rn({id:e,store:t,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:o,unselectNodesAndEdges:i,multiSelectionActive:s,nodeLookup:a,onError:c}=t.getState(),l=a.get(e);if(!l){c==null||c("012",ye.error012(e));return}t.setState({nodesSelectionActive:!1}),l.selected?(n||l.selected&&s)&&(i({nodes:[l],edges:[]}),requestAnimationFrame(()=>{var d;return(d=r==null?void 0:r.current)==null?void 0:d.blur()})):o([e])}function zi({nodeRef:e,disabled:t=!1,noDragClassName:n,handleSelector:r,nodeId:o,isSelectable:i,nodeClickDistance:s}){const a=oe(),[c,l]=D.useState(!1),d=D.useRef();return D.useEffect(()=>{d.current=Ef({getStoreItems:()=>a.getState(),onNodeMouseDown:u=>{Rn({id:u,store:a,nodeRef:e})},onDragStart:()=>{l(!0)},onDragStop:()=>{l(!1)}})},[]),D.useEffect(()=>{if(!(t||!e.current||!d.current))return d.current.update({noDragClassName:n,handleSelector:r,domNode:e.current,isSelectable:i,nodeId:o,nodeClickDistance:s}),()=>{var u;(u=d.current)==null||u.destroy()}},[n,r,t,i,e,o,s]),c}const Bd=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Di(){const e=oe();return D.useCallback(n=>{const{nodeExtent:r,snapToGrid:o,snapGrid:i,nodesDraggable:s,onError:a,updateNodePositions:c,nodeLookup:l,nodeOrigin:d}=e.getState(),u=new Map,f=Bd(s),h=o?i[0]:5,g=o?i[1]:5,y=n.direction.x*h*n.factor,x=n.direction.y*g*n.factor;for(const[,m]of l){if(!f(m))continue;let b={x:m.internals.positionAbsolute.x+y,y:m.internals.positionAbsolute.y+x};o&&(b=vt(b,i));const{position:p,positionAbsolute:w}=ti({nodeId:m.id,nextPosition:b,nodeLookup:l,nodeExtent:r,nodeOrigin:d,onError:a});m.position=p,m.internals.positionAbsolute=w,u.set(m.id,m)}c(u)},[])}const nr=D.createContext(null),Fd=nr.Provider;nr.Consumer;const Li=()=>D.useContext(nr),Od=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),jd=(e,t,n)=>r=>{const{connectionClickStartHandle:o,connectionMode:i,connection:s}=r,{fromHandle:a,toHandle:c,isValid:l}=s,d=(c==null?void 0:c.nodeId)===e&&(c==null?void 0:c.id)===t&&(c==null?void 0:c.type)===n;return{connectingFrom:(a==null?void 0:a.nodeId)===e&&(a==null?void 0:a.id)===t&&(a==null?void 0:a.type)===n,connectingTo:d,clickConnecting:(o==null?void 0:o.nodeId)===e&&(o==null?void 0:o.id)===t&&(o==null?void 0:o.type)===n,isPossibleEndHandle:i===qe.Strict?(a==null?void 0:a.type)!==n:e!==(a==null?void 0:a.nodeId)||t!==(a==null?void 0:a.id),connectionInProcess:!!a,clickConnectionInProcess:!!o,valid:d&&l}};function Xd({type:e="source",position:t=X.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:o=!0,isConnectableEnd:i=!0,id:s,onConnect:a,children:c,className:l,onMouseDown:d,onTouchStart:u,...f},h){var A,E;const g=s||null,y=e==="target",x=oe(),m=Li(),{connectOnClick:b,noPanClassName:p,rfId:w}=J(Od,re),{connectingFrom:N,connectingTo:_,clickConnecting:M,isPossibleEndHandle:T,connectionInProcess:z,clickConnectionInProcess:B,valid:I}=J(jd(m,g,e),re);m||(E=(A=x.getState()).onError)==null||E.call(A,"010",ye.error010());const $=k=>{const{defaultEdgeOptions:C,onConnect:S,hasDefaultEdges:L}=x.getState(),R={...C,...k};if(L){const{edges:H,setEdges:O}=x.getState();O(af(R,H))}S==null||S(R),a==null||a(R)},V=k=>{if(!m)return;const C=ui(k.nativeEvent);if(o&&(C&&k.button===0||!C)){const S=x.getState();Hn.onPointerDown(k.nativeEvent,{handleDomNode:k.currentTarget,autoPanOnConnect:S.autoPanOnConnect,connectionMode:S.connectionMode,connectionRadius:S.connectionRadius,domNode:S.domNode,nodeLookup:S.nodeLookup,lib:S.lib,isTarget:y,handleId:g,nodeId:m,flowId:S.rfId,panBy:S.panBy,cancelConnection:S.cancelConnection,onConnectStart:S.onConnectStart,onConnectEnd:(...L)=>{var R,H;return(H=(R=x.getState()).onConnectEnd)==null?void 0:H.call(R,...L)},updateConnection:S.updateConnection,onConnect:$,isValidConnection:n||((...L)=>{var R,H;return((H=(R=x.getState()).isValidConnection)==null?void 0:H.call(R,...L))??!0}),getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,autoPanSpeed:S.autoPanSpeed,dragThreshold:S.connectionDragThreshold})}C?d==null||d(k):u==null||u(k)},v=k=>{const{onClickConnectStart:C,onClickConnectEnd:S,connectionClickStartHandle:L,connectionMode:R,isValidConnection:H,lib:O,rfId:j,nodeLookup:Y,connection:U}=x.getState();if(!m||!L&&!o)return;if(!L){C==null||C(k.nativeEvent,{nodeId:m,handleId:g,handleType:e}),x.setState({connectionClickStartHandle:{nodeId:m,type:e,id:g}});return}const q=ai(k.target),F=n||H,{connection:W,isValid:Q}=Hn.isValid(k.nativeEvent,{handle:{nodeId:m,id:g,type:e},connectionMode:R,fromNodeId:L.nodeId,fromHandleId:L.id||null,fromType:L.type,isValidConnection:F,flowId:j,doc:q,lib:O,nodeLookup:Y});Q&&W&&$(W);const K=structuredClone(U);delete K.inProgress,K.toPosition=K.toHandle?K.toHandle.position:null,S==null||S(k,K),x.setState({connectionClickStartHandle:null})};return P.jsx("div",{"data-handleid":g,"data-nodeid":m,"data-handlepos":t,"data-id":`${w}-${m}-${g}-${e}`,className:ie(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",p,l,{source:!y,target:y,connectable:r,connectablestart:o,connectableend:i,clickconnecting:M,connectingfrom:N,connectingto:_,valid:I,connectionindicator:r&&(!z||T)&&(z||B?i:o)}]),onMouseDown:V,onTouchStart:V,onClick:b?v:void 0,ref:h,...f,children:c})}const Gt=D.memo(Pi(Xd));function Yd({data:e,isConnectable:t,sourcePosition:n=X.Bottom}){return P.jsxs(P.Fragment,{children:[e==null?void 0:e.label,P.jsx(Gt,{type:"source",position:n,isConnectable:t})]})}function Wd({data:e,isConnectable:t,targetPosition:n=X.Top,sourcePosition:r=X.Bottom}){return P.jsxs(P.Fragment,{children:[P.jsx(Gt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label,P.jsx(Gt,{type:"source",position:r,isConnectable:t})]})}function qd(){return null}function Gd({data:e,isConnectable:t,targetPosition:n=X.Top}){return P.jsxs(P.Fragment,{children:[P.jsx(Gt,{type:"target",position:n,isConnectable:t}),e==null?void 0:e.label]})}const Ut={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},ao={input:Yd,default:Wd,output:Gd,group:qd};function Ud(e){var t,n,r,o;return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??((t=e.style)==null?void 0:t.width),height:e.height??e.initialHeight??((n=e.style)==null?void 0:n.height)}:{width:e.width??((r=e.style)==null?void 0:r.width),height:e.height??((o=e.style)==null?void 0:o.height)}}const Zd=e=>{const{width:t,height:n,x:r,y:o}=wt(e.nodeLookup,{filter:i=>!!i.selected});return{width:de(t)?t:null,height:de(n)?n:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${r}px,${o}px)`}};function Kd({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:n}){const r=oe(),{width:o,height:i,transformString:s,userSelectionActive:a}=J(Zd,re),c=Di(),l=D.useRef(null);D.useEffect(()=>{var h;n||(h=l.current)==null||h.focus({preventScroll:!0})},[n]);const d=!a&&o!==null&&i!==null;if(zi({nodeRef:l,disabled:!d}),!d)return null;const u=e?h=>{const g=r.getState().nodes.filter(y=>y.selected);e(h,g)}:void 0,f=h=>{Object.prototype.hasOwnProperty.call(Ut,h.key)&&(h.preventDefault(),c({direction:Ut[h.key],factor:h.shiftKey?4:1}))};return P.jsx("div",{className:ie(["react-flow__nodesselection","react-flow__container",t]),style:{transform:s},children:P.jsx("div",{ref:l,className:"react-flow__nodesselection-rect",onContextMenu:u,tabIndex:n?void 0:-1,onKeyDown:n?void 0:f,style:{width:o,height:i}})})}const co=typeof window<"u"?window:void 0,Qd=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Hi({children:e,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,paneClickDistance:a,deleteKeyCode:c,selectionKeyCode:l,selectionOnDrag:d,selectionMode:u,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:g,panActivationKeyCode:y,zoomActivationKeyCode:x,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:w,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:T,defaultViewport:z,translateExtent:B,minZoom:I,maxZoom:$,preventScrolling:V,onSelectionContextMenu:v,noWheelClassName:A,noPanClassName:E,disableKeyboardA11y:k,onViewportChange:C,isControlledViewport:S}){const{nodesSelectionActive:L,userSelectionActive:R}=J(Qd,re),H=pt(l,{target:co}),O=pt(y,{target:co}),j=O||T,Y=O||w,U=d&&j!==!0,q=H||R||U;return Pd({deleteKeyCode:c,multiSelectionKeyCode:g}),P.jsx(Dd,{onPaneContextMenu:i,elementsSelectable:m,zoomOnScroll:b,zoomOnPinch:p,panOnScroll:Y,panOnScrollSpeed:N,panOnScrollMode:_,zoomOnDoubleClick:M,panOnDrag:!H&&j,defaultViewport:z,translateExtent:B,minZoom:I,maxZoom:$,zoomActivationKeyCode:x,preventScrolling:V,noWheelClassName:A,noPanClassName:E,onViewportChange:C,isControlledViewport:S,paneClickDistance:a,selectionOnDrag:U,children:P.jsxs(Vd,{onSelectionStart:f,onSelectionEnd:h,onPaneClick:t,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:o,onPaneContextMenu:i,onPaneScroll:s,panOnDrag:j,isSelecting:!!q,selectionMode:u,selectionKeyPressed:H,paneClickDistance:a,selectionOnDrag:U,children:[e,L&&P.jsx(Kd,{onSelectionContextMenu:v,noPanClassName:E,disableKeyboardA11y:k})]})})}Hi.displayName="FlowRenderer";const Jd=D.memo(Hi),eh=e=>t=>e?qn(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(n=>n.id):Array.from(t.nodeLookup.keys());function th(e){return J(D.useCallback(eh(e),[e]),re)}const nh=e=>e.updateNodeInternals;function rh(){const e=J(nh),[t]=D.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(o=>{const i=o.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:o.target,force:!0})}),e(r)}));return D.useEffect(()=>()=>{t==null||t.disconnect()},[t]),t}function oh({node:e,nodeType:t,hasDimensions:n,resizeObserver:r}){const o=oe(),i=D.useRef(null),s=D.useRef(null),a=D.useRef(e.sourcePosition),c=D.useRef(e.targetPosition),l=D.useRef(t),d=n&&!!e.internals.handleBounds;return D.useEffect(()=>{i.current&&!e.hidden&&(!d||s.current!==i.current)&&(s.current&&(r==null||r.unobserve(s.current)),r==null||r.observe(i.current),s.current=i.current)},[d,e.hidden]),D.useEffect(()=>()=>{s.current&&(r==null||r.unobserve(s.current),s.current=null)},[]),D.useEffect(()=>{if(i.current){const u=l.current!==t,f=a.current!==e.sourcePosition,h=c.current!==e.targetPosition;(u||f||h)&&(l.current=t,a.current=e.sourcePosition,c.current=e.targetPosition,o.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:i.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),i}function ih({id:e,onClick:t,onMouseEnter:n,onMouseMove:r,onMouseLeave:o,onContextMenu:i,onDoubleClick:s,nodesDraggable:a,elementsSelectable:c,nodesConnectable:l,nodesFocusable:d,resizeObserver:u,noDragClassName:f,noPanClassName:h,disableKeyboardA11y:g,rfId:y,nodeTypes:x,nodeClickDistance:m,onError:b}){const{node:p,internals:w,isParent:N}=J(F=>{const W=F.nodeLookup.get(e),Q=F.parentLookup.has(e);return{node:W,internals:W.internals,isParent:Q}},re);let _=p.type||"default",M=(x==null?void 0:x[_])||ao[_];M===void 0&&(b==null||b("003",ye.error003(_)),_="default",M=(x==null?void 0:x.default)||ao.default);const T=!!(p.draggable||a&&typeof p.draggable>"u"),z=!!(p.selectable||c&&typeof p.selectable>"u"),B=!!(p.connectable||l&&typeof p.connectable>"u"),I=!!(p.focusable||d&&typeof p.focusable>"u"),$=oe(),V=ii(p),v=oh({node:p,nodeType:_,hasDimensions:V,resizeObserver:u}),A=zi({nodeRef:v,disabled:p.hidden||!T,noDragClassName:f,handleSelector:p.dragHandle,nodeId:e,isSelectable:z,nodeClickDistance:m}),E=Di();if(p.hidden)return null;const k=Ee(p),C=Ud(p),S=z||T||t||n||r||o,L=n?F=>n(F,{...w.userNode}):void 0,R=r?F=>r(F,{...w.userNode}):void 0,H=o?F=>o(F,{...w.userNode}):void 0,O=i?F=>i(F,{...w.userNode}):void 0,j=s?F=>s(F,{...w.userNode}):void 0,Y=F=>{const{selectNodesOnDrag:W,nodeDragThreshold:Q}=$.getState();z&&(!W||!T||Q>0)&&Rn({id:e,store:$,nodeRef:v}),t&&t(F,{...w.userNode})},U=F=>{if(!(ci(F.nativeEvent)||g)){if(Zo.includes(F.key)&&z){const W=F.key==="Escape";Rn({id:e,store:$,unselect:W,nodeRef:v})}else if(T&&p.selected&&Object.prototype.hasOwnProperty.call(Ut,F.key)){F.preventDefault();const{ariaLabelConfig:W}=$.getState();$.setState({ariaLiveMessage:W["node.a11yDescription.ariaLiveMessage"]({direction:F.key.replace("Arrow","").toLowerCase(),x:~~w.positionAbsolute.x,y:~~w.positionAbsolute.y})}),E({direction:Ut[F.key],factor:F.shiftKey?4:1})}}},q=()=>{var te;if(g||!((te=v.current)!=null&&te.matches(":focus-visible")))return;const{transform:F,width:W,height:Q,autoPanOnNodeFocus:K,setCenter:Z}=$.getState();if(!K)return;qn(new Map([[e,p]]),{x:0,y:0,width:W,height:Q},F,!0).length>0||Z(p.position.x+k.width/2,p.position.y+k.height/2,{zoom:F[2]})};return P.jsx("div",{className:ie(["react-flow__node",`react-flow__node-${_}`,{[h]:T},p.className,{selected:p.selected,selectable:z,parent:N,draggable:T,dragging:A}]),ref:v,style:{zIndex:w.z,transform:`translate(${w.positionAbsolute.x}px,${w.positionAbsolute.y}px)`,pointerEvents:S?"all":"none",visibility:V?"visible":"hidden",...p.style,...C},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:L,onMouseMove:R,onMouseLeave:H,onContextMenu:O,onClick:Y,onDoubleClick:j,onKeyDown:I?U:void 0,tabIndex:I?0:void 0,onFocus:I?q:void 0,role:p.ariaRole??(I?"group":void 0),"aria-roledescription":"node","aria-describedby":g?void 0:`${Ci}-${y}`,"aria-label":p.ariaLabel,...p.domAttributes,children:P.jsx(Fd,{value:e,children:P.jsx(M,{id:e,data:p.data,type:_,positionAbsoluteX:w.positionAbsolute.x,positionAbsoluteY:w.positionAbsolute.y,selected:p.selected??!1,selectable:z,draggable:T,deletable:p.deletable??!0,isConnectable:B,sourcePosition:p.sourcePosition,targetPosition:p.targetPosition,dragging:A,dragHandle:p.dragHandle,zIndex:w.z,parentId:p.parentId,...k})})})}var sh=D.memo(ih);const ah=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Ri(e){const{nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,onError:i}=J(ah,re),s=th(e.onlyRenderVisibleElements),a=rh();return P.jsx("div",{className:"react-flow__nodes",style:an,children:s.map(c=>P.jsx(sh,{id:c,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:a,nodesDraggable:t,nodesConnectable:n,nodesFocusable:r,elementsSelectable:o,nodeClickDistance:e.nodeClickDistance,onError:i},c))})}Ri.displayName="NodeRenderer";const ch=D.memo(Ri);function uh(e){return J(D.useCallback(n=>{if(!e)return n.edges.map(o=>o.id);const r=[];if(n.width&&n.height)for(const o of n.edges){const i=n.nodeLookup.get(o.source),s=n.nodeLookup.get(o.target);i&&s&&rf({sourceNode:i,targetNode:s,width:n.width,height:n.height,transform:n.transform})&&r.push(o.id)}return r},[e]),re)}const lh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e}};return P.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},fh=({color:e="none",strokeWidth:t=1})=>{const n={strokeWidth:t,...e&&{stroke:e,fill:e}};return P.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},uo={[Yt.Arrow]:lh,[Yt.ArrowClosed]:fh};function dh(e){const t=oe();return D.useMemo(()=>{var o,i;return Object.prototype.hasOwnProperty.call(uo,e)?uo[e]:((i=(o=t.getState()).onError)==null||i.call(o,"009",ye.error009(e)),null)},[e])}const hh=({id:e,type:t,color:n,width:r=12.5,height:o=12.5,markerUnits:i="strokeWidth",strokeWidth:s,orient:a="auto-start-reverse"})=>{const c=dh(t);return c?P.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${r}`,markerHeight:`${o}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:a,refX:"0",refY:"0",children:P.jsx(c,{color:n,strokeWidth:s})}):null},Vi=({defaultColor:e,rfId:t})=>{const n=J(i=>i.edges),r=J(i=>i.defaultEdgeOptions),o=D.useMemo(()=>df(n,{id:t,defaultColor:e,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,t,e]);return o.length?P.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:P.jsx("defs",{children:o.map(i=>P.jsx(hh,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};Vi.displayName="MarkerDefinitions";var gh=D.memo(Vi);function Bi({x:e,y:t,label:n,labelStyle:r,labelShowBg:o=!0,labelBgStyle:i,labelBgPadding:s=[2,4],labelBgBorderRadius:a=2,children:c,className:l,...d}){const[u,f]=D.useState({x:1,y:0,width:0,height:0}),h=ie(["react-flow__edge-textwrapper",l]),g=D.useRef(null);return D.useEffect(()=>{if(g.current){const y=g.current.getBBox();f({x:y.x,y:y.y,width:y.width,height:y.height})}},[n]),n?P.jsxs("g",{transform:`translate(${e-u.width/2} ${t-u.height/2})`,className:h,visibility:u.width?"visible":"hidden",...d,children:[o&&P.jsx("rect",{width:u.width+2*s[0],x:-s[0],y:-s[1],height:u.height+2*s[1],className:"react-flow__edge-textbg",style:i,rx:a,ry:a}),P.jsx("text",{className:"react-flow__edge-text",y:u.height/2,dy:"0.3em",ref:g,style:r,children:n}),c]}):null}Bi.displayName="EdgeText";const ph=D.memo(Bi);function cn({path:e,labelX:t,labelY:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c,interactionWidth:l=20,...d}){return P.jsxs(P.Fragment,{children:[P.jsx("path",{...d,d:e,fill:"none",className:ie(["react-flow__edge-path",d.className])}),l?P.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:l,className:"react-flow__edge-interaction"}):null,r&&de(t)&&de(n)?P.jsx(ph,{x:t,y:n,label:r,labelStyle:o,labelShowBg:i,labelBgStyle:s,labelBgPadding:a,labelBgBorderRadius:c}):null]})}function lo({pos:e,x1:t,y1:n,x2:r,y2:o}){return e===X.Left||e===X.Right?[.5*(t+r),n]:[t,.5*(n+o)]}function Fi({sourceX:e,sourceY:t,sourcePosition:n=X.Bottom,targetX:r,targetY:o,targetPosition:i=X.Top}){const[s,a]=lo({pos:n,x1:e,y1:t,x2:r,y2:o}),[c,l]=lo({pos:i,x1:r,y1:o,x2:e,y2:t}),[d,u,f,h]=li({sourceX:e,sourceY:t,targetX:r,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:l});return[`M${e},${t} C${s},${a} ${c},${l} ${r},${o}`,d,u,f,h]}function Oi(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s,targetPosition:a,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:x,interactionWidth:m})=>{const[b,p,w]=Fi({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a}),N=e.isInternal?void 0:t;return P.jsx(cn,{id:N,path:b,labelX:p,labelY:w,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:x,interactionWidth:m})})}const mh=Oi({isInternal:!1}),ji=Oi({isInternal:!0});mh.displayName="SimpleBezierEdge";ji.displayName="SimpleBezierEdgeInternal";function Xi(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,sourcePosition:h=X.Bottom,targetPosition:g=X.Top,markerEnd:y,markerStart:x,pathOptions:m,interactionWidth:b})=>{const[p,w,N]=zn({sourceX:n,sourceY:r,sourcePosition:h,targetX:o,targetY:i,targetPosition:g,borderRadius:m==null?void 0:m.borderRadius,offset:m==null?void 0:m.offset,stepPosition:m==null?void 0:m.stepPosition}),_=e.isInternal?void 0:t;return P.jsx(cn,{id:_,path:p,labelX:w,labelY:N,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:y,markerStart:x,interactionWidth:b})})}const Yi=Xi({isInternal:!1}),Wi=Xi({isInternal:!0});Yi.displayName="SmoothStepEdge";Wi.displayName="SmoothStepEdgeInternal";function qi(e){return D.memo(({id:t,...n})=>{var o;const r=e.isInternal?void 0:t;return P.jsx(Yi,{...n,id:r,pathOptions:D.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(o=n.pathOptions)==null?void 0:o.offset])})})}const yh=qi({isInternal:!1}),Gi=qi({isInternal:!0});yh.displayName="StepEdge";Gi.displayName="StepEdgeInternal";function Ui(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:y})=>{const[x,m,b]=hi({sourceX:n,sourceY:r,targetX:o,targetY:i}),p=e.isInternal?void 0:t;return P.jsx(cn,{id:p,path:x,labelX:m,labelY:b,label:s,labelStyle:a,labelShowBg:c,labelBgStyle:l,labelBgPadding:d,labelBgBorderRadius:u,style:f,markerEnd:h,markerStart:g,interactionWidth:y})})}const xh=Ui({isInternal:!1}),Zi=Ui({isInternal:!0});xh.displayName="StraightEdge";Zi.displayName="StraightEdgeInternal";function Ki(e){return D.memo(({id:t,sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:s=X.Bottom,targetPosition:a=X.Top,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:x,pathOptions:m,interactionWidth:b})=>{const[p,w,N]=fi({sourceX:n,sourceY:r,sourcePosition:s,targetX:o,targetY:i,targetPosition:a,curvature:m==null?void 0:m.curvature}),_=e.isInternal?void 0:t;return P.jsx(cn,{id:_,path:p,labelX:w,labelY:N,label:c,labelStyle:l,labelShowBg:d,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,style:g,markerEnd:y,markerStart:x,interactionWidth:b})})}const wh=Ki({isInternal:!1}),Qi=Ki({isInternal:!0});wh.displayName="BezierEdge";Qi.displayName="BezierEdgeInternal";const fo={default:Qi,straight:Zi,step:Gi,smoothstep:Wi,simplebezier:ji},ho={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},vh=(e,t,n)=>n===X.Left?e-t:n===X.Right?e+t:e,bh=(e,t,n)=>n===X.Top?e-t:n===X.Bottom?e+t:e,go="react-flow__edgeupdater";function po({position:e,centerX:t,centerY:n,radius:r=10,onMouseDown:o,onMouseEnter:i,onMouseOut:s,type:a}){return P.jsx("circle",{onMouseDown:o,onMouseEnter:i,onMouseOut:s,className:ie([go,`${go}-${a}`]),cx:vh(t,r,e),cy:bh(n,r,e),r,stroke:"transparent",fill:"transparent"})}function _h({isReconnectable:e,reconnectRadius:t,edge:n,sourceX:r,sourceY:o,targetX:i,targetY:s,sourcePosition:a,targetPosition:c,onReconnect:l,onReconnectStart:d,onReconnectEnd:u,setReconnecting:f,setUpdateHover:h}){const g=oe(),y=(w,N)=>{if(w.button!==0)return;const{autoPanOnConnect:_,domNode:M,connectionMode:T,connectionRadius:z,lib:B,onConnectStart:I,cancelConnection:$,nodeLookup:V,rfId:v,panBy:A,updateConnection:E}=g.getState(),k=N.type==="target",C=(R,H)=>{f(!1),u==null||u(R,n,N.type,H)},S=R=>l==null?void 0:l(n,R),L=(R,H)=>{f(!0),d==null||d(w,n,N.type),I==null||I(R,H)};Hn.onPointerDown(w.nativeEvent,{autoPanOnConnect:_,connectionMode:T,connectionRadius:z,domNode:M,handleId:N.id,nodeId:N.nodeId,nodeLookup:V,isTarget:k,edgeUpdaterType:N.type,lib:B,flowId:v,cancelConnection:$,panBy:A,isValidConnection:(...R)=>{var H,O;return((O=(H=g.getState()).isValidConnection)==null?void 0:O.call(H,...R))??!0},onConnect:S,onConnectStart:L,onConnectEnd:(...R)=>{var H,O;return(O=(H=g.getState()).onConnectEnd)==null?void 0:O.call(H,...R)},onReconnectEnd:C,updateConnection:E,getTransform:()=>g.getState().transform,getFromHandle:()=>g.getState().connection.fromHandle,dragThreshold:g.getState().connectionDragThreshold,handleDomNode:w.currentTarget})},x=w=>y(w,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),m=w=>y(w,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),b=()=>h(!0),p=()=>h(!1);return P.jsxs(P.Fragment,{children:[(e===!0||e==="source")&&P.jsx(po,{position:a,centerX:r,centerY:o,radius:t,onMouseDown:x,onMouseEnter:b,onMouseOut:p,type:"source"}),(e===!0||e==="target")&&P.jsx(po,{position:c,centerX:i,centerY:s,radius:t,onMouseDown:m,onMouseEnter:b,onMouseOut:p,type:"target"})]})}function Eh({id:e,edgesFocusable:t,edgesReconnectable:n,elementsSelectable:r,onClick:o,onDoubleClick:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,rfId:g,edgeTypes:y,noPanClassName:x,onError:m,disableKeyboardA11y:b}){let p=J(Z=>Z.edgeLookup.get(e));const w=J(Z=>Z.defaultEdgeOptions);p=w?{...w,...p}:p;let N=p.type||"default",_=(y==null?void 0:y[N])||fo[N];_===void 0&&(m==null||m("011",ye.error011(N)),N="default",_=(y==null?void 0:y.default)||fo.default);const M=!!(p.focusable||t&&typeof p.focusable>"u"),T=typeof u<"u"&&(p.reconnectable||n&&typeof p.reconnectable>"u"),z=!!(p.selectable||r&&typeof p.selectable>"u"),B=D.useRef(null),[I,$]=D.useState(!1),[V,v]=D.useState(!1),A=oe(),{zIndex:E,sourceX:k,sourceY:C,targetX:S,targetY:L,sourcePosition:R,targetPosition:H}=J(D.useCallback(Z=>{const G=Z.nodeLookup.get(p.source),te=Z.nodeLookup.get(p.target);if(!G||!te)return{zIndex:p.zIndex,...ho};const ne=ff({id:e,sourceNode:G,targetNode:te,sourceHandle:p.sourceHandle||null,targetHandle:p.targetHandle||null,connectionMode:Z.connectionMode,onError:m});return{zIndex:nf({selected:p.selected,zIndex:p.zIndex,sourceNode:G,targetNode:te,elevateOnSelect:Z.elevateEdgesOnSelect,zIndexMode:Z.zIndexMode}),...ne||ho}},[p.source,p.target,p.sourceHandle,p.targetHandle,p.selected,p.zIndex]),re),O=D.useMemo(()=>p.markerStart?`url('#${Dn(p.markerStart,g)}')`:void 0,[p.markerStart,g]),j=D.useMemo(()=>p.markerEnd?`url('#${Dn(p.markerEnd,g)}')`:void 0,[p.markerEnd,g]);if(p.hidden||k===null||C===null||S===null||L===null)return null;const Y=Z=>{var ee;const{addSelectedEdges:G,unselectNodesAndEdges:te,multiSelectionActive:ne}=A.getState();z&&(A.setState({nodesSelectionActive:!1}),p.selected&&ne?(te({nodes:[],edges:[p]}),(ee=B.current)==null||ee.blur()):G([e])),o&&o(Z,p)},U=i?Z=>{i(Z,{...p})}:void 0,q=s?Z=>{s(Z,{...p})}:void 0,F=a?Z=>{a(Z,{...p})}:void 0,W=c?Z=>{c(Z,{...p})}:void 0,Q=l?Z=>{l(Z,{...p})}:void 0,K=Z=>{var G;if(!b&&Zo.includes(Z.key)&&z){const{unselectNodesAndEdges:te,addSelectedEdges:ne}=A.getState();Z.key==="Escape"?((G=B.current)==null||G.blur(),te({edges:[p]})):ne([e])}};return P.jsx("svg",{style:{zIndex:E},children:P.jsxs("g",{className:ie(["react-flow__edge",`react-flow__edge-${N}`,p.className,x,{selected:p.selected,animated:p.animated,inactive:!z&&!o,updating:I,selectable:z}]),onClick:Y,onDoubleClick:U,onContextMenu:q,onMouseEnter:F,onMouseMove:W,onMouseLeave:Q,onKeyDown:M?K:void 0,tabIndex:M?0:void 0,role:p.ariaRole??(M?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":p.ariaLabel===null?void 0:p.ariaLabel||`Edge from ${p.source} to ${p.target}`,"aria-describedby":M?`${Ii}-${g}`:void 0,ref:B,...p.domAttributes,children:[!V&&P.jsx(_,{id:e,source:p.source,target:p.target,type:p.type,selected:p.selected,animated:p.animated,selectable:z,deletable:p.deletable??!0,label:p.label,labelStyle:p.labelStyle,labelShowBg:p.labelShowBg,labelBgStyle:p.labelBgStyle,labelBgPadding:p.labelBgPadding,labelBgBorderRadius:p.labelBgBorderRadius,sourceX:k,sourceY:C,targetX:S,targetY:L,sourcePosition:R,targetPosition:H,data:p.data,style:p.style,sourceHandleId:p.sourceHandle,targetHandleId:p.targetHandle,markerStart:O,markerEnd:j,pathOptions:"pathOptions"in p?p.pathOptions:void 0,interactionWidth:p.interactionWidth}),T&&P.jsx(_h,{edge:p,isReconnectable:T,reconnectRadius:d,onReconnect:u,onReconnectStart:f,onReconnectEnd:h,sourceX:k,sourceY:C,targetX:S,targetY:L,sourcePosition:R,targetPosition:H,setUpdateHover:$,setReconnecting:v})]})})}var Sh=D.memo(Eh);const Nh=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Ji({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:n,edgeTypes:r,noPanClassName:o,onReconnect:i,onEdgeContextMenu:s,onEdgeMouseEnter:a,onEdgeMouseMove:c,onEdgeMouseLeave:l,onEdgeClick:d,reconnectRadius:u,onEdgeDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,disableKeyboardA11y:y}){const{edgesFocusable:x,edgesReconnectable:m,elementsSelectable:b,onError:p}=J(Nh,re),w=uh(t);return P.jsxs("div",{className:"react-flow__edges",children:[P.jsx(gh,{defaultColor:e,rfId:n}),w.map(N=>P.jsx(Sh,{id:N,edgesFocusable:x,edgesReconnectable:m,elementsSelectable:b,noPanClassName:o,onReconnect:i,onContextMenu:s,onMouseEnter:a,onMouseMove:c,onMouseLeave:l,onClick:d,reconnectRadius:u,onDoubleClick:f,onReconnectStart:h,onReconnectEnd:g,rfId:n,onError:p,edgeTypes:r,disableKeyboardA11y:y},N))]})}Ji.displayName="EdgeRenderer";const Mh=D.memo(Ji),Ch=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function Ih({children:e}){const t=J(Ch);return P.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function Ah(e){const t=tr(),n=D.useRef(!1);D.useEffect(()=>{!n.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),n.current=!0)},[e,t.viewportInitialized])}const kh=e=>{var t;return(t=e.panZoom)==null?void 0:t.syncViewport};function $h(e){const t=J(kh),n=oe();return D.useEffect(()=>{e&&(t==null||t(e),n.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function Ph(e){return e.connection.inProgress?{...e.connection,to:bt(e.connection.to,e.transform)}:{...e.connection}}function Th(e){return Ph}function zh(e){const t=Th();return J(t,re)}const Dh=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function Lh({containerStyle:e,style:t,type:n,component:r}){const{nodesConnectable:o,width:i,height:s,isValid:a,inProgress:c}=J(Dh,re);return!(i&&o&&c)?null:P.jsx("svg",{style:e,width:i,height:s,className:"react-flow__connectionline react-flow__container",children:P.jsx("g",{className:ie(["react-flow__connection",Jo(a)]),children:P.jsx(es,{style:t,type:n,CustomComponent:r,isValid:a})})})}const es=({style:e,type:t=Ce.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:o,from:i,fromNode:s,fromHandle:a,fromPosition:c,to:l,toNode:d,toHandle:u,toPosition:f,pointer:h}=zh();if(!o)return;if(n)return P.jsx(n,{connectionLineType:t,connectionLineStyle:e,fromNode:s,fromHandle:a,fromX:i.x,fromY:i.y,toX:l.x,toY:l.y,fromPosition:c,toPosition:f,connectionStatus:Jo(r),toNode:d,toHandle:u,pointer:h});let g="";const y={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:l.x,targetY:l.y,targetPosition:f};switch(t){case Ce.Bezier:[g]=fi(y);break;case Ce.SimpleBezier:[g]=Fi(y);break;case Ce.Step:[g]=zn({...y,borderRadius:0});break;case Ce.SmoothStep:[g]=zn(y);break;default:[g]=hi(y)}return P.jsx("path",{d:g,fill:"none",className:"react-flow__connection-path",style:e})};es.displayName="ConnectionLine";const Hh={};function mo(e=Hh){D.useRef(e),oe(),D.useEffect(()=>{},[e])}function Rh(){oe(),D.useRef(!1),D.useEffect(()=>{},[])}function ts({nodeTypes:e,edgeTypes:t,onInit:n,onNodeClick:r,onEdgeClick:o,onNodeDoubleClick:i,onEdgeDoubleClick:s,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,onSelectionContextMenu:u,onSelectionStart:f,onSelectionEnd:h,connectionLineType:g,connectionLineStyle:y,connectionLineComponent:x,connectionLineContainerStyle:m,selectionKeyCode:b,selectionOnDrag:p,selectionMode:w,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:M,deleteKeyCode:T,onlyRenderVisibleElements:z,elementsSelectable:B,defaultViewport:I,translateExtent:$,minZoom:V,maxZoom:v,preventScrolling:A,defaultMarkerColor:E,zoomOnScroll:k,zoomOnPinch:C,panOnScroll:S,panOnScrollSpeed:L,panOnScrollMode:R,zoomOnDoubleClick:H,panOnDrag:O,onPaneClick:j,onPaneMouseEnter:Y,onPaneMouseMove:U,onPaneMouseLeave:q,onPaneScroll:F,onPaneContextMenu:W,paneClickDistance:Q,nodeClickDistance:K,onEdgeContextMenu:Z,onEdgeMouseEnter:G,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:ee,onReconnect:se,onReconnectStart:Se,onReconnectEnd:we,noDragClassName:Ae,noWheelClassName:Ke,noPanClassName:Qe,disableKeyboardA11y:Je,nodeExtent:un,rfId:_t,viewport:Ve,onViewportChange:et}){return mo(e),mo(t),Rh(),Ah(n),$h(Ve),P.jsx(Jd,{onPaneClick:j,onPaneMouseEnter:Y,onPaneMouseMove:U,onPaneMouseLeave:q,onPaneContextMenu:W,onPaneScroll:F,paneClickDistance:Q,deleteKeyCode:T,selectionKeyCode:b,selectionOnDrag:p,selectionMode:w,onSelectionStart:f,onSelectionEnd:h,multiSelectionKeyCode:N,panActivationKeyCode:_,zoomActivationKeyCode:M,elementsSelectable:B,zoomOnScroll:k,zoomOnPinch:C,zoomOnDoubleClick:H,panOnScroll:S,panOnScrollSpeed:L,panOnScrollMode:R,panOnDrag:O,defaultViewport:I,translateExtent:$,minZoom:V,maxZoom:v,onSelectionContextMenu:u,preventScrolling:A,noDragClassName:Ae,noWheelClassName:Ke,noPanClassName:Qe,disableKeyboardA11y:Je,onViewportChange:et,isControlledViewport:!!Ve,children:P.jsxs(Ih,{children:[P.jsx(Mh,{edgeTypes:t,onEdgeClick:o,onEdgeDoubleClick:s,onReconnect:se,onReconnectStart:Se,onReconnectEnd:we,onlyRenderVisibleElements:z,onEdgeContextMenu:Z,onEdgeMouseEnter:G,onEdgeMouseMove:te,onEdgeMouseLeave:ne,reconnectRadius:ee,defaultMarkerColor:E,noPanClassName:Qe,disableKeyboardA11y:Je,rfId:_t}),P.jsx(Lh,{style:y,type:g,component:x,containerStyle:m}),P.jsx("div",{className:"react-flow__edgelabel-renderer"}),P.jsx(ch,{nodeTypes:e,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:a,onNodeMouseMove:c,onNodeMouseLeave:l,onNodeContextMenu:d,nodeClickDistance:K,onlyRenderVisibleElements:z,noPanClassName:Qe,noDragClassName:Ae,disableKeyboardA11y:Je,nodeExtent:un,rfId:_t}),P.jsx("div",{className:"react-flow__viewport-portal"})]})})}ts.displayName="GraphView";const Vh=D.memo(ts),yo=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c=.5,maxZoom:l=2,nodeOrigin:d,nodeExtent:u,zIndexMode:f="basic"}={})=>{const h=new Map,g=new Map,y=new Map,x=new Map,m=r??t??[],b=n??e??[],p=d??[0,0],w=u??ft;mi(y,x,m);const N=Ln(b,h,g,{nodeOrigin:p,nodeExtent:w,zIndexMode:f});let _=[0,0,1];if(s&&o&&i){const M=wt(h,{filter:I=>!!((I.width||I.initialWidth)&&(I.height||I.initialHeight))}),{x:T,y:z,zoom:B}=Gn(M,o,i,c,l,(a==null?void 0:a.padding)??.1);_=[T,z,B]}return{rfId:"1",width:o??0,height:i??0,transform:_,nodes:b,nodesInitialized:N,nodeLookup:h,parentLookup:g,edges:m,edgeLookup:x,connectionLookup:y,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:l,translateExtent:ft,nodeExtent:w,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:qe.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:p,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:s??!1,fitViewOptions:a,fitViewResolver:null,connection:{...Qo},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Zl,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:Ko,zIndexMode:f,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Bh=({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f})=>rd((h,g)=>{async function y(){const{nodeLookup:x,panZoom:m,fitViewOptions:b,fitViewResolver:p,width:w,height:N,minZoom:_,maxZoom:M}=g();m&&(await Gl({nodes:x,width:w,height:N,panZoom:m,minZoom:_,maxZoom:M},b),p==null||p.resolve(!0),h({fitViewResolver:null}))}return{...yo({nodes:e,edges:t,width:o,height:i,fitView:s,fitViewOptions:a,minZoom:c,maxZoom:l,nodeOrigin:d,nodeExtent:u,defaultNodes:n,defaultEdges:r,zIndexMode:f}),setNodes:x=>{const{nodeLookup:m,parentLookup:b,nodeOrigin:p,elevateNodesOnSelect:w,fitViewQueued:N,zIndexMode:_}=g(),M=Ln(x,m,b,{nodeOrigin:p,nodeExtent:u,elevateNodesOnSelect:w,checkEquality:!0,zIndexMode:_});N&&M?(y(),h({nodes:x,nodesInitialized:M,fitViewQueued:!1,fitViewOptions:void 0})):h({nodes:x,nodesInitialized:M})},setEdges:x=>{const{connectionLookup:m,edgeLookup:b}=g();mi(m,b,x),h({edges:x})},setDefaultNodesAndEdges:(x,m)=>{if(x){const{setNodes:b}=g();b(x),h({hasDefaultNodes:!0})}if(m){const{setEdges:b}=g();b(m),h({hasDefaultEdges:!0})}},updateNodeInternals:x=>{const{triggerNodeChanges:m,nodeLookup:b,parentLookup:p,domNode:w,nodeOrigin:N,nodeExtent:_,debug:M,fitViewQueued:T,zIndexMode:z}=g(),{changes:B,updatedInternals:I}=wf(x,b,p,w,N,_,z);I&&(pf(b,p,{nodeOrigin:N,nodeExtent:_,zIndexMode:z}),T?(y(),h({fitViewQueued:!1,fitViewOptions:void 0})):h({}),(B==null?void 0:B.length)>0&&(M&&console.log("React Flow: trigger node changes",B),m==null||m(B)))},updateNodePositions:(x,m=!1)=>{const b=[];let p=[];const{nodeLookup:w,triggerNodeChanges:N,connection:_,updateConnection:M,onNodesChangeMiddlewareMap:T}=g();for(const[z,B]of x){const I=w.get(z),$=!!(I!=null&&I.expandParent&&(I!=null&&I.parentId)&&(B!=null&&B.position)),V={id:z,type:"position",position:$?{x:Math.max(0,B.position.x),y:Math.max(0,B.position.y)}:B.position,dragging:m};if(I&&_.inProgress&&_.fromNode.id===I.id){const v=He(I,_.fromHandle,X.Left,!0);M({..._,from:v})}$&&I.parentId&&b.push({id:z,parentId:I.parentId,rect:{...B.internals.positionAbsolute,width:B.measured.width??0,height:B.measured.height??0}}),p.push(V)}if(b.length>0){const{parentLookup:z,nodeOrigin:B}=g(),I=er(b,w,z,B);p.push(...I)}for(const z of T.values())p=z(p);N(p)},triggerNodeChanges:x=>{const{onNodesChange:m,setNodes:b,nodes:p,hasDefaultNodes:w,debug:N}=g();if(x!=null&&x.length){if(w){const _=$i(x,p);b(_)}N&&console.log("React Flow: trigger node changes",x),m==null||m(x)}},triggerEdgeChanges:x=>{const{onEdgesChange:m,setEdges:b,edges:p,hasDefaultEdges:w,debug:N}=g();if(x!=null&&x.length){if(w){const _=Sd(x,p);b(_)}N&&console.log("React Flow: trigger edge changes",x),m==null||m(x)}},addSelectedNodes:x=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(m){const _=x.map(M=>ke(M,!0));w(_);return}w(Oe(p,new Set([...x]),!0)),N(Oe(b))},addSelectedEdges:x=>{const{multiSelectionActive:m,edgeLookup:b,nodeLookup:p,triggerNodeChanges:w,triggerEdgeChanges:N}=g();if(m){const _=x.map(M=>ke(M,!0));N(_);return}N(Oe(b,new Set([...x]))),w(Oe(p,new Set,!0))},unselectNodesAndEdges:({nodes:x,edges:m}={})=>{const{edges:b,nodes:p,nodeLookup:w,triggerNodeChanges:N,triggerEdgeChanges:_}=g(),M=x||p,T=m||b,z=[];for(const I of M){if(!I.selected)continue;const $=w.get(I.id);$&&($.selected=!1),z.push(ke(I.id,!1))}const B=[];for(const I of T)I.selected&&B.push(ke(I.id,!1));N(z),_(B)},setMinZoom:x=>{const{panZoom:m,maxZoom:b}=g();m==null||m.setScaleExtent([x,b]),h({minZoom:x})},setMaxZoom:x=>{const{panZoom:m,minZoom:b}=g();m==null||m.setScaleExtent([b,x]),h({maxZoom:x})},setTranslateExtent:x=>{var m;(m=g().panZoom)==null||m.setTranslateExtent(x),h({translateExtent:x})},resetSelectedElements:()=>{const{edges:x,nodes:m,triggerNodeChanges:b,triggerEdgeChanges:p,elementsSelectable:w}=g();if(!w)return;const N=m.reduce((M,T)=>T.selected?[...M,ke(T.id,!1)]:M,[]),_=x.reduce((M,T)=>T.selected?[...M,ke(T.id,!1)]:M,[]);b(N),p(_)},setNodeExtent:x=>{const{nodes:m,nodeLookup:b,parentLookup:p,nodeOrigin:w,elevateNodesOnSelect:N,nodeExtent:_,zIndexMode:M}=g();x[0][0]===_[0][0]&&x[0][1]===_[0][1]&&x[1][0]===_[1][0]&&x[1][1]===_[1][1]||(Ln(m,b,p,{nodeOrigin:w,nodeExtent:x,elevateNodesOnSelect:N,checkEquality:!1,zIndexMode:M}),h({nodeExtent:x}))},panBy:x=>{const{transform:m,width:b,height:p,panZoom:w,translateExtent:N}=g();return vf({delta:x,panZoom:w,transform:m,translateExtent:N,width:b,height:p})},setCenter:async(x,m,b)=>{const{width:p,height:w,maxZoom:N,panZoom:_}=g();if(!_)return Promise.resolve(!1);const M=typeof(b==null?void 0:b.zoom)<"u"?b.zoom:N;return await _.setViewport({x:p/2-x*M,y:w/2-m*M,zoom:M},{duration:b==null?void 0:b.duration,ease:b==null?void 0:b.ease,interpolate:b==null?void 0:b.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{h({connection:{...Qo}})},updateConnection:x=>{h({connection:x})},reset:()=>h({...yo()})}},Object.is);function Fh({initialNodes:e,initialEdges:t,defaultNodes:n,defaultEdges:r,initialWidth:o,initialHeight:i,initialMinZoom:s,initialMaxZoom:a,initialFitViewOptions:c,fitView:l,nodeOrigin:d,nodeExtent:u,zIndexMode:f,children:h}){const[g]=D.useState(()=>Bh({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,width:o,height:i,fitView:l,minZoom:s,maxZoom:a,fitViewOptions:c,nodeOrigin:d,nodeExtent:u,zIndexMode:f}));return P.jsx(od,{value:g,children:P.jsx(Id,{children:h})})}function Oh({children:e,nodes:t,edges:n,defaultNodes:r,defaultEdges:o,width:i,height:s,fitView:a,fitViewOptions:c,minZoom:l,maxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h}){return D.useContext(on)?P.jsx(P.Fragment,{children:e}):P.jsx(Fh,{initialNodes:t,initialEdges:n,defaultNodes:r,defaultEdges:o,initialWidth:i,initialHeight:s,fitView:a,initialFitViewOptions:c,initialMinZoom:l,initialMaxZoom:d,nodeOrigin:u,nodeExtent:f,zIndexMode:h,children:e})}const jh={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Xh({nodes:e,edges:t,defaultNodes:n,defaultEdges:r,className:o,nodeTypes:i,edgeTypes:s,onNodeClick:a,onEdgeClick:c,onInit:l,onMove:d,onMoveStart:u,onMoveEnd:f,onConnect:h,onConnectStart:g,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:z,onNodesDelete:B,onEdgesDelete:I,onDelete:$,onSelectionChange:V,onSelectionDragStart:v,onSelectionDrag:A,onSelectionDragStop:E,onSelectionContextMenu:k,onSelectionStart:C,onSelectionEnd:S,onBeforeDelete:L,connectionMode:R,connectionLineType:H=Ce.Bezier,connectionLineStyle:O,connectionLineComponent:j,connectionLineContainerStyle:Y,deleteKeyCode:U="Backspace",selectionKeyCode:q="Shift",selectionOnDrag:F=!1,selectionMode:W=dt.Full,panActivationKeyCode:Q="Space",multiSelectionKeyCode:K=gt()?"Meta":"Control",zoomActivationKeyCode:Z=gt()?"Meta":"Control",snapToGrid:G,snapGrid:te,onlyRenderVisibleElements:ne=!1,selectNodesOnDrag:ee,nodesDraggable:se,autoPanOnNodeFocus:Se,nodesConnectable:we,nodesFocusable:Ae,nodeOrigin:Ke=Ai,edgesFocusable:Qe,edgesReconnectable:Je,elementsSelectable:un=!0,defaultViewport:_t=yd,minZoom:Ve=.5,maxZoom:et=2,translateExtent:rr=ft,preventScrolling:is=!0,nodeExtent:ln,defaultMarkerColor:ss="#b1b1b7",zoomOnScroll:as=!0,zoomOnPinch:cs=!0,panOnScroll:us=!1,panOnScrollSpeed:ls=.5,panOnScrollMode:fs=Te.Free,zoomOnDoubleClick:ds=!0,panOnDrag:hs=!0,onPaneClick:gs,onPaneMouseEnter:ps,onPaneMouseMove:ms,onPaneMouseLeave:ys,onPaneScroll:xs,onPaneContextMenu:ws,paneClickDistance:vs=1,nodeClickDistance:bs=0,children:_s,onReconnect:Es,onReconnectStart:Ss,onReconnectEnd:Ns,onEdgeContextMenu:Ms,onEdgeDoubleClick:Cs,onEdgeMouseEnter:Is,onEdgeMouseMove:As,onEdgeMouseLeave:ks,reconnectRadius:$s=10,onNodesChange:Ps,onEdgesChange:Ts,noDragClassName:zs="nodrag",noWheelClassName:Ds="nowheel",noPanClassName:or="nopan",fitView:ir,fitViewOptions:sr,connectOnClick:Ls,attributionPosition:Hs,proOptions:Rs,defaultEdgeOptions:Vs,elevateNodesOnSelect:Bs=!0,elevateEdgesOnSelect:Fs=!1,disableKeyboardA11y:ar=!1,autoPanOnConnect:Os,autoPanOnNodeDrag:js,autoPanSpeed:Xs,connectionRadius:Ys,isValidConnection:Ws,onError:qs,style:Gs,id:cr,nodeDragThreshold:Us,connectionDragThreshold:Zs,viewport:Ks,onViewportChange:Qs,width:Js,height:ea,colorMode:ta="light",debug:na,onScroll:Et,ariaLabelConfig:ra,zIndexMode:ur="basic",...oa},ia){const fn=cr||"1",sa=bd(ta),aa=D.useCallback(lr=>{lr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Et==null||Et(lr)},[Et]);return P.jsx("div",{"data-testid":"rf__wrapper",...oa,onScroll:aa,style:{...Gs,...jh},ref:ia,className:ie(["react-flow",o,sa]),id:cr,role:"application",children:P.jsxs(Oh,{nodes:e,edges:t,width:Js,height:ea,fitView:ir,fitViewOptions:sr,minZoom:Ve,maxZoom:et,nodeOrigin:Ke,nodeExtent:ln,zIndexMode:ur,children:[P.jsx(Vh,{onInit:l,onNodeClick:a,onEdgeClick:c,onNodeMouseEnter:b,onNodeMouseMove:p,onNodeMouseLeave:w,onNodeContextMenu:N,onNodeDoubleClick:_,nodeTypes:i,edgeTypes:s,connectionLineType:H,connectionLineStyle:O,connectionLineComponent:j,connectionLineContainerStyle:Y,selectionKeyCode:q,selectionOnDrag:F,selectionMode:W,deleteKeyCode:U,multiSelectionKeyCode:K,panActivationKeyCode:Q,zoomActivationKeyCode:Z,onlyRenderVisibleElements:ne,defaultViewport:_t,translateExtent:rr,minZoom:Ve,maxZoom:et,preventScrolling:is,zoomOnScroll:as,zoomOnPinch:cs,zoomOnDoubleClick:ds,panOnScroll:us,panOnScrollSpeed:ls,panOnScrollMode:fs,panOnDrag:hs,onPaneClick:gs,onPaneMouseEnter:ps,onPaneMouseMove:ms,onPaneMouseLeave:ys,onPaneScroll:xs,onPaneContextMenu:ws,paneClickDistance:vs,nodeClickDistance:bs,onSelectionContextMenu:k,onSelectionStart:C,onSelectionEnd:S,onReconnect:Es,onReconnectStart:Ss,onReconnectEnd:Ns,onEdgeContextMenu:Ms,onEdgeDoubleClick:Cs,onEdgeMouseEnter:Is,onEdgeMouseMove:As,onEdgeMouseLeave:ks,reconnectRadius:$s,defaultMarkerColor:ss,noDragClassName:zs,noWheelClassName:Ds,noPanClassName:or,rfId:fn,disableKeyboardA11y:ar,nodeExtent:ln,viewport:Ks,onViewportChange:Qs}),P.jsx(vd,{nodes:e,edges:t,defaultNodes:n,defaultEdges:r,onConnect:h,onConnectStart:g,onConnectEnd:y,onClickConnectStart:x,onClickConnectEnd:m,nodesDraggable:se,autoPanOnNodeFocus:Se,nodesConnectable:we,nodesFocusable:Ae,edgesFocusable:Qe,edgesReconnectable:Je,elementsSelectable:un,elevateNodesOnSelect:Bs,elevateEdgesOnSelect:Fs,minZoom:Ve,maxZoom:et,nodeExtent:ln,onNodesChange:Ps,onEdgesChange:Ts,snapToGrid:G,snapGrid:te,connectionMode:R,translateExtent:rr,connectOnClick:Ls,defaultEdgeOptions:Vs,fitView:ir,fitViewOptions:sr,onNodesDelete:B,onEdgesDelete:I,onDelete:$,onNodeDragStart:M,onNodeDrag:T,onNodeDragStop:z,onSelectionDrag:A,onSelectionDragStart:v,onSelectionDragStop:E,onMove:d,onMoveStart:u,onMoveEnd:f,noPanClassName:or,nodeOrigin:Ke,rfId:fn,autoPanOnConnect:Os,autoPanOnNodeDrag:js,autoPanSpeed:Xs,onError:qs,connectionRadius:Ys,isValidConnection:Ws,selectNodesOnDrag:ee,nodeDragThreshold:Us,connectionDragThreshold:Zs,onBeforeDelete:L,debug:na,ariaLabelConfig:ra,zIndexMode:ur}),P.jsx(md,{onSelectionChange:V}),_s,P.jsx(fd,{proOptions:Rs,position:Hs}),P.jsx(ld,{rfId:fn,disableKeyboardA11y:ar})]})})}var xg=Pi(Xh);const Yh=e=>{var t;return(t=e.domNode)==null?void 0:t.querySelector(".react-flow__edgelabel-renderer")};function wg({children:e}){const t=J(Yh);return t?la.createPortal(e,t):null}function vg(e){const[t,n]=D.useState(e),r=D.useCallback(o=>n(i=>$i(o,i)),[]);return[t,n,r]}function Wh({dimensions:e,lineWidth:t,variant:n,className:r}){return P.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:ie(["react-flow__background-pattern",n,r])})}function qh({radius:e,className:t}){return P.jsx("circle",{cx:e,cy:e,r:e,className:ie(["react-flow__background-pattern","dots",t])})}var Ie;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ie||(Ie={}));const Gh={[Ie.Dots]:1,[Ie.Lines]:1,[Ie.Cross]:6},Uh=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function ns({id:e,variant:t=Ie.Dots,gap:n=20,size:r,lineWidth:o=1,offset:i=0,color:s,bgColor:a,style:c,className:l,patternClassName:d}){const u=D.useRef(null),{transform:f,patternId:h}=J(Uh,re),g=r||Gh[t],y=t===Ie.Dots,x=t===Ie.Cross,m=Array.isArray(n)?n:[n,n],b=[m[0]*f[2]||1,m[1]*f[2]||1],p=g*f[2],w=Array.isArray(i)?i:[i,i],N=x?[p,p]:b,_=[w[0]*f[2]||1+N[0]/2,w[1]*f[2]||1+N[1]/2],M=`${h}${e||""}`;return P.jsxs("svg",{className:ie(["react-flow__background",l]),style:{...c,...an,"--xy-background-color-props":a,"--xy-background-pattern-color-props":s},ref:u,"data-testid":"rf__background",children:[P.jsx("pattern",{id:M,x:f[0]%b[0],y:f[1]%b[1],width:b[0],height:b[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${_[0]},-${_[1]})`,children:y?P.jsx(qh,{radius:p/2,className:d}):P.jsx(Wh,{dimensions:N,lineWidth:o,variant:t,className:d})}),P.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${M})`})]})}ns.displayName="Background";const bg=D.memo(ns);function Zh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:P.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Kh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:P.jsx("path",{d:"M0 0h32v4.2H0z"})})}function Qh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:P.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function Jh(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function eg(){return P.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:P.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Pt({children:e,className:t,...n}){return P.jsx("button",{type:"button",className:ie(["react-flow__controls-button",t]),...n,children:e})}const tg=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function rs({style:e,showZoom:t=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:o,onZoomIn:i,onZoomOut:s,onFitView:a,onInteractiveChange:c,className:l,children:d,position:u="bottom-left",orientation:f="vertical","aria-label":h}){const g=oe(),{isInteractive:y,minZoomReached:x,maxZoomReached:m,ariaLabelConfig:b}=J(tg,re),{zoomIn:p,zoomOut:w,fitView:N}=tr(),_=()=>{p(),i==null||i()},M=()=>{w(),s==null||s()},T=()=>{N(o),a==null||a()},z=()=>{g.setState({nodesDraggable:!y,nodesConnectable:!y,elementsSelectable:!y}),c==null||c(!y)},B=f==="horizontal"?"horizontal":"vertical";return P.jsxs(sn,{className:ie(["react-flow__controls",B,l]),position:u,style:e,"data-testid":"rf__controls","aria-label":h??b["controls.ariaLabel"],children:[t&&P.jsxs(P.Fragment,{children:[P.jsx(Pt,{onClick:_,className:"react-flow__controls-zoomin",title:b["controls.zoomIn.ariaLabel"],"aria-label":b["controls.zoomIn.ariaLabel"],disabled:m,children:P.jsx(Zh,{})}),P.jsx(Pt,{onClick:M,className:"react-flow__controls-zoomout",title:b["controls.zoomOut.ariaLabel"],"aria-label":b["controls.zoomOut.ariaLabel"],disabled:x,children:P.jsx(Kh,{})})]}),n&&P.jsx(Pt,{className:"react-flow__controls-fitview",onClick:T,title:b["controls.fitView.ariaLabel"],"aria-label":b["controls.fitView.ariaLabel"],children:P.jsx(Qh,{})}),r&&P.jsx(Pt,{className:"react-flow__controls-interactive",onClick:z,title:b["controls.interactive.ariaLabel"],"aria-label":b["controls.interactive.ariaLabel"],children:y?P.jsx(eg,{}):P.jsx(Jh,{})}),d]})}rs.displayName="Controls";D.memo(rs);function ng({id:e,x:t,y:n,width:r,height:o,style:i,color:s,strokeColor:a,strokeWidth:c,className:l,borderRadius:d,shapeRendering:u,selected:f,onClick:h}){const{background:g,backgroundColor:y}=i||{},x=s||g||y;return P.jsx("rect",{className:ie(["react-flow__minimap-node",{selected:f},l]),x:t,y:n,rx:d,ry:d,width:r,height:o,style:{fill:x,stroke:a,strokeWidth:c},shapeRendering:u,onClick:h?m=>h(m,e):void 0})}const rg=D.memo(ng),og=e=>e.nodes.map(t=>t.id),Sn=e=>e instanceof Function?e:()=>e;function ig({nodeStrokeColor:e,nodeColor:t,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:o,nodeComponent:i=rg,onClick:s}){const a=J(og,re),c=Sn(t),l=Sn(e),d=Sn(n),u=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return P.jsx(P.Fragment,{children:a.map(f=>P.jsx(ag,{id:f,nodeColorFunc:c,nodeStrokeColorFunc:l,nodeClassNameFunc:d,nodeBorderRadius:r,nodeStrokeWidth:o,NodeComponent:i,onClick:s,shapeRendering:u},f))})}function sg({id:e,nodeColorFunc:t,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:o,nodeStrokeWidth:i,shapeRendering:s,NodeComponent:a,onClick:c}){const{node:l,x:d,y:u,width:f,height:h}=J(g=>{const y=g.nodeLookup.get(e);if(!y)return{node:void 0,x:0,y:0,width:0,height:0};const x=y.internals.userNode,{x:m,y:b}=y.internals.positionAbsolute,{width:p,height:w}=Ee(x);return{node:x,x:m,y:b,width:p,height:w}},re);return!l||l.hidden||!ii(l)?null:P.jsx(a,{x:d,y:u,width:f,height:h,style:l.style,selected:!!l.selected,className:r(l),color:t(l),borderRadius:o,strokeColor:n(l),strokeWidth:i,shapeRendering:s,onClick:c,id:l.id})}const ag=D.memo(sg);var cg=D.memo(ig);const ug=200,lg=150,fg=e=>!e.hidden,dg=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?oi(wt(e.nodeLookup,{filter:fg}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},hg="react-flow__minimap-desc";function os({style:e,className:t,nodeStrokeColor:n,nodeColor:r,nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a,bgColor:c,maskColor:l,maskStrokeColor:d,maskStrokeWidth:u,position:f="bottom-right",onClick:h,onNodeClick:g,pannable:y=!1,zoomable:x=!1,ariaLabel:m,inversePan:b,zoomStep:p=1,offsetScale:w=5}){const N=oe(),_=D.useRef(null),{boundingRect:M,viewBB:T,rfId:z,panZoom:B,translateExtent:I,flowWidth:$,flowHeight:V,ariaLabelConfig:v}=J(dg,re),A=(e==null?void 0:e.width)??ug,E=(e==null?void 0:e.height)??lg,k=M.width/A,C=M.height/E,S=Math.max(k,C),L=S*A,R=S*E,H=w*S,O=M.x-(L-M.width)/2-H,j=M.y-(R-M.height)/2-H,Y=L+H*2,U=R+H*2,q=`${hg}-${z}`,F=D.useRef(0),W=D.useRef();F.current=S,D.useEffect(()=>{if(_.current&&B)return W.current=Af({domNode:_.current,panZoom:B,getTransform:()=>N.getState().transform,getViewScale:()=>F.current}),()=>{var G;(G=W.current)==null||G.destroy()}},[B]),D.useEffect(()=>{var G;(G=W.current)==null||G.update({translateExtent:I,width:$,height:V,inversePan:b,pannable:y,zoomStep:p,zoomable:x})},[y,x,b,p,I,$,V]);const Q=h?G=>{var ee;const[te,ne]=((ee=W.current)==null?void 0:ee.pointer(G))||[0,0];h(G,{x:te,y:ne})}:void 0,K=g?D.useCallback((G,te)=>{const ne=N.getState().nodeLookup.get(te).internals.userNode;g(G,ne)},[]):void 0,Z=m??v["minimap.ariaLabel"];return P.jsx(sn,{position:f,style:{...e,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof l=="string"?l:void 0,"--xy-minimap-mask-stroke-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-width-props":typeof u=="number"?u*S:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof s=="number"?s:void 0},className:ie(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:P.jsxs("svg",{width:A,height:E,viewBox:`${O} ${j} ${Y} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":q,ref:_,onClick:Q,children:[Z&&P.jsx("title",{id:q,children:Z}),P.jsx(cg,{onClick:K,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:o,nodeStrokeWidth:s,nodeComponent:a}),P.jsx("path",{className:"react-flow__minimap-mask",d:`M${O-H},${j-H}h${Y+H*2}v${U+H*2}h${-Y-H*2}z
|
|
23
|
+
M${T.x},${T.y}h${T.width}v${T.height}h${-T.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}os.displayName="MiniMap";D.memo(os);const gg=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,pg={[Re.Line]:"right",[Re.Handle]:"bottom-right"};function mg({nodeId:e,position:t,variant:n=Re.Handle,className:r,style:o=void 0,children:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,resizeDirection:f,autoScale:h=!0,shouldResize:g,onResizeStart:y,onResize:x,onResizeEnd:m}){const b=Li(),p=typeof e=="string"?e:b,w=oe(),N=D.useRef(null),_=n===Re.Handle,M=J(D.useCallback(gg(_&&h),[_,h]),re),T=D.useRef(null),z=t??pg[n];D.useEffect(()=>{if(!(!N.current||!p))return T.current||(T.current=Yf({domNode:N.current,nodeId:p,getStoreItems:()=>{const{nodeLookup:I,transform:$,snapGrid:V,snapToGrid:v,nodeOrigin:A,domNode:E}=w.getState();return{nodeLookup:I,transform:$,snapGrid:V,snapToGrid:v,nodeOrigin:A,paneDomNode:E}},onChange:(I,$)=>{const{triggerNodeChanges:V,nodeLookup:v,parentLookup:A,nodeOrigin:E}=w.getState(),k=[],C={x:I.x,y:I.y},S=v.get(p);if(S&&S.expandParent&&S.parentId){const L=S.origin??E,R=I.width??S.measured.width??0,H=I.height??S.measured.height??0,O={id:S.id,parentId:S.parentId,rect:{width:R,height:H,...si({x:I.x??S.position.x,y:I.y??S.position.y},{width:R,height:H},S.parentId,v,L)}},j=er([O],v,A,E);k.push(...j),C.x=I.x?Math.max(L[0]*R,I.x):void 0,C.y=I.y?Math.max(L[1]*H,I.y):void 0}if(C.x!==void 0&&C.y!==void 0){const L={id:p,type:"position",position:{...C}};k.push(L)}if(I.width!==void 0&&I.height!==void 0){const R={id:p,type:"dimensions",resizing:!0,setAttributes:f?f==="horizontal"?"width":"height":!0,dimensions:{width:I.width,height:I.height}};k.push(R)}for(const L of $){const R={...L,type:"position"};k.push(R)}V(k)},onEnd:({width:I,height:$})=>{const V={id:p,type:"dimensions",resizing:!1,dimensions:{width:I,height:$}};w.getState().triggerNodeChanges([V])}})),T.current.update({controlPosition:z,boundaries:{minWidth:a,minHeight:c,maxWidth:l,maxHeight:d},keepAspectRatio:u,resizeDirection:f,onResizeStart:y,onResize:x,onResizeEnd:m,shouldResize:g}),()=>{var I;(I=T.current)==null||I.destroy()}},[z,a,c,l,d,u,y,x,m,g]);const B=z.split("-");return P.jsx("div",{className:ie(["react-flow__resize-control","nodrag",...B,n,r]),ref:N,style:{...o,scale:M,...s&&{[_?"backgroundColor":"borderColor"]:s}},children:i})}const xo=D.memo(mg);function _g({nodeId:e,isVisible:t=!0,handleClassName:n,handleStyle:r,lineClassName:o,lineStyle:i,color:s,minWidth:a=10,minHeight:c=10,maxWidth:l=Number.MAX_VALUE,maxHeight:d=Number.MAX_VALUE,keepAspectRatio:u=!1,autoScale:f=!0,shouldResize:h,onResizeStart:g,onResize:y,onResizeEnd:x}){return t?P.jsxs(P.Fragment,{children:[Vf.map(m=>P.jsx(xo,{className:o,style:i,nodeId:e,position:m,variant:Re.Line,color:s,minWidth:a,minHeight:c,maxWidth:l,maxHeight:d,onResizeStart:g,keepAspectRatio:u,autoScale:f,shouldResize:h,onResize:y,onResizeEnd:x},m)),Rf.map(m=>P.jsx(xo,{className:n,style:r,nodeId:e,position:m,color:s,minWidth:a,minHeight:c,maxWidth:l,maxHeight:d,onResizeStart:g,keepAspectRatio:u,autoScale:f,shouldResize:h,onResize:y,onResizeEnd:x},m))]}):null}export{cn as B,qe as C,wg as E,Gt as H,Yt as M,_g as N,X as P,Fh as R,vg as a,bg as b,xg as i,tr as u};
|