purecontext-mcp 1.1.8 → 1.2.0
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/AGENT_INSTRUCTIONS.md +393 -0
- package/AGENT_INSTRUCTIONS_SHORT.md +53 -0
- package/AST-SEARCH.md +274 -0
- package/CHANGELOG.md +62 -0
- package/CODE-INTELLIGENCE.md +369 -0
- package/HEALTH-DASHBOARDS.md +241 -0
- package/README.md +7 -0
- package/REFACTORING-SAFELY.md +279 -0
- package/UNDERSTANDING-RELATIONSHIPS.md +240 -0
- package/USER-GUIDE.md +14 -0
- package/VISUALIZING-CODE.md +199 -0
- package/WORKFLOW-TECH-DEBT.md +286 -0
- package/dist/core/db/dep-store.d.ts +75 -0
- package/dist/core/db/dep-store.d.ts.map +1 -1
- package/dist/core/db/dep-store.js +277 -0
- package/dist/core/db/dep-store.js.map +1 -1
- package/dist/core/db/schema.d.ts.map +1 -1
- package/dist/core/db/schema.js +12 -0
- package/dist/core/db/schema.js.map +1 -1
- package/dist/core/index-manager.js +1 -1
- package/dist/core/index-manager.js.map +1 -1
- package/dist/core/types.d.ts +5 -0
- package/dist/core/types.d.ts.map +1 -1
- package/dist/graph/diagram-renderer.d.ts +83 -0
- package/dist/graph/diagram-renderer.d.ts.map +1 -0
- package/dist/graph/diagram-renderer.js +294 -0
- package/dist/graph/diagram-renderer.js.map +1 -0
- package/dist/graph/graph-traversal.d.ts +92 -0
- package/dist/graph/graph-traversal.d.ts.map +1 -1
- package/dist/graph/graph-traversal.js +440 -2
- package/dist/graph/graph-traversal.js.map +1 -1
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +145 -0
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/tools/check-delete-safe.d.ts +50 -0
- package/dist/server/tools/check-delete-safe.d.ts.map +1 -0
- package/dist/server/tools/check-delete-safe.js +308 -0
- package/dist/server/tools/check-delete-safe.js.map +1 -0
- package/dist/server/tools/check-move-safe.d.ts +44 -0
- package/dist/server/tools/check-move-safe.d.ts.map +1 -0
- package/dist/server/tools/check-move-safe.js +266 -0
- package/dist/server/tools/check-move-safe.js.map +1 -0
- package/dist/server/tools/check-rename-safe.d.ts +48 -0
- package/dist/server/tools/check-rename-safe.d.ts.map +1 -0
- package/dist/server/tools/check-rename-safe.js +218 -0
- package/dist/server/tools/check-rename-safe.js.map +1 -0
- package/dist/server/tools/diff-health-radar.d.ts +44 -0
- package/dist/server/tools/diff-health-radar.d.ts.map +1 -0
- package/dist/server/tools/diff-health-radar.js +192 -0
- package/dist/server/tools/diff-health-radar.js.map +1 -0
- package/dist/server/tools/find-cycles.d.ts +31 -0
- package/dist/server/tools/find-cycles.d.ts.map +1 -0
- package/dist/server/tools/find-cycles.js +85 -0
- package/dist/server/tools/find-cycles.js.map +1 -0
- package/dist/server/tools/find-implementations.d.ts +47 -0
- package/dist/server/tools/find-implementations.d.ts.map +1 -0
- package/dist/server/tools/find-implementations.js +167 -0
- package/dist/server/tools/find-implementations.js.map +1 -0
- package/dist/server/tools/find-untested-symbols.d.ts +52 -0
- package/dist/server/tools/find-untested-symbols.d.ts.map +1 -0
- package/dist/server/tools/find-untested-symbols.js +308 -0
- package/dist/server/tools/find-untested-symbols.js.map +1 -0
- package/dist/server/tools/get-architecture-snapshot.d.ts +43 -0
- package/dist/server/tools/get-architecture-snapshot.d.ts.map +1 -0
- package/dist/server/tools/get-architecture-snapshot.js +292 -0
- package/dist/server/tools/get-architecture-snapshot.js.map +1 -0
- package/dist/server/tools/get-call-hierarchy.d.ts +43 -0
- package/dist/server/tools/get-call-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/get-call-hierarchy.js +119 -0
- package/dist/server/tools/get-call-hierarchy.js.map +1 -0
- package/dist/server/tools/get-class-hierarchy.d.ts +36 -0
- package/dist/server/tools/get-class-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/get-class-hierarchy.js +125 -0
- package/dist/server/tools/get-class-hierarchy.js.map +1 -0
- package/dist/server/tools/get-complexity-hotspots.d.ts +50 -0
- package/dist/server/tools/get-complexity-hotspots.d.ts.map +1 -0
- package/dist/server/tools/get-complexity-hotspots.js +282 -0
- package/dist/server/tools/get-complexity-hotspots.js.map +1 -0
- package/dist/server/tools/get-coupling-map.d.ts +39 -0
- package/dist/server/tools/get-coupling-map.d.ts.map +1 -0
- package/dist/server/tools/get-coupling-map.js +107 -0
- package/dist/server/tools/get-coupling-map.js.map +1 -0
- package/dist/server/tools/get-debt-report.d.ts +44 -0
- package/dist/server/tools/get-debt-report.d.ts.map +1 -0
- package/dist/server/tools/get-debt-report.js +606 -0
- package/dist/server/tools/get-debt-report.js.map +1 -0
- package/dist/server/tools/get-entry-points.d.ts +79 -0
- package/dist/server/tools/get-entry-points.d.ts.map +1 -0
- package/dist/server/tools/get-entry-points.js +362 -0
- package/dist/server/tools/get-entry-points.js.map +1 -0
- package/dist/server/tools/get-public-api.d.ts +53 -0
- package/dist/server/tools/get-public-api.d.ts.map +1 -0
- package/dist/server/tools/get-public-api.js +218 -0
- package/dist/server/tools/get-public-api.js.map +1 -0
- package/dist/server/tools/get-test-coverage-map.d.ts +66 -0
- package/dist/server/tools/get-test-coverage-map.d.ts.map +1 -0
- package/dist/server/tools/get-test-coverage-map.js +588 -0
- package/dist/server/tools/get-test-coverage-map.js.map +1 -0
- package/dist/server/tools/get-todos.d.ts +51 -0
- package/dist/server/tools/get-todos.d.ts.map +1 -0
- package/dist/server/tools/get-todos.js +180 -0
- package/dist/server/tools/get-todos.js.map +1 -0
- package/dist/server/tools/get-type-graph.d.ts +73 -0
- package/dist/server/tools/get-type-graph.d.ts.map +1 -0
- package/dist/server/tools/get-type-graph.js +437 -0
- package/dist/server/tools/get-type-graph.js.map +1 -0
- package/dist/server/tools/health-radar.d.ts +50 -0
- package/dist/server/tools/health-radar.d.ts.map +1 -0
- package/dist/server/tools/health-radar.js +426 -0
- package/dist/server/tools/health-radar.js.map +1 -0
- package/dist/server/tools/plan-refactoring.d.ts +74 -0
- package/dist/server/tools/plan-refactoring.d.ts.map +1 -0
- package/dist/server/tools/plan-refactoring.js +644 -0
- package/dist/server/tools/plan-refactoring.js.map +1 -0
- package/dist/server/tools/render-call-graph.d.ts +40 -0
- package/dist/server/tools/render-call-graph.d.ts.map +1 -0
- package/dist/server/tools/render-call-graph.js +215 -0
- package/dist/server/tools/render-call-graph.js.map +1 -0
- package/dist/server/tools/render-class-hierarchy.d.ts +42 -0
- package/dist/server/tools/render-class-hierarchy.d.ts.map +1 -0
- package/dist/server/tools/render-class-hierarchy.js +265 -0
- package/dist/server/tools/render-class-hierarchy.js.map +1 -0
- package/dist/server/tools/render-dep-matrix.d.ts +38 -0
- package/dist/server/tools/render-dep-matrix.d.ts.map +1 -0
- package/dist/server/tools/render-dep-matrix.js +186 -0
- package/dist/server/tools/render-dep-matrix.js.map +1 -0
- package/dist/server/tools/render-diagram.d.ts +47 -0
- package/dist/server/tools/render-diagram.d.ts.map +1 -0
- package/dist/server/tools/render-diagram.js +266 -0
- package/dist/server/tools/render-diagram.js.map +1 -0
- package/dist/server/tools/render-import-graph.d.ts +41 -0
- package/dist/server/tools/render-import-graph.d.ts.map +1 -0
- package/dist/server/tools/render-import-graph.js +158 -0
- package/dist/server/tools/render-import-graph.js.map +1 -0
- package/dist/server/tools/search-ast.d.ts +55 -0
- package/dist/server/tools/search-ast.d.ts.map +1 -0
- package/dist/server/tools/search-ast.js +279 -0
- package/dist/server/tools/search-ast.js.map +1 -0
- package/dist/server/tools/search-by-complexity.d.ts +92 -0
- package/dist/server/tools/search-by-complexity.d.ts.map +1 -0
- package/dist/server/tools/search-by-complexity.js +268 -0
- package/dist/server/tools/search-by-complexity.js.map +1 -0
- package/dist/server/tools/search-by-decorator.d.ts +48 -0
- package/dist/server/tools/search-by-decorator.d.ts.map +1 -0
- package/dist/server/tools/search-by-decorator.js +518 -0
- package/dist/server/tools/search-by-decorator.js.map +1 -0
- package/dist/server/tools/search-by-signature.d.ts +56 -0
- package/dist/server/tools/search-by-signature.d.ts.map +1 -0
- package/dist/server/tools/search-by-signature.js +200 -0
- package/dist/server/tools/search-by-signature.js.map +1 -0
- package/dist/ui/assets/BlastRadius-QdgESOL8.js +1 -0
- package/dist/ui/assets/{DependencyGraph-B60SMPbX.js → DependencyGraph-BSMhzwWV.js} +1 -1
- package/dist/ui/assets/{NotFound-Bsg8Wppk.js → NotFound-CipFP_s1.js} +1 -1
- package/dist/ui/assets/{RepoDetail-Cie0D4_s.js → RepoDetail-Dfp5z5Kq.js} +1 -1
- package/dist/ui/assets/{RepoList-CldNt89M.js → RepoList-BKtST3hB.js} +1 -1
- package/dist/ui/assets/{Search-CgvpHMOi.js → Search-DzhGDViy.js} +1 -1
- package/dist/ui/assets/{SymbolView-B9h0LZTz.js → SymbolView-ryVEwAHG.js} +1 -1
- package/dist/ui/assets/{index-DADf5y_L.css → index-Ny8gn9F0.css} +1 -1
- package/dist/ui/assets/{index-eK0wMkUR.js → index-nX2chMqi.js} +2 -2
- package/dist/ui/assets/{useSearch-KAl3Qyi2.js → useSearch-BnBCRKui.js} +1 -1
- package/dist/ui/index.html +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/dev/jcodemunch-gap-analysis.md +198 -0
- package/package.json +9 -1
- package/user-manual.md +2466 -0
- package/dist/ui/assets/BlastRadius-RP7vJEyQ.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{h as ka,i as Lo,k as Ia,R as Aa,r as P,j as b,d as $a,a as Pa,L as Do}from"./index-eK0wMkUR.js";ka();function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=it(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Ta={value:()=>{}};function Ne(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Xe(n)}function Xe(t){this._=t}function za(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Xe.prototype=Ne.prototype={constructor:Xe,on:function(t,e){var n=this._,r=za(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=ja(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=_r(n[o],t.name,e);else if(e==null)for(o in n)n[o]=_r(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Xe(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function ja(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function _r(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=Ta,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Tn="http://www.w3.org/1999/xhtml";const Nr={svg:"http://www.w3.org/2000/svg",xhtml:Tn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Nr.hasOwnProperty(e)?{space:Nr[e],local:t}:t}function La(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Tn&&e.documentElement.namespaceURI===Tn?e.createElement(t):e.createElementNS(n,t)}}function Da(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ro(t){var e=sn(t);return(e.local?Da:La)(e)}function Ra(){}function qn(t){return t==null?Ra:function(){return this.querySelector(t)}}function Ha(t){typeof t!="function"&&(t=qn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),l,c,f=0;f<s;++f)(l=i[f])&&(c=t.call(l,l.__data__,f,i))&&("__data__"in l&&(c.__data__=l.__data__),a[f]=c);return new ft(r,this._parents)}function Va(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ba(){return[]}function Ho(t){return t==null?Ba:function(){return this.querySelectorAll(t)}}function Fa(t){return function(){return Va(t.apply(this,arguments))}}function Oa(t){typeof t=="function"?t=Fa(t):t=Ho(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(r.push(t.call(l,l.__data__,c,s)),o.push(l));return new ft(r,o)}function Vo(t){return function(){return this.matches(t)}}function Bo(t){return function(e){return e.matches(t)}}var Xa=Array.prototype.find;function Ya(t){return function(){return Xa.call(this.children,t)}}function Wa(){return this.firstElementChild}function Ga(t){return this.select(t==null?Wa:Ya(typeof t=="function"?t:Bo(t)))}var qa=Array.prototype.filter;function Ua(){return Array.from(this.children)}function Za(t){return function(){return qa.call(this.children,t)}}function Ka(t){return this.selectAll(t==null?Ua:Za(typeof t=="function"?t:Bo(t)))}function Qa(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&a.push(l);return new ft(r,this._parents)}function Fo(t){return new Array(t.length)}function Ja(){return new ft(this._enter||this._groups.map(Fo),this._parents)}function Ue(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ue.prototype={constructor:Ue,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function tc(t){return function(){return t}}function ec(t,e,n,r,o,i){for(var s=0,a,l=e.length,c=i.length;s<c;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Ue(t,i[s]);for(;s<l;++s)(a=e[s])&&(o[s]=a)}function nc(t,e,n,r,o,i,s){var a,l,c=new Map,f=e.length,u=i.length,d=new Array(f),h;for(a=0;a<f;++a)(l=e[a])&&(d[a]=h=s.call(l,l.__data__,a,e)+"",c.has(h)?o[a]=l:c.set(h,l));for(a=0;a<u;++a)h=s.call(t,i[a],a,i)+"",(l=c.get(h))?(r[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new Ue(t,i[a]);for(a=0;a<f;++a)(l=e[a])&&c.get(d[a])===l&&(o[a]=l)}function rc(t){return t.__data__}function oc(t,e){if(!arguments.length)return Array.from(this,rc);var n=e?nc:ec,r=this._parents,o=this._groups;typeof t!="function"&&(t=tc(t));for(var i=o.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],u=o[c],d=u.length,h=ic(t.call(f,f&&f.__data__,c,r)),g=h.length,y=a[c]=new Array(g),p=s[c]=new Array(g),m=l[c]=new Array(d);n(f,u,y,p,m,h,e);for(var v=0,x=0,w,E;v<g;++v)if(w=y[v]){for(v>=x&&(x=v+1);!(E=p[x])&&++x<g;);w._next=E||null}}return s=new ft(s,r),s._enter=a,s._exit=l,s}function ic(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function sc(){return new ft(this._exit||this._groups.map(Fo),this._parents)}function ac(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function cc(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var c=n[l],f=r[l],u=c.length,d=a[l]=new Array(u),h,g=0;g<u;++g)(h=c[g]||f[g])&&(d[g]=h);for(;l<o;++l)a[l]=n[l];return new ft(a,this._parents)}function lc(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],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 uc(t){t||(t=fc);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}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,l=o[i]=new Array(a),c,f=0;f<a;++f)(c=s[f])&&(l[f]=c);l.sort(e)}return new ft(o,this._parents).order()}function fc(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function dc(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function hc(){return Array.from(this)}function gc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function pc(){let t=0;for(const e of this)++t;return t}function mc(){return!this.node()}function yc(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function xc(t){return function(){this.removeAttribute(t)}}function wc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vc(t,e){return function(){this.setAttribute(t,e)}}function bc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _c(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Nc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ec(t,e){var n=sn(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?wc:xc:typeof e=="function"?n.local?Nc:_c:n.local?bc:vc)(n,e))}function Oo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Sc(t){return function(){this.style.removeProperty(t)}}function Mc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Cc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function kc(t,e,n){return arguments.length>1?this.each((e==null?Sc:typeof e=="function"?Cc:Mc)(t,e,n??"")):qt(this.node(),t)}function qt(t,e){return t.style.getPropertyValue(e)||Oo(t).getComputedStyle(t,null).getPropertyValue(e)}function Ic(t){return function(){delete this[t]}}function Ac(t,e){return function(){this[t]=e}}function $c(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Pc(t,e){return arguments.length>1?this.each((e==null?Ic:typeof e=="function"?$c:Ac)(t,e)):this.node()[t]}function Xo(t){return t.trim().split(/^|\s+/)}function Un(t){return t.classList||new Yo(t)}function Yo(t){this._node=t,this._names=Xo(t.getAttribute("class")||"")}Yo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wo(t,e){for(var n=Un(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function Go(t,e){for(var n=Un(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function Tc(t){return function(){Wo(this,t)}}function zc(t){return function(){Go(this,t)}}function jc(t,e){return function(){(e.apply(this,arguments)?Wo:Go)(this,t)}}function Lc(t,e){var n=Xo(t+"");if(arguments.length<2){for(var r=Un(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?jc:e?Tc:zc)(n,e))}function Dc(){this.textContent=""}function Rc(t){return function(){this.textContent=t}}function Hc(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Vc(t){return arguments.length?this.each(t==null?Dc:(typeof t=="function"?Hc:Rc)(t)):this.node().textContent}function Bc(){this.innerHTML=""}function Fc(t){return function(){this.innerHTML=t}}function Oc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Xc(t){return arguments.length?this.each(t==null?Bc:(typeof t=="function"?Oc:Fc)(t)):this.node().innerHTML}function Yc(){this.nextSibling&&this.parentNode.appendChild(this)}function Wc(){return this.each(Yc)}function Gc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qc(){return this.each(Gc)}function Uc(t){var e=typeof t=="function"?t:Ro(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Zc(){return null}function Kc(t,e){var n=typeof t=="function"?t:Ro(t),r=e==null?Zc:typeof e=="function"?e:qn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qc(){var t=this.parentNode;t&&t.removeChild(this)}function Jc(){return this.each(Qc)}function tl(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function el(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function nl(t){return this.select(t?el:tl)}function rl(t){return arguments.length?this.property("__data__",t):this.node().__data__}function ol(t){return function(e){t.call(this,e,this.__data__)}}function il(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function sl(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function al(t,e,n){return function(){var r=this.__on,o,i=ol(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function cl(t,e,n){var r=il(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,f;l<c;++l)for(o=0,f=a[l];o<i;++o)if((s=r[o]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?al:sl,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function qo(t,e,n){var r=Oo(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function ll(t,e){return function(){return qo(this,t,e)}}function ul(t,e){return function(){return qo(this,t,e.apply(this,arguments))}}function fl(t,e){return this.each((typeof e=="function"?ul:ll)(t,e))}function*dl(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Uo=[null];function ft(t,e){this._groups=t,this._parents=e}function Ee(){return new ft([[document.documentElement]],Uo)}function hl(){return this}ft.prototype=Ee.prototype={constructor:ft,select:Ha,selectAll:Oa,selectChild:Ga,selectChildren:Ka,filter:Qa,data:oc,enter:Ja,exit:sc,join:ac,merge:cc,selection:hl,order:lc,sort:uc,call:dc,nodes:hc,node:gc,size:pc,empty:mc,each:yc,attr:Ec,style:kc,property:Pc,classed:Lc,text:Vc,html:Xc,raise:Wc,lower:qc,append:Uc,insert:Kc,remove:Jc,clone:nl,datum:rl,on:cl,dispatch:fl,[Symbol.iterator]:dl};function ut(t){return typeof t=="string"?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],Uo)}function gl(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=gl(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const pl={passive:!1},ge={capture:!0,passive:!1};function vn(t){t.stopImmediatePropagation()}function Wt(t){t.preventDefault(),t.stopImmediatePropagation()}function Zo(t){var e=t.document.documentElement,n=ut(t).on("dragstart.drag",Wt,ge);"onselectstart"in e?n.on("selectstart.drag",Wt,ge):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ko(t,e){var n=t.document.documentElement,r=ut(t).on("dragstart.drag",null);e&&(r.on("click.drag",Wt,ge),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 Te=t=>()=>t;function zn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:l,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}zn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ml(t){return!t.ctrlKey&&!t.button}function yl(){return this.parentNode}function xl(t,e){return e??{x:t.x,y:t.y}}function wl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(){var t=ml,e=yl,n=xl,r=wl,o={},i=Ne("start","drag","end"),s=0,a,l,c,f,u=0;function d(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",p).on("touchmove.drag",m,pl).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,E){if(!(f||!t.call(this,w,E))){var N=x(this,e.call(this,w,E),w,E,"mouse");N&&(ut(w.view).on("mousemove.drag",g,ge).on("mouseup.drag",y,ge),Zo(w.view),vn(w),c=!1,a=w.clientX,l=w.clientY,N("start",w))}}function g(w){if(Wt(w),!c){var E=w.clientX-a,N=w.clientY-l;c=E*E+N*N>u}o.mouse("drag",w)}function y(w){ut(w.view).on("mousemove.drag mouseup.drag",null),Ko(w.view,c),Wt(w),o.mouse("end",w)}function p(w,E){if(t.call(this,w,E)){var N=w.changedTouches,S=e.call(this,w,E),I=N.length,T,D;for(T=0;T<I;++T)(D=x(this,S,w,E,N[T].identifier,N[T]))&&(vn(w),D("start",w,N[T]))}}function m(w){var E=w.changedTouches,N=E.length,S,I;for(S=0;S<N;++S)(I=o[E[S].identifier])&&(Wt(w),I("drag",w,E[S]))}function v(w){var E=w.changedTouches,N=E.length,S,I;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),S=0;S<N;++S)(I=o[E[S].identifier])&&(vn(w),I("end",w,E[S]))}function x(w,E,N,S,I,T){var D=i.copy(),k=dt(T||N,E),j,H,_;if((_=n.call(w,new zn("beforestart",{sourceEvent:N,target:d,identifier:I,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:D}),S))!=null)return j=_.x-k[0]||0,H=_.y-k[1]||0,function $(C,z,A){var M=k,L;switch(C){case"start":o[I]=$,L=s++;break;case"end":delete o[I],--s;case"drag":k=dt(A||z,E),L=s;break}D.call(C,w,new zn(C,{sourceEvent:z,subject:_,target:d,identifier:I,active:L,x:k[0]+j,y:k[1]+H,dx:k[0]-M[0],dy:k[1]-M[1],dispatch:D}),S)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:Te(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:Te(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Te(w),d):n},d.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Te(!!w),d):r},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}function Zn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Jo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Se(){}var pe=.7,Ze=1/pe,Gt="\\s*([+-]?\\d+)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vl=/^#([0-9a-f]{3,8})$/,bl=new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`),_l=new RegExp(`^rgb\\(${xt},${xt},${xt}\\)$`),Nl=new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${me}\\)$`),El=new RegExp(`^rgba\\(${xt},${xt},${xt},${me}\\)$`),Sl=new RegExp(`^hsl\\(${me},${xt},${xt}\\)$`),Ml=new RegExp(`^hsla\\(${me},${xt},${xt},${me}\\)$`),Er={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};Zn(Se,Rt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Sr,formatHex:Sr,formatHex8:Cl,formatHsl:kl,formatRgb:Mr,toString:Mr});function Sr(){return this.rgb().formatHex()}function Cl(){return this.rgb().formatHex8()}function kl(){return ti(this).formatHsl()}function Mr(){return this.rgb().formatRgb()}function Rt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=vl.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Cr(e):n===3?new lt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ze(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ze(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=bl.exec(t))?new lt(e[1],e[2],e[3],1):(e=_l.exec(t))?new lt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nl.exec(t))?ze(e[1],e[2],e[3],e[4]):(e=El.exec(t))?ze(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Sl.exec(t))?Ar(e[1],e[2]/100,e[3]/100,1):(e=Ml.exec(t))?Ar(e[1],e[2]/100,e[3]/100,e[4]):Er.hasOwnProperty(t)?Cr(Er[t]):t==="transparent"?new lt(NaN,NaN,NaN,0):null}function Cr(t){return new lt(t>>16&255,t>>8&255,t&255,1)}function ze(t,e,n,r){return r<=0&&(t=e=n=NaN),new lt(t,e,n,r)}function Il(t){return t instanceof Se||(t=Rt(t)),t?(t=t.rgb(),new lt(t.r,t.g,t.b,t.opacity)):new lt}function jn(t,e,n,r){return arguments.length===1?Il(t):new lt(t,e,n,r??1)}function lt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Zn(lt,jn,Jo(Se,{brighter(t){return t=t==null?Ze:Math.pow(Ze,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?pe:Math.pow(pe,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lt(jt(this.r),jt(this.g),jt(this.b),Ke(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:kr,formatHex:kr,formatHex8:Al,formatRgb:Ir,toString:Ir}));function kr(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}`}function Al(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}${zt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ir(){const t=Ke(this.opacity);return`${t===1?"rgb(":"rgba("}${jt(this.r)}, ${jt(this.g)}, ${jt(this.b)}${t===1?")":`, ${t})`}`}function Ke(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function jt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zt(t){return t=jt(t),(t<16?"0":"")+t.toString(16)}function Ar(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ht(t,e,n,r)}function ti(t){if(t instanceof ht)return new ht(t.h,t.s,t.l,t.opacity);if(t instanceof Se||(t=Rt(t)),!t)return new ht;if(t instanceof ht)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,l=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=l<.5?i+o:2-i-o,s*=60):a=l>0&&l<1?0:s,new ht(s,a,l,t.opacity)}function $l(t,e,n,r){return arguments.length===1?ti(t):new ht(t,e,n,r??1)}function ht(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Zn(ht,$l,Jo(Se,{brighter(t){return t=t==null?Ze:Math.pow(Ze,t),new ht(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?pe:Math.pow(pe,t),new ht(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new lt(bn(t>=240?t-240:t+120,o,r),bn(t,o,r),bn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new ht($r(this.h),je(this.s),je(this.l),Ke(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 t=Ke(this.opacity);return`${t===1?"hsl(":"hsla("}${$r(this.h)}, ${je(this.s)*100}%, ${je(this.l)*100}%${t===1?")":`, ${t})`}`}}));function $r(t){return t=(t||0)%360,t<0?t+360:t}function je(t){return Math.max(0,Math.min(1,t||0))}function bn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Kn=t=>()=>t;function Pl(t,e){return function(n){return t+n*e}}function Tl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function zl(t){return(t=+t)==1?ei:function(e,n){return n-e?Tl(e,n,t):Kn(isNaN(e)?n:e)}}function ei(t,e){var n=e-t;return n?Pl(t,n):Kn(isNaN(t)?e:t)}const Qe=(function t(e){var n=zl(e);function r(o,i){var s=n((o=jn(o)).r,(i=jn(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=ei(o.opacity,i.opacity);return function(f){return o.r=s(f),o.g=a(f),o.b=l(f),o.opacity=c(f),o+""}}return r.gamma=t,r})(1);function jl(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function Ll(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Dl(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=de(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Rl(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function yt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Hl(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=de(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_n=new RegExp(Ln.source,"g");function Vl(t){return function(){return t}}function Bl(t){return function(e){return t(e)+""}}function ni(t,e){var n=Ln.lastIndex=_n.lastIndex=0,r,o,i,s=-1,a=[],l=[];for(t=t+"",e=e+"";(r=Ln.exec(t))&&(o=_n.exec(e));)(i=o.index)>n&&(i=e.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,l.push({i:s,x:yt(r,o)})),n=_n.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Bl(l[0].x):Vl(e):(e=l.length,function(c){for(var f=0,u;f<e;++f)a[(u=l[f]).i]=u.x(c);return a.join("")})}function de(t,e){var n=typeof e,r;return e==null||n==="boolean"?Kn(e):(n==="number"?yt:n==="string"?(r=Rt(e))?(e=r,Qe):ni:e instanceof Rt?Qe:e instanceof Date?Rl:Ll(e)?jl:Array.isArray(e)?Dl:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Hl:yt)(t,e)}var Pr=180/Math.PI,Dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(t,e,n,r,o,i){var s,a,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Pr,skewX:Math.atan(l)*Pr,scaleX:s,scaleY:a}}var Le;function Fl(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Dn:ri(e.a,e.b,e.c,e.d,e.e,e.f)}function Ol(t){return t==null||(Le||(Le=document.createElementNS("http://www.w3.org/2000/svg","g")),Le.setAttribute("transform",t),!(t=Le.transform.baseVal.consolidate()))?Dn:(t=t.matrix,ri(t.a,t.b,t.c,t.d,t.e,t.f))}function oi(t,e,n,r){function o(c){return c.length?c.pop()+" ":""}function i(c,f,u,d,h,g){if(c!==u||f!==d){var y=h.push("translate(",null,e,null,n);g.push({i:y-4,x:yt(c,u)},{i:y-2,x:yt(f,d)})}else(u||d)&&h.push("translate("+u+e+d+n)}function s(c,f,u,d){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),d.push({i:u.push(o(u)+"rotate(",null,r)-2,x:yt(c,f)})):f&&u.push(o(u)+"rotate("+f+r)}function a(c,f,u,d){c!==f?d.push({i:u.push(o(u)+"skewX(",null,r)-2,x:yt(c,f)}):f&&u.push(o(u)+"skewX("+f+r)}function l(c,f,u,d,h,g){if(c!==u||f!==d){var y=h.push(o(h)+"scale(",null,",",null,")");g.push({i:y-4,x:yt(c,u)},{i:y-2,x:yt(f,d)})}else(u!==1||d!==1)&&h.push(o(h)+"scale("+u+","+d+")")}return function(c,f){var u=[],d=[];return c=t(c),f=t(f),i(c.translateX,c.translateY,f.translateX,f.translateY,u,d),s(c.rotate,f.rotate,u,d),a(c.skewX,f.skewX,u,d),l(c.scaleX,c.scaleY,f.scaleX,f.scaleY,u,d),c=f=null,function(h){for(var g=-1,y=d.length,p;++g<y;)u[(p=d[g]).i]=p.x(h);return u.join("")}}}var Xl=oi(Fl,"px, ","px)","deg)"),Yl=oi(Ol,", ",")",")"),Wl=1e-12;function Tr(t){return((t=Math.exp(t))+1/t)/2}function Gl(t){return((t=Math.exp(t))-1/t)/2}function ql(t){return((t=Math.exp(2*t))-1)/(t+1)}const Ye=(function t(e,n,r){function o(i,s){var a=i[0],l=i[1],c=i[2],f=s[0],u=s[1],d=s[2],h=f-a,g=u-l,y=h*h+g*g,p,m;if(y<Wl)m=Math.log(d/c)/e,p=function(S){return[a+S*h,l+S*g,c*Math.exp(e*S*m)]};else{var v=Math.sqrt(y),x=(d*d-c*c+r*y)/(2*c*n*v),w=(d*d-c*c-r*y)/(2*d*n*v),E=Math.log(Math.sqrt(x*x+1)-x),N=Math.log(Math.sqrt(w*w+1)-w);m=(N-E)/e,p=function(S){var I=S*m,T=Tr(E),D=c/(n*v)*(T*ql(e*I+E)-Gl(E));return[a+D*h,l+D*g,c*T/Tr(e*I+E)]}}return p.duration=m*1e3*e/Math.SQRT2,p}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return t(s,a,l)},o})(Math.SQRT2,2,4);var Ut=0,ue=0,ae=0,ii=1e3,Je,fe,tn=0,Ht=0,an=0,ye=typeof performance=="object"&&performance.now?performance:Date,si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qn(){return Ht||(si(Ul),Ht=ye.now()+an)}function Ul(){Ht=0}function en(){this._call=this._time=this._next=null}en.prototype=Jn.prototype={constructor:en,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Qn():+n)+(e==null?0:+e),!this._next&&fe!==this&&(fe?fe._next=this:Je=this,fe=this),this._call=t,this._time=n,Rn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rn())}};function Jn(t,e,n){var r=new en;return r.restart(t,e,n),r}function Zl(){Qn(),++Ut;for(var t=Je,e;t;)(e=Ht-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ut}function zr(){Ht=(tn=ye.now())+an,Ut=ue=0;try{Zl()}finally{Ut=0,Ql(),Ht=0}}function Kl(){var t=ye.now(),e=t-tn;e>ii&&(an-=e,tn=t)}function Ql(){for(var t,e=Je,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Je=n);fe=t,Rn(r)}function Rn(t){if(!Ut){ue&&(ue=clearTimeout(ue));var e=t-Ht;e>24?(t<1/0&&(ue=setTimeout(zr,t-ye.now()-an)),ae&&(ae=clearInterval(ae))):(ae||(tn=ye.now(),ae=setInterval(Kl,ii)),Ut=1,si(zr))}}function jr(t,e,n){var r=new en;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var Jl=Ne("start","end","cancel","interrupt"),tu=[],ai=0,Lr=1,Hn=2,We=3,Dr=4,Vn=5,Ge=6;function cn(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;eu(t,n,{name:e,index:r,group:o,on:Jl,tween:tu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ai})}function tr(t,e){var n=mt(t,e);if(n.state>ai)throw new Error("too late; already scheduled");return n}function vt(t,e){var n=mt(t,e);if(n.state>We)throw new Error("too late; already running");return n}function mt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function eu(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Jn(i,0,n.time);function i(c){n.state=Lr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var f,u,d,h;if(n.state!==Lr)return l();for(f in r)if(h=r[f],h.name===n.name){if(h.state===We)return jr(s);h.state===Dr?(h.state=Ge,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[f]):+f<e&&(h.state=Ge,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[f])}if(jr(function(){n.state===We&&(n.state=Dr,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Hn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Hn){for(n.state=We,o=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(h=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(c){for(var f=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Vn,1),u=-1,d=o.length;++u<d;)o[u].call(t,f);n.state===Vn&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Ge,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function qe(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>Hn&&r.state<Vn,r.state=Ge,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function nu(t){return this.each(function(){qe(this,t)})}function ru(t,e){var n,r;return function(){var o=vt(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function ou(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=vt(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===e){o[l]=a;break}l===c&&o.push(a)}i.tween=o}}function iu(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=mt(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?ru:ou)(n,t,e))}function er(t,e,n){var r=t._id;return t.each(function(){var o=vt(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return mt(o,r).value[e]}}function ci(t,e){var n;return(typeof e=="number"?yt:e instanceof Rt?Qe:(n=Rt(e))?(e=n,Qe):ni)(t,e)}function su(t){return function(){this.removeAttribute(t)}}function au(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function lu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function uu(t,e,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a)))}}function fu(t,e,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a)))}}function du(t,e){var n=sn(t),r=n==="transform"?Yl:ci;return this.attrTween(t,typeof e=="function"?(n.local?fu:uu)(n,r,er(this,"attr."+t,e)):e==null?(n.local?au:su)(n):(n.local?lu:cu)(n,r,e))}function hu(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function gu(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function pu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&gu(t,i)),n}return o._value=e,o}function mu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&hu(t,i)),n}return o._value=e,o}function yu(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=sn(t);return this.tween(n,(r.local?pu:mu)(r,e))}function xu(t,e){return function(){tr(this,t).delay=+e.apply(this,arguments)}}function wu(t,e){return e=+e,function(){tr(this,t).delay=e}}function vu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?xu:wu)(e,t)):mt(this.node(),e).delay}function bu(t,e){return function(){vt(this,t).duration=+e.apply(this,arguments)}}function _u(t,e){return e=+e,function(){vt(this,t).duration=e}}function Nu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?bu:_u)(e,t)):mt(this.node(),e).duration}function Eu(t,e){if(typeof e!="function")throw new Error;return function(){vt(this,t).ease=e}}function Su(t){var e=this._id;return arguments.length?this.each(Eu(e,t)):mt(this.node(),e).ease}function Mu(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;vt(this,t).ease=n}}function Cu(t){if(typeof t!="function")throw new Error;return this.each(Mu(this._id,t))}function ku(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&a.push(l);return new St(r,this._parents,this._name,this._id)}function Iu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var l=e[a],c=n[a],f=l.length,u=s[a]=new Array(f),d,h=0;h<f;++h)(d=l[h]||c[h])&&(u[h]=d);for(;a<r;++a)s[a]=e[a];return new St(s,this._parents,this._name,this._id)}function Au(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function $u(t,e,n){var r,o,i=Au(e)?tr:vt;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function Pu(t,e){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(t):this.each($u(n,t,e))}function Tu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function zu(){return this.on("end.remove",Tu(this._id))}function ju(t){var e=this._name,n=this._id;typeof t!="function"&&(t=qn(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],l=a.length,c=i[s]=new Array(l),f,u,d=0;d<l;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),c[d]=u,cn(c[d],e,n,d,c,mt(f,n)));return new St(i,this._parents,e,n)}function Lu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ho(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var l=r[a],c=l.length,f,u=0;u<c;++u)if(f=l[u]){for(var d=t.call(f,f.__data__,u,l),h,g=mt(f,n),y=0,p=d.length;y<p;++y)(h=d[y])&&cn(h,e,n,y,d,g);i.push(d),s.push(f)}return new St(i,s,e,n)}var Du=Ee.prototype.constructor;function Ru(){return new Du(this._groups,this._parents)}function Hu(t,e){var n,r,o;return function(){var i=qt(this,t),s=(this.style.removeProperty(t),qt(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function li(t){return function(){this.style.removeProperty(t)}}function Vu(t,e,n){var r,o=n+"",i;return function(){var s=qt(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function Bu(t,e,n){var r,o,i;return function(){var s=qt(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),qt(this,t))),s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a))}}function Fu(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var l=vt(this,t),c=l.on,f=l.value[i]==null?a||(a=li(e)):void 0;(c!==n||o!==f)&&(r=(n=c).copy()).on(s,o=f),l.on=r}}function Ou(t,e,n){var r=(t+="")=="transform"?Xl:ci;return e==null?this.styleTween(t,Hu(t,r)).on("end.style."+t,li(t)):typeof e=="function"?this.styleTween(t,Bu(t,r,er(this,"style."+t,e))).each(Fu(this._id,t)):this.styleTween(t,Vu(t,r,e),n).on("end.style."+t,null)}function Xu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Yu(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&Xu(t,s,n)),r}return i._value=e,i}function Wu(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Yu(t,e,n??""))}function Gu(t){return function(){this.textContent=t}}function qu(t){return function(){var e=t(this);this.textContent=e??""}}function Uu(t){return this.tween("text",typeof t=="function"?qu(er(this,"text",t)):Gu(t==null?"":t+""))}function Zu(t){return function(e){this.textContent=t.call(this,e)}}function Ku(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&Zu(o)),e}return r._value=t,r}function Qu(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Ku(t))}function Ju(){for(var t=this._name,e=this._id,n=ui(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var f=mt(l,e);cn(l,t,n,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new St(r,this._parents,t,n)}function tf(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--o===0&&i()}};n.each(function(){var c=vt(this,r),f=c.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),o===0&&i()})}var ef=0;function St(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ui(){return++ef}var _t=Ee.prototype;St.prototype={constructor:St,select:ju,selectAll:Lu,selectChild:_t.selectChild,selectChildren:_t.selectChildren,filter:ku,merge:Iu,selection:Ru,transition:Ju,call:_t.call,nodes:_t.nodes,node:_t.node,size:_t.size,empty:_t.empty,each:_t.each,on:Pu,attr:du,attrTween:yu,style:Ou,styleTween:Wu,text:Uu,textTween:Qu,remove:zu,tween:iu,delay:vu,duration:Nu,ease:Su,easeVarying:Cu,end:tf,[Symbol.iterator]:_t[Symbol.iterator]};function nf(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var rf={time:null,delay:0,duration:250,ease:nf};function of(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function sf(t){var e,n;t instanceof St?(e=t._id,t=t._name):(e=ui(),(n=rf).time=Qn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&cn(l,t,e,c,s,n||of(l,e));return new St(r,this._parents,t,e)}Ee.prototype.interrupt=nu;Ee.prototype.transition=sf;const De=t=>()=>t;function af(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Nt(t,e,n){this.k=t,this.x=e,this.y=n}Nt.prototype={constructor:Nt,scale:function(t){return t===1?this:new Nt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Nt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ln=new Nt(1,0,0);fi.prototype=Nt.prototype;function fi(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ln;return t.__zoom}function Nn(t){t.stopImmediatePropagation()}function ce(t){t.preventDefault(),t.stopImmediatePropagation()}function cf(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function lf(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Rr(){return this.__zoom||ln}function uf(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ff(){return navigator.maxTouchPoints||"ontouchstart"in this}function df(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 di(){var t=cf,e=lf,n=df,r=uf,o=ff,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ye,c=Ne("start","zoom","end"),f,u,d,h=500,g=150,y=0,p=10;function m(_){_.property("__zoom",Rr).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(o).on("touchstart.zoom",k).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,$,C,z){var A=_.selection?_.selection():_;A.property("__zoom",Rr),_!==A?E(_,$,C,z):A.interrupt().each(function(){N(this,arguments).event(z).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},m.scaleBy=function(_,$,C,z){m.scaleTo(_,function(){var A=this.__zoom.k,M=typeof $=="function"?$.apply(this,arguments):$;return A*M},C,z)},m.scaleTo=function(_,$,C,z){m.transform(_,function(){var A=e.apply(this,arguments),M=this.__zoom,L=C==null?w(A):typeof C=="function"?C.apply(this,arguments):C,V=M.invert(L),R=typeof $=="function"?$.apply(this,arguments):$;return n(x(v(M,R),L,V),A,s)},C,z)},m.translateBy=function(_,$,C,z){m.transform(_,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),s)},null,z)},m.translateTo=function(_,$,C,z,A){m.transform(_,function(){var M=e.apply(this,arguments),L=this.__zoom,V=z==null?w(M):typeof z=="function"?z.apply(this,arguments):z;return n(ln.translate(V[0],V[1]).scale(L.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof C=="function"?-C.apply(this,arguments):-C),M,s)},z,A)};function v(_,$){return $=Math.max(i[0],Math.min(i[1],$)),$===_.k?_:new Nt($,_.x,_.y)}function x(_,$,C){var z=$[0]-C[0]*_.k,A=$[1]-C[1]*_.k;return z===_.x&&A===_.y?_:new Nt(_.k,z,A)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function E(_,$,C,z){_.on("start.zoom",function(){N(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(z).end()}).tween("zoom",function(){var A=this,M=arguments,L=N(A,M).event(z),V=e.apply(A,M),R=C==null?w(V):typeof C=="function"?C.apply(A,M):C,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),Y=A.__zoom,W=typeof $=="function"?$.apply(A,M):$,q=l(Y.invert(R).concat(X/Y.k),W.invert(R).concat(X/W.k));return function(F){if(F===1)F=W;else{var B=q(F),O=X/B[2];F=new Nt(O,R[0]-B[0]*O,R[1]-B[1]*O)}L.zoom(null,F)}})}function N(_,$,C){return!C&&_.__zooming||new S(_,$)}function S(_,$){this.that=_,this.args=$,this.active=0,this.sourceEvent=null,this.extent=e.apply(_,$),this.taps=0}S.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,$){return this.mouse&&_!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var $=ut(this.that).datum();c.call(_,this.that,new af(_,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),$)}};function I(_,...$){if(!t.apply(this,arguments))return;var C=N(this,$).event(_),z=this.__zoom,A=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),M=dt(_);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===A)return;C.mouse=[M,z.invert(M)],qe(this),C.start()}ce(_),C.wheel=setTimeout(L,g),C.zoom("mouse",n(x(v(z,A),C.mouse[0],C.mouse[1]),C.extent,s));function L(){C.wheel=null,C.end()}}function T(_,...$){if(d||!t.apply(this,arguments))return;var C=_.currentTarget,z=N(this,$,!0).event(_),A=ut(_.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),M=dt(_,C),L=_.clientX,V=_.clientY;Zo(_.view),Nn(_),z.mouse=[M,this.__zoom.invert(M)],qe(this),z.start();function R(Y){if(ce(Y),!z.moved){var W=Y.clientX-L,q=Y.clientY-V;z.moved=W*W+q*q>y}z.event(Y).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=dt(Y,C),z.mouse[1]),z.extent,s))}function X(Y){A.on("mousemove.zoom mouseup.zoom",null),Ko(Y.view,z.moved),ce(Y),z.event(Y).end()}}function D(_,...$){if(t.apply(this,arguments)){var C=this.__zoom,z=dt(_.changedTouches?_.changedTouches[0]:_,this),A=C.invert(z),M=C.k*(_.shiftKey?.5:2),L=n(x(v(C,M),z,A),e.apply(this,$),s);ce(_),a>0?ut(this).transition().duration(a).call(E,L,z,_):ut(this).call(m.transform,L,z,_)}}function k(_,...$){if(t.apply(this,arguments)){var C=_.touches,z=C.length,A=N(this,$,_.changedTouches.length===z).event(_),M,L,V,R;for(Nn(_),L=0;L<z;++L)V=C[L],R=dt(V,this),R=[R,this.__zoom.invert(R),V.identifier],A.touch0?!A.touch1&&A.touch0[2]!==R[2]&&(A.touch1=R,A.taps=0):(A.touch0=R,M=!0,A.taps=1+!!f);f&&(f=clearTimeout(f)),M&&(A.taps<2&&(u=R[0],f=setTimeout(function(){f=null},h)),qe(this),A.start())}}function j(_,...$){if(this.__zooming){var C=N(this,$).event(_),z=_.changedTouches,A=z.length,M,L,V,R;for(ce(_),M=0;M<A;++M)L=z[M],V=dt(L,this),C.touch0&&C.touch0[2]===L.identifier?C.touch0[0]=V:C.touch1&&C.touch1[2]===L.identifier&&(C.touch1[0]=V);if(L=C.that.__zoom,C.touch1){var X=C.touch0[0],Y=C.touch0[1],W=C.touch1[0],q=C.touch1[1],F=(F=W[0]-X[0])*F+(F=W[1]-X[1])*F,B=(B=q[0]-Y[0])*B+(B=q[1]-Y[1])*B;L=v(L,Math.sqrt(F/B)),V=[(X[0]+W[0])/2,(X[1]+W[1])/2],R=[(Y[0]+q[0])/2,(Y[1]+q[1])/2]}else if(C.touch0)V=C.touch0[0],R=C.touch0[1];else return;C.zoom("touch",n(x(L,V,R),C.extent,s))}}function H(_,...$){if(this.__zooming){var C=N(this,$).event(_),z=_.changedTouches,A=z.length,M,L;for(Nn(_),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<A;++M)L=z[M],C.touch0&&C.touch0[2]===L.identifier?delete C.touch0:C.touch1&&C.touch1[2]===L.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(L=dt(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<p)){var V=ut(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:De(+_),m):r},m.filter=function(_){return arguments.length?(t=typeof _=="function"?_:De(!!_),m):t},m.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:De(!!_),m):o},m.extent=function(_){return arguments.length?(e=typeof _=="function"?_:De([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):e},m.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],m):[i[0],i[1]]},m.translateExtent=function(_){return arguments.length?(s[0][0]=+_[0][0],s[1][0]=+_[1][0],s[0][1]=+_[0][1],s[1][1]=+_[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(l=_,m):l},m.on=function(){var _=c.on.apply(c,arguments);return _===c?m:_},m.clickDistance=function(_){return arguments.length?(y=(_=+_)*_,m):Math.sqrt(y)},m.tapDistance=function(_){return arguments.length?(p=+_,m):p},m}const wt={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},xe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],hi=["Enter"," ","Escape"],gi={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Zt;(function(t){t.Strict="strict",t.Loose="loose"})(Zt||(Zt={}));var Lt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Lt||(Lt={}));var we;(function(t){t.Partial="partial",t.Full="full"})(we||(we={}));const pi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var At;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(At||(At={}));var Kt;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(G||(G={}));const Hr={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function mi(t){return t===null?null:t?"valid":"invalid"}const yi=t=>"id"in t&&"source"in t&&"target"in t,hf=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),nr=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Me=(t,e=[0,0])=>{const{width:n,height:r}=Mt(t),o=t.origin??e,i=n*o[0],s=r*o[1];return{x:t.position.x-i,y:t.position.y-s}},gf=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const i=typeof o=="string";let s=!e.nodeLookup&&!i?o:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(o):nr(o)?o:e.nodeLookup.get(o.id));const a=s?nn(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return un(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(o=>{(e.filter===void 0||e.filter(o))&&(n=un(n,nn(o)),r=!0)}),r?fn(n):{x:0,y:0,width:0,height:0}},rr=(t,e,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...Ie(e,[n,r,o]),width:e.width/o,height:e.height/o},l=[];for(const c of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=c;if(s&&!u||d)continue;const h=f.width??c.width??c.initialWidth??null,g=f.height??c.height??c.initialHeight??null,y=ve(a,Jt(c)),p=(h??0)*(g??0),m=i&&y>0;(!c.internals.handleBounds||m||y>=p||c.dragging)&&l.push(c)}return l},pf=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function mf(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(o=>o.id)):null;return t.forEach(o=>{o.measured.width&&o.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function yf({nodes:t,width:e,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=mf(t,s),l=Ce(a),c=or(l,e,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(c,{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 xi({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",wt.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[l,c],[l+h,c+g]])}else a&&te(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=te(u)?Vt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",wt.error015())),{position:{x:d.x-l+(s.measured.width??0)*f[0],y:d.y-c+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function xf({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(y=>y.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),l=r.filter(d=>d.deletable!==!1),f=pf(s,l);for(const d of l)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!o)return{edges:f,nodes:s};const u=await o({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Qt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Vt=(t={x:0,y:0},e,n)=>({x:Qt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Qt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function wi(t,e,n){const{width:r,height:o}=Mt(n),{x:i,y:s}=n.internals.positionAbsolute;return Vt(t,[[i,s],[i+r,s+o]],e)}const Vr=(t,e,n)=>t<e?Qt(Math.abs(t-e),1,e)/e:t>n?-Qt(Math.abs(t-n),1,e)/e:0,vi=(t,e,n=15,r=40)=>{const o=Vr(t.x,r,e.width-r)*n,i=Vr(t.y,r,e.height-r)*n;return[o,i]},un=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Bn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),fn=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),Jt=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=nr(t)?t.internals.positionAbsolute:Me(t,e);return{x:n,y:r,width:((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},nn=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=nr(t)?t.internals.positionAbsolute:Me(t,e);return{x:n,y:r,x2:n+(((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0),y2:r+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},bi=(t,e)=>fn(un(Bn(t),Bn(e))),ve=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},Br=t=>gt(t.width)&>(t.height)&>(t.x)&>(t.y),gt=t=>!isNaN(t)&&isFinite(t),wf=(t,e)=>{},ke=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Ie=({x:t,y:e},[n,r,o],i=!1,s=[1,1])=>{const a={x:(t-n)/o,y:(e-r)/o};return i?ke(a,s):a},rn=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r});function Ot(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vf(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Ot(t,n),o=Ot(t,e);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof t=="object"){const r=Ot(t.top??t.y??0,n),o=Ot(t.bottom??t.y??0,n),i=Ot(t.left??t.x??0,e),s=Ot(t.right??t.x??0,e);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 bf(t,e,n,r,o,i){const{x:s,y:a}=rn(t,[e,n,r]),{x:l,y:c}=rn({x:t.x+t.width,y:t.y+t.height},[e,n,r]),f=o-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const or=(t,e,n,r,o,i)=>{const s=vf(i,e,n),a=(e-s.x)/t.width,l=(n-s.y)/t.height,c=Math.min(a,l),f=Qt(c,r,o),u=t.x+t.width/2,d=t.y+t.height/2,h=e/2-u*f,g=n/2-d*f,y=bf(t,h,g,f,e,n),p={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-p.left+p.right,y:g-p.top+p.bottom,zoom:f}},be=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function te(t){return t!=null&&t!=="parent"}function Mt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function _i(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Ni(t,e={width:0,height:0},n,r,o){const i={...t},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function Fr(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function _f(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}function Nf(t){return{...gi,...t||{}}}function he(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pt(t),a=Ie({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:l,y:c}=n?ke(a,e):a;return{xSnapped:l,ySnapped:c,...a}}const ir=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ei=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Ef=["INPUT","SELECT","TEXTAREA"];function Si(t){var r,o;const e=((o=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:o[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:Ef.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Mi=t=>"clientX"in t,pt=(t,e)=>{var i,s;const n=Mi(t),r=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,o=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},Or=(t,e,n,r,o)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...ir(s)}})};function Ci({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=t*.125+o*.375+s*.375+n*.125,c=e*.125+i*.375+a*.375+r*.125,f=Math.abs(l-t),u=Math.abs(c-e);return[l,c,f,u]}function Re(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Xr({pos:t,x1:e,y1:n,x2:r,y2:o,c:i}){switch(t){case G.Left:return[e-Re(e-r,i),n];case G.Right:return[e+Re(r-e,i),n];case G.Top:return[e,n-Re(n-o,i)];case G.Bottom:return[e,n+Re(o-n,i)]}}function ki({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[a,l]=Xr({pos:n,x1:t,y1:e,x2:r,y2:o,c:s}),[c,f]=Xr({pos:i,x1:r,y1:o,x2:t,y2:e,c:s}),[u,d,h,g]=Ci({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:f});return[`M${t},${e} C${a},${l} ${c},${f} ${r},${o}`,u,d,h,g]}function Ii({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,i=n<t?n+o:n-o,s=Math.abs(r-e)/2,a=r<e?r+s:r-s;return[i,a,o,s]}function Sf({sourceNode:t,targetNode:e,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(t.parentId||o&&t.selected?t.internals.z:0,e.parentId||o&&e.selected?e.internals.z:0);return s+a}function Mf({sourceNode:t,targetNode:e,width:n,height:r,transform:o}){const i=un(nn(t),nn(e));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 ve(s,fn(i))>0}const Cf=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,kf=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),If=(t,e,n={})=>{if(!t.source||!t.target)return e;const r=n.getEdgeId||Cf;let o;return yi(t)?o={...t}:o={...t,id:r(t)},kf(o,e)?e:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,e.concat(o))};function Ai({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,i,s,a]=Ii({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,i,s,a]}const Yr={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},Af=({source:t,sourcePosition:e=G.Bottom,target:n})=>e===G.Left||e===G.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Wr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function $f({source:t,sourcePosition:e=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const a=Yr[e],l=Yr[r],c={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+l.x*i,y:n.y+l.y*i},u=Af({source:c,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",h=u[d];let g=[],y,p;const m={x:0,y:0},v={x:0,y:0},[,,x,w]=Ii({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(y=o.x??c.x+(f.x-c.x)*s,p=o.y??(c.y+f.y)/2):(y=o.x??(c.x+f.x)/2,p=o.y??c.y+(f.y-c.y)*s);const I=[{x:y,y:c.y},{x:y,y:f.y}],T=[{x:c.x,y:p},{x:f.x,y:p}];a[d]===h?g=d==="x"?I:T:g=d==="x"?T:I}else{const I=[{x:c.x,y:f.y}],T=[{x:f.x,y:c.y}];if(d==="x"?g=a.x===h?T:I:g=a.y===h?I:T,e===r){const _=Math.abs(t[d]-n[d]);if(_<=i){const $=Math.min(i-1,i-_);a[d]===h?m[d]=(c[d]>t[d]?-1:1)*$:v[d]=(f[d]>n[d]?-1:1)*$}}if(e!==r){const _=d==="x"?"y":"x",$=a[d]===l[_],C=c[_]>f[_],z=c[_]<f[_];(a[d]===1&&(!$&&C||$&&z)||a[d]!==1&&(!$&&z||$&&C))&&(g=d==="x"?I:T)}const D={x:c.x+m.x,y:c.y+m.y},k={x:f.x+v.x,y:f.y+v.y},j=Math.max(Math.abs(D.x-g[0].x),Math.abs(k.x-g[0].x)),H=Math.max(Math.abs(D.y-g[0].y),Math.abs(k.y-g[0].y));j>=H?(y=(D.x+k.x)/2,p=g[0].y):(y=g[0].x,p=(D.y+k.y)/2)}const E={x:c.x+m.x,y:c.y+m.y},N={x:f.x+v.x,y:f.y+v.y};return[[t,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...N.x!==g[g.length-1].x||N.y!==g[g.length-1].y?[N]:[],n],y,p,x,w]}function Pf(t,e,n,r){const o=Math.min(Wr(t,e)/2,Wr(e,n)/2,r),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const c=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+o*c},${s}Q ${i},${s} ${i},${s+o*f}`}const a=t.x<n.x?1:-1,l=t.y<n.y?-1:1;return`L ${i},${s+o*l}Q ${i},${s} ${i+o*a},${s}`}function Fn({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:f=.5}){const[u,d,h,g,y]=$f({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:f});let p=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)p+=Pf(u[m-1],u[m],u[m+1],s);return p+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[p,d,h,g,y]}function Gr(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function Tf(t){var u;const{sourceNode:e,targetNode:n}=t;if(!Gr(e)||!Gr(n))return null;const r=e.internals.handleBounds||qr(e.handles),o=n.internals.handleBounds||qr(n.handles),i=Ur((r==null?void 0:r.source)??[],t.sourceHandle),s=Ur(t.connectionMode===Zt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",wt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||G.Bottom,l=(s==null?void 0:s.position)||G.Top,c=Bt(e,i,a),f=Bt(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:l}}function qr(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function Bt(t,e,n=G.Left,r=!1){const o=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??Mt(t);if(r)return{x:o+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case G.Top:return{x:o+s/2,y:i};case G.Right:return{x:o+s,y:i+a/2};case G.Bottom:return{x:o+s/2,y:i+a};case G.Left:return{x:o,y:i+a/2}}}function Ur(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function On(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function zf(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(l=>{if(l&&typeof l=="object"){const c=On(l,e);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const $i=1e3,jf=10,sr={nodeOrigin:[0,0],nodeExtent:xe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Lf={...sr,checkEquality:!0};function ar(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function Df(t,e,n){const r=ar(sr,n);for(const o of t.values())if(o.parentId)lr(o,t,e,r);else{const i=Me(o,r.nodeOrigin),s=te(o.extent)?o.extent:r.nodeExtent,a=Vt(i,s,Mt(o));o.internals.positionAbsolute=a}}function Rf(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const o of t.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:t.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 cr(t){return t==="manual"}function Xn(t,e,n,r={}){var f,u;const o=ar(Lf,r),i={i:0},s=new Map(e),a=o!=null&&o.elevateNodesOnSelect&&!cr(o.zIndexMode)?$i:0;let l=t.length>0,c=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(o.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=Me(d,o.nodeOrigin),y=te(d.extent)?d.extent:o.nodeExtent,p=Vt(g,y,Mt(d));h={...o.defaults,...d,measured:{width:(f=d.measured)==null?void 0:f.width,height:(u=d.measured)==null?void 0:u.height},internals:{positionAbsolute:p,handleBounds:Rf(d,h),z:Pi(d,a,o.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),d.parentId&&lr(h,e,n,r,i),c||(c=d.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:c}}function Hf(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function lr(t,e,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=ar(sr,r),c=t.parentId,f=e.get(c);if(!f){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Hf(t,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&l==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*jf),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const u=i&&!cr(l)?$i:0,{x:d,y:h,z:g}=Vf(t,f,s,a,u,l),{positionAbsolute:y}=t.internals,p=d!==y.x||h!==y.y;(p||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:p?{x:d,y:h}:y,z:g}})}function Pi(t,e,n){const r=gt(t.zIndex)?t.zIndex:0;return cr(n)?r:r+(t.selected?e:0)}function Vf(t,e,n,r,o,i){const{x:s,y:a}=e.internals.positionAbsolute,l=Mt(t),c=Me(t,n),f=te(t.extent)?Vt(c,t.extent,l):c;let u=Vt({x:s+f.x,y:a+f.y},r,l);t.extent==="parent"&&(u=wi(u,l,e));const d=Pi(t,o,i),h=e.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}function ur(t,e,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of t){const l=e.get(a.parentId);if(!l)continue;const c=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Jt(l),f=bi(c,a.rect);i.set(a.parentId,{expandedRect:f,parent:l})}return i.size>0&&i.forEach(({expandedRect:a,parent:l},c)=>{var x;const f=l.internals.positionAbsolute,u=Mt(l),d=l.origin??r,h=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,y=Math.max(u.width,Math.round(a.width)),p=Math.max(u.height,Math.round(a.height)),m=(y-u.width)*d[0],v=(p-u.height)*d[1];(h>0||g>0||m||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-h+m,y:l.position.y-g+v}}),(x=n.get(c))==null||x.forEach(w=>{t.some(E=>E.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:c,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?d[0]*h-m:0),height:p+(g?d[1]*g-v:0)}})}),o}function Bf(t,e,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const y=ir(h.nodeElement),p=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(p||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),x=te(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=wi(w,y,e.get(g.parentId)):x&&(w=Vt(w,x,y));const E={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Or("source",h.nodeElement,v,u,g.id),target:Or("target",h.nodeElement,v,u,g.id)}}};e.set(g.id,E),g.parentId&&lr(E,e,n,{nodeOrigin:o,zIndexMode:s}),l=!0,p&&(c.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Jt(E,o)}))}}if(d.length>0){const h=ur(d,e,n,o);c.push(...h)}return{changes:c,updatedInternals:l}}async function Ff({delta:t,panZoom:e,transform:n,translateExtent:r,width:o,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.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 Zr(t,e,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,e)),s=`${o}-${t}`;const l=r.get(s)||new Map;if(r.set(s,l.set(n,e)),i){s=`${o}-${t}-${i}`;const c=r.get(s)||new Map;r.set(s,c.set(n,e))}}function Ti(t,e,n){t.clear(),e.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,l={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},c=`${o}-${s}--${i}-${a}`,f=`${i}-${a}--${o}-${s}`;Zr("source",l,f,t,o,s),Zr("target",l,c,t,i,a),e.set(r.id,r)}}function zi(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:zi(n,e):!1}function Kr(t,e,n){var o;let r=t;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Of(t,e,n,r){const o=new Map;for(const[i,s]of t)if((s.selected||s.id===r)&&(!s.parentId||!zi(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 En({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var s,a,l;const o=[];for(const[c,f]of e){const u=(s=n.get(c))==null?void 0:s.internals.userNode;u&&o.push({...u,position:f.position,dragging:r})}if(!t)return[o[0],o];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((l=e.get(t))==null?void 0:l.position)||i.position,dragging:r}:o[0],o]}function Xf({dragItems:t,snapGrid:e,x:n,y:r}){const o=t.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=ke(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Yf({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},f=null,u=!1,d=null,h=!1,g=!1,y=null;function p({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:E,nodeId:N,nodeClickDistance:S=0}){d=ut(w);function I({x:j,y:H}){const{nodeLookup:_,nodeExtent:$,snapGrid:C,snapToGrid:z,nodeOrigin:A,onNodeDrag:M,onSelectionDrag:L,onError:V,updateNodePositions:R}=e();i={x:j,y:H};let X=!1;const Y=a.size>1,W=Y&&$?Bn(Ce(a)):null,q=Y&&z?Xf({dragItems:a,snapGrid:C,x:j,y:H}):null;for(const[F,B]of a){if(!_.has(F))continue;let O={x:j-B.distance.x,y:H-B.distance.y};z&&(O=q?{x:Math.round(O.x+q.x),y:Math.round(O.y+q.y)}:ke(O,C));let Z=null;if(Y&&$&&!B.extent&&W){const{positionAbsolute:U}=B.internals,et=U.x-W.x+$[0][0],nt=U.x+B.measured.width-W.x2+$[1][0],tt=U.y-W.y+$[0][1],st=U.y+B.measured.height-W.y2+$[1][1];Z=[[et,tt],[nt,st]]}const{position:Q,positionAbsolute:K}=xi({nodeId:F,nextPosition:O,nodeLookup:_,nodeExtent:Z||$,nodeOrigin:A,onError:V});X=X||B.position.x!==Q.x||B.position.y!==Q.y,B.position=Q,B.internals.positionAbsolute=K}if(g=g||X,!!X&&(R(a,!0),y&&(r||M||!N&&L))){const[F,B]=En({nodeId:N,dragItems:a,nodeLookup:_});r==null||r(y,a,F,B),M==null||M(y,F,B),N||L==null||L(y,B)}}async function T(){if(!f)return;const{transform:j,panBy:H,autoPanSpeed:_,autoPanOnNodeDrag:$}=e();if(!$){l=!1,cancelAnimationFrame(s);return}const[C,z]=vi(c,f,_);(C!==0||z!==0)&&(i.x=(i.x??0)-C/j[2],i.y=(i.y??0)-z/j[2],await H({x:C,y:z})&&I(i)),s=requestAnimationFrame(T)}function D(j){var Y;const{nodeLookup:H,multiSelectionActive:_,nodesDraggable:$,transform:C,snapGrid:z,snapToGrid:A,selectNodesOnDrag:M,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=e();u=!0,(!M||!E)&&!_&&N&&((Y=H.get(N))!=null&&Y.selected||R()),E&&M&&N&&(t==null||t(N));const X=he(j.sourceEvent,{transform:C,snapGrid:z,snapToGrid:A,containerBounds:f});if(i=X,a=Of(H,$,X,N),a.size>0&&(n||L||!N&&V)){const[W,q]=En({nodeId:N,dragItems:a,nodeLookup:H});n==null||n(j.sourceEvent,a,W,q),L==null||L(j.sourceEvent,W,q),N||V==null||V(j.sourceEvent,q)}}const k=Qo().clickDistance(S).on("start",j=>{const{domNode:H,nodeDragThreshold:_,transform:$,snapGrid:C,snapToGrid:z}=e();f=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,y=j.sourceEvent,_===0&&D(j),i=he(j.sourceEvent,{transform:$,snapGrid:C,snapToGrid:z,containerBounds:f}),c=pt(j.sourceEvent,f)}).on("drag",j=>{const{autoPanOnNodeDrag:H,transform:_,snapGrid:$,snapToGrid:C,nodeDragThreshold:z,nodeLookup:A}=e(),M=he(j.sourceEvent,{transform:_,snapGrid:$,snapToGrid:C,containerBounds:f});if(y=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||N&&!A.has(N))&&(h=!0),!h){if(!l&&H&&u&&(l=!0,T()),!u){const L=pt(j.sourceEvent,f),V=L.x-c.x,R=L.y-c.y;Math.sqrt(V*V+R*R)>z&&D(j)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&u&&(c=pt(j.sourceEvent,f),I(M))}}).on("end",j=>{if(!(!u||h)&&(l=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:_,onNodeDragStop:$,onSelectionDragStop:C}=e();if(g&&(_(a,!1),g=!1),o||$||!N&&C){const[z,A]=En({nodeId:N,dragItems:a,nodeLookup:H,dragging:!1});o==null||o(j.sourceEvent,a,z,A),$==null||$(j.sourceEvent,z,A),N||C==null||C(j.sourceEvent,A)}}}).filter(j=>{const H=j.target;return!j.button&&(!v||!Kr(H,`.${v}`,w))&&(!x||Kr(H,x,w))});d.call(k)}function m(){d==null||d.on(".drag",null)}return{update:p,destroy:m}}function Wf(t,e,n){const r=[],o={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())ve(o,Jt(i))>0&&r.push(i);return r}const Gf=250;function qf(t,e,n,r){var a,l;let o=[],i=1/0;const s=Wf(t,n,e+Gf);for(const c of s){const f=[...((a=c.internals.handleBounds)==null?void 0:a.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:d,y:h}=Bt(c,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(o=[{...u,x:d,y:h}],i=g):g===i&&o.push({...u,x:d,y:h}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(f=>f.type===c)??o[0]}return o[0]}function ji(t,e,n,r,o,i=!1){var c,f,u;const s=r.get(t);if(!s)return null;const a=o==="strict"?(c=s.internals.handleBounds)==null?void 0:c[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],l=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return l&&i?{...l,...Bt(s,l,l.position,!0)}:l}function Li(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Uf(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Di=()=>!0;function Zf(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:p,isValidConnection:m=Di,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:E,autoPanSpeed:N,dragThreshold:S=1,handleDomNode:I}){const T=Ei(t.target);let D=0,k;const{x:j,y:H}=pt(t),_=Li(i,I),$=a==null?void 0:a.getBoundingClientRect();let C=!1;if(!$||!_)return;const z=ji(o,_,r,l,e);if(!z)return;let A=pt(t,$),M=!1,L=null,V=!1,R=null;function X(){if(!f||!$)return;const[Q,K]=vi(A,$,N);d({x:Q,y:K}),D=requestAnimationFrame(X)}const Y={...z,nodeId:o,type:_,position:z.position},W=l.get(o);let F={inProgress:!0,isValid:null,from:Bt(W,Y,G.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:W,to:A,toHandle:null,toPosition:Hr[Y.position],toNode:null,pointer:A};function B(){C=!0,x(F),g==null||g(t,{nodeId:o,handleId:r,handleType:_})}S===0&&B();function O(Q){if(!C){const{x:st,y:Ct}=pt(Q),bt=st-j,Pt=Ct-H;if(!(bt*bt+Pt*Pt>S*S))return;B()}if(!E()||!Y){Z(Q);return}const K=w();A=pt(Q,$),k=qf(Ie(A,K,!1,[1,1]),n,l,Y),M||(X(),M=!0);const U=Ri(Q,{handle:k,connectionMode:e,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:c,flowId:u,nodeLookup:l});R=U.handleDomNode,L=U.connection,V=Uf(!!k,U.isValid);const et=l.get(o),nt=et?Bt(et,Y,G.Left,!0):F.from,tt={...F,from:nt,isValid:V,to:U.toHandle&&V?rn({x:U.toHandle.x,y:U.toHandle.y},K):A,toHandle:U.toHandle,toPosition:V&&U.toHandle?U.toHandle.position:Hr[Y.position],toNode:U.toHandle?l.get(U.toHandle.nodeId):null,pointer:A};x(tt),F=tt}function Z(Q){if(!("touches"in Q&&Q.touches.length>0)){if(C){(k||R)&&L&&V&&(y==null||y(L));const{inProgress:K,...U}=F,et={...U,toPosition:F.toHandle?F.toPosition:null};p==null||p(Q,et),i&&(v==null||v(Q,et))}h(),cancelAnimationFrame(D),M=!1,V=!1,L=null,R=null,T.removeEventListener("mousemove",O),T.removeEventListener("mouseup",Z),T.removeEventListener("touchmove",O),T.removeEventListener("touchend",Z)}}T.addEventListener("mousemove",O),T.addEventListener("mouseup",Z),T.addEventListener("touchmove",O),T.addEventListener("touchend",Z)}function Ri(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Di,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${l}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=pt(t),y=s.elementFromPoint(h,g),p=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:d,m={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const v=Li(void 0,p),x=p.getAttribute("data-nodeid"),w=p.getAttribute("data-handleid"),E=p.classList.contains("connectable"),N=p.classList.contains("connectableend");if(!x||!v)return m;const S={source:u?x:r,sourceHandle:u?w:o,target:u?r:x,targetHandle:u?o:w};m.connection=S;const T=E&&N&&(n===Zt.Strict?u&&v==="source"||!u&&v==="target":x!==r||w!==o);m.isValid=T&&c(S),m.toHandle=ji(x,v,w,f,n,!0)}return m}const Yn={onPointerDown:Zf,isValid:Ri};function Kf({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const o=ut(t);function i({translateExtent:a,width:l,height:c,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:h=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!e)return;const w=n(),E=x.sourceEvent.ctrlKey&&be()?10:1,N=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*f,S=w[2]*Math.pow(2,N*E);e.scaleTo(S)};let y=[0,0];const p=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(y=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},m=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!e)return;const E=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],N=[E[0]-y[0],E[1]-y[1]];y=E;const S=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-N[0]*S,y:w[1]-N[1]*S},T=[[0,0],[l,c]];e.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},T,a)},v=di().on("start",p).on("zoom",u?m:null).on("zoom.wheel",d?g:null);o.call(v,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const dn=t=>({x:t.x,y:t.y,zoom:t.k}),Sn=({x:t,y:e,zoom:n})=>ln.translate(t,e).scale(n),Xt=(t,e)=>t.target.closest(`.${e}`),Hi=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Qf=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Mn=(t,e=0,n=Qf,r=()=>{})=>{const o=typeof e=="number"&&e>0;return o||r(),o?t.transition().duration(e).ease(n).on("end",r):t},Vi=t=>{const e=t.ctrlKey&&be()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Jf({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return f=>{if(Xt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const p=dt(f),m=Vi(f),v=u*Math.pow(2,m);r.scaleTo(n,v,p,f);return}const d=f.deltaMode===1?20:1;let h=o===Lt.Vertical?0:f.deltaX*d,g=o===Lt.Horizontal?0:f.deltaY*d;!be()&&f.shiftKey&&o!==Lt.Vertical&&(h=f.deltaY*d,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const y=dn(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(l==null||l(f,y),t.panScrollTimeout=setTimeout(()=>{c==null||c(f,y),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,y))}}function td({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!e&&i&&!r.ctrlKey,a=Xt(r,t);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function ed({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=dn(r.transform);t.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,o))}}function nd({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Hi(e,t.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,dn(i.transform)))}}function rd({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Hi(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,r(!1),o)){const l=dn(s.transform);t.prevViewport=l,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,l)},n?150:0)}}}function od({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:f}){return u=>{var p;const d=t||e,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Xt(u,`${c}-flow__node`)||Xt(u,`${c}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||f&&!g||Xt(u,a)&&g||Xt(u,l)&&(!g||o&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((p=u.touches)==null?void 0:p.length)>1)return u.preventDefault(),!1;if(!d&&!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 id({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=di().scaleExtent([e,n]).translateExtent(r),d=ut(t).call(u);v({x:o.x,y:o.y,zoom:Qt(o.zoom,e,n)},[[0,0],[f.width,f.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Vi);function y(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).transform(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function p({noWheelClassName:k,noPanClassName:j,onPaneContextMenu:H,userSelectionActive:_,panOnScroll:$,panOnDrag:C,panOnScrollMode:z,panOnScrollSpeed:A,preventScrolling:M,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:X,lib:Y,onTransformChange:W,connectionInProgress:q,paneClickDistance:F,selectionOnDrag:B}){_&&!c.isZoomingOrPanning&&m();const O=$&&!X&&!_;u.clickDistance(B?1/0:!gt(F)||F<0?0:F);const Z=O?Jf({zoomPanValues:c,noWheelClassName:k,d3Selection:d,d3Zoom:u,panOnScrollMode:z,panOnScrollSpeed:A,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):td({noWheelClassName:k,preventScrolling:M,d3ZoomHandler:h});if(d.on("wheel.zoom",Z,{passive:!1}),!_){const K=ed({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});u.on("start",K);const U=nd({zoomPanValues:c,panOnDrag:C,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});u.on("zoom",U);const et=rd({zoomPanValues:c,panOnDrag:C,panOnScroll:$,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});u.on("end",et)}const Q=od({zoomActivationKeyPressed:X,panOnDrag:C,zoomOnScroll:V,panOnScroll:$,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:_,noPanClassName:j,noWheelClassName:k,lib:Y,connectionInProgress:q});u.filter(Q),R?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function v(k,j,H){const _=Sn(k),$=u==null?void 0:u.constrain()(_,j,H);return $&&await y($),new Promise(C=>C($))}async function x(k,j){const H=Sn(k);return await y(H,j),new Promise(_=>_(H))}function w(k){if(d){const j=Sn(k),H=d.property("__zoom");(H.k!==k.zoom||H.x!==k.x||H.y!==k.y)&&(u==null||u.transform(d,j,null,{sync:!0}))}}function E(){const k=d?fi(d.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function N(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).scaleTo(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function S(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).scaleBy(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function I(k){u==null||u.scaleExtent(k)}function T(k){u==null||u.translateExtent(k)}function D(k){const j=!gt(k)||k<0?0:k;u==null||u.clickDistance(j)}return{update:p,destroy:m,setViewport:x,setViewportConstrained:v,getViewport:E,scaleTo:N,scaleBy:S,setScaleExtent:I,setTranslateExtent:T,syncViewport:w,setClickDistance:D}}var ee;(function(t){t.Line="line",t.Handle="handle"})(ee||(ee={}));function sd({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=t-e,a=n-r,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Qr(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),o=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:o}}function kt(t,e){return Math.max(0,e-t)}function It(t,e){return Math.max(0,t-e)}function He(t,e,n){return Math.max(0,e-t,t-n)}function Jr(t,e){return t?!e:e}function ad(t,e,n,r,o,i,s,a){let{affectsX:l,affectsY:c}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:y,maxWidth:p,minHeight:m,maxHeight:v}=r,{x,y:w,width:E,height:N,aspectRatio:S}=t;let I=Math.floor(f?h-t.pointerX:0),T=Math.floor(u?g-t.pointerY:0);const D=E+(l?-I:I),k=N+(c?-T:T),j=-i[0]*E,H=-i[1]*N;let _=He(D,y,p),$=He(k,m,v);if(s){let A=0,M=0;l&&I<0?A=kt(x+I+j,s[0][0]):!l&&I>0&&(A=It(x+D+j,s[1][0])),c&&T<0?M=kt(w+T+H,s[0][1]):!c&&T>0&&(M=It(w+k+H,s[1][1])),_=Math.max(_,A),$=Math.max($,M)}if(a){let A=0,M=0;l&&I>0?A=It(x+I,a[0][0]):!l&&I<0&&(A=kt(x+D,a[1][0])),c&&T>0?M=It(w+T,a[0][1]):!c&&T<0&&(M=kt(w+k,a[1][1])),_=Math.max(_,A),$=Math.max($,M)}if(o){if(f){const A=He(D/S,m,v)*S;if(_=Math.max(_,A),s){let M=0;!l&&!c||l&&!c&&d?M=It(w+H+D/S,s[1][1])*S:M=kt(w+H+(l?I:-I)/S,s[0][1])*S,_=Math.max(_,M)}if(a){let M=0;!l&&!c||l&&!c&&d?M=kt(w+D/S,a[1][1])*S:M=It(w+(l?I:-I)/S,a[0][1])*S,_=Math.max(_,M)}}if(u){const A=He(k*S,y,p)/S;if($=Math.max($,A),s){let M=0;!l&&!c||c&&!l&&d?M=It(x+k*S+j,s[1][0])/S:M=kt(x+(c?T:-T)*S+j,s[0][0])/S,$=Math.max($,M)}if(a){let M=0;!l&&!c||c&&!l&&d?M=kt(x+k*S,a[1][0])/S:M=It(x+(c?T:-T)*S,a[0][0])/S,$=Math.max($,M)}}}T=T+(T<0?$:-$),I=I+(I<0?_:-_),o&&(d?D>k*S?T=(Jr(l,c)?-I:I)/S:I=(Jr(l,c)?-T:T)*S:f?(T=I/S,c=l):(I=T*S,l=c));const C=l?x+I:x,z=c?w+T:w;return{width:E+(l?-I:I),height:N+(c?-T:T),x:i[0]*I*(l?-1:1)+C,y:i[1]*T*(c?-1:1)+z}}const Bi={width:0,height:0,x:0,y:0},cd={...Bi,pointerX:0,pointerY:0,aspectRatio:1};function ld(t){return[[0,0],[t.measured.width,t.measured.height]]}function ud(t,e,n){const r=e.position.x+t.position.x,o=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,l=n[1]*s;return[[r-a,o-l],[r+i-a,o+s-l]]}function fd({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:o}){const i=ut(t);let s={controlDirection:Qr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:y,shouldResize:p}){let m={...Bi},v={...cd};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:Qr(c)};let x,w=null,E=[],N,S,I,T=!1;const D=Qo().on("start",k=>{const{nodeLookup:j,transform:H,snapGrid:_,snapToGrid:$,nodeOrigin:C,paneDomNode:z}=n();if(x=j.get(e),!x)return;w=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:M}=he(k.sourceEvent,{transform:H,snapGrid:_,snapToGrid:$,containerBounds:w});m={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...m,pointerX:A,pointerY:M,aspectRatio:m.width/m.height},N=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(N=j.get(x.parentId),S=N&&x.extent==="parent"?ld(N):void 0),E=[],I=void 0;for(const[L,V]of j)if(V.parentId===e&&(E.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=ud(V,x,V.origin??C);I?I=[[Math.min(R[0][0],I[0][0]),Math.min(R[0][1],I[0][1])],[Math.max(R[1][0],I[1][0]),Math.max(R[1][1],I[1][1])]]:I=R}h==null||h(k,{...m})}).on("drag",k=>{const{transform:j,snapGrid:H,snapToGrid:_,nodeOrigin:$}=n(),C=he(k.sourceEvent,{transform:j,snapGrid:H,snapToGrid:_,containerBounds:w}),z=[];if(!x)return;const{x:A,y:M,width:L,height:V}=m,R={},X=x.origin??$,{width:Y,height:W,x:q,y:F}=ad(v,s.controlDirection,C,s.boundaries,s.keepAspectRatio,X,S,I),B=Y!==L,O=W!==V,Z=q!==A&&B,Q=F!==M&&O;if(!Z&&!Q&&!B&&!O)return;if((Z||Q||X[0]===1||X[1]===1)&&(R.x=Z?q:m.x,R.y=Q?F:m.y,m.x=R.x,m.y=R.y,E.length>0)){const nt=q-A,tt=F-M;for(const st of E)st.position={x:st.position.x-nt+X[0]*(Y-L),y:st.position.y-tt+X[1]*(W-V)},z.push(st)}if((B||O)&&(R.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,R.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),N&&x.expandParent){const nt=X[0]*(R.width??0);R.x&&R.x<nt&&(m.x=nt,v.x=v.x-(R.x-nt));const tt=X[1]*(R.height??0);R.y&&R.y<tt&&(m.y=tt,v.y=v.y-(R.y-tt))}const K=sd({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:K};(p==null?void 0:p(k,U))!==!1&&(T=!0,g==null||g(k,U),r(R,z))}).on("end",k=>{T&&(y==null||y(k,{...m}),o==null||o({...m}),T=!1)});i.call(D)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var Cn={exports:{}},kn={},In={exports:{}},An={};/**
|
|
1
|
+
import{h as ka,i as Lo,k as Ia,R as Aa,r as P,j as b,d as $a,a as Pa,L as Do}from"./index-nX2chMqi.js";ka();function it(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=it(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Ta={value:()=>{}};function Ne(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Xe(n)}function Xe(t){this._=t}function za(t,e){return t.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&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Xe.prototype=Ne.prototype={constructor:Xe,on:function(t,e){var n=this._,r=za(t+"",n),o,i=-1,s=r.length;if(arguments.length<2){for(;++i<s;)if((o=(t=r[i]).type)&&(o=ja(n[o],t.name)))return o;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<s;)if(o=(t=r[i]).type)n[o]=_r(n[o],t.name,e);else if(e==null)for(o in n)n[o]=_r(n[o],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Xe(t)},call:function(t,e){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(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],o=0,i=r.length;o<i;++o)r[o].value.apply(e,n)}};function ja(t,e){for(var n=0,r=t.length,o;n<r;++n)if((o=t[n]).name===e)return o.value}function _r(t,e,n){for(var r=0,o=t.length;r<o;++r)if(t[r].name===e){t[r]=Ta,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var Tn="http://www.w3.org/1999/xhtml";const Nr={svg:"http://www.w3.org/2000/svg",xhtml:Tn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function sn(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),Nr.hasOwnProperty(e)?{space:Nr[e],local:t}:t}function La(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===Tn&&e.documentElement.namespaceURI===Tn?e.createElement(t):e.createElementNS(n,t)}}function Da(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Ro(t){var e=sn(t);return(e.local?Da:La)(e)}function Ra(){}function qn(t){return t==null?Ra:function(){return this.querySelector(t)}}function Ha(t){typeof t!="function"&&(t=qn(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=new Array(s),l,c,f=0;f<s;++f)(l=i[f])&&(c=t.call(l,l.__data__,f,i))&&("__data__"in l&&(c.__data__=l.__data__),a[f]=c);return new ft(r,this._parents)}function Va(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Ba(){return[]}function Ho(t){return t==null?Ba:function(){return this.querySelectorAll(t)}}function Fa(t){return function(){return Va(t.apply(this,arguments))}}function Oa(t){typeof t=="function"?t=Fa(t):t=Ho(t);for(var e=this._groups,n=e.length,r=[],o=[],i=0;i<n;++i)for(var s=e[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(r.push(t.call(l,l.__data__,c,s)),o.push(l));return new ft(r,o)}function Vo(t){return function(){return this.matches(t)}}function Bo(t){return function(e){return e.matches(t)}}var Xa=Array.prototype.find;function Ya(t){return function(){return Xa.call(this.children,t)}}function Wa(){return this.firstElementChild}function Ga(t){return this.select(t==null?Wa:Ya(typeof t=="function"?t:Bo(t)))}var qa=Array.prototype.filter;function Ua(){return Array.from(this.children)}function Za(t){return function(){return qa.call(this.children,t)}}function Ka(t){return this.selectAll(t==null?Ua:Za(typeof t=="function"?t:Bo(t)))}function Qa(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&a.push(l);return new ft(r,this._parents)}function Fo(t){return new Array(t.length)}function Ja(){return new ft(this._enter||this._groups.map(Fo),this._parents)}function Ue(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Ue.prototype={constructor:Ue,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function tc(t){return function(){return t}}function ec(t,e,n,r,o,i){for(var s=0,a,l=e.length,c=i.length;s<c;++s)(a=e[s])?(a.__data__=i[s],r[s]=a):n[s]=new Ue(t,i[s]);for(;s<l;++s)(a=e[s])&&(o[s]=a)}function nc(t,e,n,r,o,i,s){var a,l,c=new Map,f=e.length,u=i.length,d=new Array(f),h;for(a=0;a<f;++a)(l=e[a])&&(d[a]=h=s.call(l,l.__data__,a,e)+"",c.has(h)?o[a]=l:c.set(h,l));for(a=0;a<u;++a)h=s.call(t,i[a],a,i)+"",(l=c.get(h))?(r[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new Ue(t,i[a]);for(a=0;a<f;++a)(l=e[a])&&c.get(d[a])===l&&(o[a]=l)}function rc(t){return t.__data__}function oc(t,e){if(!arguments.length)return Array.from(this,rc);var n=e?nc:ec,r=this._parents,o=this._groups;typeof t!="function"&&(t=tc(t));for(var i=o.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],u=o[c],d=u.length,h=ic(t.call(f,f&&f.__data__,c,r)),g=h.length,y=a[c]=new Array(g),p=s[c]=new Array(g),m=l[c]=new Array(d);n(f,u,y,p,m,h,e);for(var v=0,x=0,w,E;v<g;++v)if(w=y[v]){for(v>=x&&(x=v+1);!(E=p[x])&&++x<g;);w._next=E||null}}return s=new ft(s,r),s._enter=a,s._exit=l,s}function ic(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function sc(){return new ft(this._exit||this._groups.map(Fo),this._parents)}function ac(t,e,n){var r=this.enter(),o=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(o=e(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function cc(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,o=n.length,i=r.length,s=Math.min(o,i),a=new Array(o),l=0;l<s;++l)for(var c=n[l],f=r[l],u=c.length,d=a[l]=new Array(u),h,g=0;g<u;++g)(h=c[g]||f[g])&&(d[g]=h);for(;l<o;++l)a[l]=n[l];return new ft(a,this._parents)}function lc(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],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 uc(t){t||(t=fc);function e(u,d){return u&&d?t(u.__data__,d.__data__):!u-!d}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,l=o[i]=new Array(a),c,f=0;f<a;++f)(c=s[f])&&(l[f]=c);l.sort(e)}return new ft(o,this._parents).order()}function fc(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function dc(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function hc(){return Array.from(this)}function gc(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length;o<i;++o){var s=r[o];if(s)return s}return null}function pc(){let t=0;for(const e of this)++t;return t}function mc(){return!this.node()}function yc(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var o=e[n],i=0,s=o.length,a;i<s;++i)(a=o[i])&&t.call(a,a.__data__,i,o);return this}function xc(t){return function(){this.removeAttribute(t)}}function wc(t){return function(){this.removeAttributeNS(t.space,t.local)}}function vc(t,e){return function(){this.setAttribute(t,e)}}function bc(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _c(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Nc(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Ec(t,e){var n=sn(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?wc:xc:typeof e=="function"?n.local?Nc:_c:n.local?bc:vc)(n,e))}function Oo(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Sc(t){return function(){this.style.removeProperty(t)}}function Mc(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Cc(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function kc(t,e,n){return arguments.length>1?this.each((e==null?Sc:typeof e=="function"?Cc:Mc)(t,e,n??"")):qt(this.node(),t)}function qt(t,e){return t.style.getPropertyValue(e)||Oo(t).getComputedStyle(t,null).getPropertyValue(e)}function Ic(t){return function(){delete this[t]}}function Ac(t,e){return function(){this[t]=e}}function $c(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Pc(t,e){return arguments.length>1?this.each((e==null?Ic:typeof e=="function"?$c:Ac)(t,e)):this.node()[t]}function Xo(t){return t.trim().split(/^|\s+/)}function Un(t){return t.classList||new Yo(t)}function Yo(t){this._node=t,this._names=Xo(t.getAttribute("class")||"")}Yo.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Wo(t,e){for(var n=Un(t),r=-1,o=e.length;++r<o;)n.add(e[r])}function Go(t,e){for(var n=Un(t),r=-1,o=e.length;++r<o;)n.remove(e[r])}function Tc(t){return function(){Wo(this,t)}}function zc(t){return function(){Go(this,t)}}function jc(t,e){return function(){(e.apply(this,arguments)?Wo:Go)(this,t)}}function Lc(t,e){var n=Xo(t+"");if(arguments.length<2){for(var r=Un(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof e=="function"?jc:e?Tc:zc)(n,e))}function Dc(){this.textContent=""}function Rc(t){return function(){this.textContent=t}}function Hc(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Vc(t){return arguments.length?this.each(t==null?Dc:(typeof t=="function"?Hc:Rc)(t)):this.node().textContent}function Bc(){this.innerHTML=""}function Fc(t){return function(){this.innerHTML=t}}function Oc(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Xc(t){return arguments.length?this.each(t==null?Bc:(typeof t=="function"?Oc:Fc)(t)):this.node().innerHTML}function Yc(){this.nextSibling&&this.parentNode.appendChild(this)}function Wc(){return this.each(Yc)}function Gc(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function qc(){return this.each(Gc)}function Uc(t){var e=typeof t=="function"?t:Ro(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Zc(){return null}function Kc(t,e){var n=typeof t=="function"?t:Ro(t),r=e==null?Zc:typeof e=="function"?e:qn(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Qc(){var t=this.parentNode;t&&t.removeChild(this)}function Jc(){return this.each(Qc)}function tl(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function el(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function nl(t){return this.select(t?el:tl)}function rl(t){return arguments.length?this.property("__data__",t):this.node().__data__}function ol(t){return function(e){t.call(this,e,this.__data__)}}function il(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function sl(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,o=e.length,i;n<o;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function al(t,e,n){return function(){var r=this.__on,o,i=ol(e);if(r){for(var s=0,a=r.length;s<a;++s)if((o=r[s]).type===t.type&&o.name===t.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=e;return}}this.addEventListener(t.type,i,n),o={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(o):this.__on=[o]}}function cl(t,e,n){var r=il(t+""),o,i=r.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,f;l<c;++l)for(o=0,f=a[l];o<i;++o)if((s=r[o]).type===f.type&&s.name===f.name)return f.value}return}for(a=e?al:sl,o=0;o<i;++o)this.each(a(r[o],e,n));return this}function qo(t,e,n){var r=Oo(t),o=r.CustomEvent;typeof o=="function"?o=new o(e,n):(o=r.document.createEvent("Event"),n?(o.initEvent(e,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(e,!1,!1)),t.dispatchEvent(o)}function ll(t,e){return function(){return qo(this,t,e)}}function ul(t,e){return function(){return qo(this,t,e.apply(this,arguments))}}function fl(t,e){return this.each((typeof e=="function"?ul:ll)(t,e))}function*dl(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],o=0,i=r.length,s;o<i;++o)(s=r[o])&&(yield s)}var Uo=[null];function ft(t,e){this._groups=t,this._parents=e}function Ee(){return new ft([[document.documentElement]],Uo)}function hl(){return this}ft.prototype=Ee.prototype={constructor:ft,select:Ha,selectAll:Oa,selectChild:Ga,selectChildren:Ka,filter:Qa,data:oc,enter:Ja,exit:sc,join:ac,merge:cc,selection:hl,order:lc,sort:uc,call:dc,nodes:hc,node:gc,size:pc,empty:mc,each:yc,attr:Ec,style:kc,property:Pc,classed:Lc,text:Vc,html:Xc,raise:Wc,lower:qc,append:Uc,insert:Kc,remove:Jc,clone:nl,datum:rl,on:cl,dispatch:fl,[Symbol.iterator]:dl};function ut(t){return typeof t=="string"?new ft([[document.querySelector(t)]],[document.documentElement]):new ft([[t]],Uo)}function gl(t){let e;for(;e=t.sourceEvent;)t=e;return t}function dt(t,e){if(t=gl(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var o=e.getBoundingClientRect();return[t.clientX-o.left-e.clientLeft,t.clientY-o.top-e.clientTop]}}return[t.pageX,t.pageY]}const pl={passive:!1},ge={capture:!0,passive:!1};function vn(t){t.stopImmediatePropagation()}function Wt(t){t.preventDefault(),t.stopImmediatePropagation()}function Zo(t){var e=t.document.documentElement,n=ut(t).on("dragstart.drag",Wt,ge);"onselectstart"in e?n.on("selectstart.drag",Wt,ge):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ko(t,e){var n=t.document.documentElement,r=ut(t).on("dragstart.drag",null);e&&(r.on("click.drag",Wt,ge),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 Te=t=>()=>t;function zn(t,{sourceEvent:e,subject:n,target:r,identifier:o,active:i,x:s,y:a,dx:l,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,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:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}zn.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ml(t){return!t.ctrlKey&&!t.button}function yl(){return this.parentNode}function xl(t,e){return e??{x:t.x,y:t.y}}function wl(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(){var t=ml,e=yl,n=xl,r=wl,o={},i=Ne("start","drag","end"),s=0,a,l,c,f,u=0;function d(w){w.on("mousedown.drag",h).filter(r).on("touchstart.drag",p).on("touchmove.drag",m,pl).on("touchend.drag touchcancel.drag",v).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,E){if(!(f||!t.call(this,w,E))){var N=x(this,e.call(this,w,E),w,E,"mouse");N&&(ut(w.view).on("mousemove.drag",g,ge).on("mouseup.drag",y,ge),Zo(w.view),vn(w),c=!1,a=w.clientX,l=w.clientY,N("start",w))}}function g(w){if(Wt(w),!c){var E=w.clientX-a,N=w.clientY-l;c=E*E+N*N>u}o.mouse("drag",w)}function y(w){ut(w.view).on("mousemove.drag mouseup.drag",null),Ko(w.view,c),Wt(w),o.mouse("end",w)}function p(w,E){if(t.call(this,w,E)){var N=w.changedTouches,S=e.call(this,w,E),I=N.length,T,D;for(T=0;T<I;++T)(D=x(this,S,w,E,N[T].identifier,N[T]))&&(vn(w),D("start",w,N[T]))}}function m(w){var E=w.changedTouches,N=E.length,S,I;for(S=0;S<N;++S)(I=o[E[S].identifier])&&(Wt(w),I("drag",w,E[S]))}function v(w){var E=w.changedTouches,N=E.length,S,I;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),S=0;S<N;++S)(I=o[E[S].identifier])&&(vn(w),I("end",w,E[S]))}function x(w,E,N,S,I,T){var D=i.copy(),k=dt(T||N,E),j,H,_;if((_=n.call(w,new zn("beforestart",{sourceEvent:N,target:d,identifier:I,active:s,x:k[0],y:k[1],dx:0,dy:0,dispatch:D}),S))!=null)return j=_.x-k[0]||0,H=_.y-k[1]||0,function $(C,z,A){var M=k,L;switch(C){case"start":o[I]=$,L=s++;break;case"end":delete o[I],--s;case"drag":k=dt(A||z,E),L=s;break}D.call(C,w,new zn(C,{sourceEvent:z,subject:_,target:d,identifier:I,active:L,x:k[0]+j,y:k[1]+H,dx:k[0]-M[0],dy:k[1]-M[1],dispatch:D}),S)}}return d.filter=function(w){return arguments.length?(t=typeof w=="function"?w:Te(!!w),d):t},d.container=function(w){return arguments.length?(e=typeof w=="function"?w:Te(w),d):e},d.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Te(w),d):n},d.touchable=function(w){return arguments.length?(r=typeof w=="function"?w:Te(!!w),d):r},d.on=function(){var w=i.on.apply(i,arguments);return w===i?d:w},d.clickDistance=function(w){return arguments.length?(u=(w=+w)*w,d):Math.sqrt(u)},d}function Zn(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Jo(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function Se(){}var pe=.7,Ze=1/pe,Gt="\\s*([+-]?\\d+)\\s*",me="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",xt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vl=/^#([0-9a-f]{3,8})$/,bl=new RegExp(`^rgb\\(${Gt},${Gt},${Gt}\\)$`),_l=new RegExp(`^rgb\\(${xt},${xt},${xt}\\)$`),Nl=new RegExp(`^rgba\\(${Gt},${Gt},${Gt},${me}\\)$`),El=new RegExp(`^rgba\\(${xt},${xt},${xt},${me}\\)$`),Sl=new RegExp(`^hsl\\(${me},${xt},${xt}\\)$`),Ml=new RegExp(`^hsla\\(${me},${xt},${xt},${me}\\)$`),Er={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};Zn(Se,Rt,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Sr,formatHex:Sr,formatHex8:Cl,formatHsl:kl,formatRgb:Mr,toString:Mr});function Sr(){return this.rgb().formatHex()}function Cl(){return this.rgb().formatHex8()}function kl(){return ti(this).formatHsl()}function Mr(){return this.rgb().formatRgb()}function Rt(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=vl.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?Cr(e):n===3?new lt(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?ze(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?ze(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=bl.exec(t))?new lt(e[1],e[2],e[3],1):(e=_l.exec(t))?new lt(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=Nl.exec(t))?ze(e[1],e[2],e[3],e[4]):(e=El.exec(t))?ze(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=Sl.exec(t))?Ar(e[1],e[2]/100,e[3]/100,1):(e=Ml.exec(t))?Ar(e[1],e[2]/100,e[3]/100,e[4]):Er.hasOwnProperty(t)?Cr(Er[t]):t==="transparent"?new lt(NaN,NaN,NaN,0):null}function Cr(t){return new lt(t>>16&255,t>>8&255,t&255,1)}function ze(t,e,n,r){return r<=0&&(t=e=n=NaN),new lt(t,e,n,r)}function Il(t){return t instanceof Se||(t=Rt(t)),t?(t=t.rgb(),new lt(t.r,t.g,t.b,t.opacity)):new lt}function jn(t,e,n,r){return arguments.length===1?Il(t):new lt(t,e,n,r??1)}function lt(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}Zn(lt,jn,Jo(Se,{brighter(t){return t=t==null?Ze:Math.pow(Ze,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?pe:Math.pow(pe,t),new lt(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new lt(jt(this.r),jt(this.g),jt(this.b),Ke(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:kr,formatHex:kr,formatHex8:Al,formatRgb:Ir,toString:Ir}));function kr(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}`}function Al(){return`#${zt(this.r)}${zt(this.g)}${zt(this.b)}${zt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Ir(){const t=Ke(this.opacity);return`${t===1?"rgb(":"rgba("}${jt(this.r)}, ${jt(this.g)}, ${jt(this.b)}${t===1?")":`, ${t})`}`}function Ke(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function jt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function zt(t){return t=jt(t),(t<16?"0":"")+t.toString(16)}function Ar(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new ht(t,e,n,r)}function ti(t){if(t instanceof ht)return new ht(t.h,t.s,t.l,t.opacity);if(t instanceof Se||(t=Rt(t)),!t)return new ht;if(t instanceof ht)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,o=Math.min(e,n,r),i=Math.max(e,n,r),s=NaN,a=i-o,l=(i+o)/2;return a?(e===i?s=(n-r)/a+(n<r)*6:n===i?s=(r-e)/a+2:s=(e-n)/a+4,a/=l<.5?i+o:2-i-o,s*=60):a=l>0&&l<1?0:s,new ht(s,a,l,t.opacity)}function $l(t,e,n,r){return arguments.length===1?ti(t):new ht(t,e,n,r??1)}function ht(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}Zn(ht,$l,Jo(Se,{brighter(t){return t=t==null?Ze:Math.pow(Ze,t),new ht(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?pe:Math.pow(pe,t),new ht(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,o=2*n-r;return new lt(bn(t>=240?t-240:t+120,o,r),bn(t,o,r),bn(t<120?t+240:t-120,o,r),this.opacity)},clamp(){return new ht($r(this.h),je(this.s),je(this.l),Ke(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 t=Ke(this.opacity);return`${t===1?"hsl(":"hsla("}${$r(this.h)}, ${je(this.s)*100}%, ${je(this.l)*100}%${t===1?")":`, ${t})`}`}}));function $r(t){return t=(t||0)%360,t<0?t+360:t}function je(t){return Math.max(0,Math.min(1,t||0))}function bn(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Kn=t=>()=>t;function Pl(t,e){return function(n){return t+n*e}}function Tl(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function zl(t){return(t=+t)==1?ei:function(e,n){return n-e?Tl(e,n,t):Kn(isNaN(e)?n:e)}}function ei(t,e){var n=e-t;return n?Pl(t,n):Kn(isNaN(t)?e:t)}const Qe=(function t(e){var n=zl(e);function r(o,i){var s=n((o=jn(o)).r,(i=jn(i)).r),a=n(o.g,i.g),l=n(o.b,i.b),c=ei(o.opacity,i.opacity);return function(f){return o.r=s(f),o.g=a(f),o.b=l(f),o.opacity=c(f),o+""}}return r.gamma=t,r})(1);function jl(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),o;return function(i){for(o=0;o<n;++o)r[o]=t[o]*(1-i)+e[o]*i;return r}}function Ll(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Dl(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,o=new Array(r),i=new Array(n),s;for(s=0;s<r;++s)o[s]=de(t[s],e[s]);for(;s<n;++s)i[s]=e[s];return function(a){for(s=0;s<r;++s)i[s]=o[s](a);return i}}function Rl(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function yt(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Hl(t,e){var n={},r={},o;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(o in e)o in t?n[o]=de(t[o],e[o]):r[o]=e[o];return function(i){for(o in n)r[o]=n[o](i);return r}}var Ln=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_n=new RegExp(Ln.source,"g");function Vl(t){return function(){return t}}function Bl(t){return function(e){return t(e)+""}}function ni(t,e){var n=Ln.lastIndex=_n.lastIndex=0,r,o,i,s=-1,a=[],l=[];for(t=t+"",e=e+"";(r=Ln.exec(t))&&(o=_n.exec(e));)(i=o.index)>n&&(i=e.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,l.push({i:s,x:yt(r,o)})),n=_n.lastIndex;return n<e.length&&(i=e.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?Bl(l[0].x):Vl(e):(e=l.length,function(c){for(var f=0,u;f<e;++f)a[(u=l[f]).i]=u.x(c);return a.join("")})}function de(t,e){var n=typeof e,r;return e==null||n==="boolean"?Kn(e):(n==="number"?yt:n==="string"?(r=Rt(e))?(e=r,Qe):ni:e instanceof Rt?Qe:e instanceof Date?Rl:Ll(e)?jl:Array.isArray(e)?Dl:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Hl:yt)(t,e)}var Pr=180/Math.PI,Dn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function ri(t,e,n,r,o,i){var s,a,l;return(s=Math.sqrt(t*t+e*e))&&(t/=s,e/=s),(l=t*n+e*r)&&(n-=t*l,r-=e*l),(a=Math.sqrt(n*n+r*r))&&(n/=a,r/=a,l/=a),t*r<e*n&&(t=-t,e=-e,l=-l,s=-s),{translateX:o,translateY:i,rotate:Math.atan2(e,t)*Pr,skewX:Math.atan(l)*Pr,scaleX:s,scaleY:a}}var Le;function Fl(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Dn:ri(e.a,e.b,e.c,e.d,e.e,e.f)}function Ol(t){return t==null||(Le||(Le=document.createElementNS("http://www.w3.org/2000/svg","g")),Le.setAttribute("transform",t),!(t=Le.transform.baseVal.consolidate()))?Dn:(t=t.matrix,ri(t.a,t.b,t.c,t.d,t.e,t.f))}function oi(t,e,n,r){function o(c){return c.length?c.pop()+" ":""}function i(c,f,u,d,h,g){if(c!==u||f!==d){var y=h.push("translate(",null,e,null,n);g.push({i:y-4,x:yt(c,u)},{i:y-2,x:yt(f,d)})}else(u||d)&&h.push("translate("+u+e+d+n)}function s(c,f,u,d){c!==f?(c-f>180?f+=360:f-c>180&&(c+=360),d.push({i:u.push(o(u)+"rotate(",null,r)-2,x:yt(c,f)})):f&&u.push(o(u)+"rotate("+f+r)}function a(c,f,u,d){c!==f?d.push({i:u.push(o(u)+"skewX(",null,r)-2,x:yt(c,f)}):f&&u.push(o(u)+"skewX("+f+r)}function l(c,f,u,d,h,g){if(c!==u||f!==d){var y=h.push(o(h)+"scale(",null,",",null,")");g.push({i:y-4,x:yt(c,u)},{i:y-2,x:yt(f,d)})}else(u!==1||d!==1)&&h.push(o(h)+"scale("+u+","+d+")")}return function(c,f){var u=[],d=[];return c=t(c),f=t(f),i(c.translateX,c.translateY,f.translateX,f.translateY,u,d),s(c.rotate,f.rotate,u,d),a(c.skewX,f.skewX,u,d),l(c.scaleX,c.scaleY,f.scaleX,f.scaleY,u,d),c=f=null,function(h){for(var g=-1,y=d.length,p;++g<y;)u[(p=d[g]).i]=p.x(h);return u.join("")}}}var Xl=oi(Fl,"px, ","px)","deg)"),Yl=oi(Ol,", ",")",")"),Wl=1e-12;function Tr(t){return((t=Math.exp(t))+1/t)/2}function Gl(t){return((t=Math.exp(t))-1/t)/2}function ql(t){return((t=Math.exp(2*t))-1)/(t+1)}const Ye=(function t(e,n,r){function o(i,s){var a=i[0],l=i[1],c=i[2],f=s[0],u=s[1],d=s[2],h=f-a,g=u-l,y=h*h+g*g,p,m;if(y<Wl)m=Math.log(d/c)/e,p=function(S){return[a+S*h,l+S*g,c*Math.exp(e*S*m)]};else{var v=Math.sqrt(y),x=(d*d-c*c+r*y)/(2*c*n*v),w=(d*d-c*c-r*y)/(2*d*n*v),E=Math.log(Math.sqrt(x*x+1)-x),N=Math.log(Math.sqrt(w*w+1)-w);m=(N-E)/e,p=function(S){var I=S*m,T=Tr(E),D=c/(n*v)*(T*ql(e*I+E)-Gl(E));return[a+D*h,l+D*g,c*T/Tr(e*I+E)]}}return p.duration=m*1e3*e/Math.SQRT2,p}return o.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return t(s,a,l)},o})(Math.SQRT2,2,4);var Ut=0,ue=0,ae=0,ii=1e3,Je,fe,tn=0,Ht=0,an=0,ye=typeof performance=="object"&&performance.now?performance:Date,si=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Qn(){return Ht||(si(Ul),Ht=ye.now()+an)}function Ul(){Ht=0}function en(){this._call=this._time=this._next=null}en.prototype=Jn.prototype={constructor:en,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Qn():+n)+(e==null?0:+e),!this._next&&fe!==this&&(fe?fe._next=this:Je=this,fe=this),this._call=t,this._time=n,Rn()},stop:function(){this._call&&(this._call=null,this._time=1/0,Rn())}};function Jn(t,e,n){var r=new en;return r.restart(t,e,n),r}function Zl(){Qn(),++Ut;for(var t=Je,e;t;)(e=Ht-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ut}function zr(){Ht=(tn=ye.now())+an,Ut=ue=0;try{Zl()}finally{Ut=0,Ql(),Ht=0}}function Kl(){var t=ye.now(),e=t-tn;e>ii&&(an-=e,tn=t)}function Ql(){for(var t,e=Je,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Je=n);fe=t,Rn(r)}function Rn(t){if(!Ut){ue&&(ue=clearTimeout(ue));var e=t-Ht;e>24?(t<1/0&&(ue=setTimeout(zr,t-ye.now()-an)),ae&&(ae=clearInterval(ae))):(ae||(tn=ye.now(),ae=setInterval(Kl,ii)),Ut=1,si(zr))}}function jr(t,e,n){var r=new en;return e=e==null?0:+e,r.restart(o=>{r.stop(),t(o+e)},e,n),r}var Jl=Ne("start","end","cancel","interrupt"),tu=[],ai=0,Lr=1,Hn=2,We=3,Dr=4,Vn=5,Ge=6;function cn(t,e,n,r,o,i){var s=t.__transition;if(!s)t.__transition={};else if(n in s)return;eu(t,n,{name:e,index:r,group:o,on:Jl,tween:tu,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:ai})}function tr(t,e){var n=mt(t,e);if(n.state>ai)throw new Error("too late; already scheduled");return n}function vt(t,e){var n=mt(t,e);if(n.state>We)throw new Error("too late; already running");return n}function mt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function eu(t,e,n){var r=t.__transition,o;r[e]=n,n.timer=Jn(i,0,n.time);function i(c){n.state=Lr,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var f,u,d,h;if(n.state!==Lr)return l();for(f in r)if(h=r[f],h.name===n.name){if(h.state===We)return jr(s);h.state===Dr?(h.state=Ge,h.timer.stop(),h.on.call("interrupt",t,t.__data__,h.index,h.group),delete r[f]):+f<e&&(h.state=Ge,h.timer.stop(),h.on.call("cancel",t,t.__data__,h.index,h.group),delete r[f])}if(jr(function(){n.state===We&&(n.state=Dr,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=Hn,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Hn){for(n.state=We,o=new Array(d=n.tween.length),f=0,u=-1;f<d;++f)(h=n.tween[f].value.call(t,t.__data__,n.index,n.group))&&(o[++u]=h);o.length=u+1}}function a(c){for(var f=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=Vn,1),u=-1,d=o.length;++u<d;)o[u].call(t,f);n.state===Vn&&(n.on.call("end",t,t.__data__,n.index,n.group),l())}function l(){n.state=Ge,n.timer.stop(),delete r[e];for(var c in r)return;delete t.__transition}}function qe(t,e){var n=t.__transition,r,o,i=!0,s;if(n){e=e==null?null:e+"";for(s in n){if((r=n[s]).name!==e){i=!1;continue}o=r.state>Hn&&r.state<Vn,r.state=Ge,r.timer.stop(),r.on.call(o?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[s]}i&&delete t.__transition}}function nu(t){return this.each(function(){qe(this,t)})}function ru(t,e){var n,r;return function(){var o=vt(this,t),i=o.tween;if(i!==n){r=n=i;for(var s=0,a=r.length;s<a;++s)if(r[s].name===e){r=r.slice(),r.splice(s,1);break}}o.tween=r}}function ou(t,e,n){var r,o;if(typeof n!="function")throw new Error;return function(){var i=vt(this,t),s=i.tween;if(s!==r){o=(r=s).slice();for(var a={name:e,value:n},l=0,c=o.length;l<c;++l)if(o[l].name===e){o[l]=a;break}l===c&&o.push(a)}i.tween=o}}function iu(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=mt(this.node(),n).tween,o=0,i=r.length,s;o<i;++o)if((s=r[o]).name===t)return s.value;return null}return this.each((e==null?ru:ou)(n,t,e))}function er(t,e,n){var r=t._id;return t.each(function(){var o=vt(this,r);(o.value||(o.value={}))[e]=n.apply(this,arguments)}),function(o){return mt(o,r).value[e]}}function ci(t,e){var n;return(typeof e=="number"?yt:e instanceof Rt?Qe:(n=Rt(e))?(e=n,Qe):ni)(t,e)}function su(t){return function(){this.removeAttribute(t)}}function au(t){return function(){this.removeAttributeNS(t.space,t.local)}}function cu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttribute(t);return s===o?null:s===r?i:i=e(r=s,n)}}function lu(t,e,n){var r,o=n+"",i;return function(){var s=this.getAttributeNS(t.space,t.local);return s===o?null:s===r?i:i=e(r=s,n)}}function uu(t,e,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(t):(s=this.getAttribute(t),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a)))}}function fu(t,e,n){var r,o,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(t.space,t.local):(s=this.getAttributeNS(t.space,t.local),l=a+"",s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a)))}}function du(t,e){var n=sn(t),r=n==="transform"?Yl:ci;return this.attrTween(t,typeof e=="function"?(n.local?fu:uu)(n,r,er(this,"attr."+t,e)):e==null?(n.local?au:su)(n):(n.local?lu:cu)(n,r,e))}function hu(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function gu(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function pu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&gu(t,i)),n}return o._value=e,o}function mu(t,e){var n,r;function o(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&hu(t,i)),n}return o._value=e,o}function yu(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=sn(t);return this.tween(n,(r.local?pu:mu)(r,e))}function xu(t,e){return function(){tr(this,t).delay=+e.apply(this,arguments)}}function wu(t,e){return e=+e,function(){tr(this,t).delay=e}}function vu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?xu:wu)(e,t)):mt(this.node(),e).delay}function bu(t,e){return function(){vt(this,t).duration=+e.apply(this,arguments)}}function _u(t,e){return e=+e,function(){vt(this,t).duration=e}}function Nu(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?bu:_u)(e,t)):mt(this.node(),e).duration}function Eu(t,e){if(typeof e!="function")throw new Error;return function(){vt(this,t).ease=e}}function Su(t){var e=this._id;return arguments.length?this.each(Eu(e,t)):mt(this.node(),e).ease}function Mu(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;vt(this,t).ease=n}}function Cu(t){if(typeof t!="function")throw new Error;return this.each(Mu(this._id,t))}function ku(t){typeof t!="function"&&(t=Vo(t));for(var e=this._groups,n=e.length,r=new Array(n),o=0;o<n;++o)for(var i=e[o],s=i.length,a=r[o]=[],l,c=0;c<s;++c)(l=i[c])&&t.call(l,l.__data__,c,i)&&a.push(l);return new St(r,this._parents,this._name,this._id)}function Iu(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,o=n.length,i=Math.min(r,o),s=new Array(r),a=0;a<i;++a)for(var l=e[a],c=n[a],f=l.length,u=s[a]=new Array(f),d,h=0;h<f;++h)(d=l[h]||c[h])&&(u[h]=d);for(;a<r;++a)s[a]=e[a];return new St(s,this._parents,this._name,this._id)}function Au(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function $u(t,e,n){var r,o,i=Au(e)?tr:vt;return function(){var s=i(this,t),a=s.on;a!==r&&(o=(r=a).copy()).on(e,n),s.on=o}}function Pu(t,e){var n=this._id;return arguments.length<2?mt(this.node(),n).on.on(t):this.each($u(n,t,e))}function Tu(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function zu(){return this.on("end.remove",Tu(this._id))}function ju(t){var e=this._name,n=this._id;typeof t!="function"&&(t=qn(t));for(var r=this._groups,o=r.length,i=new Array(o),s=0;s<o;++s)for(var a=r[s],l=a.length,c=i[s]=new Array(l),f,u,d=0;d<l;++d)(f=a[d])&&(u=t.call(f,f.__data__,d,a))&&("__data__"in f&&(u.__data__=f.__data__),c[d]=u,cn(c[d],e,n,d,c,mt(f,n)));return new St(i,this._parents,e,n)}function Lu(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ho(t));for(var r=this._groups,o=r.length,i=[],s=[],a=0;a<o;++a)for(var l=r[a],c=l.length,f,u=0;u<c;++u)if(f=l[u]){for(var d=t.call(f,f.__data__,u,l),h,g=mt(f,n),y=0,p=d.length;y<p;++y)(h=d[y])&&cn(h,e,n,y,d,g);i.push(d),s.push(f)}return new St(i,s,e,n)}var Du=Ee.prototype.constructor;function Ru(){return new Du(this._groups,this._parents)}function Hu(t,e){var n,r,o;return function(){var i=qt(this,t),s=(this.style.removeProperty(t),qt(this,t));return i===s?null:i===n&&s===r?o:o=e(n=i,r=s)}}function li(t){return function(){this.style.removeProperty(t)}}function Vu(t,e,n){var r,o=n+"",i;return function(){var s=qt(this,t);return s===o?null:s===r?i:i=e(r=s,n)}}function Bu(t,e,n){var r,o,i;return function(){var s=qt(this,t),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(t),qt(this,t))),s===l?null:s===r&&l===o?i:(o=l,i=e(r=s,a))}}function Fu(t,e){var n,r,o,i="style."+e,s="end."+i,a;return function(){var l=vt(this,t),c=l.on,f=l.value[i]==null?a||(a=li(e)):void 0;(c!==n||o!==f)&&(r=(n=c).copy()).on(s,o=f),l.on=r}}function Ou(t,e,n){var r=(t+="")=="transform"?Xl:ci;return e==null?this.styleTween(t,Hu(t,r)).on("end.style."+t,li(t)):typeof e=="function"?this.styleTween(t,Bu(t,r,er(this,"style."+t,e))).each(Fu(this._id,t)):this.styleTween(t,Vu(t,r,e),n).on("end.style."+t,null)}function Xu(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function Yu(t,e,n){var r,o;function i(){var s=e.apply(this,arguments);return s!==o&&(r=(o=s)&&Xu(t,s,n)),r}return i._value=e,i}function Wu(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,Yu(t,e,n??""))}function Gu(t){return function(){this.textContent=t}}function qu(t){return function(){var e=t(this);this.textContent=e??""}}function Uu(t){return this.tween("text",typeof t=="function"?qu(er(this,"text",t)):Gu(t==null?"":t+""))}function Zu(t){return function(e){this.textContent=t.call(this,e)}}function Ku(t){var e,n;function r(){var o=t.apply(this,arguments);return o!==n&&(e=(n=o)&&Zu(o)),e}return r._value=t,r}function Qu(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Ku(t))}function Ju(){for(var t=this._name,e=this._id,n=ui(),r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var f=mt(l,e);cn(l,t,n,c,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new St(r,this._parents,t,n)}function tf(){var t,e,n=this,r=n._id,o=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--o===0&&i()}};n.each(function(){var c=vt(this,r),f=c.on;f!==t&&(e=(t=f).copy(),e._.cancel.push(a),e._.interrupt.push(a),e._.end.push(l)),c.on=e}),o===0&&i()})}var ef=0;function St(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function ui(){return++ef}var _t=Ee.prototype;St.prototype={constructor:St,select:ju,selectAll:Lu,selectChild:_t.selectChild,selectChildren:_t.selectChildren,filter:ku,merge:Iu,selection:Ru,transition:Ju,call:_t.call,nodes:_t.nodes,node:_t.node,size:_t.size,empty:_t.empty,each:_t.each,on:Pu,attr:du,attrTween:yu,style:Ou,styleTween:Wu,text:Uu,textTween:Qu,remove:zu,tween:iu,delay:vu,duration:Nu,ease:Su,easeVarying:Cu,end:tf,[Symbol.iterator]:_t[Symbol.iterator]};function nf(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var rf={time:null,delay:0,duration:250,ease:nf};function of(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function sf(t){var e,n;t instanceof St?(e=t._id,t=t._name):(e=ui(),(n=rf).time=Qn(),t=t==null?null:t+"");for(var r=this._groups,o=r.length,i=0;i<o;++i)for(var s=r[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&cn(l,t,e,c,s,n||of(l,e));return new St(r,this._parents,t,e)}Ee.prototype.interrupt=nu;Ee.prototype.transition=sf;const De=t=>()=>t;function af(t,{sourceEvent:e,target:n,transform:r,dispatch:o}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:o}})}function Nt(t,e,n){this.k=t,this.x=e,this.y=n}Nt.prototype={constructor:Nt,scale:function(t){return t===1?this:new Nt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Nt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ln=new Nt(1,0,0);fi.prototype=Nt.prototype;function fi(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ln;return t.__zoom}function Nn(t){t.stopImmediatePropagation()}function ce(t){t.preventDefault(),t.stopImmediatePropagation()}function cf(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function lf(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Rr(){return this.__zoom||ln}function uf(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function ff(){return navigator.maxTouchPoints||"ontouchstart"in this}function df(t,e,n){var r=t.invertX(e[0][0])-n[0][0],o=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],s=t.invertY(e[1][1])-n[1][1];return t.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 di(){var t=cf,e=lf,n=df,r=uf,o=ff,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=Ye,c=Ne("start","zoom","end"),f,u,d,h=500,g=150,y=0,p=10;function m(_){_.property("__zoom",Rr).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",T).on("dblclick.zoom",D).filter(o).on("touchstart.zoom",k).on("touchmove.zoom",j).on("touchend.zoom touchcancel.zoom",H).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(_,$,C,z){var A=_.selection?_.selection():_;A.property("__zoom",Rr),_!==A?E(_,$,C,z):A.interrupt().each(function(){N(this,arguments).event(z).start().zoom(null,typeof $=="function"?$.apply(this,arguments):$).end()})},m.scaleBy=function(_,$,C,z){m.scaleTo(_,function(){var A=this.__zoom.k,M=typeof $=="function"?$.apply(this,arguments):$;return A*M},C,z)},m.scaleTo=function(_,$,C,z){m.transform(_,function(){var A=e.apply(this,arguments),M=this.__zoom,L=C==null?w(A):typeof C=="function"?C.apply(this,arguments):C,V=M.invert(L),R=typeof $=="function"?$.apply(this,arguments):$;return n(x(v(M,R),L,V),A,s)},C,z)},m.translateBy=function(_,$,C,z){m.transform(_,function(){return n(this.__zoom.translate(typeof $=="function"?$.apply(this,arguments):$,typeof C=="function"?C.apply(this,arguments):C),e.apply(this,arguments),s)},null,z)},m.translateTo=function(_,$,C,z,A){m.transform(_,function(){var M=e.apply(this,arguments),L=this.__zoom,V=z==null?w(M):typeof z=="function"?z.apply(this,arguments):z;return n(ln.translate(V[0],V[1]).scale(L.k).translate(typeof $=="function"?-$.apply(this,arguments):-$,typeof C=="function"?-C.apply(this,arguments):-C),M,s)},z,A)};function v(_,$){return $=Math.max(i[0],Math.min(i[1],$)),$===_.k?_:new Nt($,_.x,_.y)}function x(_,$,C){var z=$[0]-C[0]*_.k,A=$[1]-C[1]*_.k;return z===_.x&&A===_.y?_:new Nt(_.k,z,A)}function w(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function E(_,$,C,z){_.on("start.zoom",function(){N(this,arguments).event(z).start()}).on("interrupt.zoom end.zoom",function(){N(this,arguments).event(z).end()}).tween("zoom",function(){var A=this,M=arguments,L=N(A,M).event(z),V=e.apply(A,M),R=C==null?w(V):typeof C=="function"?C.apply(A,M):C,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),Y=A.__zoom,W=typeof $=="function"?$.apply(A,M):$,q=l(Y.invert(R).concat(X/Y.k),W.invert(R).concat(X/W.k));return function(F){if(F===1)F=W;else{var B=q(F),O=X/B[2];F=new Nt(O,R[0]-B[0]*O,R[1]-B[1]*O)}L.zoom(null,F)}})}function N(_,$,C){return!C&&_.__zooming||new S(_,$)}function S(_,$){this.that=_,this.args=$,this.active=0,this.sourceEvent=null,this.extent=e.apply(_,$),this.taps=0}S.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,$){return this.mouse&&_!=="mouse"&&(this.mouse[1]=$.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=$.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=$.invert(this.touch1[0])),this.that.__zoom=$,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var $=ut(this.that).datum();c.call(_,this.that,new af(_,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:c}),$)}};function I(_,...$){if(!t.apply(this,arguments))return;var C=N(this,$).event(_),z=this.__zoom,A=Math.max(i[0],Math.min(i[1],z.k*Math.pow(2,r.apply(this,arguments)))),M=dt(_);if(C.wheel)(C.mouse[0][0]!==M[0]||C.mouse[0][1]!==M[1])&&(C.mouse[1]=z.invert(C.mouse[0]=M)),clearTimeout(C.wheel);else{if(z.k===A)return;C.mouse=[M,z.invert(M)],qe(this),C.start()}ce(_),C.wheel=setTimeout(L,g),C.zoom("mouse",n(x(v(z,A),C.mouse[0],C.mouse[1]),C.extent,s));function L(){C.wheel=null,C.end()}}function T(_,...$){if(d||!t.apply(this,arguments))return;var C=_.currentTarget,z=N(this,$,!0).event(_),A=ut(_.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),M=dt(_,C),L=_.clientX,V=_.clientY;Zo(_.view),Nn(_),z.mouse=[M,this.__zoom.invert(M)],qe(this),z.start();function R(Y){if(ce(Y),!z.moved){var W=Y.clientX-L,q=Y.clientY-V;z.moved=W*W+q*q>y}z.event(Y).zoom("mouse",n(x(z.that.__zoom,z.mouse[0]=dt(Y,C),z.mouse[1]),z.extent,s))}function X(Y){A.on("mousemove.zoom mouseup.zoom",null),Ko(Y.view,z.moved),ce(Y),z.event(Y).end()}}function D(_,...$){if(t.apply(this,arguments)){var C=this.__zoom,z=dt(_.changedTouches?_.changedTouches[0]:_,this),A=C.invert(z),M=C.k*(_.shiftKey?.5:2),L=n(x(v(C,M),z,A),e.apply(this,$),s);ce(_),a>0?ut(this).transition().duration(a).call(E,L,z,_):ut(this).call(m.transform,L,z,_)}}function k(_,...$){if(t.apply(this,arguments)){var C=_.touches,z=C.length,A=N(this,$,_.changedTouches.length===z).event(_),M,L,V,R;for(Nn(_),L=0;L<z;++L)V=C[L],R=dt(V,this),R=[R,this.__zoom.invert(R),V.identifier],A.touch0?!A.touch1&&A.touch0[2]!==R[2]&&(A.touch1=R,A.taps=0):(A.touch0=R,M=!0,A.taps=1+!!f);f&&(f=clearTimeout(f)),M&&(A.taps<2&&(u=R[0],f=setTimeout(function(){f=null},h)),qe(this),A.start())}}function j(_,...$){if(this.__zooming){var C=N(this,$).event(_),z=_.changedTouches,A=z.length,M,L,V,R;for(ce(_),M=0;M<A;++M)L=z[M],V=dt(L,this),C.touch0&&C.touch0[2]===L.identifier?C.touch0[0]=V:C.touch1&&C.touch1[2]===L.identifier&&(C.touch1[0]=V);if(L=C.that.__zoom,C.touch1){var X=C.touch0[0],Y=C.touch0[1],W=C.touch1[0],q=C.touch1[1],F=(F=W[0]-X[0])*F+(F=W[1]-X[1])*F,B=(B=q[0]-Y[0])*B+(B=q[1]-Y[1])*B;L=v(L,Math.sqrt(F/B)),V=[(X[0]+W[0])/2,(X[1]+W[1])/2],R=[(Y[0]+q[0])/2,(Y[1]+q[1])/2]}else if(C.touch0)V=C.touch0[0],R=C.touch0[1];else return;C.zoom("touch",n(x(L,V,R),C.extent,s))}}function H(_,...$){if(this.__zooming){var C=N(this,$).event(_),z=_.changedTouches,A=z.length,M,L;for(Nn(_),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),M=0;M<A;++M)L=z[M],C.touch0&&C.touch0[2]===L.identifier?delete C.touch0:C.touch1&&C.touch1[2]===L.identifier&&delete C.touch1;if(C.touch1&&!C.touch0&&(C.touch0=C.touch1,delete C.touch1),C.touch0)C.touch0[1]=this.__zoom.invert(C.touch0[0]);else if(C.end(),C.taps===2&&(L=dt(L,this),Math.hypot(u[0]-L[0],u[1]-L[1])<p)){var V=ut(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(_){return arguments.length?(r=typeof _=="function"?_:De(+_),m):r},m.filter=function(_){return arguments.length?(t=typeof _=="function"?_:De(!!_),m):t},m.touchable=function(_){return arguments.length?(o=typeof _=="function"?_:De(!!_),m):o},m.extent=function(_){return arguments.length?(e=typeof _=="function"?_:De([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),m):e},m.scaleExtent=function(_){return arguments.length?(i[0]=+_[0],i[1]=+_[1],m):[i[0],i[1]]},m.translateExtent=function(_){return arguments.length?(s[0][0]=+_[0][0],s[1][0]=+_[1][0],s[0][1]=+_[0][1],s[1][1]=+_[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(_){return arguments.length?(n=_,m):n},m.duration=function(_){return arguments.length?(a=+_,m):a},m.interpolate=function(_){return arguments.length?(l=_,m):l},m.on=function(){var _=c.on.apply(c,arguments);return _===c?m:_},m.clickDistance=function(_){return arguments.length?(y=(_=+_)*_,m):Math.sqrt(y)},m.tapDistance=function(_){return arguments.length?(p=+_,m):p},m}const wt={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},xe=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],hi=["Enter"," ","Escape"],gi={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, 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 Zt;(function(t){t.Strict="strict",t.Loose="loose"})(Zt||(Zt={}));var Lt;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Lt||(Lt={}));var we;(function(t){t.Partial="partial",t.Full="full"})(we||(we={}));const pi={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var At;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(At||(At={}));var Kt;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Kt||(Kt={}));var G;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(G||(G={}));const Hr={[G.Left]:G.Right,[G.Right]:G.Left,[G.Top]:G.Bottom,[G.Bottom]:G.Top};function mi(t){return t===null?null:t?"valid":"invalid"}const yi=t=>"id"in t&&"source"in t&&"target"in t,hf=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),nr=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Me=(t,e=[0,0])=>{const{width:n,height:r}=Mt(t),o=t.origin??e,i=n*o[0],s=r*o[1];return{x:t.position.x-i,y:t.position.y-s}},gf=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,o)=>{const i=typeof o=="string";let s=!e.nodeLookup&&!i?o:void 0;e.nodeLookup&&(s=i?e.nodeLookup.get(o):nr(o)?o:e.nodeLookup.get(o.id));const a=s?nn(s,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return un(r,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return fn(n)},Ce=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(o=>{(e.filter===void 0||e.filter(o))&&(n=un(n,nn(o)),r=!0)}),r?fn(n):{x:0,y:0,width:0,height:0}},rr=(t,e,[n,r,o]=[0,0,1],i=!1,s=!1)=>{const a={...Ie(e,[n,r,o]),width:e.width/o,height:e.height/o},l=[];for(const c of t.values()){const{measured:f,selectable:u=!0,hidden:d=!1}=c;if(s&&!u||d)continue;const h=f.width??c.width??c.initialWidth??null,g=f.height??c.height??c.initialHeight??null,y=ve(a,Jt(c)),p=(h??0)*(g??0),m=i&&y>0;(!c.internals.handleBounds||m||y>=p||c.dragging)&&l.push(c)}return l},pf=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function mf(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(o=>o.id)):null;return t.forEach(o=>{o.measured.width&&o.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!o.hidden)&&(!r||r.has(o.id))&&n.set(o.id,o)}),n}async function yf({nodes:t,width:e,height:n,panZoom:r,minZoom:o,maxZoom:i},s){if(t.size===0)return Promise.resolve(!0);const a=mf(t,s),l=Ce(a),c=or(l,e,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(c,{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 xi({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:o,onError:i}){const s=n.get(t),a=s.parentId?n.get(s.parentId):void 0,{x:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},f=s.origin??r;let u=s.extent||o;if(s.extent==="parent"&&!s.expandParent)if(!a)i==null||i("005",wt.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(u=[[l,c],[l+h,c+g]])}else a&&te(s.extent)&&(u=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=te(u)?Vt(e,u,s.measured):e;return(s.measured.width===void 0||s.measured.height===void 0)&&(i==null||i("015",wt.error015())),{position:{x:d.x-l+(s.measured.width??0)*f[0],y:d.y-c+(s.measured.height??0)*f[1]},positionAbsolute:d}}async function xf({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:o}){const i=new Set(t.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(y=>y.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(e.map(d=>d.id)),l=r.filter(d=>d.deletable!==!1),f=pf(s,l);for(const d of l)a.has(d.id)&&!f.find(g=>g.id===d.id)&&f.push(d);if(!o)return{edges:f,nodes:s};const u=await o({nodes:s,edges:f});return typeof u=="boolean"?u?{edges:f,nodes:s}:{edges:[],nodes:[]}:u}const Qt=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Vt=(t={x:0,y:0},e,n)=>({x:Qt(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:Qt(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function wi(t,e,n){const{width:r,height:o}=Mt(n),{x:i,y:s}=n.internals.positionAbsolute;return Vt(t,[[i,s],[i+r,s+o]],e)}const Vr=(t,e,n)=>t<e?Qt(Math.abs(t-e),1,e)/e:t>n?-Qt(Math.abs(t-n),1,e)/e:0,vi=(t,e,n=15,r=40)=>{const o=Vr(t.x,r,e.width-r)*n,i=Vr(t.y,r,e.height-r)*n;return[o,i]},un=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Bn=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),fn=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),Jt=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=nr(t)?t.internals.positionAbsolute:Me(t,e);return{x:n,y:r,width:((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},nn=(t,e=[0,0])=>{var o,i;const{x:n,y:r}=nr(t)?t.internals.positionAbsolute:Me(t,e);return{x:n,y:r,x2:n+(((o=t.measured)==null?void 0:o.width)??t.width??t.initialWidth??0),y2:r+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},bi=(t,e)=>fn(un(Bn(t),Bn(e))),ve=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),r=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*r)},Br=t=>gt(t.width)&>(t.height)&>(t.x)&>(t.y),gt=t=>!isNaN(t)&&isFinite(t),wf=(t,e)=>{},ke=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Ie=({x:t,y:e},[n,r,o],i=!1,s=[1,1])=>{const a={x:(t-n)/o,y:(e-r)/o};return i?ke(a,s):a},rn=({x:t,y:e},[n,r,o])=>({x:t*o+n,y:e*o+r});function Ot(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function vf(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=Ot(t,n),o=Ot(t,e);return{top:r,right:o,bottom:r,left:o,x:o*2,y:r*2}}if(typeof t=="object"){const r=Ot(t.top??t.y??0,n),o=Ot(t.bottom??t.y??0,n),i=Ot(t.left??t.x??0,e),s=Ot(t.right??t.x??0,e);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 bf(t,e,n,r,o,i){const{x:s,y:a}=rn(t,[e,n,r]),{x:l,y:c}=rn({x:t.x+t.width,y:t.y+t.height},[e,n,r]),f=o-l,u=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(f),bottom:Math.floor(u)}}const or=(t,e,n,r,o,i)=>{const s=vf(i,e,n),a=(e-s.x)/t.width,l=(n-s.y)/t.height,c=Math.min(a,l),f=Qt(c,r,o),u=t.x+t.width/2,d=t.y+t.height/2,h=e/2-u*f,g=n/2-d*f,y=bf(t,h,g,f,e,n),p={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-p.left+p.right,y:g-p.top+p.bottom,zoom:f}},be=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function te(t){return t!=null&&t!=="parent"}function Mt(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function _i(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function Ni(t,e={width:0,height:0},n,r,o){const i={...t},s=r.get(n);if(s){const a=s.origin||o;i.x+=s.internals.positionAbsolute.x-(e.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(e.height??0)*a[1]}return i}function Fr(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function _f(){let t,e;return{promise:new Promise((r,o)=>{t=r,e=o}),resolve:t,reject:e}}function Nf(t){return{...gi,...t||{}}}function he(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:o}){const{x:i,y:s}=pt(t),a=Ie({x:i-((o==null?void 0:o.left)??0),y:s-((o==null?void 0:o.top)??0)},r),{x:l,y:c}=n?ke(a,e):a;return{xSnapped:l,ySnapped:c,...a}}const ir=t=>({width:t.offsetWidth,height:t.offsetHeight}),Ei=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},Ef=["INPUT","SELECT","TEXTAREA"];function Si(t){var r,o;const e=((o=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:o[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:Ef.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Mi=t=>"clientX"in t,pt=(t,e)=>{var i,s;const n=Mi(t),r=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,o=n?t.clientY:(s=t.touches)==null?void 0:s[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:o-((e==null?void 0:e.top)??0)}},Or=(t,e,n,r,o)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:t,nodeId:o,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/r,y:(a.top-n.top)/r,...ir(s)}})};function Ci({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:o,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=t*.125+o*.375+s*.375+n*.125,c=e*.125+i*.375+a*.375+r*.125,f=Math.abs(l-t),u=Math.abs(c-e);return[l,c,f,u]}function Re(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function Xr({pos:t,x1:e,y1:n,x2:r,y2:o,c:i}){switch(t){case G.Left:return[e-Re(e-r,i),n];case G.Right:return[e+Re(r-e,i),n];case G.Top:return[e,n-Re(n-o,i)];case G.Bottom:return[e,n+Re(o-n,i)]}}function ki({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,curvature:s=.25}){const[a,l]=Xr({pos:n,x1:t,y1:e,x2:r,y2:o,c:s}),[c,f]=Xr({pos:i,x1:r,y1:o,x2:t,y2:e,c:s}),[u,d,h,g]=Ci({sourceX:t,sourceY:e,targetX:r,targetY:o,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:f});return[`M${t},${e} C${a},${l} ${c},${f} ${r},${o}`,u,d,h,g]}function Ii({sourceX:t,sourceY:e,targetX:n,targetY:r}){const o=Math.abs(n-t)/2,i=n<t?n+o:n-o,s=Math.abs(r-e)/2,a=r<e?r+s:r-s;return[i,a,o,s]}function Sf({sourceNode:t,targetNode:e,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(t.parentId||o&&t.selected?t.internals.z:0,e.parentId||o&&e.selected?e.internals.z:0);return s+a}function Mf({sourceNode:t,targetNode:e,width:n,height:r,transform:o}){const i=un(nn(t),nn(e));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 ve(s,fn(i))>0}const Cf=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,kf=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),If=(t,e,n={})=>{if(!t.source||!t.target)return e;const r=n.getEdgeId||Cf;let o;return yi(t)?o={...t}:o={...t,id:r(t)},kf(o,e)?e:(o.sourceHandle===null&&delete o.sourceHandle,o.targetHandle===null&&delete o.targetHandle,e.concat(o))};function Ai({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[o,i,s,a]=Ii({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,o,i,s,a]}const Yr={[G.Left]:{x:-1,y:0},[G.Right]:{x:1,y:0},[G.Top]:{x:0,y:-1},[G.Bottom]:{x:0,y:1}},Af=({source:t,sourcePosition:e=G.Bottom,target:n})=>e===G.Left||e===G.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Wr=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function $f({source:t,sourcePosition:e=G.Bottom,target:n,targetPosition:r=G.Top,center:o,offset:i,stepPosition:s}){const a=Yr[e],l=Yr[r],c={x:t.x+a.x*i,y:t.y+a.y*i},f={x:n.x+l.x*i,y:n.y+l.y*i},u=Af({source:c,sourcePosition:e,target:f}),d=u.x!==0?"x":"y",h=u[d];let g=[],y,p;const m={x:0,y:0},v={x:0,y:0},[,,x,w]=Ii({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(y=o.x??c.x+(f.x-c.x)*s,p=o.y??(c.y+f.y)/2):(y=o.x??(c.x+f.x)/2,p=o.y??c.y+(f.y-c.y)*s);const I=[{x:y,y:c.y},{x:y,y:f.y}],T=[{x:c.x,y:p},{x:f.x,y:p}];a[d]===h?g=d==="x"?I:T:g=d==="x"?T:I}else{const I=[{x:c.x,y:f.y}],T=[{x:f.x,y:c.y}];if(d==="x"?g=a.x===h?T:I:g=a.y===h?I:T,e===r){const _=Math.abs(t[d]-n[d]);if(_<=i){const $=Math.min(i-1,i-_);a[d]===h?m[d]=(c[d]>t[d]?-1:1)*$:v[d]=(f[d]>n[d]?-1:1)*$}}if(e!==r){const _=d==="x"?"y":"x",$=a[d]===l[_],C=c[_]>f[_],z=c[_]<f[_];(a[d]===1&&(!$&&C||$&&z)||a[d]!==1&&(!$&&z||$&&C))&&(g=d==="x"?I:T)}const D={x:c.x+m.x,y:c.y+m.y},k={x:f.x+v.x,y:f.y+v.y},j=Math.max(Math.abs(D.x-g[0].x),Math.abs(k.x-g[0].x)),H=Math.max(Math.abs(D.y-g[0].y),Math.abs(k.y-g[0].y));j>=H?(y=(D.x+k.x)/2,p=g[0].y):(y=g[0].x,p=(D.y+k.y)/2)}const E={x:c.x+m.x,y:c.y+m.y},N={x:f.x+v.x,y:f.y+v.y};return[[t,...E.x!==g[0].x||E.y!==g[0].y?[E]:[],...g,...N.x!==g[g.length-1].x||N.y!==g[g.length-1].y?[N]:[],n],y,p,x,w]}function Pf(t,e,n,r){const o=Math.min(Wr(t,e)/2,Wr(e,n)/2,r),{x:i,y:s}=e;if(t.x===i&&i===n.x||t.y===s&&s===n.y)return`L${i} ${s}`;if(t.y===s){const c=t.x<n.x?-1:1,f=t.y<n.y?1:-1;return`L ${i+o*c},${s}Q ${i},${s} ${i},${s+o*f}`}const a=t.x<n.x?1:-1,l=t.y<n.y?-1:1;return`L ${i},${s+o*l}Q ${i},${s} ${i+o*a},${s}`}function Fn({sourceX:t,sourceY:e,sourcePosition:n=G.Bottom,targetX:r,targetY:o,targetPosition:i=G.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:f=.5}){const[u,d,h,g,y]=$f({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:o},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:f});let p=`M${u[0].x} ${u[0].y}`;for(let m=1;m<u.length-1;m++)p+=Pf(u[m-1],u[m],u[m+1],s);return p+=`L${u[u.length-1].x} ${u[u.length-1].y}`,[p,d,h,g,y]}function Gr(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function Tf(t){var u;const{sourceNode:e,targetNode:n}=t;if(!Gr(e)||!Gr(n))return null;const r=e.internals.handleBounds||qr(e.handles),o=n.internals.handleBounds||qr(n.handles),i=Ur((r==null?void 0:r.source)??[],t.sourceHandle),s=Ur(t.connectionMode===Zt.Strict?(o==null?void 0:o.target)??[]:((o==null?void 0:o.target)??[]).concat((o==null?void 0:o.source)??[]),t.targetHandle);if(!i||!s)return(u=t.onError)==null||u.call(t,"008",wt.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const a=(i==null?void 0:i.position)||G.Bottom,l=(s==null?void 0:s.position)||G.Top,c=Bt(e,i,a),f=Bt(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:f.x,targetY:f.y,sourcePosition:a,targetPosition:l}}function qr(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function Bt(t,e,n=G.Left,r=!1){const o=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:s,height:a}=e??Mt(t);if(r)return{x:o+s/2,y:i+a/2};switch((e==null?void 0:e.position)??n){case G.Top:return{x:o+s/2,y:i};case G.Right:return{x:o+s,y:i+a/2};case G.Bottom:return{x:o+s/2,y:i+a};case G.Left:return{x:o,y:i+a/2}}}function Ur(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function On(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function zf(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:o}){const i=new Set;return t.reduce((s,a)=>([a.markerStart||r,a.markerEnd||o].forEach(l=>{if(l&&typeof l=="object"){const c=On(l,e);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const $i=1e3,jf=10,sr={nodeOrigin:[0,0],nodeExtent:xe,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Lf={...sr,checkEquality:!0};function ar(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function Df(t,e,n){const r=ar(sr,n);for(const o of t.values())if(o.parentId)lr(o,t,e,r);else{const i=Me(o,r.nodeOrigin),s=te(o.extent)?o.extent:r.nodeExtent,a=Vt(i,s,Mt(o));o.internals.positionAbsolute=a}}function Rf(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const o of t.handles){const i={id:o.id,width:o.width??1,height:o.height??1,nodeId:t.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 cr(t){return t==="manual"}function Xn(t,e,n,r={}){var f,u;const o=ar(Lf,r),i={i:0},s=new Map(e),a=o!=null&&o.elevateNodesOnSelect&&!cr(o.zIndexMode)?$i:0;let l=t.length>0,c=!1;e.clear(),n.clear();for(const d of t){let h=s.get(d.id);if(o.checkEquality&&d===(h==null?void 0:h.internals.userNode))e.set(d.id,h);else{const g=Me(d,o.nodeOrigin),y=te(d.extent)?d.extent:o.nodeExtent,p=Vt(g,y,Mt(d));h={...o.defaults,...d,measured:{width:(f=d.measured)==null?void 0:f.width,height:(u=d.measured)==null?void 0:u.height},internals:{positionAbsolute:p,handleBounds:Rf(d,h),z:Pi(d,a,o.zIndexMode),userNode:d}},e.set(d.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(l=!1),d.parentId&&lr(h,e,n,r,i),c||(c=d.selected??!1)}return{nodesInitialized:l,hasSelectedNodes:c}}function Hf(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function lr(t,e,n,r,o){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=ar(sr,r),c=t.parentId,f=e.get(c);if(!f){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Hf(t,n),o&&!f.parentId&&f.internals.rootParentIndex===void 0&&l==="auto"&&(f.internals.rootParentIndex=++o.i,f.internals.z=f.internals.z+o.i*jf),o&&f.internals.rootParentIndex!==void 0&&(o.i=f.internals.rootParentIndex);const u=i&&!cr(l)?$i:0,{x:d,y:h,z:g}=Vf(t,f,s,a,u,l),{positionAbsolute:y}=t.internals,p=d!==y.x||h!==y.y;(p||g!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:p?{x:d,y:h}:y,z:g}})}function Pi(t,e,n){const r=gt(t.zIndex)?t.zIndex:0;return cr(n)?r:r+(t.selected?e:0)}function Vf(t,e,n,r,o,i){const{x:s,y:a}=e.internals.positionAbsolute,l=Mt(t),c=Me(t,n),f=te(t.extent)?Vt(c,t.extent,l):c;let u=Vt({x:s+f.x,y:a+f.y},r,l);t.extent==="parent"&&(u=wi(u,l,e));const d=Pi(t,o,i),h=e.internals.z??0;return{x:u.x,y:u.y,z:h>=d?h+1:d}}function ur(t,e,n,r=[0,0]){var s;const o=[],i=new Map;for(const a of t){const l=e.get(a.parentId);if(!l)continue;const c=((s=i.get(a.parentId))==null?void 0:s.expandedRect)??Jt(l),f=bi(c,a.rect);i.set(a.parentId,{expandedRect:f,parent:l})}return i.size>0&&i.forEach(({expandedRect:a,parent:l},c)=>{var x;const f=l.internals.positionAbsolute,u=Mt(l),d=l.origin??r,h=a.x<f.x?Math.round(Math.abs(f.x-a.x)):0,g=a.y<f.y?Math.round(Math.abs(f.y-a.y)):0,y=Math.max(u.width,Math.round(a.width)),p=Math.max(u.height,Math.round(a.height)),m=(y-u.width)*d[0],v=(p-u.height)*d[1];(h>0||g>0||m||v)&&(o.push({id:c,type:"position",position:{x:l.position.x-h+m,y:l.position.y-g+v}}),(x=n.get(c))==null||x.forEach(w=>{t.some(E=>E.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:c,type:"dimensions",setAttributes:!0,dimensions:{width:y+(h?d[0]*h-m:0),height:p+(g?d[1]*g-v:0)}})}),o}function Bf(t,e,n,r,o,i,s){const a=r==null?void 0:r.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],f=window.getComputedStyle(a),{m22:u}=new window.DOMMatrixReadOnly(f.transform),d=[];for(const h of t.values()){const g=e.get(h.id);if(!g)continue;if(g.hidden){e.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),l=!0;continue}const y=ir(h.nodeElement),p=g.measured.width!==y.width||g.measured.height!==y.height;if(!!(y.width&&y.height&&(p||!g.internals.handleBounds||h.force))){const v=h.nodeElement.getBoundingClientRect(),x=te(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;g.parentId&&g.extent==="parent"?w=wi(w,y,e.get(g.parentId)):x&&(w=Vt(w,x,y));const E={...g,measured:y,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:Or("source",h.nodeElement,v,u,g.id),target:Or("target",h.nodeElement,v,u,g.id)}}};e.set(g.id,E),g.parentId&&lr(E,e,n,{nodeOrigin:o,zIndexMode:s}),l=!0,p&&(c.push({id:g.id,type:"dimensions",dimensions:y}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Jt(E,o)}))}}if(d.length>0){const h=ur(d,e,n,o);c.push(...h)}return{changes:c,updatedInternals:l}}async function Ff({delta:t,panZoom:e,transform:n,translateExtent:r,width:o,height:i}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const s=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.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 Zr(t,e,n,r,o,i){let s=o;const a=r.get(s)||new Map;r.set(s,a.set(n,e)),s=`${o}-${t}`;const l=r.get(s)||new Map;if(r.set(s,l.set(n,e)),i){s=`${o}-${t}-${i}`;const c=r.get(s)||new Map;r.set(s,c.set(n,e))}}function Ti(t,e,n){t.clear(),e.clear();for(const r of n){const{source:o,target:i,sourceHandle:s=null,targetHandle:a=null}=r,l={edgeId:r.id,source:o,target:i,sourceHandle:s,targetHandle:a},c=`${o}-${s}--${i}-${a}`,f=`${i}-${a}--${o}-${s}`;Zr("source",l,f,t,o,s),Zr("target",l,c,t,i,a),e.set(r.id,r)}}function zi(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:zi(n,e):!1}function Kr(t,e,n){var o;let r=t;do{if((o=r==null?void 0:r.matches)!=null&&o.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function Of(t,e,n,r){const o=new Map;for(const[i,s]of t)if((s.selected||s.id===r)&&(!s.parentId||!zi(s,t))&&(s.draggable||e&&typeof s.draggable>"u")){const a=t.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 En({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var s,a,l;const o=[];for(const[c,f]of e){const u=(s=n.get(c))==null?void 0:s.internals.userNode;u&&o.push({...u,position:f.position,dragging:r})}if(!t)return[o[0],o];const i=(a=n.get(t))==null?void 0:a.internals.userNode;return[i?{...i,position:((l=e.get(t))==null?void 0:l.position)||i.position,dragging:r}:o[0],o]}function Xf({dragItems:t,snapGrid:e,x:n,y:r}){const o=t.values().next().value;if(!o)return null;const i={x:n-o.distance.x,y:r-o.distance.y},s=ke(i,e);return{x:s.x-i.x,y:s.y-i.y}}function Yf({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:o}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},f=null,u=!1,d=null,h=!1,g=!1,y=null;function p({noDragClassName:v,handleSelector:x,domNode:w,isSelectable:E,nodeId:N,nodeClickDistance:S=0}){d=ut(w);function I({x:j,y:H}){const{nodeLookup:_,nodeExtent:$,snapGrid:C,snapToGrid:z,nodeOrigin:A,onNodeDrag:M,onSelectionDrag:L,onError:V,updateNodePositions:R}=e();i={x:j,y:H};let X=!1;const Y=a.size>1,W=Y&&$?Bn(Ce(a)):null,q=Y&&z?Xf({dragItems:a,snapGrid:C,x:j,y:H}):null;for(const[F,B]of a){if(!_.has(F))continue;let O={x:j-B.distance.x,y:H-B.distance.y};z&&(O=q?{x:Math.round(O.x+q.x),y:Math.round(O.y+q.y)}:ke(O,C));let Z=null;if(Y&&$&&!B.extent&&W){const{positionAbsolute:U}=B.internals,et=U.x-W.x+$[0][0],nt=U.x+B.measured.width-W.x2+$[1][0],tt=U.y-W.y+$[0][1],st=U.y+B.measured.height-W.y2+$[1][1];Z=[[et,tt],[nt,st]]}const{position:Q,positionAbsolute:K}=xi({nodeId:F,nextPosition:O,nodeLookup:_,nodeExtent:Z||$,nodeOrigin:A,onError:V});X=X||B.position.x!==Q.x||B.position.y!==Q.y,B.position=Q,B.internals.positionAbsolute=K}if(g=g||X,!!X&&(R(a,!0),y&&(r||M||!N&&L))){const[F,B]=En({nodeId:N,dragItems:a,nodeLookup:_});r==null||r(y,a,F,B),M==null||M(y,F,B),N||L==null||L(y,B)}}async function T(){if(!f)return;const{transform:j,panBy:H,autoPanSpeed:_,autoPanOnNodeDrag:$}=e();if(!$){l=!1,cancelAnimationFrame(s);return}const[C,z]=vi(c,f,_);(C!==0||z!==0)&&(i.x=(i.x??0)-C/j[2],i.y=(i.y??0)-z/j[2],await H({x:C,y:z})&&I(i)),s=requestAnimationFrame(T)}function D(j){var Y;const{nodeLookup:H,multiSelectionActive:_,nodesDraggable:$,transform:C,snapGrid:z,snapToGrid:A,selectNodesOnDrag:M,onNodeDragStart:L,onSelectionDragStart:V,unselectNodesAndEdges:R}=e();u=!0,(!M||!E)&&!_&&N&&((Y=H.get(N))!=null&&Y.selected||R()),E&&M&&N&&(t==null||t(N));const X=he(j.sourceEvent,{transform:C,snapGrid:z,snapToGrid:A,containerBounds:f});if(i=X,a=Of(H,$,X,N),a.size>0&&(n||L||!N&&V)){const[W,q]=En({nodeId:N,dragItems:a,nodeLookup:H});n==null||n(j.sourceEvent,a,W,q),L==null||L(j.sourceEvent,W,q),N||V==null||V(j.sourceEvent,q)}}const k=Qo().clickDistance(S).on("start",j=>{const{domNode:H,nodeDragThreshold:_,transform:$,snapGrid:C,snapToGrid:z}=e();f=(H==null?void 0:H.getBoundingClientRect())||null,h=!1,g=!1,y=j.sourceEvent,_===0&&D(j),i=he(j.sourceEvent,{transform:$,snapGrid:C,snapToGrid:z,containerBounds:f}),c=pt(j.sourceEvent,f)}).on("drag",j=>{const{autoPanOnNodeDrag:H,transform:_,snapGrid:$,snapToGrid:C,nodeDragThreshold:z,nodeLookup:A}=e(),M=he(j.sourceEvent,{transform:_,snapGrid:$,snapToGrid:C,containerBounds:f});if(y=j.sourceEvent,(j.sourceEvent.type==="touchmove"&&j.sourceEvent.touches.length>1||N&&!A.has(N))&&(h=!0),!h){if(!l&&H&&u&&(l=!0,T()),!u){const L=pt(j.sourceEvent,f),V=L.x-c.x,R=L.y-c.y;Math.sqrt(V*V+R*R)>z&&D(j)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&a&&u&&(c=pt(j.sourceEvent,f),I(M))}}).on("end",j=>{if(!(!u||h)&&(l=!1,u=!1,cancelAnimationFrame(s),a.size>0)){const{nodeLookup:H,updateNodePositions:_,onNodeDragStop:$,onSelectionDragStop:C}=e();if(g&&(_(a,!1),g=!1),o||$||!N&&C){const[z,A]=En({nodeId:N,dragItems:a,nodeLookup:H,dragging:!1});o==null||o(j.sourceEvent,a,z,A),$==null||$(j.sourceEvent,z,A),N||C==null||C(j.sourceEvent,A)}}}).filter(j=>{const H=j.target;return!j.button&&(!v||!Kr(H,`.${v}`,w))&&(!x||Kr(H,x,w))});d.call(k)}function m(){d==null||d.on(".drag",null)}return{update:p,destroy:m}}function Wf(t,e,n){const r=[],o={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())ve(o,Jt(i))>0&&r.push(i);return r}const Gf=250;function qf(t,e,n,r){var a,l;let o=[],i=1/0;const s=Wf(t,n,e+Gf);for(const c of s){const f=[...((a=c.internals.handleBounds)==null?void 0:a.source)??[],...((l=c.internals.handleBounds)==null?void 0:l.target)??[]];for(const u of f){if(r.nodeId===u.nodeId&&r.type===u.type&&r.id===u.id)continue;const{x:d,y:h}=Bt(c,u,u.position,!0),g=Math.sqrt(Math.pow(d-t.x,2)+Math.pow(h-t.y,2));g>e||(g<i?(o=[{...u,x:d,y:h}],i=g):g===i&&o.push({...u,x:d,y:h}))}}if(!o.length)return null;if(o.length>1){const c=r.type==="source"?"target":"source";return o.find(f=>f.type===c)??o[0]}return o[0]}function ji(t,e,n,r,o,i=!1){var c,f,u;const s=r.get(t);if(!s)return null;const a=o==="strict"?(c=s.internals.handleBounds)==null?void 0:c[e]:[...((f=s.internals.handleBounds)==null?void 0:f.source)??[],...((u=s.internals.handleBounds)==null?void 0:u.target)??[]],l=(n?a==null?void 0:a.find(d=>d.id===n):a==null?void 0:a[0])??null;return l&&i?{...l,...Bt(s,l,l.position,!0)}:l}function Li(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function Uf(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Di=()=>!0;function Zf(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:o,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:f,flowId:u,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:y,onConnectEnd:p,isValidConnection:m=Di,onReconnectEnd:v,updateConnection:x,getTransform:w,getFromHandle:E,autoPanSpeed:N,dragThreshold:S=1,handleDomNode:I}){const T=Ei(t.target);let D=0,k;const{x:j,y:H}=pt(t),_=Li(i,I),$=a==null?void 0:a.getBoundingClientRect();let C=!1;if(!$||!_)return;const z=ji(o,_,r,l,e);if(!z)return;let A=pt(t,$),M=!1,L=null,V=!1,R=null;function X(){if(!f||!$)return;const[Q,K]=vi(A,$,N);d({x:Q,y:K}),D=requestAnimationFrame(X)}const Y={...z,nodeId:o,type:_,position:z.position},W=l.get(o);let F={inProgress:!0,isValid:null,from:Bt(W,Y,G.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:W,to:A,toHandle:null,toPosition:Hr[Y.position],toNode:null,pointer:A};function B(){C=!0,x(F),g==null||g(t,{nodeId:o,handleId:r,handleType:_})}S===0&&B();function O(Q){if(!C){const{x:st,y:Ct}=pt(Q),bt=st-j,Pt=Ct-H;if(!(bt*bt+Pt*Pt>S*S))return;B()}if(!E()||!Y){Z(Q);return}const K=w();A=pt(Q,$),k=qf(Ie(A,K,!1,[1,1]),n,l,Y),M||(X(),M=!0);const U=Ri(Q,{handle:k,connectionMode:e,fromNodeId:o,fromHandleId:r,fromType:s?"target":"source",isValidConnection:m,doc:T,lib:c,flowId:u,nodeLookup:l});R=U.handleDomNode,L=U.connection,V=Uf(!!k,U.isValid);const et=l.get(o),nt=et?Bt(et,Y,G.Left,!0):F.from,tt={...F,from:nt,isValid:V,to:U.toHandle&&V?rn({x:U.toHandle.x,y:U.toHandle.y},K):A,toHandle:U.toHandle,toPosition:V&&U.toHandle?U.toHandle.position:Hr[Y.position],toNode:U.toHandle?l.get(U.toHandle.nodeId):null,pointer:A};x(tt),F=tt}function Z(Q){if(!("touches"in Q&&Q.touches.length>0)){if(C){(k||R)&&L&&V&&(y==null||y(L));const{inProgress:K,...U}=F,et={...U,toPosition:F.toHandle?F.toPosition:null};p==null||p(Q,et),i&&(v==null||v(Q,et))}h(),cancelAnimationFrame(D),M=!1,V=!1,L=null,R=null,T.removeEventListener("mousemove",O),T.removeEventListener("mouseup",Z),T.removeEventListener("touchmove",O),T.removeEventListener("touchend",Z)}}T.addEventListener("mousemove",O),T.addEventListener("mouseup",Z),T.addEventListener("touchmove",O),T.addEventListener("touchend",Z)}function Ri(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:o,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Di,nodeLookup:f}){const u=i==="target",d=e?s.querySelector(`.${a}-flow__handle[data-id="${l}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:h,y:g}=pt(t),y=s.elementFromPoint(h,g),p=y!=null&&y.classList.contains(`${a}-flow__handle`)?y:d,m={handleDomNode:p,isValid:!1,connection:null,toHandle:null};if(p){const v=Li(void 0,p),x=p.getAttribute("data-nodeid"),w=p.getAttribute("data-handleid"),E=p.classList.contains("connectable"),N=p.classList.contains("connectableend");if(!x||!v)return m;const S={source:u?x:r,sourceHandle:u?w:o,target:u?r:x,targetHandle:u?o:w};m.connection=S;const T=E&&N&&(n===Zt.Strict?u&&v==="source"||!u&&v==="target":x!==r||w!==o);m.isValid=T&&c(S),m.toHandle=ji(x,v,w,f,n,!0)}return m}const Yn={onPointerDown:Zf,isValid:Ri};function Kf({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const o=ut(t);function i({translateExtent:a,width:l,height:c,zoomStep:f=1,pannable:u=!0,zoomable:d=!0,inversePan:h=!1}){const g=x=>{if(x.sourceEvent.type!=="wheel"||!e)return;const w=n(),E=x.sourceEvent.ctrlKey&&be()?10:1,N=-x.sourceEvent.deltaY*(x.sourceEvent.deltaMode===1?.05:x.sourceEvent.deltaMode?1:.002)*f,S=w[2]*Math.pow(2,N*E);e.scaleTo(S)};let y=[0,0];const p=x=>{(x.sourceEvent.type==="mousedown"||x.sourceEvent.type==="touchstart")&&(y=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY])},m=x=>{const w=n();if(x.sourceEvent.type!=="mousemove"&&x.sourceEvent.type!=="touchmove"||!e)return;const E=[x.sourceEvent.clientX??x.sourceEvent.touches[0].clientX,x.sourceEvent.clientY??x.sourceEvent.touches[0].clientY],N=[E[0]-y[0],E[1]-y[1]];y=E;const S=r()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-N[0]*S,y:w[1]-N[1]*S},T=[[0,0],[l,c]];e.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},T,a)},v=di().on("start",p).on("zoom",u?m:null).on("zoom.wheel",d?g:null);o.call(v,{})}function s(){o.on("zoom",null)}return{update:i,destroy:s,pointer:dt}}const dn=t=>({x:t.x,y:t.y,zoom:t.k}),Sn=({x:t,y:e,zoom:n})=>ln.translate(t,e).scale(n),Xt=(t,e)=>t.target.closest(`.${e}`),Hi=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),Qf=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Mn=(t,e=0,n=Qf,r=()=>{})=>{const o=typeof e=="number"&&e>0;return o||r(),o?t.transition().duration(e).ease(n).on("end",r):t},Vi=t=>{const e=t.ctrlKey&&be()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function Jf({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:o,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return f=>{if(Xt(f,e))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const u=n.property("__zoom").k||1;if(f.ctrlKey&&s){const p=dt(f),m=Vi(f),v=u*Math.pow(2,m);r.scaleTo(n,v,p,f);return}const d=f.deltaMode===1?20:1;let h=o===Lt.Vertical?0:f.deltaX*d,g=o===Lt.Horizontal?0:f.deltaY*d;!be()&&f.shiftKey&&o!==Lt.Vertical&&(h=f.deltaY*d,g=0),r.translateBy(n,-(h/u)*i,-(g/u)*i,{internal:!0});const y=dn(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(l==null||l(f,y),t.panScrollTimeout=setTimeout(()=>{c==null||c(f,y),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,a==null||a(f,y))}}function td({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,o){const i=r.type==="wheel",s=!e&&i&&!r.ctrlKey,a=Xt(r,t);if(r.ctrlKey&&i&&a&&r.preventDefault(),s||a)return null;r.preventDefault(),n.call(this,r,o)}}function ed({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var i,s,a;if((i=r.sourceEvent)!=null&&i.internal)return;const o=dn(r.transform);t.mouseButton=((s=r.sourceEvent)==null?void 0:s.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=o,((a=r.sourceEvent)==null?void 0:a.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,o))}}function nd({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:o}){return i=>{var s,a;t.usedRightMouseButton=!!(n&&Hi(e,t.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,dn(i.transform)))}}function rd({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:o,onPaneContextMenu:i}){return s=>{var a;if(!((a=s.sourceEvent)!=null&&a.internal)&&(t.isZoomingOrPanning=!1,i&&Hi(e,t.mouseButton??0)&&!t.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),t.usedRightMouseButton=!1,r(!1),o)){const l=dn(s.transform);t.prevViewport=l,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{o==null||o(s.sourceEvent,l)},n?150:0)}}}function od({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:o,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:f}){return u=>{var p;const d=t||e,h=n&&u.ctrlKey,g=u.type==="wheel";if(u.button===1&&u.type==="mousedown"&&(Xt(u,`${c}-flow__node`)||Xt(u,`${c}-flow__edge`)))return!0;if(!r&&!d&&!o&&!i&&!n||s||f&&!g||Xt(u,a)&&g||Xt(u,l)&&(!g||o&&g&&!t)||!n&&u.ctrlKey&&g)return!1;if(!n&&u.type==="touchstart"&&((p=u.touches)==null?void 0:p.length)>1)return u.preventDefault(),!1;if(!d&&!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 id({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:o,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=t.getBoundingClientRect(),u=di().scaleExtent([e,n]).translateExtent(r),d=ut(t).call(u);v({x:o.x,y:o.y,zoom:Qt(o.zoom,e,n)},[[0,0],[f.width,f.height]],r);const h=d.on("wheel.zoom"),g=d.on("dblclick.zoom");u.wheelDelta(Vi);function y(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).transform(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function p({noWheelClassName:k,noPanClassName:j,onPaneContextMenu:H,userSelectionActive:_,panOnScroll:$,panOnDrag:C,panOnScrollMode:z,panOnScrollSpeed:A,preventScrolling:M,zoomOnPinch:L,zoomOnScroll:V,zoomOnDoubleClick:R,zoomActivationKeyPressed:X,lib:Y,onTransformChange:W,connectionInProgress:q,paneClickDistance:F,selectionOnDrag:B}){_&&!c.isZoomingOrPanning&&m();const O=$&&!X&&!_;u.clickDistance(B?1/0:!gt(F)||F<0?0:F);const Z=O?Jf({zoomPanValues:c,noWheelClassName:k,d3Selection:d,d3Zoom:u,panOnScrollMode:z,panOnScrollSpeed:A,zoomOnPinch:L,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):td({noWheelClassName:k,preventScrolling:M,d3ZoomHandler:h});if(d.on("wheel.zoom",Z,{passive:!1}),!_){const K=ed({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});u.on("start",K);const U=nd({zoomPanValues:c,panOnDrag:C,onPaneContextMenu:!!H,onPanZoom:i,onTransformChange:W});u.on("zoom",U);const et=rd({zoomPanValues:c,panOnDrag:C,panOnScroll:$,onPaneContextMenu:H,onPanZoomEnd:a,onDraggingChange:l});u.on("end",et)}const Q=od({zoomActivationKeyPressed:X,panOnDrag:C,zoomOnScroll:V,panOnScroll:$,zoomOnDoubleClick:R,zoomOnPinch:L,userSelectionActive:_,noPanClassName:j,noWheelClassName:k,lib:Y,connectionInProgress:q});u.filter(Q),R?d.on("dblclick.zoom",g):d.on("dblclick.zoom",null)}function m(){u.on("zoom",null)}async function v(k,j,H){const _=Sn(k),$=u==null?void 0:u.constrain()(_,j,H);return $&&await y($),new Promise(C=>C($))}async function x(k,j){const H=Sn(k);return await y(H,j),new Promise(_=>_(H))}function w(k){if(d){const j=Sn(k),H=d.property("__zoom");(H.k!==k.zoom||H.x!==k.x||H.y!==k.y)&&(u==null||u.transform(d,j,null,{sync:!0}))}}function E(){const k=d?fi(d.node()):{x:0,y:0,k:1};return{x:k.x,y:k.y,zoom:k.k}}function N(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).scaleTo(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function S(k,j){return d?new Promise(H=>{u==null||u.interpolate((j==null?void 0:j.interpolate)==="linear"?de:Ye).scaleBy(Mn(d,j==null?void 0:j.duration,j==null?void 0:j.ease,()=>H(!0)),k)}):Promise.resolve(!1)}function I(k){u==null||u.scaleExtent(k)}function T(k){u==null||u.translateExtent(k)}function D(k){const j=!gt(k)||k<0?0:k;u==null||u.clickDistance(j)}return{update:p,destroy:m,setViewport:x,setViewportConstrained:v,getViewport:E,scaleTo:N,scaleBy:S,setScaleExtent:I,setTranslateExtent:T,syncViewport:w,setClickDistance:D}}var ee;(function(t){t.Line="line",t.Handle="handle"})(ee||(ee={}));function sd({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:o,affectsY:i}){const s=t-e,a=n-r,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&o&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function Qr(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),o=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:o}}function kt(t,e){return Math.max(0,e-t)}function It(t,e){return Math.max(0,t-e)}function He(t,e,n){return Math.max(0,e-t,t-n)}function Jr(t,e){return t?!e:e}function ad(t,e,n,r,o,i,s,a){let{affectsX:l,affectsY:c}=e;const{isHorizontal:f,isVertical:u}=e,d=f&&u,{xSnapped:h,ySnapped:g}=n,{minWidth:y,maxWidth:p,minHeight:m,maxHeight:v}=r,{x,y:w,width:E,height:N,aspectRatio:S}=t;let I=Math.floor(f?h-t.pointerX:0),T=Math.floor(u?g-t.pointerY:0);const D=E+(l?-I:I),k=N+(c?-T:T),j=-i[0]*E,H=-i[1]*N;let _=He(D,y,p),$=He(k,m,v);if(s){let A=0,M=0;l&&I<0?A=kt(x+I+j,s[0][0]):!l&&I>0&&(A=It(x+D+j,s[1][0])),c&&T<0?M=kt(w+T+H,s[0][1]):!c&&T>0&&(M=It(w+k+H,s[1][1])),_=Math.max(_,A),$=Math.max($,M)}if(a){let A=0,M=0;l&&I>0?A=It(x+I,a[0][0]):!l&&I<0&&(A=kt(x+D,a[1][0])),c&&T>0?M=It(w+T,a[0][1]):!c&&T<0&&(M=kt(w+k,a[1][1])),_=Math.max(_,A),$=Math.max($,M)}if(o){if(f){const A=He(D/S,m,v)*S;if(_=Math.max(_,A),s){let M=0;!l&&!c||l&&!c&&d?M=It(w+H+D/S,s[1][1])*S:M=kt(w+H+(l?I:-I)/S,s[0][1])*S,_=Math.max(_,M)}if(a){let M=0;!l&&!c||l&&!c&&d?M=kt(w+D/S,a[1][1])*S:M=It(w+(l?I:-I)/S,a[0][1])*S,_=Math.max(_,M)}}if(u){const A=He(k*S,y,p)/S;if($=Math.max($,A),s){let M=0;!l&&!c||c&&!l&&d?M=It(x+k*S+j,s[1][0])/S:M=kt(x+(c?T:-T)*S+j,s[0][0])/S,$=Math.max($,M)}if(a){let M=0;!l&&!c||c&&!l&&d?M=kt(x+k*S,a[1][0])/S:M=It(x+(c?T:-T)*S,a[0][0])/S,$=Math.max($,M)}}}T=T+(T<0?$:-$),I=I+(I<0?_:-_),o&&(d?D>k*S?T=(Jr(l,c)?-I:I)/S:I=(Jr(l,c)?-T:T)*S:f?(T=I/S,c=l):(I=T*S,l=c));const C=l?x+I:x,z=c?w+T:w;return{width:E+(l?-I:I),height:N+(c?-T:T),x:i[0]*I*(l?-1:1)+C,y:i[1]*T*(c?-1:1)+z}}const Bi={width:0,height:0,x:0,y:0},cd={...Bi,pointerX:0,pointerY:0,aspectRatio:1};function ld(t){return[[0,0],[t.measured.width,t.measured.height]]}function ud(t,e,n){const r=e.position.x+t.position.x,o=e.position.y+t.position.y,i=t.measured.width??0,s=t.measured.height??0,a=n[0]*i,l=n[1]*s;return[[r-a,o-l],[r+i-a,o+s-l]]}function fd({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:o}){const i=ut(t);let s={controlDirection:Qr("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:f,keepAspectRatio:u,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:y,shouldResize:p}){let m={...Bi},v={...cd};s={boundaries:f,resizeDirection:d,keepAspectRatio:u,controlDirection:Qr(c)};let x,w=null,E=[],N,S,I,T=!1;const D=Qo().on("start",k=>{const{nodeLookup:j,transform:H,snapGrid:_,snapToGrid:$,nodeOrigin:C,paneDomNode:z}=n();if(x=j.get(e),!x)return;w=(z==null?void 0:z.getBoundingClientRect())??null;const{xSnapped:A,ySnapped:M}=he(k.sourceEvent,{transform:H,snapGrid:_,snapToGrid:$,containerBounds:w});m={width:x.measured.width??0,height:x.measured.height??0,x:x.position.x??0,y:x.position.y??0},v={...m,pointerX:A,pointerY:M,aspectRatio:m.width/m.height},N=void 0,x.parentId&&(x.extent==="parent"||x.expandParent)&&(N=j.get(x.parentId),S=N&&x.extent==="parent"?ld(N):void 0),E=[],I=void 0;for(const[L,V]of j)if(V.parentId===e&&(E.push({id:L,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=ud(V,x,V.origin??C);I?I=[[Math.min(R[0][0],I[0][0]),Math.min(R[0][1],I[0][1])],[Math.max(R[1][0],I[1][0]),Math.max(R[1][1],I[1][1])]]:I=R}h==null||h(k,{...m})}).on("drag",k=>{const{transform:j,snapGrid:H,snapToGrid:_,nodeOrigin:$}=n(),C=he(k.sourceEvent,{transform:j,snapGrid:H,snapToGrid:_,containerBounds:w}),z=[];if(!x)return;const{x:A,y:M,width:L,height:V}=m,R={},X=x.origin??$,{width:Y,height:W,x:q,y:F}=ad(v,s.controlDirection,C,s.boundaries,s.keepAspectRatio,X,S,I),B=Y!==L,O=W!==V,Z=q!==A&&B,Q=F!==M&&O;if(!Z&&!Q&&!B&&!O)return;if((Z||Q||X[0]===1||X[1]===1)&&(R.x=Z?q:m.x,R.y=Q?F:m.y,m.x=R.x,m.y=R.y,E.length>0)){const nt=q-A,tt=F-M;for(const st of E)st.position={x:st.position.x-nt+X[0]*(Y-L),y:st.position.y-tt+X[1]*(W-V)},z.push(st)}if((B||O)&&(R.width=B&&(!s.resizeDirection||s.resizeDirection==="horizontal")?Y:m.width,R.height=O&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),N&&x.expandParent){const nt=X[0]*(R.width??0);R.x&&R.x<nt&&(m.x=nt,v.x=v.x-(R.x-nt));const tt=X[1]*(R.height??0);R.y&&R.y<tt&&(m.y=tt,v.y=v.y-(R.y-tt))}const K=sd({width:m.width,prevWidth:L,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),U={...m,direction:K};(p==null?void 0:p(k,U))!==!1&&(T=!0,g==null||g(k,U),r(R,z))}).on("end",k=>{T&&(y==null||y(k,{...m}),o==null||o({...m}),T=!1)});i.call(D)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var Cn={exports:{}},kn={},In={exports:{}},An={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as s,j as e}from"./index-
|
|
1
|
+
import{u as s,j as e}from"./index-nX2chMqi.js";function o(){const t=s();return e.jsxs("div",{className:"flex flex-col items-center justify-center h-full gap-4 text-center",children:[e.jsx("p",{className:"text-6xl font-bold text-gray-800",children:"404"}),e.jsx("p",{className:"text-gray-400",children:"Page not found"}),e.jsx("button",{onClick:()=>t("/"),className:"px-4 py-2 bg-blue-600 rounded text-sm hover:bg-blue-700 transition-colors",children:"Go home"})]})}export{o as default};
|