videobook 0.2.2 → 0.2.4
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/CHANGELOG.md +59 -0
- package/README.md +10 -10
- package/dist/book-manager.js +40 -2
- package/dist/command-reference.js +16 -2
- package/dist/env-secrets.js +7 -4
- package/dist/image-edit-models.js +1 -0
- package/dist/jobs/complete-provider-task.js +7 -1
- package/dist/jobs/generate-media.js +4 -0
- package/dist/jobs/render-project.js +124 -31
- package/dist/media/adapters/index.js +4 -0
- package/dist/media/adapters/machgen.js +48 -0
- package/dist/media/adapters/types.js +1 -0
- package/dist/media/catalog.js +83 -0
- package/dist/media/complete.js +1 -1
- package/dist/media/cost.js +79 -6
- package/dist/media/frontier-gaps.js +49 -0
- package/dist/media/frontier.js +30 -0
- package/dist/media/json-schema.js +7 -0
- package/dist/media/listing.js +9 -2
- package/dist/media/machgen.js +261 -0
- package/dist/media/model-id.js +1 -1
- package/dist/media/preview.js +2 -0
- package/dist/media/prompt-dialects.js +2 -0
- package/dist/media/ref-fields.js +11 -3
- package/dist/media/request.js +49 -0
- package/dist/media/seedance-draft.js +48 -0
- package/dist/media/wire.js +3 -0
- package/dist/notebook-action-catalog.js +5 -0
- package/dist/one-password.js +13 -7
- package/dist/provider-status-link.js +1 -1
- package/dist/provider-task-status.js +6 -3
- package/dist/provider-usage.js +24 -10
- package/dist/queue.js +3 -0
- package/dist/tools/commands.js +1 -1
- package/dist/tools/estimate-cost.js +7 -5
- package/dist/tools/provider-key-status.js +4 -0
- package/dist/tools/reconcile-project-work.js +69 -1
- package/dist/usage-providers.js +4 -0
- package/dist/workspace-action-catalog.js +1 -1
- package/package.json +14 -13
- package/ui/assets/{alive-captions-C48o6dfv.js → alive-captions-Bp6dxosy.js} +1 -1
- package/ui/assets/confirm-bodies-Ds1HtaGc.js +1 -0
- package/ui/assets/{fullscreen-4m0qtZ7w.js → fullscreen-BCeVHjvY.js} +1 -1
- package/ui/assets/{goal-ui-2pUWP_B2.js → goal-ui-DbAGwgMN.js} +2 -2
- package/ui/assets/index-D1d-F1y9.js +37 -0
- package/ui/assets/index-DWfR79lA.css +1 -0
- package/ui/assets/{inspector-CnKySYc5.js → inspector-BJTC0luH.js} +1 -1
- package/ui/assets/{jobs-ui-lRoS1MbL.js → jobs-ui-C1cbw-xG.js} +1 -1
- package/ui/assets/{music-video-BQnnPp-X.js → music-video-CWtxPlxq.js} +1 -1
- package/ui/assets/ui-CXDi5Omq.js +2 -0
- package/ui/assets/vendor-BFupLz37.js +19 -0
- package/ui/assets/{vendor-flow-zBavaNEW.js → vendor-flow-CKiuzaeM.js} +1 -1
- package/ui/assets/{vendor-mcp-DQ7EusT9.js → vendor-mcp-DQEeVZH0.js} +1 -1
- package/ui/assets/videobook-J-j9bSjM.js +20 -0
- package/ui/index.html +12 -12
- package/ui/assets/confirm-bodies-aq6Az8Md.js +0 -1
- package/ui/assets/index-DmDH4gYr.js +0 -37
- package/ui/assets/index-DzPAnCUj.css +0 -1
- package/ui/assets/ui-OHFUngrc.js +0 -2
- package/ui/assets/vendor-yctIZ9Dz.js +0 -19
- package/ui/assets/videobook-DZ58pKW5.js +0 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as Er,g as ga,R as pa,a as P,j as k,b as ma}from"./vendor-react-Dj7D1fD4.js";import{c as ie}from"./vendor-yctIZ9Dz.js";var ya={value:()=>{}};function Kt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Tt(n)}function Tt(e){this._=e}function xa(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Tt.prototype=Kt.prototype={constructor:Tt,on:function(e,t){var n=this._,o=xa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=wa(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=go(n[r],e.name,t);else if(t==null)for(r in n)n[r]=go(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Tt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function wa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function go(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ya,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const po={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),po.hasOwnProperty(t)?{space:po[t],local:e}:e}function va(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sr(e){var t=Qt(e);return(t.local?ba:va)(t)}function _a(){}function On(e){return e==null?_a:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=On(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Sa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Na(){return[]}function Nr(e){return e==null?Na:function(){return this.querySelectorAll(e)}}function Ca(e){return function(){return Sa(e.apply(this,arguments))}}function Ma(e){typeof e=="function"?e=Ca(e):e=Nr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function Cr(e){return function(){return this.matches(e)}}function Mr(e){return function(t){return t.matches(e)}}var Ia=Array.prototype.find;function ka(e){return function(){return Ia.call(this.children,e)}}function Aa(){return this.firstElementChild}function $a(e){return this.select(e==null?Aa:ka(typeof e=="function"?e:Mr(e)))}var Pa=Array.prototype.filter;function Da(){return Array.from(this.children)}function Ta(e){return function(){return Pa.call(this.children,e)}}function za(e){return this.selectAll(e==null?Da:Ta(typeof e=="function"?e:Mr(e)))}function Ha(e){typeof e!="function"&&(e=Cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Ir(e){return new Array(e.length)}function Ra(){return new le(this._enter||this._groups.map(Ir),this._parents)}function Vt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vt.prototype={constructor:Vt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function La(e){return function(){return e}}function Va(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Vt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Oa(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Vt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(f[a])===c&&(r[a]=c)}function Ba(e){return e.__data__}function Fa(e,t){if(!arguments.length)return Array.from(this,Ba);var n=t?Oa:Va,o=this._parents,r=this._groups;typeof e!="function"&&(e=La(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],d=r[l],f=d.length,h=ja(e.call(u,u&&u.__data__,l,o)),g=h.length,v=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(f);n(u,d,v,x,m,h,t);for(var _=0,p=0,w,N;_<g;++_)if(w=v[_]){for(_>=p&&(p=_+1);!(N=x[p])&&++p<g;);w._next=N||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xa(){return new le(this._exit||this._groups.map(Ir),this._parents)}function Ya(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Za(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],d=l.length,f=a[c]=new Array(d),h,g=0;g<d;++g)(h=l[g]||u[g])&&(f[g]=h);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Wa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function qa(e){e||(e=Ga);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Ga(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ua(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ka(){return Array.from(this)}function Qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Ja(){let e=0;for(const t of this)++e;return e}function ec(){return!this.node()}function tc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function nc(e){return function(){this.removeAttribute(e)}}function oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cc(e,t){var n=Qt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?oc:nc:typeof t=="function"?n.local?ac:sc:n.local?ic:rc)(n,t))}function kr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lc(e){return function(){this.style.removeProperty(e)}}function uc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?lc:typeof t=="function"?dc:uc)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||kr(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function Ar(e){return e.trim().split(/^|\s+/)}function Bn(e){return e.classList||new $r(e)}function $r(e){this._node=e,this._names=Ar(e.getAttribute("class")||"")}$r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Pr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Dr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function yc(e){return function(){Pr(this,e)}}function xc(e){return function(){Dr(this,e)}}function wc(e,t){return function(){(t.apply(this,arguments)?Pr:Dr)(this,e)}}function vc(e,t){var n=Ar(e+"");if(arguments.length<2){for(var o=Bn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?wc:t?yc:xc)(n,t))}function bc(){this.textContent=""}function _c(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Ec:_c)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Cc(e){return function(){this.innerHTML=e}}function Mc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ic(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Mc:Cc)(e)):this.node().innerHTML}function kc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(kc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pc(){return this.each($c)}function Dc(e){var t=typeof e=="function"?e:Sr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Tc(){return null}function zc(e,t){var n=typeof e=="function"?e:Sr(e),o=t==null?Tc:typeof t=="function"?t:On(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Hc(){var e=this.parentNode;e&&e.removeChild(this)}function Rc(){return this.each(Hc)}function Lc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(e){return this.select(e?Vc:Lc)}function Bc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function jc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Xc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Yc(e,t,n){return function(){var o=this.__on,r,i=Fc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Zc(e,t,n){var o=jc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Yc:Xc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Tr(e,t,n){var o=kr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Wc(e,t){return function(){return Tr(this,e,t)}}function qc(e,t){return function(){return Tr(this,e,t.apply(this,arguments))}}function Gc(e,t){return this.each((typeof t=="function"?qc:Wc)(e,t))}function*Uc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var zr=[null];function le(e,t){this._groups=e,this._parents=t}function wt(){return new le([[document.documentElement]],zr)}function Kc(){return this}le.prototype=wt.prototype={constructor:le,select:Ea,selectAll:Ma,selectChild:$a,selectChildren:za,filter:Ha,data:Fa,enter:Ra,exit:Xa,join:Ya,merge:Za,selection:Kc,order:Wa,sort:qa,call:Ua,nodes:Ka,node:Qa,size:Ja,empty:ec,each:tc,attr:cc,style:fc,property:mc,classed:vc,text:Sc,html:Ic,raise:Ac,lower:Pc,append:Dc,insert:zc,remove:Rc,clone:Oc,datum:Bc,on:Zc,dispatch:Gc,[Symbol.iterator]:Uc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],zr)}function Qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Qc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Jc={passive:!1},ut={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Hr(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ge,ut);"onselectstart"in t?n.on("selectstart.drag",Ge,ut):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Rr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,ut),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Nt=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function el(e){return!e.ctrlKey&&!e.button}function tl(){return this.parentNode}function nl(e,t){return t??{x:e.x,y:e.y}}function ol(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lr(){var e=el,t=tl,n=nl,o=ol,r={},i=Kt("start","drag","end"),s=0,a,c,l,u,d=0;function f(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Jc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(u||!e.call(this,w,N))){var b=p(this,t.call(this,w,N),w,N,"mouse");b&&(ce(w.view).on("mousemove.drag",g,ut).on("mouseup.drag",v,ut),Hr(w.view),hn(w),l=!1,a=w.clientX,c=w.clientY,b("start",w))}}function g(w){if(Ge(w),!l){var N=w.clientX-a,b=w.clientY-c;l=N*N+b*b>d}r.mouse("drag",w)}function v(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Rr(w.view,l),Ge(w),r.mouse("end",w)}function x(w,N){if(e.call(this,w,N)){var b=w.changedTouches,C=t.call(this,w,N),I=b.length,A,B;for(A=0;A<I;++A)(B=p(this,C,w,N,b[A].identifier,b[A]))&&(hn(w),B("start",w,b[A]))}}function m(w){var N=w.changedTouches,b=N.length,C,I;for(C=0;C<b;++C)(I=r[N[C].identifier])&&(Ge(w),I("drag",w,N[C]))}function _(w){var N=w.changedTouches,b=N.length,C,I;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<b;++C)(I=r[N[C].identifier])&&(hn(w),I("end",w,N[C]))}function p(w,N,b,C,I,A){var B=i.copy(),T=de(A||b,N),L,z,y;if((y=n.call(w,new Mn("beforestart",{sourceEvent:b,target:f,identifier:I,active:s,x:T[0],y:T[1],dx:0,dy:0,dispatch:B}),C))!=null)return L=y.x-T[0]||0,z=y.y-T[1]||0,function E(S,M,D){var $=T,O;switch(S){case"start":r[I]=E,O=s++;break;case"end":delete r[I],--s;case"drag":T=de(D||M,N),O=s;break}B.call(S,w,new Mn(S,{sourceEvent:M,subject:y,target:f,identifier:I,active:O,x:T[0]+L,y:T[1]+z,dx:T[0]-$[0],dy:T[1]-$[1],dispatch:B}),C)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Nt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Nt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Nt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Nt(!!w),f):o},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}function Fn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Vr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function vt(){}var dt=.7,Ot=1/dt,Ue="\\s*([+-]?\\d+)\\s*",ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ve="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rl=/^#([0-9a-f]{3,8})$/,il=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),sl=new RegExp(`^rgb\\(${ve},${ve},${ve}\\)$`),al=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${ft}\\)$`),cl=new RegExp(`^rgba\\(${ve},${ve},${ve},${ft}\\)$`),ll=new RegExp(`^hsl\\(${ft},${ve},${ve}\\)$`),ul=new RegExp(`^hsla\\(${ft},${ve},${ve},${ft}\\)$`),mo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Fn(vt,Be,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yo,formatHex:yo,formatHex8:dl,formatHsl:fl,formatRgb:xo,toString:xo});function yo(){return this.rgb().formatHex()}function dl(){return this.rgb().formatHex8()}function fl(){return Or(this).formatHsl()}function xo(){return this.rgb().formatRgb()}function Be(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=rl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ct(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ct(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=il.exec(e))?new ae(t[1],t[2],t[3],1):(t=sl.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=al.exec(e))?Ct(t[1],t[2],t[3],t[4]):(t=cl.exec(e))?Ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ll.exec(e))?_o(t[1],t[2]/100,t[3]/100,1):(t=ul.exec(e))?_o(t[1],t[2]/100,t[3]/100,t[4]):mo.hasOwnProperty(e)?wo(mo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function wo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ct(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function hl(e){return e instanceof vt||(e=Be(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function In(e,t,n,o){return arguments.length===1?hl(e):new ae(e,t,n,o??1)}function ae(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Fn(ae,In,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),Bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:vo,formatHex:vo,formatHex8:gl,formatRgb:bo,toString:bo}));function vo(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function gl(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity)?1:this.opacity)*255)}`}function bo(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Le(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function _o(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function Or(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof vt||(e=Be(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,c=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function pl(e,t,n,o){return arguments.length===1?Or(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Fn(fe,pl,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ae(gn(e>=240?e-240:e+120,r,o),gn(e,r,o),gn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(Eo(this.h),Mt(this.s),Mt(this.l),Bt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${Eo(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Eo(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jn=e=>()=>e;function ml(e,t){return function(n){return e+n*t}}function yl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function xl(e){return(e=+e)==1?Br:function(t,n){return n-t?yl(t,n,e):jn(isNaN(t)?n:t)}}function Br(e,t){var n=t-e;return n?ml(e,n):jn(isNaN(e)?t:e)}const Ft=(function e(t){var n=xl(t);function o(r,i){var s=n((r=In(r)).r,(i=In(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Br(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=c(u),r.opacity=l(u),r+""}}return o.gamma=e,o})(1);function wl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function vl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=ct(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function _l(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function El(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=ct(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(kn.source,"g");function Sl(e){return function(){return e}}function Nl(e){return function(t){return e(t)+""}}function Fr(e,t){var n=kn.lastIndex=pn.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=kn.exec(e))&&(r=pn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:we(o,r)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Nl(c[0].x):Sl(t):(t=c.length,function(l){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(l);return a.join("")})}function ct(e,t){var n=typeof t,o;return t==null||n==="boolean"?jn(t):(n==="number"?we:n==="string"?(o=Be(t))?(t=o,Ft):Fr:t instanceof Be?Ft:t instanceof Date?_l:vl(t)?wl:Array.isArray(t)?bl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?El:we)(e,t)}var So=180/Math.PI,An={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*So,skewX:Math.atan(c)*So,scaleX:s,scaleY:a}}var It;function Cl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?An:jr(t.a,t.b,t.c,t.d,t.e,t.f)}function Ml(e){return e==null||(It||(It=document.createElementNS("http://www.w3.org/2000/svg","g")),It.setAttribute("transform",e),!(e=It.transform.baseVal.consolidate()))?An:(e=e.matrix,jr(e.a,e.b,e.c,e.d,e.e,e.f))}function Xr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:we(l,d)},{i:v-2,x:we(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(l,u,d,f){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:we(l,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(l,u,d,f){l!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:we(l,u)}):u&&d.push(r(d)+"skewX("+u+o)}function c(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:we(l,d)},{i:v-2,x:we(u,f)})}else(d!==1||f!==1)&&h.push(r(h)+"scale("+d+","+f+")")}return function(l,u){var d=[],f=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,d,f),s(l.rotate,u.rotate,d,f),a(l.skewX,u.skewX,d,f),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,d,f),l=u=null,function(h){for(var g=-1,v=f.length,x;++g<v;)d[(x=f[g]).i]=x.x(h);return d.join("")}}}var Il=Xr(Cl,"px, ","px)","deg)"),kl=Xr(Ml,", ",")",")"),Al=1e-12;function No(e){return((e=Math.exp(e))+1/e)/2}function $l(e){return((e=Math.exp(e))-1/e)/2}function Pl(e){return((e=Math.exp(2*e))-1)/(e+1)}const zt=(function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],d=s[1],f=s[2],h=u-a,g=d-c,v=h*h+g*g,x,m;if(v<Al)m=Math.log(f/l)/t,x=function(C){return[a+C*h,c+C*g,l*Math.exp(t*C*m)]};else{var _=Math.sqrt(v),p=(f*f-l*l+o*v)/(2*l*n*_),w=(f*f-l*l-o*v)/(2*f*n*_),N=Math.log(Math.sqrt(p*p+1)-p),b=Math.log(Math.sqrt(w*w+1)-w);m=(b-N)/t,x=function(C){var I=C*m,A=No(N),B=l/(n*_)*(A*Pl(t*I+N)-$l(N));return[a+B*h,c+B*g,l*A/No(t*I+N)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r})(Math.SQRT2,2,4);var Qe=0,st=0,rt=0,Yr=1e3,jt,at,Xt=0,Fe=0,Jt=0,ht=typeof performance=="object"&&performance.now?performance:Date,Zr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Fe||(Zr(Dl),Fe=ht.now()+Jt)}function Dl(){Fe=0}function Yt(){this._call=this._time=this._next=null}Yt.prototype=Wr.prototype={constructor:Yt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&at!==this&&(at?at._next=this:jt=this,at=this),this._call=e,this._time=n,$n()},stop:function(){this._call&&(this._call=null,this._time=1/0,$n())}};function Wr(e,t,n){var o=new Yt;return o.restart(e,t,n),o}function Tl(){Xn(),++Qe;for(var e=jt,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Co(){Fe=(Xt=ht.now())+Jt,Qe=st=0;try{Tl()}finally{Qe=0,Hl(),Fe=0}}function zl(){var e=ht.now(),t=e-Xt;t>Yr&&(Jt-=t,Xt=e)}function Hl(){for(var e,t=jt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:jt=n);at=e,$n(o)}function $n(e){if(!Qe){st&&(st=clearTimeout(st));var t=e-Fe;t>24?(e<1/0&&(st=setTimeout(Co,e-ht.now()-Jt)),rt&&(rt=clearInterval(rt))):(rt||(Xt=ht.now(),rt=setInterval(zl,Yr)),Qe=1,Zr(Co))}}function Mo(e,t,n){var o=new Yt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Rl=Kt("start","end","cancel","interrupt"),Ll=[],qr=0,Io=1,Pn=2,Ht=3,ko=4,Dn=5,Rt=6;function en(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Vl(e,n,{name:t,index:o,group:r,on:Rl,tween:Ll,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:qr})}function Yn(e,t){var n=me(e,t);if(n.state>qr)throw new Error("too late; already scheduled");return n}function be(e,t){var n=me(e,t);if(n.state>Ht)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Vl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Wr(i,0,n.time);function i(l){n.state=Io,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Io)return c();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Ht)return Mo(s);h.state===ko?(h.state=Rt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Rt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Mo(function(){n.state===Ht&&(n.state=ko,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pn){for(n.state=Ht,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Dn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Dn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Rt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Lt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Pn&&o.state<Dn,o.state=Rt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ol(e){return this.each(function(){Lt(this,e)})}function Bl(e,t){var n,o;return function(){var r=be(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Fl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=be(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function jl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Bl:Fl)(n,e,t))}function Zn(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Gr(e,t){var n;return(typeof t=="number"?we:t instanceof Be?Ft:(n=Be(t))?(t=n,Ft):Fr)(e,t)}function Xl(e){return function(){this.removeAttribute(e)}}function Yl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Wl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function ql(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Gl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ul(e,t){var n=Qt(e),o=n==="transform"?kl:Gr;return this.attrTween(e,typeof t=="function"?(n.local?Gl:ql)(n,o,Zn(this,"attr."+e,t)):t==null?(n.local?Yl:Xl)(n):(n.local?Wl:Zl)(n,o,t))}function Kl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ql(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ql(e,i)),n}return r._value=t,r}function eu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kl(e,i)),n}return r._value=t,r}function tu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Qt(e);return this.tween(n,(o.local?Jl:eu)(o,t))}function nu(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){Yn(this,e).delay=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):me(this.node(),t).delay}function iu(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function su(e,t){return t=+t,function(){be(this,e).duration=t}}function au(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iu:su)(t,e)):me(this.node(),t).duration}function cu(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function lu(e){var t=this._id;return arguments.length?this.each(cu(t,e)):me(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function du(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function fu(e){typeof e!="function"&&(e=Cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ke(o,this._parents,this._name,this._id)}function hu(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,d=s[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||l[h])&&(d[h]=f);for(;a<o;++a)s[a]=t[a];return new ke(s,this._parents,this._name,this._id)}function gu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function pu(e,t,n){var o,r,i=gu(t)?Yn:be;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mu(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(pu(n,e,t))}function yu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xu(){return this.on("end.remove",yu(this._id))}function wu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=On(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,d,f=0;f<c;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,en(l[f],t,n,f,l,me(u,n)));return new ke(i,this._parents,t,n)}function vu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),h,g=me(u,n),v=0,x=f.length;v<x;++v)(h=f[v])&&en(h,t,n,v,f,g);i.push(f),s.push(u)}return new ke(i,s,t,n)}var bu=wt.prototype.constructor;function _u(){return new bu(this._groups,this._parents)}function Eu(e,t){var n,o,r;return function(){var i=Ke(this,e),s=(this.style.removeProperty(e),Ke(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Ur(e){return function(){this.style.removeProperty(e)}}function Su(e,t,n){var o,r=n+"",i;return function(){var s=Ke(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nu(e,t,n){var o,r,i;return function(){var s=Ke(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ke(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Cu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=be(this,e),l=c.on,u=c.value[i]==null?a||(a=Ur(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function Mu(e,t,n){var o=(e+="")=="transform"?Il:Gr;return t==null?this.styleTween(e,Eu(e,o)).on("end.style."+e,Ur(e)):typeof t=="function"?this.styleTween(e,Nu(e,o,Zn(this,"style."+e,t))).each(Cu(this._id,e)):this.styleTween(e,Su(e,o,t),n).on("end.style."+e,null)}function Iu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ku(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Iu(e,s,n)),o}return i._value=t,i}function Au(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,ku(e,t,n??""))}function $u(e){return function(){this.textContent=e}}function Pu(e){return function(){var t=e(this);this.textContent=t??""}}function Du(e){return this.tween("text",typeof e=="function"?Pu(Zn(this,"text",e)):$u(e==null?"":e+""))}function Tu(e){return function(t){this.textContent=e.call(this,t)}}function zu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Tu(r)),t}return o._value=e,o}function Hu(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zu(e))}function Ru(){for(var e=this._name,t=this._id,n=Kr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=me(c,t);en(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ke(o,this._parents,e,n)}function Lu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=be(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Vu=0;function ke(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Kr(){return++Vu}var Me=wt.prototype;ke.prototype={constructor:ke,select:wu,selectAll:vu,selectChild:Me.selectChild,selectChildren:Me.selectChildren,filter:fu,merge:hu,selection:_u,transition:Ru,call:Me.call,nodes:Me.nodes,node:Me.node,size:Me.size,empty:Me.empty,each:Me.each,on:mu,attr:Ul,attrTween:tu,style:Mu,styleTween:Au,text:Du,textTween:Hu,remove:xu,tween:jl,delay:ru,duration:au,ease:lu,easeVarying:du,end:Lu,[Symbol.iterator]:Me[Symbol.iterator]};function Ou(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bu={time:null,delay:0,duration:250,ease:Ou};function Fu(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ju(e){var t,n;e instanceof ke?(t=e._id,e=e._name):(t=Kr(),(n=Bu).time=Xn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&en(c,e,t,l,s,n||Fu(c,t));return new ke(o,this._parents,e,t)}wt.prototype.interrupt=Ol;wt.prototype.transition=ju;const kt=e=>()=>e;function Xu(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var tn=new Ie(1,0,0);Qr.prototype=Ie.prototype;function Qr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tn;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function it(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ao(){return this.__zoom||tn}function Wu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Jr(){var e=Yu,t=Zu,n=Gu,o=Wu,r=qu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=zt,l=Kt("start","zoom","end"),u,d,f,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Ao).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",T).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,E,S,M){var D=y.selection?y.selection():y;D.property("__zoom",Ao),y!==D?N(y,E,S,M):D.interrupt().each(function(){b(this,arguments).event(M).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(y,E,S,M){m.scaleTo(y,function(){var D=this.__zoom.k,$=typeof E=="function"?E.apply(this,arguments):E;return D*$},S,M)},m.scaleTo=function(y,E,S,M){m.transform(y,function(){var D=t.apply(this,arguments),$=this.__zoom,O=S==null?w(D):typeof S=="function"?S.apply(this,arguments):S,V=$.invert(O),R=typeof E=="function"?E.apply(this,arguments):E;return n(p(_($,R),O,V),D,s)},S,M)},m.translateBy=function(y,E,S,M){m.transform(y,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,M)},m.translateTo=function(y,E,S,M,D){m.transform(y,function(){var $=t.apply(this,arguments),O=this.__zoom,V=M==null?w($):typeof M=="function"?M.apply(this,arguments):M;return n(tn.translate(V[0],V[1]).scale(O.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),$,s)},M,D)};function _(y,E){return E=Math.max(i[0],Math.min(i[1],E)),E===y.k?y:new Ie(E,y.x,y.y)}function p(y,E,S){var M=E[0]-S[0]*y.k,D=E[1]-S[1]*y.k;return M===y.x&&D===y.y?y:new Ie(y.k,M,D)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,E,S,M){y.on("start.zoom",function(){b(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,$=arguments,O=b(D,$).event(M),V=t.apply(D,$),R=S==null?w(V):typeof S=="function"?S.apply(D,$):S,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),j=D.__zoom,W=typeof E=="function"?E.apply(D,$):E,Q=c(j.invert(R).concat(X/j.k),W.invert(R).concat(X/W.k));return function(q){if(q===1)q=W;else{var H=Q(q),F=X/H[2];q=new Ie(F,R[0]-H[0]*F,R[1]-H[1]*F)}O.zoom(null,q)}})}function b(y,E,S){return!S&&y.__zooming||new C(y,E)}function C(y,E){this.that=y,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,E),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,E){return this.mouse&&y!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var E=ce(this.that).datum();l.call(y,this.that,new Xu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),E)}};function I(y,...E){if(!e.apply(this,arguments))return;var S=b(this,E).event(y),M=this.__zoom,D=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,o.apply(this,arguments)))),$=de(y);if(S.wheel)(S.mouse[0][0]!==$[0]||S.mouse[0][1]!==$[1])&&(S.mouse[1]=M.invert(S.mouse[0]=$)),clearTimeout(S.wheel);else{if(M.k===D)return;S.mouse=[$,M.invert($)],Lt(this),S.start()}it(y),S.wheel=setTimeout(O,g),S.zoom("mouse",n(p(_(M,D),S.mouse[0],S.mouse[1]),S.extent,s));function O(){S.wheel=null,S.end()}}function A(y,...E){if(f||!e.apply(this,arguments))return;var S=y.currentTarget,M=b(this,E,!0).event(y),D=ce(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),$=de(y,S),O=y.clientX,V=y.clientY;Hr(y.view),mn(y),M.mouse=[$,this.__zoom.invert($)],Lt(this),M.start();function R(j){if(it(j),!M.moved){var W=j.clientX-O,Q=j.clientY-V;M.moved=W*W+Q*Q>v}M.event(j).zoom("mouse",n(p(M.that.__zoom,M.mouse[0]=de(j,S),M.mouse[1]),M.extent,s))}function X(j){D.on("mousemove.zoom mouseup.zoom",null),Rr(j.view,M.moved),it(j),M.event(j).end()}}function B(y,...E){if(e.apply(this,arguments)){var S=this.__zoom,M=de(y.changedTouches?y.changedTouches[0]:y,this),D=S.invert(M),$=S.k*(y.shiftKey?.5:2),O=n(p(_(S,$),M,D),t.apply(this,E),s);it(y),a>0?ce(this).transition().duration(a).call(N,O,M,y):ce(this).call(m.transform,O,M,y)}}function T(y,...E){if(e.apply(this,arguments)){var S=y.touches,M=S.length,D=b(this,E,y.changedTouches.length===M).event(y),$,O,V,R;for(mn(y),O=0;O<M;++O)V=S[O],R=de(V,this),R=[R,this.__zoom.invert(R),V.identifier],D.touch0?!D.touch1&&D.touch0[2]!==R[2]&&(D.touch1=R,D.taps=0):(D.touch0=R,$=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(D.taps<2&&(d=R[0],u=setTimeout(function(){u=null},h)),Lt(this),D.start())}}function L(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,D=M.length,$,O,V,R;for(it(y),$=0;$<D;++$)O=M[$],V=de(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=V:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=V);if(O=S.that.__zoom,S.touch1){var X=S.touch0[0],j=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],q=(q=W[0]-X[0])*q+(q=W[1]-X[1])*q,H=(H=Q[0]-j[0])*H+(H=Q[1]-j[1])*H;O=_(O,Math.sqrt(q/H)),V=[(X[0]+W[0])/2,(X[1]+W[1])/2],R=[(j[0]+Q[0])/2,(j[1]+Q[1])/2]}else if(S.touch0)V=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(p(O,V,R),S.extent,s))}}function z(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,D=M.length,$,O;for(mn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),$=0;$<D;++$)O=M[$],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<x)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:kt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:kt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:kt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:kt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const pe={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ei=["Enter"," ","Escape"],ti={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Oe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oe||(Oe={}));var pt;(function(e){e.Partial="partial",e.Full="full"})(pt||(pt={}));const ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const $o={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function oi(e){return e===null?null:e?"valid":"invalid"}const ri=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Uu=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ku=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Wn(r)?r:t.nodeLookup.get(r.id));const a=s?Wt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return nn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return on(n)},_t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=nn(n,Wt(r)),o=!0)}),o?on(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,d=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=f;if(s&&!g||v)continue;const x=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:_,y:p}=f.internals.positionAbsolute,w=ci(a,c,l,u,_,p,x,m),N=x*m,b=i&&w>0;(!f.internals.handleBounds||b||w>=N||f.dragging)&&d.push(f)}return d},Qu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ju(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=_e(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function ed({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=Ju(e,s),c=_t(a),l=Un(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function ii({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(d=[[c,l],[c+h,l+g]])}else a&&Xe(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Xe(d)?je(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:f.x-c+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function td({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(v=>v.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=o.filter(f=>f.deletable!==!1),u=Qu(s,c);for(const f of c)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),je=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function si(e,t,n){const{width:o,height:r}=_e(n),{x:i,y:s}=n.internals.positionAbsolute;return je(e,[[i,s],[i+o,s+r]],t)}const Po=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Gn=(e,t,n=15,o=40)=>{const r=Po(e.x,o,t.width-o)*n,i=Po(e.y,o,t.height-o)*n;return[r,i]},nn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Tn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),on=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),mt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Wt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},ai=(e,t)=>on(nn(Tn(e),Tn(t))),ci=(e,t,n,o,r,i,s,a)=>{const c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},qt=(e,t)=>ci(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Do=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),li=(e,t)=>(n,o)=>{},Et=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),St=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Et(a,s):a},tt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ze(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ze(e,n),r=Ze(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ze(e.top??e.y??0,n),r=Ze(e.bottom??e.y??0,n),i=Ze(e.left??e.x??0,t),s=Ze(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function od(e,t,n,o,r,i){const{x:s,y:a}=tt(e,[t,n,o]),{x:c,y:l}=tt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,d=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const Un=(e,t,n,o,r,i)=>{const s=nd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=et(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u,v=od(e,h,g,u,t,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:u}},yt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Xe(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ui(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function di(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function To(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function id(e){return{...ti,...e||{}}}function lt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),a=St({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?Et(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),fi=e=>e?.getRootNode?.()||window?.document,sd=["INPUT","SELECT","TEXTAREA"];function hi(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const gi=e=>"clientX"in e,ge=(e,t)=>{const n=gi(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},zo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Kn(s)}})};function pi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),d=Math.abs(l-t);return[c,l,u,d]}function At(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ho({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Z.Left:return[t-At(t-o,i),n];case Z.Right:return[t+At(o-t,i),n];case Z.Top:return[t,n-At(n-r,i)];case Z.Bottom:return[t,n+At(r-n,i)]}}function mi({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,curvature:s=.25}){const[a,c]=Ho({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=Ho({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,g]=pi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,d,f,h,g]}function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ad({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=nn(Wt(e),Wt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return qt(s,on(i))>0}const ld=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,ud=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),dd=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",pe.error006()),t;const o=n.getEdgeId||ld;let r;return ri(e)?r={...e}:r={...e,id:o(e)},ud(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function xi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=yi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ro={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},fd=({source:e,sourcePosition:t=Z.Bottom,target:n})=>t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hd({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:r,offset:i,stepPosition:s}){const a=Ro[t],c=Ro[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},d=fd({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],v,x;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=r.x??l.x+(u.x-l.x)*s,x=r.y??(l.y+u.y)/2):(v=r.x??(l.x+u.x)/2,x=r.y??l.y+(u.y-l.y)*s);const I=[{x:v,y:l.y},{x:v,y:u.y}],A=[{x:l.x,y:x},{x:u.x,y:x}];a[f]===h?g=f==="x"?I:A:g=f==="x"?A:I}else{const I=[{x:l.x,y:u.y}],A=[{x:u.x,y:l.y}];if(f==="x"?g=a.x===h?A:I:g=a.y===h?I:A,t===o){const y=Math.abs(e[f]-n[f]);if(y<=i){const E=Math.min(i-1,i-y);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*E:_[f]=(u[f]>n[f]?-1:1)*E}}if(t!==o){const y=f==="x"?"y":"x",E=a[f]===c[y],S=l[y]>u[y],M=l[y]<u[y];(a[f]===1&&(!E&&S||E&&M)||a[f]!==1&&(!E&&M||E&&S))&&(g=f==="x"?I:A)}const B={x:l.x+m.x,y:l.y+m.y},T={x:u.x+_.x,y:u.y+_.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(T.x-g[0].x)),z=Math.max(Math.abs(B.y-g[0].y),Math.abs(T.y-g[0].y));L>=z?(v=(B.x+T.x)/2,x=g[0].y):(v=g[0].x,x=(B.y+T.y)/2)}const N={x:l.x+m.x,y:l.y+m.y},b={x:u.x+_.x,y:u.y+_.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],v,x,p,w]}function gd(e,t,n,o){const r=Math.min(Lo(e,t)/2,Lo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function zn({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[d,f,h,g,v]=hd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});let x=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)x+=gd(d[m-1],d[m],d[m+1],s);return x+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[x,f,h,g,v]}function Vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pd(e){const{sourceNode:t,targetNode:n}=e;if(!Vo(t)||!Vo(n))return null;const o=t.internals.handleBounds||Oo(t.handles),r=n.internals.handleBounds||Oo(n.handles),i=Bo(o?.source??[],e.sourceHandle),s=Bo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Z.Bottom,c=s?.position||Z.Top,l=Ye(t,i,a),u=Ye(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Oo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Ye(e,t,n=Z.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??_e(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Z.Top:return{x:r+s/2,y:i};case Z.Right:return{x:r+s,y:i+a/2};case Z.Bottom:return{x:r+s/2,y:i+a};case Z.Left:return{x:r,y:i+a/2}}}function Bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Hn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function md(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=Hn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const wi=1e3,yd=10,Qn={nodeOrigin:[0,0],nodeExtent:gt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xd={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function wd(e,t,n){const o=Jn(Qn,n);for(const r of e.values())if(r.parentId)to(r,e,t,o);else{const i=bt(r,o.nodeOrigin),s=Xe(r.extent)?r.extent:o.nodeExtent,a=je(i,s,_e(r));r.internals.positionAbsolute=a}}function vd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function eo(e){return e==="manual"}function Rn(e,t,n,o={}){const r=Jn(xd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!eo(r.zIndexMode)?wi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===d?.internals.userNode)t.set(u.id,d);else{const f=bt(u,r.nodeOrigin),h=Xe(u.extent)?u.extent:r.nodeExtent,g=je(f,h,_e(u));d={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:vd(u,d),z:vi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&to(d,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function bd(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function to(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Jn(Qn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*yd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!eo(c)?wi:0,{x:f,y:h,z:g}=_d(e,u,s,a,d,c),{positionAbsolute:v}=e.internals,x=f!==v.x||h!==v.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:h}:v,z:g}})}function vi(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return eo(n)?o:o+(e.selected?t:0)}function _d(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,c=_e(e),l=bt(e,n),u=Xe(e.extent)?je(l,e.extent,c):l;let d=je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(d=si(d,c,t));const f=vi(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function no(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const c=i.get(s.parentId)?.expandedRect??mt(a),l=ai(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,u=_e(a),d=a.origin??o,f=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),x=(g-u.width)*d[0],m=(v-u.height)*d[1];(f>0||h>0||x||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-f+x,y:a.position.y-h+m}}),n.get(c)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+h}})})),(u.width<s.width||u.height<s.height||f||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-x:0),height:v+(h?d[1]*h-m:0)}})}),r}function Ed(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=Kn(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Xe(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const b=t.get(g.parentId);b&&(w=si(w,v,b))}else p&&(w=je(w,p,v));const N={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:zo("source",h.nodeElement,_,d,g.id),target:zo("target",h.nodeElement,_,d,g.id)}}};t.set(g.id,N),g.parentId&&to(N,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:mt(N,r)}))}}if(f.length>0){const h=no(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function Sd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Fo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function bi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Fo("source",c,u,e,r,s),Fo("target",c,l,e,i,a),t.set(o.id,o)}}function _i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_i(n,t):!1}function jo(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Nd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!_i(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.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 r}function yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Cd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Et(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Md({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,g=!1,v=null;function x({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:N,nodeId:b,nodeClickDistance:C=0}){f=ce(w);function I({x:L,y:z}){const{nodeLookup:y,nodeExtent:E,snapGrid:S,snapToGrid:M,nodeOrigin:D,onNodeDrag:$,onSelectionDrag:O,onError:V,updateNodePositions:R}=t();i={x:L,y:z};let X=!1;const j=a.size>1,W=j&&E?Tn(_t(a)):null,Q=j&&M?Cd({dragItems:a,snapGrid:S,x:L,y:z}):null;for(const[q,H]of a){if(!y.has(q))continue;let F={x:L-H.distance.x,y:z-H.distance.y};M&&(F=Q?{x:Math.round(F.x+Q.x),y:Math.round(F.y+Q.y)}:Et(F,S));let K=null;if(j&&E&&!H.extent&&W){const{positionAbsolute:G}=H.internals,J=G.x-W.x+E[0][0],te=G.x+H.measured.width-W.x2+E[1][0],oe=G.y-W.y+E[0][1],se=G.y+H.measured.height-W.y2+E[1][1];K=[[J,oe],[te,se]]}const{position:U,positionAbsolute:Y}=ii({nodeId:q,nextPosition:F,nodeLookup:y,nodeExtent:K||E,nodeOrigin:D,onError:V});X=X||H.position.x!==U.x||H.position.y!==U.y,H.position=U,H.internals.positionAbsolute=Y}if(g=g||X,!!X&&(R(a,!0),v&&(o||$||!b&&O))){const[q,H]=yn({nodeId:b,dragItems:a,nodeLookup:y});o?.(v,a,q,H),$?.(v,q,H),b||O?.(v,H)}}async function A(){if(!u)return;const{transform:L,panBy:z,autoPanSpeed:y,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(s);return}const[S,M]=Gn(l,u,y);(S!==0||M!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-M/L[2],await z({x:S,y:M})&&I(i)),s=requestAnimationFrame(A)}function B(L){const{nodeLookup:z,multiSelectionActive:y,nodesDraggable:E,transform:S,snapGrid:M,snapToGrid:D,selectNodesOnDrag:$,onNodeDragStart:O,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();d=!0,(!$||!N)&&!y&&b&&(z.get(b)?.selected||R()),N&&$&&b&&e?.(b);const X=lt(L.sourceEvent,{transform:S,snapGrid:M,snapToGrid:D,containerBounds:u});if(i=X,a=Nd(z,E,X,b),a.size>0&&(n||O||!b&&V)){const[j,W]=yn({nodeId:b,dragItems:a,nodeLookup:z});n?.(L.sourceEvent,a,j,W),O?.(L.sourceEvent,j,W),b||V?.(L.sourceEvent,W)}}const T=Lr().clickDistance(C).on("start",L=>{const{domNode:z,nodeDragThreshold:y,transform:E,snapGrid:S,snapToGrid:M}=t();u=z?.getBoundingClientRect()||null,h=!1,g=!1,v=L.sourceEvent,y===0&&B(L),i=lt(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:M,containerBounds:u}),l=ge(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:z,transform:y,snapGrid:E,snapToGrid:S,nodeDragThreshold:M,nodeLookup:D}=t(),$=lt(L.sourceEvent,{transform:y,snapGrid:E,snapToGrid:S,containerBounds:u});if(v=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||b&&!D.has(b))&&(h=!0),!h){if(!c&&z&&d&&(c=!0,A()),!d){const O=ge(L.sourceEvent,u),V=O.x-l.x,R=O.y-l.y;Math.sqrt(V*V+R*R)>M&&B(L)}(i.x!==$.xSnapped||i.y!==$.ySnapped)&&a&&d&&(l=ge(L.sourceEvent,u),I($))}}).on("end",L=>{if(!d||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,d=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:z,updateNodePositions:y,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(y(a,!1),g=!1),r||E||!b&&S){const[M,D]=yn({nodeId:b,dragItems:a,nodeLookup:z,dragging:!1});r?.(L.sourceEvent,a,M,D),E?.(L.sourceEvent,M,D),b||S?.(L.sourceEvent,D)}}}).filter(L=>{const z=L.target;return!L.button&&(!_||!jo(z,`.${_}`,w))&&(!p||jo(z,p,w))});f.call(T)}function m(){f?.on(".drag",null)}return{update:x,destroy:m}}function Id(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())qt(r,mt(i))>0&&o.push(i);return o}const kd=250;function Ad(e,t,n,o){let r=[],i=1/0;const s=Id(e,n,t+kd);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=Ye(a,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...l,x:u,y:d}],i=f):f===i&&r.push({...l,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ei(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Ye(s,c,c.position,!0)}:c}function Si(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function $d(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ni=()=>!0;function Pd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=Ni,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:N,autoPanSpeed:b,dragThreshold:C=1,handleDomNode:I}){const A=fi(e.target);let B=0,T;const{x:L,y:z}=ge(e),y=Si(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!y)return;const M=Ei(r,y,o,c,t);if(!M)return;let D=ge(e,E),$=!1,O=null,V=!1,R=null;function X(){if(!u||!E)return;const[U,Y]=Gn(D,E,b);f({x:U,y:Y}),B=requestAnimationFrame(X)}const j={...M,nodeId:r,type:y,position:M.position},W=c.get(r);let q={inProgress:!0,isValid:null,from:Ye(W,j,Z.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:W,to:D,toHandle:null,toPosition:$o[j.position],toNode:null,pointer:D};function H(){S=!0,p(q),g?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&H();function F(U){if(!S){const{x:se,y:Ee}=ge(U),ye=se-L,xe=Ee-z;if(!(ye*ye+xe*xe>C*C))return;H()}if(!N()||!j){K(U);return}const Y=w();D=ge(U,E),T=Ad(St(D,Y,!1,[1,1]),n,c,j),$||(X(),$=!0);const G=Ci(U,{handle:T,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:l,flowId:d,nodeLookup:c});R=G.handleDomNode,O=G.connection,V=$d(!!T,G.isValid);const J=c.get(r),te=J?Ye(J,j,Z.Left,!0):q.from,oe={...q,from:te,isValid:V,to:G.toHandle&&V?tt({x:G.toHandle.x,y:G.toHandle.y},Y):D,toHandle:G.toHandle,toPosition:V&&G.toHandle?G.toHandle.position:$o[j.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:D};p(oe),q=oe}function K(U){if(!("touches"in U&&U.touches.length>0)){if(S){(T||R)&&O&&V&&v?.(O);const{inProgress:Y,...G}=q,J={...G,toPosition:q.toHandle?q.toPosition:null};x?.(U,J),i&&_?.(U,J)}h(),cancelAnimationFrame(B),$=!1,V=!1,O=null,R=null,A.removeEventListener("mousemove",F),A.removeEventListener("mouseup",K),A.removeEventListener("touchmove",F),A.removeEventListener("touchend",K)}}A.addEventListener("mousemove",F),A.addEventListener("mouseup",K),A.addEventListener("touchmove",F),A.addEventListener("touchend",K)}function Ci(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Ni,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=ge(e),v=s.elementFromPoint(h,g),x=v?.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Si(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!p||!_)return m;const C={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};m.connection=C;const A=N&&b&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);m.isValid=A&&l(C),m.toHandle=Ei(p,_,w,u,n,!0)}return m}const Ln={onPointerDown:Pd,isValid:Ci};function Dd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=p.sourceEvent.ctrlKey&&yt()?10:1,b=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,C=w[2]*Math.pow(2,b*N);t.scaleTo(C)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],b=[N[0]-v[0],N[1]-v[1]];v=N;const C=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-b[0]*C,y:w[1]-b[1]*C},A=[[0,0],[c,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},A,a)},_=Jr().on("start",x).on("zoom",d?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const rn=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>tn.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Mi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Td=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=Td,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ii=e=>{const t=e.ctrlKey&&yt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(We(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const x=de(u),m=Ii(u),_=d*Math.pow(2,m);o.scaleTo(n,_,x,u);return}const f=u.deltaMode===1?20:1;let h=r===Oe.Vertical?0:u.deltaX*f,g=r===Oe.Horizontal?0:u.deltaY*f;!yt()&&u.shiftKey&&r!==Oe.Vertical&&(h=u.deltaY*f,g=0),o.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const v=rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,v):(e.isPanScrolling=!0,a?.(u,v)),e.panScrollTimeout=setTimeout(()=>{l?.(u,v),e.isPanScrolling=!1},150)}}function Hd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=We(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Rd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=rn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Ld({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Mi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,rn(i.transform))}}function Vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Mi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=rn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Od({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(We(d,`${l}-flow__node`)||We(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!g||We(d,a)&&g||We(d,c)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const v=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&v}}function Bd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(z=>{const y=z[0];y&&(d=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);const h=Jr().extent(()=>d).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);w({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Ii);async function m(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).transform(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}function _({noWheelClassName:z,noPanClassName:y,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:M,panOnDrag:D,panOnScrollMode:$,panOnScrollSpeed:O,preventScrolling:V,zoomOnPinch:R,zoomOnScroll:X,zoomOnDoubleClick:j,zoomActivationKeyPressed:W,lib:Q,onTransformChange:q,connectionInProgress:H,paneClickDistance:F,selectionOnDrag:K}){S&&!l.isZoomingOrPanning&&p();const U=M&&!W&&!S;h.clickDistance(K?1/0:!he(F)||F<0?0:F);const Y=U?zd({zoomPanValues:l,noWheelClassName:z,d3Selection:g,d3Zoom:h,panOnScrollMode:$,panOnScrollSpeed:O,zoomOnPinch:R,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Hd({noWheelClassName:z,preventScrolling:V,d3ZoomHandler:v});g.on("wheel.zoom",Y,{passive:!1});const G=Rd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",G);const J=Ld({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:q});h.on("zoom",J);const te=Vd({zoomPanValues:l,panOnDrag:D,panOnScroll:M,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:c});h.on("end",te);const oe=Od({zoomActivationKeyPressed:W,panOnDrag:D,zoomOnScroll:X,panOnScroll:M,zoomOnDoubleClick:j,zoomOnPinch:R,userSelectionActive:S,noPanClassName:y,noWheelClassName:z,lib:Q,connectionInProgress:H});h.filter(oe),j?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(z,y,E){const S=xn(z),M=h?.constrain()(S,y,E);return M&&await m(M),M}async function N(z,y){const E=xn(z);return await m(E,y),E}function b(z){if(g){const y=xn(z),E=g.property("__zoom");(E.k!==z.zoom||E.x!==z.x||E.y!==z.y)&&h?.transform(g,y,null,{sync:!0})}}function C(){const z=g?Qr(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function I(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleTo(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}async function A(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleBy(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}function B(z){h?.scaleExtent(z)}function T(z){h?.translateExtent(z)}function L(z){const y=!he(z)||z<0?0:z;h?.clickDistance(y)}return{update:_,destroy:p,setViewport:N,setViewportConstrained:w,getViewport:C,scaleTo:I,scaleBy:A,setScaleExtent:B,setTranslateExtent:T,syncViewport:b,setClickDistance:L}}var nt;(function(e){e.Line="line",e.Handle="handle"})(nt||(nt={}));function Fd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Xo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ae(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function $t(e,t,n){return Math.max(0,t-e,e-n)}function Yo(e,t){return e?!t:t}function jd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:N,height:b,aspectRatio:C}=e;let I=Math.floor(u?h-e.pointerX:0),A=Math.floor(d?g-e.pointerY:0);const B=N+(c?-I:I),T=b+(l?-A:A),L=-i[0]*N,z=-i[1]*b;let y=$t(B,v,x),E=$t(T,m,_);if(s){let D=0,$=0;c&&I<0?D=Ae(p+I+L,s[0][0]):!c&&I>0&&(D=$e(p+B+L,s[1][0])),l&&A<0?$=Ae(w+A+z,s[0][1]):!l&&A>0&&($=$e(w+T+z,s[1][1])),y=Math.max(y,D),E=Math.max(E,$)}if(a){let D=0,$=0;c&&I>0?D=$e(p+I,a[0][0]):!c&&I<0&&(D=Ae(p+B,a[1][0])),l&&A>0?$=$e(w+A,a[0][1]):!l&&A<0&&($=Ae(w+T,a[1][1])),y=Math.max(y,D),E=Math.max(E,$)}if(r){if(u){const D=$t(B/C,m,_)*C;if(y=Math.max(y,D),s){let $=0;!c&&!l||c&&!l&&f?$=$e(w+z+B/C,s[1][1])*C:$=Ae(w+z+(c?I:-I)/C,s[0][1])*C,y=Math.max(y,$)}if(a){let $=0;!c&&!l||c&&!l&&f?$=Ae(w+B/C,a[1][1])*C:$=$e(w+(c?I:-I)/C,a[0][1])*C,y=Math.max(y,$)}}if(d){const D=$t(T*C,v,x)/C;if(E=Math.max(E,D),s){let $=0;!c&&!l||l&&!c&&f?$=$e(p+T*C+L,s[1][0])/C:$=Ae(p+(l?A:-A)*C+L,s[0][0])/C,E=Math.max(E,$)}if(a){let $=0;!c&&!l||l&&!c&&f?$=Ae(p+T*C,a[1][0])/C:$=$e(p+(l?A:-A)*C,a[0][0])/C,E=Math.max(E,$)}}}A=A+(A<0?E:-E),I=I+(I<0?y:-y),r&&(f?B>T*C?A=(Yo(c,l)?-I:I)/C:I=(Yo(c,l)?-A:A)*C:u?(A=I/C,l=c):(I=A*C,c=l));const S=c?p+I:p,M=l?w+A:w;return{width:N+(c?-I:I),height:b+(l?-A:A),x:i[0]*I*(c?-1:1)+S,y:i[1]*A*(l?-1:1)+M}}const ki={width:0,height:0,x:0,y:0},Xd={...ki,pointerX:0,pointerY:0,aspectRatio:1};function Yd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Zd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:Xo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...ki},_={...Xd};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:Xo(l)};let p,w=null,N=[],b,C,I,A=!1;const B=Lr().on("start",T=>{const{nodeLookup:L,transform:z,snapGrid:y,snapToGrid:E,nodeOrigin:S,paneDomNode:M}=n();if(p=L.get(t),!p)return;w=M?.getBoundingClientRect()??null;const{xSnapped:D,ySnapped:$}=lt(T.sourceEvent,{transform:z,snapGrid:y,snapToGrid:E,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:D,pointerY:$,aspectRatio:m.width/m.height},b=void 0,C=Xe(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(b=L.get(p.parentId)),b&&p.extent==="parent"&&(C=[[0,0],[b.measured.width,b.measured.height]]),N=[],I=void 0;for(const[O,V]of L)if(V.parentId===t&&(N.push({id:O,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Yd(V,p,V.origin??S);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?.(T,{...m})}).on("drag",T=>{const{transform:L,snapGrid:z,snapToGrid:y,nodeOrigin:E}=n(),S=lt(T.sourceEvent,{transform:L,snapGrid:z,snapToGrid:y,containerBounds:w}),M=[];if(!p)return;const{x:D,y:$,width:O,height:V}=m,R={},X=p.origin??E,{width:j,height:W,x:Q,y:q}=jd(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,X,C,I),H=j!==O,F=W!==V,K=Q!==D&&H,U=q!==$&&F;if(!K&&!U&&!H&&!F)return;if((K||U||X[0]===1||X[1]===1)&&(R.x=K?Q:m.x,R.y=U?q:m.y,m.x=R.x,m.y=R.y,N.length>0)){const te=Q-D,oe=q-$;for(const se of N)se.position={x:se.position.x-te+X[0]*(j-O),y:se.position.y-oe+X[1]*(W-V)},M.push(se)}if((H||F)&&(R.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?j:m.width,R.height=F&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),b&&p.expandParent){const te=X[0]*(R.width??0);R.x&&R.x<te&&(m.x=te,_.x=_.x-(R.x-te));const oe=X[1]*(R.height??0);R.y&&R.y<oe&&(m.y=oe,_.y=_.y-(R.y-oe))}const Y=Fd({width:m.width,prevWidth:O,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Y};x?.(T,G)!==!1&&(A=!0,g?.(T,G),o(R,M))}).on("end",T=>{A&&(v?.(T,{...m}),r?.({...m}),A=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var vn={exports:{}},bn={},_n={exports:{}},En={};var Zo;function Wd(){if(Zo)return En;Zo=1;var e=Er();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,f){var h=f(),g=o({inst:{value:h,getSnapshot:f}}),v=g[0].inst,x=g[1];return i(function(){v.value=h,v.getSnapshot=f,c(v)&&x({inst:v})},[d,h,f]),r(function(){return c(v)&&x({inst:v}),d(function(){c(v)&&x({inst:v})})},[d]),s(h),h}function c(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function l(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return En.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,En}var Wo;function qd(){return Wo||(Wo=1,_n.exports=Wd()),_n.exports}var qo;function Gd(){if(qo)return bn;qo=1;var e=Er(),t=qd();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return bn.useSyncExternalStoreWithSelector=function(l,u,d,f,h){var g=i(null);if(g.current===null){var v={hasValue:!1,value:null};g.current=v}else v=g.current;g=a(function(){function m(b){if(!_){if(_=!0,p=b,b=f(b),h!==void 0&&v.hasValue){var C=v.value;if(h(C,b))return w=C}return w=b}if(C=w,o(p,b))return C;var I=f(b);return h!==void 0&&h(C,I)?(p=b,C):(p=b,w=I)}var _=!1,p,w,N=d===void 0?null:d;return[function(){return m(u())},N===null?void 0:function(){return m(N())}]},[u,d,f,h]);var x=r(l,g[0],g[1]);return s(function(){v.hasValue=!0,v.value=x},[x]),c(x),x},bn}var Go;function Ud(){return Go||(Go=1,vn.exports=Gd()),vn.exports}var Kd=Ud();const Qd=ga(Kd),Jd={},Uo=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Jd?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},ef=e=>e?Uo(e):Uo,{useDebugValue:tf}=pa,{useSyncExternalStoreWithSelector:nf}=Qd,of=e=>e;function Ai(e,t=of,n){const o=nf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return tf(o),o}const Ko=(e,t)=>{const n=ef(e),o=(r,i=t)=>Ai(n,r,i);return Object.assign(o,n),o},rf=(e,t)=>e?Ko(e,t):Ko;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const sn=P.createContext(null),sf=sn.Provider,$i=pe.error001("react");function ee(e,t){const n=P.useContext(sn);if(n===null)throw new Error($i);return Ai(n,e,t)}function ne(){const e=P.useContext(sn);if(e===null)throw new Error($i);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Qo={display:"none"},af={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Pi="react-flow__node-desc",Di="react-flow__edge-desc",cf="react-flow__aria-live",lf=e=>e.ariaLiveMessage,uf=e=>e.ariaLabelConfig;function df({rfId:e}){const t=ee(lf);return k.jsx("div",{id:`${cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:af,children:t})}function ff({rfId:e,disableKeyboardA11y:t}){const n=ee(uf);return k.jsxs(k.Fragment,{children:[k.jsx("div",{id:`${Pi}-${e}`,style:Qo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),k.jsx("div",{id:`${Di}-${e}`,style:Qo,children:n["edge.a11yDescription.default"]}),!t&&k.jsx(df,{rfId:e})]})}const an=P.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return k.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});an.displayName="Panel";const Jo="https://reactflow.dev?utm_source=attribution";function hf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:k.jsx(an,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Jo}`,children:k.jsx("a",{href:Jo,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const gf=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Pt=e=>e.id;function pf(e,t){return re(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&re(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function mf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(gf,pf);return P.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const yf=e=>!!e.onSelectionChangeHandlers;function xf({onSelectionChange:e}){const t=ee(yf);return e||t?k.jsx(mf,{onSelectionChange:e}):null}const Ti=[0,0],wf={x:0,y:0,zoom:1},vf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],er=[...vf,"rfId"],bf=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),tr={translateExtent:gt,nodeOrigin:Ti,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _f(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=ee(bf,re),l=ne();P.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=tr,a()}),[]);const u=P.useRef(tr);return P.useEffect(()=>{for(const d of er){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:id(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},er.map(d=>e[d])),null}function nr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ef(e){const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const o=nr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:nr()?.matches?"dark":"light"}const or=typeof document<"u"?document:null;function xt(e=null,t={target:or,actInsideInputWithModifier:!0}){const[n,o]=P.useState(!1),r=P.useRef(!1),i=P.useRef(new Set([])),[s,a]=P.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
1
|
+
import{r as Er,g as ga,R as pa,a as P,j as k,b as ma}from"./vendor-react-Dj7D1fD4.js";import{c as ie}from"./vendor-BFupLz37.js";var ya={value:()=>{}};function Kt(){for(var e=0,t=arguments.length,n={},o;e<t;++e){if(!(o=arguments[e]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Tt(n)}function Tt(e){this._=e}function xa(e,t){return e.trim().split(/^|\s+/).map(function(n){var o="",r=n.indexOf(".");if(r>=0&&(o=n.slice(r+1),n=n.slice(0,r)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Tt.prototype=Kt.prototype={constructor:Tt,on:function(e,t){var n=this._,o=xa(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=wa(n[r],e.name)))return r;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<s;)if(r=(e=o[i]).type)n[r]=go(n[r],e.name,t);else if(t==null)for(r in n)n[r]=go(n[r],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Tt(e)},call:function(e,t){if((r=arguments.length-2)>0)for(var n=new Array(r),o=0,r,i;o<r;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],o=0,r=i.length;o<r;++o)i[o].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],r=0,i=o.length;r<i;++r)o[r].value.apply(t,n)}};function wa(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function go(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ya,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Cn="http://www.w3.org/1999/xhtml";const po={svg:"http://www.w3.org/2000/svg",xhtml:Cn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Qt(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),po.hasOwnProperty(t)?{space:po[t],local:e}:e}function va(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Cn&&t.documentElement.namespaceURI===Cn?t.createElement(e):t.createElementNS(n,e)}}function ba(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Sr(e){var t=Qt(e);return(t.local?ba:va)(t)}function _a(){}function On(e){return e==null?_a:function(){return this.querySelector(e)}}function Ea(e){typeof e!="function"&&(e=On(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=new Array(s),c,l,u=0;u<s;++u)(c=i[u])&&(l=e.call(c,c.__data__,u,i))&&("__data__"in c&&(l.__data__=c.__data__),a[u]=l);return new le(o,this._parents)}function Sa(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Na(){return[]}function Nr(e){return e==null?Na:function(){return this.querySelectorAll(e)}}function Ca(e){return function(){return Sa(e.apply(this,arguments))}}function Ma(e){typeof e=="function"?e=Ca(e):e=Nr(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&(o.push(e.call(c,c.__data__,l,s)),r.push(c));return new le(o,r)}function Cr(e){return function(){return this.matches(e)}}function Mr(e){return function(t){return t.matches(e)}}var Ia=Array.prototype.find;function ka(e){return function(){return Ia.call(this.children,e)}}function Aa(){return this.firstElementChild}function $a(e){return this.select(e==null?Aa:ka(typeof e=="function"?e:Mr(e)))}var Pa=Array.prototype.filter;function Da(){return Array.from(this.children)}function Ta(e){return function(){return Pa.call(this.children,e)}}function za(e){return this.selectAll(e==null?Da:Ta(typeof e=="function"?e:Mr(e)))}function Ha(e){typeof e!="function"&&(e=Cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new le(o,this._parents)}function Ir(e){return new Array(e.length)}function Ra(){return new le(this._enter||this._groups.map(Ir),this._parents)}function Vt(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Vt.prototype={constructor:Vt,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function La(e){return function(){return e}}function Va(e,t,n,o,r,i){for(var s=0,a,c=t.length,l=i.length;s<l;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new Vt(e,i[s]);for(;s<c;++s)(a=t[s])&&(r[s]=a)}function Oa(e,t,n,o,r,i,s){var a,c,l=new Map,u=t.length,d=i.length,f=new Array(u),h;for(a=0;a<u;++a)(c=t[a])&&(f[a]=h=s.call(c,c.__data__,a,t)+"",l.has(h)?r[a]=c:l.set(h,c));for(a=0;a<d;++a)h=s.call(e,i[a],a,i)+"",(c=l.get(h))?(o[a]=c,c.__data__=i[a],l.delete(h)):n[a]=new Vt(e,i[a]);for(a=0;a<u;++a)(c=t[a])&&l.get(f[a])===c&&(r[a]=c)}function Ba(e){return e.__data__}function Fa(e,t){if(!arguments.length)return Array.from(this,Ba);var n=t?Oa:Va,o=this._parents,r=this._groups;typeof e!="function"&&(e=La(e));for(var i=r.length,s=new Array(i),a=new Array(i),c=new Array(i),l=0;l<i;++l){var u=o[l],d=r[l],f=d.length,h=ja(e.call(u,u&&u.__data__,l,o)),g=h.length,v=a[l]=new Array(g),x=s[l]=new Array(g),m=c[l]=new Array(f);n(u,d,v,x,m,h,t);for(var _=0,p=0,w,N;_<g;++_)if(w=v[_]){for(_>=p&&(p=_+1);!(N=x[p])&&++p<g;);w._next=N||null}}return s=new le(s,o),s._enter=a,s._exit=c,s}function ja(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Xa(){return new le(this._exit||this._groups.map(Ir),this._parents)}function Ya(e,t,n){var o=this.enter(),r=this,i=this.exit();return typeof e=="function"?(o=e(o),o&&(o=o.selection())):o=o.append(e+""),t!=null&&(r=t(r),r&&(r=r.selection())),n==null?i.remove():n(i),o&&r?o.merge(r).order():r}function Za(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,r=n.length,i=o.length,s=Math.min(r,i),a=new Array(r),c=0;c<s;++c)for(var l=n[c],u=o[c],d=l.length,f=a[c]=new Array(d),h,g=0;g<d;++g)(h=l[g]||u[g])&&(f[g]=h);for(;c<r;++c)a[c]=n[c];return new le(a,this._parents)}function Wa(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o=e[t],r=o.length-1,i=o[r],s;--r>=0;)(s=o[r])&&(i&&s.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(s,i),i=s);return this}function qa(e){e||(e=Ga);function t(d,f){return d&&f?e(d.__data__,f.__data__):!d-!f}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],a=s.length,c=r[i]=new Array(a),l,u=0;u<a;++u)(l=s[u])&&(c[u]=l);c.sort(t)}return new le(r,this._parents).order()}function Ga(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Ua(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Ka(){return Array.from(this)}function Qa(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length;r<i;++r){var s=o[r];if(s)return s}return null}function Ja(){let e=0;for(const t of this)++e;return e}function ec(){return!this.node()}function tc(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,a;i<s;++i)(a=r[i])&&e.call(a,a.__data__,i,r);return this}function nc(e){return function(){this.removeAttribute(e)}}function oc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function rc(e,t){return function(){this.setAttribute(e,t)}}function ic(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function sc(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function ac(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function cc(e,t){var n=Qt(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((t==null?n.local?oc:nc:typeof t=="function"?n.local?ac:sc:n.local?ic:rc)(n,t))}function kr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function lc(e){return function(){this.style.removeProperty(e)}}function uc(e,t,n){return function(){this.style.setProperty(e,t,n)}}function dc(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function fc(e,t,n){return arguments.length>1?this.each((t==null?lc:typeof t=="function"?dc:uc)(e,t,n??"")):Ke(this.node(),e)}function Ke(e,t){return e.style.getPropertyValue(t)||kr(e).getComputedStyle(e,null).getPropertyValue(t)}function hc(e){return function(){delete this[e]}}function gc(e,t){return function(){this[e]=t}}function pc(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function mc(e,t){return arguments.length>1?this.each((t==null?hc:typeof t=="function"?pc:gc)(e,t)):this.node()[e]}function Ar(e){return e.trim().split(/^|\s+/)}function Bn(e){return e.classList||new $r(e)}function $r(e){this._node=e,this._names=Ar(e.getAttribute("class")||"")}$r.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function Pr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Dr(e,t){for(var n=Bn(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function yc(e){return function(){Pr(this,e)}}function xc(e){return function(){Dr(this,e)}}function wc(e,t){return function(){(t.apply(this,arguments)?Pr:Dr)(this,e)}}function vc(e,t){var n=Ar(e+"");if(arguments.length<2){for(var o=Bn(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?wc:t?yc:xc)(n,t))}function bc(){this.textContent=""}function _c(e){return function(){this.textContent=e}}function Ec(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Sc(e){return arguments.length?this.each(e==null?bc:(typeof e=="function"?Ec:_c)(e)):this.node().textContent}function Nc(){this.innerHTML=""}function Cc(e){return function(){this.innerHTML=e}}function Mc(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ic(e){return arguments.length?this.each(e==null?Nc:(typeof e=="function"?Mc:Cc)(e)):this.node().innerHTML}function kc(){this.nextSibling&&this.parentNode.appendChild(this)}function Ac(){return this.each(kc)}function $c(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pc(){return this.each($c)}function Dc(e){var t=typeof e=="function"?e:Sr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Tc(){return null}function zc(e,t){var n=typeof e=="function"?e:Sr(e),o=t==null?Tc:typeof t=="function"?t:On(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Hc(){var e=this.parentNode;e&&e.removeChild(this)}function Rc(){return this.each(Hc)}function Lc(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Vc(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Oc(e){return this.select(e?Vc:Lc)}function Bc(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Fc(e){return function(t){e.call(this,t,this.__data__)}}function jc(e){return e.trim().split(/^|\s+/).map(function(t){var n="",o=t.indexOf(".");return o>=0&&(n=t.slice(o+1),t=t.slice(0,o)),{type:t,name:n}})}function Xc(e){return function(){var t=this.__on;if(t){for(var n=0,o=-1,r=t.length,i;n<r;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++o]=i;++o?t.length=o:delete this.__on}}}function Yc(e,t,n){return function(){var o=this.__on,r,i=Fc(t);if(o){for(var s=0,a=o.length;s<a;++s)if((r=o[s]).type===e.type&&r.name===e.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=i,r.options=n),r.value=t;return}}this.addEventListener(e.type,i,n),r={type:e.type,name:e.name,value:t,listener:i,options:n},o?o.push(r):this.__on=[r]}}function Zc(e,t,n){var o=jc(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var c=0,l=a.length,u;c<l;++c)for(r=0,u=a[c];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Yc:Xc,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Tr(e,t,n){var o=kr(e),r=o.CustomEvent;typeof r=="function"?r=new r(t,n):(r=o.document.createEvent("Event"),n?(r.initEvent(t,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(t,!1,!1)),e.dispatchEvent(r)}function Wc(e,t){return function(){return Tr(this,e,t)}}function qc(e,t){return function(){return Tr(this,e,t.apply(this,arguments))}}function Gc(e,t){return this.each((typeof t=="function"?qc:Wc)(e,t))}function*Uc(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],r=0,i=o.length,s;r<i;++r)(s=o[r])&&(yield s)}var zr=[null];function le(e,t){this._groups=e,this._parents=t}function wt(){return new le([[document.documentElement]],zr)}function Kc(){return this}le.prototype=wt.prototype={constructor:le,select:Ea,selectAll:Ma,selectChild:$a,selectChildren:za,filter:Ha,data:Fa,enter:Ra,exit:Xa,join:Ya,merge:Za,selection:Kc,order:Wa,sort:qa,call:Ua,nodes:Ka,node:Qa,size:Ja,empty:ec,each:tc,attr:cc,style:fc,property:mc,classed:vc,text:Sc,html:Ic,raise:Ac,lower:Pc,append:Dc,insert:zc,remove:Rc,clone:Oc,datum:Bc,on:Zc,dispatch:Gc,[Symbol.iterator]:Uc};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],zr)}function Qc(e){let t;for(;t=e.sourceEvent;)e=t;return e}function de(e,t){if(e=Qc(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=e.clientX,o.y=e.clientY,o=o.matrixTransform(t.getScreenCTM().inverse()),[o.x,o.y]}if(t.getBoundingClientRect){var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]}}return[e.pageX,e.pageY]}const Jc={passive:!1},ut={capture:!0,passive:!1};function hn(e){e.stopImmediatePropagation()}function Ge(e){e.preventDefault(),e.stopImmediatePropagation()}function Hr(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Ge,ut);"onselectstart"in t?n.on("selectstart.drag",Ge,ut):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Rr(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Ge,ut),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Nt=e=>()=>e;function Mn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}Mn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function el(e){return!e.ctrlKey&&!e.button}function tl(){return this.parentNode}function nl(e,t){return t??{x:e.x,y:e.y}}function ol(){return navigator.maxTouchPoints||"ontouchstart"in this}function Lr(){var e=el,t=tl,n=nl,o=ol,r={},i=Kt("start","drag","end"),s=0,a,c,l,u,d=0;function f(w){w.on("mousedown.drag",h).filter(o).on("touchstart.drag",x).on("touchmove.drag",m,Jc).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(w,N){if(!(u||!e.call(this,w,N))){var b=p(this,t.call(this,w,N),w,N,"mouse");b&&(ce(w.view).on("mousemove.drag",g,ut).on("mouseup.drag",v,ut),Hr(w.view),hn(w),l=!1,a=w.clientX,c=w.clientY,b("start",w))}}function g(w){if(Ge(w),!l){var N=w.clientX-a,b=w.clientY-c;l=N*N+b*b>d}r.mouse("drag",w)}function v(w){ce(w.view).on("mousemove.drag mouseup.drag",null),Rr(w.view,l),Ge(w),r.mouse("end",w)}function x(w,N){if(e.call(this,w,N)){var b=w.changedTouches,C=t.call(this,w,N),I=b.length,A,B;for(A=0;A<I;++A)(B=p(this,C,w,N,b[A].identifier,b[A]))&&(hn(w),B("start",w,b[A]))}}function m(w){var N=w.changedTouches,b=N.length,C,I;for(C=0;C<b;++C)(I=r[N[C].identifier])&&(Ge(w),I("drag",w,N[C]))}function _(w){var N=w.changedTouches,b=N.length,C,I;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),C=0;C<b;++C)(I=r[N[C].identifier])&&(hn(w),I("end",w,N[C]))}function p(w,N,b,C,I,A){var B=i.copy(),T=de(A||b,N),L,z,y;if((y=n.call(w,new Mn("beforestart",{sourceEvent:b,target:f,identifier:I,active:s,x:T[0],y:T[1],dx:0,dy:0,dispatch:B}),C))!=null)return L=y.x-T[0]||0,z=y.y-T[1]||0,function E(S,M,D){var $=T,O;switch(S){case"start":r[I]=E,O=s++;break;case"end":delete r[I],--s;case"drag":T=de(D||M,N),O=s;break}B.call(S,w,new Mn(S,{sourceEvent:M,subject:y,target:f,identifier:I,active:O,x:T[0]+L,y:T[1]+z,dx:T[0]-$[0],dy:T[1]-$[1],dispatch:B}),C)}}return f.filter=function(w){return arguments.length?(e=typeof w=="function"?w:Nt(!!w),f):e},f.container=function(w){return arguments.length?(t=typeof w=="function"?w:Nt(w),f):t},f.subject=function(w){return arguments.length?(n=typeof w=="function"?w:Nt(w),f):n},f.touchable=function(w){return arguments.length?(o=typeof w=="function"?w:Nt(!!w),f):o},f.on=function(){var w=i.on.apply(i,arguments);return w===i?f:w},f.clickDistance=function(w){return arguments.length?(d=(w=+w)*w,f):Math.sqrt(d)},f}function Fn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Vr(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function vt(){}var dt=.7,Ot=1/dt,Ue="\\s*([+-]?\\d+)\\s*",ft="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ve="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",rl=/^#([0-9a-f]{3,8})$/,il=new RegExp(`^rgb\\(${Ue},${Ue},${Ue}\\)$`),sl=new RegExp(`^rgb\\(${ve},${ve},${ve}\\)$`),al=new RegExp(`^rgba\\(${Ue},${Ue},${Ue},${ft}\\)$`),cl=new RegExp(`^rgba\\(${ve},${ve},${ve},${ft}\\)$`),ll=new RegExp(`^hsl\\(${ft},${ve},${ve}\\)$`),ul=new RegExp(`^hsla\\(${ft},${ve},${ve},${ft}\\)$`),mo={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Fn(vt,Be,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:yo,formatHex:yo,formatHex8:dl,formatHsl:fl,formatRgb:xo,toString:xo});function yo(){return this.rgb().formatHex()}function dl(){return this.rgb().formatHex8()}function fl(){return Or(this).formatHsl()}function xo(){return this.rgb().formatRgb()}function Be(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=rl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?wo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ct(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ct(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=il.exec(e))?new ae(t[1],t[2],t[3],1):(t=sl.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=al.exec(e))?Ct(t[1],t[2],t[3],t[4]):(t=cl.exec(e))?Ct(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=ll.exec(e))?_o(t[1],t[2]/100,t[3]/100,1):(t=ul.exec(e))?_o(t[1],t[2]/100,t[3]/100,t[4]):mo.hasOwnProperty(e)?wo(mo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function wo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ct(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function hl(e){return e instanceof vt||(e=Be(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function In(e,t,n,o){return arguments.length===1?hl(e):new ae(e,t,n,o??1)}function ae(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}Fn(ae,In,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ae(Ve(this.r),Ve(this.g),Ve(this.b),Bt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:vo,formatHex:vo,formatHex8:gl,formatRgb:bo,toString:bo}));function vo(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}`}function gl(){return`#${Le(this.r)}${Le(this.g)}${Le(this.b)}${Le((isNaN(this.opacity)?1:this.opacity)*255)}`}function bo(){const e=Bt(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function Bt(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Ve(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Le(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function _o(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new fe(e,t,n,o)}function Or(e){if(e instanceof fe)return new fe(e.h,e.s,e.l,e.opacity);if(e instanceof vt||(e=Be(e)),!e)return new fe;if(e instanceof fe)return e;e=e.rgb();var t=e.r/255,n=e.g/255,o=e.b/255,r=Math.min(t,n,o),i=Math.max(t,n,o),s=NaN,a=i-r,c=(i+r)/2;return a?(t===i?s=(n-o)/a+(n<o)*6:n===i?s=(o-t)/a+2:s=(t-n)/a+4,a/=c<.5?i+r:2-i-r,s*=60):a=c>0&&c<1?0:s,new fe(s,a,c,e.opacity)}function pl(e,t,n,o){return arguments.length===1?Or(e):new fe(e,t,n,o??1)}function fe(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}Fn(fe,pl,Vr(vt,{brighter(e){return e=e==null?Ot:Math.pow(Ot,e),new fe(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dt:Math.pow(dt,e),new fe(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,r=2*n-o;return new ae(gn(e>=240?e-240:e+120,r,o),gn(e,r,o),gn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new fe(Eo(this.h),Mt(this.s),Mt(this.l),Bt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=Bt(this.opacity);return`${e===1?"hsl(":"hsla("}${Eo(this.h)}, ${Mt(this.s)*100}%, ${Mt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Eo(e){return e=(e||0)%360,e<0?e+360:e}function Mt(e){return Math.max(0,Math.min(1,e||0))}function gn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const jn=e=>()=>e;function ml(e,t){return function(n){return e+n*t}}function yl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function xl(e){return(e=+e)==1?Br:function(t,n){return n-t?yl(t,n,e):jn(isNaN(t)?n:t)}}function Br(e,t){var n=t-e;return n?ml(e,n):jn(isNaN(e)?t:e)}const Ft=(function e(t){var n=xl(t);function o(r,i){var s=n((r=In(r)).r,(i=In(i)).r),a=n(r.g,i.g),c=n(r.b,i.b),l=Br(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=c(u),r.opacity=l(u),r+""}}return o.gamma=e,o})(1);function wl(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,o=t.slice(),r;return function(i){for(r=0;r<n;++r)o[r]=e[r]*(1-i)+t[r]*i;return o}}function vl(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function bl(e,t){var n=t?t.length:0,o=e?Math.min(n,e.length):0,r=new Array(o),i=new Array(n),s;for(s=0;s<o;++s)r[s]=ct(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(a){for(s=0;s<o;++s)i[s]=r[s](a);return i}}function _l(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function we(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function El(e,t){var n={},o={},r;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(r in t)r in e?n[r]=ct(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var kn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pn=new RegExp(kn.source,"g");function Sl(e){return function(){return e}}function Nl(e){return function(t){return e(t)+""}}function Fr(e,t){var n=kn.lastIndex=pn.lastIndex=0,o,r,i,s=-1,a=[],c=[];for(e=e+"",t=t+"";(o=kn.exec(e))&&(r=pn.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),a[s]?a[s]+=i:a[++s]=i),(o=o[0])===(r=r[0])?a[s]?a[s]+=r:a[++s]=r:(a[++s]=null,c.push({i:s,x:we(o,r)})),n=pn.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?c[0]?Nl(c[0].x):Sl(t):(t=c.length,function(l){for(var u=0,d;u<t;++u)a[(d=c[u]).i]=d.x(l);return a.join("")})}function ct(e,t){var n=typeof t,o;return t==null||n==="boolean"?jn(t):(n==="number"?we:n==="string"?(o=Be(t))?(t=o,Ft):Fr:t instanceof Be?Ft:t instanceof Date?_l:vl(t)?wl:Array.isArray(t)?bl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?El:we)(e,t)}var So=180/Math.PI,An={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function jr(e,t,n,o,r,i){var s,a,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,c/=a),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*So,skewX:Math.atan(c)*So,scaleX:s,scaleY:a}}var It;function Cl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?An:jr(t.a,t.b,t.c,t.d,t.e,t.f)}function Ml(e){return e==null||(It||(It=document.createElementNS("http://www.w3.org/2000/svg","g")),It.setAttribute("transform",e),!(e=It.transform.baseVal.consolidate()))?An:(e=e.matrix,jr(e.a,e.b,e.c,e.d,e.e,e.f))}function Xr(e,t,n,o){function r(l){return l.length?l.pop()+" ":""}function i(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push("translate(",null,t,null,n);g.push({i:v-4,x:we(l,d)},{i:v-2,x:we(u,f)})}else(d||f)&&h.push("translate("+d+t+f+n)}function s(l,u,d,f){l!==u?(l-u>180?u+=360:u-l>180&&(l+=360),f.push({i:d.push(r(d)+"rotate(",null,o)-2,x:we(l,u)})):u&&d.push(r(d)+"rotate("+u+o)}function a(l,u,d,f){l!==u?f.push({i:d.push(r(d)+"skewX(",null,o)-2,x:we(l,u)}):u&&d.push(r(d)+"skewX("+u+o)}function c(l,u,d,f,h,g){if(l!==d||u!==f){var v=h.push(r(h)+"scale(",null,",",null,")");g.push({i:v-4,x:we(l,d)},{i:v-2,x:we(u,f)})}else(d!==1||f!==1)&&h.push(r(h)+"scale("+d+","+f+")")}return function(l,u){var d=[],f=[];return l=e(l),u=e(u),i(l.translateX,l.translateY,u.translateX,u.translateY,d,f),s(l.rotate,u.rotate,d,f),a(l.skewX,u.skewX,d,f),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,d,f),l=u=null,function(h){for(var g=-1,v=f.length,x;++g<v;)d[(x=f[g]).i]=x.x(h);return d.join("")}}}var Il=Xr(Cl,"px, ","px)","deg)"),kl=Xr(Ml,", ",")",")"),Al=1e-12;function No(e){return((e=Math.exp(e))+1/e)/2}function $l(e){return((e=Math.exp(e))-1/e)/2}function Pl(e){return((e=Math.exp(2*e))-1)/(e+1)}const zt=(function e(t,n,o){function r(i,s){var a=i[0],c=i[1],l=i[2],u=s[0],d=s[1],f=s[2],h=u-a,g=d-c,v=h*h+g*g,x,m;if(v<Al)m=Math.log(f/l)/t,x=function(C){return[a+C*h,c+C*g,l*Math.exp(t*C*m)]};else{var _=Math.sqrt(v),p=(f*f-l*l+o*v)/(2*l*n*_),w=(f*f-l*l-o*v)/(2*f*n*_),N=Math.log(Math.sqrt(p*p+1)-p),b=Math.log(Math.sqrt(w*w+1)-w);m=(b-N)/t,x=function(C){var I=C*m,A=No(N),B=l/(n*_)*(A*Pl(t*I+N)-$l(N));return[a+B*h,c+B*g,l*A/No(t*I+N)]}}return x.duration=m*1e3*t/Math.SQRT2,x}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,c=a*a;return e(s,a,c)},r})(Math.SQRT2,2,4);var Qe=0,st=0,rt=0,Yr=1e3,jt,at,Xt=0,Fe=0,Jt=0,ht=typeof performance=="object"&&performance.now?performance:Date,Zr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Xn(){return Fe||(Zr(Dl),Fe=ht.now()+Jt)}function Dl(){Fe=0}function Yt(){this._call=this._time=this._next=null}Yt.prototype=Wr.prototype={constructor:Yt,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?Xn():+n)+(t==null?0:+t),!this._next&&at!==this&&(at?at._next=this:jt=this,at=this),this._call=e,this._time=n,$n()},stop:function(){this._call&&(this._call=null,this._time=1/0,$n())}};function Wr(e,t,n){var o=new Yt;return o.restart(e,t,n),o}function Tl(){Xn(),++Qe;for(var e=jt,t;e;)(t=Fe-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Qe}function Co(){Fe=(Xt=ht.now())+Jt,Qe=st=0;try{Tl()}finally{Qe=0,Hl(),Fe=0}}function zl(){var e=ht.now(),t=e-Xt;t>Yr&&(Jt-=t,Xt=e)}function Hl(){for(var e,t=jt,n,o=1/0;t;)t._call?(o>t._time&&(o=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:jt=n);at=e,$n(o)}function $n(e){if(!Qe){st&&(st=clearTimeout(st));var t=e-Fe;t>24?(e<1/0&&(st=setTimeout(Co,e-ht.now()-Jt)),rt&&(rt=clearInterval(rt))):(rt||(Xt=ht.now(),rt=setInterval(zl,Yr)),Qe=1,Zr(Co))}}function Mo(e,t,n){var o=new Yt;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Rl=Kt("start","end","cancel","interrupt"),Ll=[],qr=0,Io=1,Pn=2,Ht=3,ko=4,Dn=5,Rt=6;function en(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Vl(e,n,{name:t,index:o,group:r,on:Rl,tween:Ll,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:qr})}function Yn(e,t){var n=me(e,t);if(n.state>qr)throw new Error("too late; already scheduled");return n}function be(e,t){var n=me(e,t);if(n.state>Ht)throw new Error("too late; already running");return n}function me(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Vl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Wr(i,0,n.time);function i(l){n.state=Io,n.timer.restart(s,n.delay,n.time),n.delay<=l&&s(l-n.delay)}function s(l){var u,d,f,h;if(n.state!==Io)return c();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Ht)return Mo(s);h.state===ko?(h.state=Rt,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Rt,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(Mo(function(){n.state===Ht&&(n.state=ko,n.timer.restart(a,n.delay,n.time),a(l))}),n.state=Pn,n.on.call("start",e,e.__data__,n.index,n.group),n.state===Pn){for(n.state=Ht,r=new Array(f=n.tween.length),u=0,d=-1;u<f;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++d]=h);r.length=d+1}}function a(l){for(var u=l<n.duration?n.ease.call(null,l/n.duration):(n.timer.restart(c),n.state=Dn,1),d=-1,f=r.length;++d<f;)r[d].call(e,u);n.state===Dn&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=Rt,n.timer.stop(),delete o[t];for(var l in o)return;delete e.__transition}}function Lt(e,t){var n=e.__transition,o,r,i=!0,s;if(n){t=t==null?null:t+"";for(s in n){if((o=n[s]).name!==t){i=!1;continue}r=o.state>Pn&&o.state<Dn,o.state=Rt,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Ol(e){return this.each(function(){Lt(this,e)})}function Bl(e,t){var n,o;return function(){var r=be(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,a=o.length;s<a;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Fl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=be(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},c=0,l=r.length;c<l;++c)if(r[c].name===t){r[c]=a;break}c===l&&r.push(a)}i.tween=r}}function jl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=me(this.node(),n).tween,r=0,i=o.length,s;r<i;++r)if((s=o[r]).name===e)return s.value;return null}return this.each((t==null?Bl:Fl)(n,e,t))}function Zn(e,t,n){var o=e._id;return e.each(function(){var r=be(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return me(r,o).value[t]}}function Gr(e,t){var n;return(typeof t=="number"?we:t instanceof Be?Ft:(n=Be(t))?(t=n,Ft):Fr)(e,t)}function Xl(e){return function(){this.removeAttribute(e)}}function Yl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Zl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttribute(e);return s===r?null:s===o?i:i=t(o=s,n)}}function Wl(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function ql(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Gl(e,t,n){var o,r,i;return function(){var s,a=n(this),c;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=a+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a)))}}function Ul(e,t){var n=Qt(e),o=n==="transform"?kl:Gr;return this.attrTween(e,typeof t=="function"?(n.local?Gl:ql)(n,o,Zn(this,"attr."+e,t)):t==null?(n.local?Yl:Xl)(n):(n.local?Wl:Zl)(n,o,t))}function Kl(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Ql(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Jl(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Ql(e,i)),n}return r._value=t,r}function eu(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Kl(e,i)),n}return r._value=t,r}function tu(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(t==null)return this.tween(n,null);if(typeof t!="function")throw new Error;var o=Qt(e);return this.tween(n,(o.local?Jl:eu)(o,t))}function nu(e,t){return function(){Yn(this,e).delay=+t.apply(this,arguments)}}function ou(e,t){return t=+t,function(){Yn(this,e).delay=t}}function ru(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?nu:ou)(t,e)):me(this.node(),t).delay}function iu(e,t){return function(){be(this,e).duration=+t.apply(this,arguments)}}function su(e,t){return t=+t,function(){be(this,e).duration=t}}function au(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?iu:su)(t,e)):me(this.node(),t).duration}function cu(e,t){if(typeof t!="function")throw new Error;return function(){be(this,e).ease=t}}function lu(e){var t=this._id;return arguments.length?this.each(cu(t,e)):me(this.node(),t).ease}function uu(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;be(this,e).ease=n}}function du(e){if(typeof e!="function")throw new Error;return this.each(uu(this._id,e))}function fu(e){typeof e!="function"&&(e=Cr(e));for(var t=this._groups,n=t.length,o=new Array(n),r=0;r<n;++r)for(var i=t[r],s=i.length,a=o[r]=[],c,l=0;l<s;++l)(c=i[l])&&e.call(c,c.__data__,l,i)&&a.push(c);return new ke(o,this._parents,this._name,this._id)}function hu(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,r=n.length,i=Math.min(o,r),s=new Array(o),a=0;a<i;++a)for(var c=t[a],l=n[a],u=c.length,d=s[a]=new Array(u),f,h=0;h<u;++h)(f=c[h]||l[h])&&(d[h]=f);for(;a<o;++a)s[a]=t[a];return new ke(s,this._parents,this._name,this._id)}function gu(e){return(e+"").trim().split(/^|\s+/).every(function(t){var n=t.indexOf(".");return n>=0&&(t=t.slice(0,n)),!t||t==="start"})}function pu(e,t,n){var o,r,i=gu(t)?Yn:be;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function mu(e,t){var n=this._id;return arguments.length<2?me(this.node(),n).on.on(e):this.each(pu(n,e,t))}function yu(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xu(){return this.on("end.remove",yu(this._id))}function wu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=On(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],c=a.length,l=i[s]=new Array(c),u,d,f=0;f<c;++f)(u=a[f])&&(d=e.call(u,u.__data__,f,a))&&("__data__"in u&&(d.__data__=u.__data__),l[f]=d,en(l[f],t,n,f,l,me(u,n)));return new ke(i,this._parents,t,n)}function vu(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Nr(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var c=o[a],l=c.length,u,d=0;d<l;++d)if(u=c[d]){for(var f=e.call(u,u.__data__,d,c),h,g=me(u,n),v=0,x=f.length;v<x;++v)(h=f[v])&&en(h,t,n,v,f,g);i.push(f),s.push(u)}return new ke(i,s,t,n)}var bu=wt.prototype.constructor;function _u(){return new bu(this._groups,this._parents)}function Eu(e,t){var n,o,r;return function(){var i=Ke(this,e),s=(this.style.removeProperty(e),Ke(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Ur(e){return function(){this.style.removeProperty(e)}}function Su(e,t,n){var o,r=n+"",i;return function(){var s=Ke(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nu(e,t,n){var o,r,i;return function(){var s=Ke(this,e),a=n(this),c=a+"";return a==null&&(c=a=(this.style.removeProperty(e),Ke(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,a))}}function Cu(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var c=be(this,e),l=c.on,u=c.value[i]==null?a||(a=Ur(t)):void 0;(l!==n||r!==u)&&(o=(n=l).copy()).on(s,r=u),c.on=o}}function Mu(e,t,n){var o=(e+="")=="transform"?Il:Gr;return t==null?this.styleTween(e,Eu(e,o)).on("end.style."+e,Ur(e)):typeof t=="function"?this.styleTween(e,Nu(e,o,Zn(this,"style."+e,t))).each(Cu(this._id,e)):this.styleTween(e,Su(e,o,t),n).on("end.style."+e,null)}function Iu(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function ku(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&Iu(e,s,n)),o}return i._value=t,i}function Au(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(t==null)return this.tween(o,null);if(typeof t!="function")throw new Error;return this.tween(o,ku(e,t,n??""))}function $u(e){return function(){this.textContent=e}}function Pu(e){return function(){var t=e(this);this.textContent=t??""}}function Du(e){return this.tween("text",typeof e=="function"?Pu(Zn(this,"text",e)):$u(e==null?"":e+""))}function Tu(e){return function(t){this.textContent=e.call(this,t)}}function zu(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Tu(r)),t}return o._value=e,o}function Hu(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,zu(e))}function Ru(){for(var e=this._name,t=this._id,n=Kr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)if(c=s[l]){var u=me(c,t);en(c,e,n,l,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new ke(o,this._parents,e,n)}function Lu(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var l=be(this,o),u=l.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(c)),l.on=t}),r===0&&i()})}var Vu=0;function ke(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Kr(){return++Vu}var Me=wt.prototype;ke.prototype={constructor:ke,select:wu,selectAll:vu,selectChild:Me.selectChild,selectChildren:Me.selectChildren,filter:fu,merge:hu,selection:_u,transition:Ru,call:Me.call,nodes:Me.nodes,node:Me.node,size:Me.size,empty:Me.empty,each:Me.each,on:mu,attr:Ul,attrTween:tu,style:Mu,styleTween:Au,text:Du,textTween:Hu,remove:xu,tween:jl,delay:ru,duration:au,ease:lu,easeVarying:du,end:Lu,[Symbol.iterator]:Me[Symbol.iterator]};function Ou(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Bu={time:null,delay:0,duration:250,ease:Ou};function Fu(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}function ju(e){var t,n;e instanceof ke?(t=e._id,e=e._name):(t=Kr(),(n=Bu).time=Xn(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,c,l=0;l<a;++l)(c=s[l])&&en(c,e,t,l,s,n||Fu(c,t));return new ke(o,this._parents,e,t)}wt.prototype.interrupt=Ol;wt.prototype.transition=ju;const kt=e=>()=>e;function Xu(e,{sourceEvent:t,target:n,transform:o,dispatch:r}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:r}})}function Ie(e,t,n){this.k=e,this.x=t,this.y=n}Ie.prototype={constructor:Ie,scale:function(e){return e===1?this:new Ie(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ie(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var tn=new Ie(1,0,0);Qr.prototype=Ie.prototype;function Qr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return tn;return e.__zoom}function mn(e){e.stopImmediatePropagation()}function it(e){e.preventDefault(),e.stopImmediatePropagation()}function Yu(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Zu(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function Ao(){return this.__zoom||tn}function Wu(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function qu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gu(e,t,n){var o=e.invertX(t[0][0])-n[0][0],r=e.invertX(t[1][0])-n[1][0],i=e.invertY(t[0][1])-n[0][1],s=e.invertY(t[1][1])-n[1][1];return e.translate(r>o?(o+r)/2:Math.min(0,o)||Math.max(0,r),s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s))}function Jr(){var e=Yu,t=Zu,n=Gu,o=Wu,r=qu,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,c=zt,l=Kt("start","zoom","end"),u,d,f,h=500,g=150,v=0,x=10;function m(y){y.property("__zoom",Ao).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",B).filter(r).on("touchstart.zoom",T).on("touchmove.zoom",L).on("touchend.zoom touchcancel.zoom",z).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}m.transform=function(y,E,S,M){var D=y.selection?y.selection():y;D.property("__zoom",Ao),y!==D?N(y,E,S,M):D.interrupt().each(function(){b(this,arguments).event(M).start().zoom(null,typeof E=="function"?E.apply(this,arguments):E).end()})},m.scaleBy=function(y,E,S,M){m.scaleTo(y,function(){var D=this.__zoom.k,$=typeof E=="function"?E.apply(this,arguments):E;return D*$},S,M)},m.scaleTo=function(y,E,S,M){m.transform(y,function(){var D=t.apply(this,arguments),$=this.__zoom,O=S==null?w(D):typeof S=="function"?S.apply(this,arguments):S,V=$.invert(O),R=typeof E=="function"?E.apply(this,arguments):E;return n(p(_($,R),O,V),D,s)},S,M)},m.translateBy=function(y,E,S,M){m.transform(y,function(){return n(this.__zoom.translate(typeof E=="function"?E.apply(this,arguments):E,typeof S=="function"?S.apply(this,arguments):S),t.apply(this,arguments),s)},null,M)},m.translateTo=function(y,E,S,M,D){m.transform(y,function(){var $=t.apply(this,arguments),O=this.__zoom,V=M==null?w($):typeof M=="function"?M.apply(this,arguments):M;return n(tn.translate(V[0],V[1]).scale(O.k).translate(typeof E=="function"?-E.apply(this,arguments):-E,typeof S=="function"?-S.apply(this,arguments):-S),$,s)},M,D)};function _(y,E){return E=Math.max(i[0],Math.min(i[1],E)),E===y.k?y:new Ie(E,y.x,y.y)}function p(y,E,S){var M=E[0]-S[0]*y.k,D=E[1]-S[1]*y.k;return M===y.x&&D===y.y?y:new Ie(y.k,M,D)}function w(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function N(y,E,S,M){y.on("start.zoom",function(){b(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){b(this,arguments).event(M).end()}).tween("zoom",function(){var D=this,$=arguments,O=b(D,$).event(M),V=t.apply(D,$),R=S==null?w(V):typeof S=="function"?S.apply(D,$):S,X=Math.max(V[1][0]-V[0][0],V[1][1]-V[0][1]),j=D.__zoom,W=typeof E=="function"?E.apply(D,$):E,Q=c(j.invert(R).concat(X/j.k),W.invert(R).concat(X/W.k));return function(q){if(q===1)q=W;else{var H=Q(q),F=X/H[2];q=new Ie(F,R[0]-H[0]*F,R[1]-H[1]*F)}O.zoom(null,q)}})}function b(y,E,S){return!S&&y.__zooming||new C(y,E)}function C(y,E){this.that=y,this.args=E,this.active=0,this.sourceEvent=null,this.extent=t.apply(y,E),this.taps=0}C.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,E){return this.mouse&&y!=="mouse"&&(this.mouse[1]=E.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=E.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=E.invert(this.touch1[0])),this.that.__zoom=E,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var E=ce(this.that).datum();l.call(y,this.that,new Xu(y,{sourceEvent:this.sourceEvent,target:m,transform:this.that.__zoom,dispatch:l}),E)}};function I(y,...E){if(!e.apply(this,arguments))return;var S=b(this,E).event(y),M=this.__zoom,D=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,o.apply(this,arguments)))),$=de(y);if(S.wheel)(S.mouse[0][0]!==$[0]||S.mouse[0][1]!==$[1])&&(S.mouse[1]=M.invert(S.mouse[0]=$)),clearTimeout(S.wheel);else{if(M.k===D)return;S.mouse=[$,M.invert($)],Lt(this),S.start()}it(y),S.wheel=setTimeout(O,g),S.zoom("mouse",n(p(_(M,D),S.mouse[0],S.mouse[1]),S.extent,s));function O(){S.wheel=null,S.end()}}function A(y,...E){if(f||!e.apply(this,arguments))return;var S=y.currentTarget,M=b(this,E,!0).event(y),D=ce(y.view).on("mousemove.zoom",R,!0).on("mouseup.zoom",X,!0),$=de(y,S),O=y.clientX,V=y.clientY;Hr(y.view),mn(y),M.mouse=[$,this.__zoom.invert($)],Lt(this),M.start();function R(j){if(it(j),!M.moved){var W=j.clientX-O,Q=j.clientY-V;M.moved=W*W+Q*Q>v}M.event(j).zoom("mouse",n(p(M.that.__zoom,M.mouse[0]=de(j,S),M.mouse[1]),M.extent,s))}function X(j){D.on("mousemove.zoom mouseup.zoom",null),Rr(j.view,M.moved),it(j),M.event(j).end()}}function B(y,...E){if(e.apply(this,arguments)){var S=this.__zoom,M=de(y.changedTouches?y.changedTouches[0]:y,this),D=S.invert(M),$=S.k*(y.shiftKey?.5:2),O=n(p(_(S,$),M,D),t.apply(this,E),s);it(y),a>0?ce(this).transition().duration(a).call(N,O,M,y):ce(this).call(m.transform,O,M,y)}}function T(y,...E){if(e.apply(this,arguments)){var S=y.touches,M=S.length,D=b(this,E,y.changedTouches.length===M).event(y),$,O,V,R;for(mn(y),O=0;O<M;++O)V=S[O],R=de(V,this),R=[R,this.__zoom.invert(R),V.identifier],D.touch0?!D.touch1&&D.touch0[2]!==R[2]&&(D.touch1=R,D.taps=0):(D.touch0=R,$=!0,D.taps=1+!!u);u&&(u=clearTimeout(u)),$&&(D.taps<2&&(d=R[0],u=setTimeout(function(){u=null},h)),Lt(this),D.start())}}function L(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,D=M.length,$,O,V,R;for(it(y),$=0;$<D;++$)O=M[$],V=de(O,this),S.touch0&&S.touch0[2]===O.identifier?S.touch0[0]=V:S.touch1&&S.touch1[2]===O.identifier&&(S.touch1[0]=V);if(O=S.that.__zoom,S.touch1){var X=S.touch0[0],j=S.touch0[1],W=S.touch1[0],Q=S.touch1[1],q=(q=W[0]-X[0])*q+(q=W[1]-X[1])*q,H=(H=Q[0]-j[0])*H+(H=Q[1]-j[1])*H;O=_(O,Math.sqrt(q/H)),V=[(X[0]+W[0])/2,(X[1]+W[1])/2],R=[(j[0]+Q[0])/2,(j[1]+Q[1])/2]}else if(S.touch0)V=S.touch0[0],R=S.touch0[1];else return;S.zoom("touch",n(p(O,V,R),S.extent,s))}}function z(y,...E){if(this.__zooming){var S=b(this,E).event(y),M=y.changedTouches,D=M.length,$,O;for(mn(y),f&&clearTimeout(f),f=setTimeout(function(){f=null},h),$=0;$<D;++$)O=M[$],S.touch0&&S.touch0[2]===O.identifier?delete S.touch0:S.touch1&&S.touch1[2]===O.identifier&&delete S.touch1;if(S.touch1&&!S.touch0&&(S.touch0=S.touch1,delete S.touch1),S.touch0)S.touch0[1]=this.__zoom.invert(S.touch0[0]);else if(S.end(),S.taps===2&&(O=de(O,this),Math.hypot(d[0]-O[0],d[1]-O[1])<x)){var V=ce(this).on("dblclick.zoom");V&&V.apply(this,arguments)}}}return m.wheelDelta=function(y){return arguments.length?(o=typeof y=="function"?y:kt(+y),m):o},m.filter=function(y){return arguments.length?(e=typeof y=="function"?y:kt(!!y),m):e},m.touchable=function(y){return arguments.length?(r=typeof y=="function"?y:kt(!!y),m):r},m.extent=function(y){return arguments.length?(t=typeof y=="function"?y:kt([[+y[0][0],+y[0][1]],[+y[1][0],+y[1][1]]]),m):t},m.scaleExtent=function(y){return arguments.length?(i[0]=+y[0],i[1]=+y[1],m):[i[0],i[1]]},m.translateExtent=function(y){return arguments.length?(s[0][0]=+y[0][0],s[1][0]=+y[1][0],s[0][1]=+y[0][1],s[1][1]=+y[1][1],m):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},m.constrain=function(y){return arguments.length?(n=y,m):n},m.duration=function(y){return arguments.length?(a=+y,m):a},m.interpolate=function(y){return arguments.length?(c=y,m):c},m.on=function(){var y=l.on.apply(l,arguments);return y===l?m:y},m.clickDistance=function(y){return arguments.length?(v=(y=+y)*y,m):Math.sqrt(v)},m.tapDistance=function(y){return arguments.length?(x=+y,m):x},m}const pe={error001:(e="react")=>`Seems like you have not used ${e==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${e}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${e} handle id: "${e==="source"?n:o}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:e=>`Edge with id "${e}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},gt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ei=["Enter"," ","Escape"],ti={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:n})=>`Moved selected node ${e}. New position, x: ${t}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var Je;(function(e){e.Strict="strict",e.Loose="loose"})(Je||(Je={}));var Oe;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Oe||(Oe={}));var pt;(function(e){e.Partial="partial",e.Full="full"})(pt||(pt={}));const ni={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Pe;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Pe||(Pe={}));var Zt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(Zt||(Zt={}));var Z;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Z||(Z={}));const $o={[Z.Left]:Z.Right,[Z.Right]:Z.Left,[Z.Top]:Z.Bottom,[Z.Bottom]:Z.Top};function oi(e){return e===null?null:e?"valid":"invalid"}const ri=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Uu=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),Wn=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),bt=(e,t=[0,0])=>{const{width:n,height:o}=_e(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Ku=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const n=e.reduce((o,r)=>{const i=typeof r=="string";let s=!t.nodeLookup&&!i?r:void 0;t.nodeLookup&&(s=i?t.nodeLookup.get(r):Wn(r)?r:t.nodeLookup.get(r.id));const a=s?Wt(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return nn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return on(n)},_t=(e,t={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return e.forEach(r=>{(t.filter===void 0||t.filter(r))&&(n=nn(n,Wt(r)),o=!0)}),o?on(n):{x:0,y:0,width:0,height:0}},qn=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,c=(t.y-o)/r,l=t.width/r,u=t.height/r,d=[];for(const f of e.values()){const{measured:h,selectable:g=!0,hidden:v=!1}=f;if(s&&!g||v)continue;const x=h.width??f.width??f.initialWidth??0,m=h.height??f.height??f.initialHeight??0,{x:_,y:p}=f.internals.positionAbsolute,w=ci(a,c,l,u,_,p,x,m),N=x*m,b=i&&w>0;(!f.internals.handleBounds||b||w>=N||f.dragging)&&d.push(f)}return d},Qu=(e,t)=>{const n=new Set;return e.forEach(o=>{n.add(o.id)}),t.filter(o=>n.has(o.source)||n.has(o.target))};function Ju(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{let i;if(t?.includeHiddenNodes){const{width:s,height:a}=_e(r);i=s>0&&a>0}else i=!!(r.measured.width&&r.measured.height&&!r.hidden);i&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}async function ed({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=Ju(e,s),c=_t(a),l=Un(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function ii({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),a=s.parentId?n.get(s.parentId):void 0,{x:c,y:l}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let d=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",pe.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(d=[[c,l],[c+h,l+g]])}else a&&Xe(s.extent)&&(d=[[s.extent[0][0]+c,s.extent[0][1]+l],[s.extent[1][0]+c,s.extent[1][1]+l]]);const f=Xe(d)?je(t,d,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",pe.error015()),{position:{x:f.x-c+(s.measured.width??0)*u[0],y:f.y-l+(s.measured.height??0)*u[1]},positionAbsolute:f}}async function td({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(f=>f.id)),s=[];for(const f of n){if(f.deletable===!1)continue;const h=i.has(f.id),g=!h&&f.parentId&&s.find(v=>v.id===f.parentId);(h||g)&&s.push(f)}const a=new Set(t.map(f=>f.id)),c=o.filter(f=>f.deletable!==!1),u=Qu(s,c);for(const f of c)a.has(f.id)&&!u.find(g=>g.id===f.id)&&u.push(f);if(!r)return{edges:u,nodes:s};const d=await r({nodes:s,edges:u});return typeof d=="boolean"?d?{edges:u,nodes:s}:{edges:[],nodes:[]}:d}const et=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),je=(e={x:0,y:0},t,n)=>({x:et(e.x,t[0][0],t[1][0]-(n?.width??0)),y:et(e.y,t[0][1],t[1][1]-(n?.height??0))});function si(e,t,n){const{width:o,height:r}=_e(n),{x:i,y:s}=n.internals.positionAbsolute;return je(e,[[i,s],[i+o,s+r]],t)}const Po=(e,t,n)=>e<t?et(Math.abs(e-t),1,t)/t:e>n?-et(Math.abs(e-n),1,t)/t:0,Gn=(e,t,n=15,o=40)=>{const r=Po(e.x,o,t.width-o)*n,i=Po(e.y,o,t.height-o)*n;return[r,i]},nn=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),Tn=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),on=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),mt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},Wt=(e,t=[0,0])=>{const{x:n,y:o}=Wn(e)?e.internals.positionAbsolute:bt(e,t);return{x:n,y:o,x2:n+(e.measured?.width??e.width??e.initialWidth??0),y2:o+(e.measured?.height??e.height??e.initialHeight??0)}},ai=(e,t)=>on(nn(Tn(e),Tn(t))),ci=(e,t,n,o,r,i,s,a)=>{const c=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),l=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(c*l)},qt=(e,t)=>ci(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),Do=e=>he(e.width)&&he(e.height)&&he(e.x)&&he(e.y),he=e=>!isNaN(e)&&isFinite(e),li=(e,t)=>(n,o)=>{},Et=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),St=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Et(a,s):a},tt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function Ze(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function nd(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=Ze(e,n),r=Ze(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=Ze(e.top??e.y??0,n),r=Ze(e.bottom??e.y??0,n),i=Ze(e.left??e.x??0,t),s=Ze(e.right??e.x??0,t);return{top:o,right:s,bottom:r,left:i,x:i+s,y:o+r}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function od(e,t,n,o,r,i){const{x:s,y:a}=tt(e,[t,n,o]),{x:c,y:l}=tt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-c,d=i-l;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(d)}}const Un=(e,t,n,o,r,i)=>{const s=nd(i,t,n),a=(t-s.x)/e.width,c=(n-s.y)/e.height,l=Math.min(a,c),u=et(l,o,r),d=e.x+e.width/2,f=e.y+e.height/2,h=t/2-d*u,g=n/2-f*u,v=od(e,h,g,u,t,n),x={left:Math.min(v.left-s.left,0),top:Math.min(v.top-s.top,0),right:Math.min(v.right-s.right,0),bottom:Math.min(v.bottom-s.bottom,0)};return{x:h-x.left+x.right,y:g-x.top+x.bottom,zoom:u}},yt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Xe(e){return e!=null&&e!=="parent"}function _e(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function ui(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function di(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const a=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*a[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*a[1]}return i}function To(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function rd(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function id(e){return{...ti,...e||{}}}function lt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=ge(e),a=St({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:l}=n?Et(a,t):a;return{xSnapped:c,ySnapped:l,...a}}const Kn=e=>({width:e.offsetWidth,height:e.offsetHeight}),fi=e=>e?.getRootNode?.()||window?.document,sd=["INPUT","SELECT","TEXTAREA"];function hi(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:sd.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const gi=e=>"clientX"in e,ge=(e,t)=>{const n=gi(e),o=n?e.clientX:e.touches?.[0].clientX,r=n?e.clientY:e.touches?.[0].clientY;return{x:o-(t?.left??0),y:r-(t?.top??0)}},zo=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const a=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(a.left-n.left)/o,y:(a.top-n.top)/o,...Kn(s)}})};function pi({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const c=e*.125+r*.375+s*.375+n*.125,l=t*.125+i*.375+a*.375+o*.125,u=Math.abs(c-e),d=Math.abs(l-t);return[c,l,u,d]}function At(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function Ho({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Z.Left:return[t-At(t-o,i),n];case Z.Right:return[t+At(o-t,i),n];case Z.Top:return[t,n-At(n-r,i)];case Z.Bottom:return[t,n+At(r-n,i)]}}function mi({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,curvature:s=.25}){const[a,c]=Ho({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[l,u]=Ho({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[d,f,h,g]=pi({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:c,targetControlX:l,targetControlY:u});return[`M${e},${t} C${a},${c} ${l},${u} ${o},${r}`,d,f,h,g]}function yi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const r=Math.abs(n-e)/2,i=n<e?n+r:n-r,s=Math.abs(o-t)/2,a=o<t?o+s:o-s;return[i,a,r,s]}function ad({sourceNode:e,targetNode:t,selected:n=!1,zIndex:o=0,elevateOnSelect:r=!1,zIndexMode:i="basic"}){if(i==="manual")return o;const s=r&&n?o+1e3:o,a=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+a}function cd({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=nn(Wt(e),Wt(t));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const s={x:-r[0]/r[2],y:-r[1]/r[2],width:n/r[2],height:o/r[2]};return qt(s,on(i))>0}const ld=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,ud=(e,t)=>t.some(n=>n.source===e.source&&n.target===e.target&&(n.sourceHandle===e.sourceHandle||!n.sourceHandle&&!e.sourceHandle)&&(n.targetHandle===e.targetHandle||!n.targetHandle&&!e.targetHandle)),dd=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",pe.error006()),t;const o=n.getEdgeId||ld;let r;return ri(e)?r={...e}:r={...e,id:o(e)},ud(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function xi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=yi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const Ro={[Z.Left]:{x:-1,y:0},[Z.Right]:{x:1,y:0},[Z.Top]:{x:0,y:-1},[Z.Bottom]:{x:0,y:1}},fd=({source:e,sourcePosition:t=Z.Bottom,target:n})=>t===Z.Left||t===Z.Right?e.x<n.x?{x:1,y:0}:{x:-1,y:0}:e.y<n.y?{x:0,y:1}:{x:0,y:-1},Lo=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function hd({source:e,sourcePosition:t=Z.Bottom,target:n,targetPosition:o=Z.Top,center:r,offset:i,stepPosition:s}){const a=Ro[t],c=Ro[o],l={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},d=fd({source:l,sourcePosition:t,target:u}),f=d.x!==0?"x":"y",h=d[f];let g=[],v,x;const m={x:0,y:0},_={x:0,y:0},[,,p,w]=yi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[f]*c[f]===-1){f==="x"?(v=r.x??l.x+(u.x-l.x)*s,x=r.y??(l.y+u.y)/2):(v=r.x??(l.x+u.x)/2,x=r.y??l.y+(u.y-l.y)*s);const I=[{x:v,y:l.y},{x:v,y:u.y}],A=[{x:l.x,y:x},{x:u.x,y:x}];a[f]===h?g=f==="x"?I:A:g=f==="x"?A:I}else{const I=[{x:l.x,y:u.y}],A=[{x:u.x,y:l.y}];if(f==="x"?g=a.x===h?A:I:g=a.y===h?I:A,t===o){const y=Math.abs(e[f]-n[f]);if(y<=i){const E=Math.min(i-1,i-y);a[f]===h?m[f]=(l[f]>e[f]?-1:1)*E:_[f]=(u[f]>n[f]?-1:1)*E}}if(t!==o){const y=f==="x"?"y":"x",E=a[f]===c[y],S=l[y]>u[y],M=l[y]<u[y];(a[f]===1&&(!E&&S||E&&M)||a[f]!==1&&(!E&&M||E&&S))&&(g=f==="x"?I:A)}const B={x:l.x+m.x,y:l.y+m.y},T={x:u.x+_.x,y:u.y+_.y},L=Math.max(Math.abs(B.x-g[0].x),Math.abs(T.x-g[0].x)),z=Math.max(Math.abs(B.y-g[0].y),Math.abs(T.y-g[0].y));L>=z?(v=(B.x+T.x)/2,x=g[0].y):(v=g[0].x,x=(B.y+T.y)/2)}const N={x:l.x+m.x,y:l.y+m.y},b={x:u.x+_.x,y:u.y+_.y};return[[e,...N.x!==g[0].x||N.y!==g[0].y?[N]:[],...g,...b.x!==g[g.length-1].x||b.y!==g[g.length-1].y?[b]:[],n],v,x,p,w]}function gd(e,t,n,o){const r=Math.min(Lo(e,t)/2,Lo(t,n)/2,o),{x:i,y:s}=t;if(e.x===i&&i===n.x||e.y===s&&s===n.y)return`L${i} ${s}`;if(e.y===s){const l=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*l},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*a},${s}`}function zn({sourceX:e,sourceY:t,sourcePosition:n=Z.Bottom,targetX:o,targetY:r,targetPosition:i=Z.Top,borderRadius:s=5,centerX:a,centerY:c,offset:l=20,stepPosition:u=.5}){const[d,f,h,g,v]=hd({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:c},offset:l,stepPosition:u});let x=`M${d[0].x} ${d[0].y}`;for(let m=1;m<d.length-1;m++)x+=gd(d[m-1],d[m],d[m+1],s);return x+=`L${d[d.length-1].x} ${d[d.length-1].y}`,[x,f,h,g,v]}function Vo(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function pd(e){const{sourceNode:t,targetNode:n}=e;if(!Vo(t)||!Vo(n))return null;const o=t.internals.handleBounds||Oo(t.handles),r=n.internals.handleBounds||Oo(n.handles),i=Bo(o?.source??[],e.sourceHandle),s=Bo(e.connectionMode===Je.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",pe.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Z.Bottom,c=s?.position||Z.Top,l=Ye(t,i,a),u=Ye(n,s,c);return{sourceX:l.x,sourceY:l.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:c}}function Oo(e){if(!e)return null;const t=[],n=[];for(const o of e)o.width=o.width??1,o.height=o.height??1,o.type==="source"?t.push(o):o.type==="target"&&n.push(o);return{source:t,target:n}}function Ye(e,t,n=Z.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:a}=t??_e(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Z.Top:return{x:r+s/2,y:i};case Z.Right:return{x:r+s,y:i+a/2};case Z.Bottom:return{x:r+s/2,y:i+a};case Z.Left:return{x:r,y:i+a/2}}}function Bo(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function Hn(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function md(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,a)=>([a.markerStart||o,a.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const l=Hn(c,t);i.has(l)||(s.push({id:l,color:c.color||n,...c}),i.add(l))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const wi=1e3,yd=10,Qn={nodeOrigin:[0,0],nodeExtent:gt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},xd={...Qn,checkEquality:!0};function Jn(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function wd(e,t,n){const o=Jn(Qn,n);for(const r of e.values())if(r.parentId)to(r,e,t,o);else{const i=bt(r,o.nodeOrigin),s=Xe(r.extent)?r.extent:o.nodeExtent,a=je(i,s,_e(r));r.internals.positionAbsolute=a}}function vd(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const n=[],o=[];for(const r of e.handles){const i={id:r.id,width:r.width??1,height:r.height??1,nodeId:e.id,x:r.x,y:r.y,position:r.position,type:r.type};r.type==="source"?n.push(i):r.type==="target"&&o.push(i)}return{source:n,target:o}}function eo(e){return e==="manual"}function Rn(e,t,n,o={}){const r=Jn(xd,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!eo(r.zIndexMode)?wi:0;let c=e.length>0,l=!1;t.clear(),n.clear();for(const u of e){let d=s.get(u.id);if(r.checkEquality&&u===d?.internals.userNode)t.set(u.id,d);else{const f=bt(u,r.nodeOrigin),h=Xe(u.extent)?u.extent:r.nodeExtent,g=je(f,h,_e(u));d={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:vd(u,d),z:vi(u,a,r.zIndexMode),userNode:u}},t.set(u.id,d)}(d.measured===void 0||d.measured.width===void 0||d.measured.height===void 0)&&!d.hidden&&(c=!1),u.parentId&&to(d,t,n,o,i),l||=u.selected??!1}return{nodesInitialized:c,hasSelectedNodes:l}}function bd(e,t){if(!e.parentId)return;const n=t.get(e.parentId);n?n.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function to(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:c}=Jn(Qn,o),l=e.parentId,u=t.get(l);if(!u){console.warn(`Parent node ${l} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}bd(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*yd),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const d=i&&!eo(c)?wi:0,{x:f,y:h,z:g}=_d(e,u,s,a,d,c),{positionAbsolute:v}=e.internals,x=f!==v.x||h!==v.y;(x||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:x?{x:f,y:h}:v,z:g}})}function vi(e,t,n){const o=he(e.zIndex)?e.zIndex:0;return eo(n)?o:o+(e.selected?t:0)}function _d(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,c=_e(e),l=bt(e,n),u=Xe(e.extent)?je(l,e.extent,c):l;let d=je({x:s+u.x,y:a+u.y},o,c);e.extent==="parent"&&(d=si(d,c,t));const f=vi(e,r,i),h=t.internals.z??0;return{x:d.x,y:d.y,z:h>=f?h+1:f}}function no(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const a=t.get(s.parentId);if(!a)continue;const c=i.get(s.parentId)?.expandedRect??mt(a),l=ai(c,s.rect);i.set(s.parentId,{expandedRect:l,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},c)=>{const l=a.internals.positionAbsolute,u=_e(a),d=a.origin??o,f=s.x<l.x?Math.round(Math.abs(l.x-s.x)):0,h=s.y<l.y?Math.round(Math.abs(l.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),v=Math.max(u.height,Math.round(s.height)),x=(g-u.width)*d[0],m=(v-u.height)*d[1];(f>0||h>0||x||m)&&(r.push({id:c,type:"position",position:{x:a.position.x-f+x,y:a.position.y-h+m}}),n.get(c)?.forEach(_=>{e.some(p=>p.id===_.id)||r.push({id:_.id,type:"position",position:{x:_.position.x+f,y:_.position.y+h}})})),(u.width<s.width||u.height<s.height||f||h)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?d[0]*f-x:0),height:v+(h?d[1]*h-m:0)}})}),r}function Ed(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let c=!1;if(!a)return{changes:[],updatedInternals:c};const l=[],u=window.getComputedStyle(a),{m22:d}=new window.DOMMatrixReadOnly(u.transform),f=[];for(const h of e.values()){const g=t.get(h.id);if(!g)continue;if(g.hidden){t.set(g.id,{...g,internals:{...g.internals,handleBounds:void 0}}),c=!0;continue}const v=Kn(h.nodeElement),x=g.measured.width!==v.width||g.measured.height!==v.height;if(!!(v.width&&v.height&&(x||!g.internals.handleBounds||h.force))){const _=h.nodeElement.getBoundingClientRect(),p=Xe(g.extent)?g.extent:i;let{positionAbsolute:w}=g.internals;if(g.parentId&&g.extent==="parent"){const b=t.get(g.parentId);b&&(w=si(w,v,b))}else p&&(w=je(w,p,v));const N={...g,measured:v,internals:{...g.internals,positionAbsolute:w,handleBounds:{source:zo("source",h.nodeElement,_,d,g.id),target:zo("target",h.nodeElement,_,d,g.id)}}};t.set(g.id,N),g.parentId&&to(N,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,x&&(l.push({id:g.id,type:"dimensions",dimensions:v}),g.expandParent&&g.parentId&&f.push({id:g.id,parentId:g.parentId,rect:mt(N,r)}))}}if(f.length>0){const h=no(f,t,n,r);l.push(...h)}return{changes:l,updatedInternals:c}}async function Sd({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return!1;const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o);return!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2])}function Fo(e,t,n,o,r,i){let s=r;const a=o.get(s)||new Map;o.set(s,a.set(n,t)),s=`${r}-${e}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const l=o.get(s)||new Map;o.set(s,l.set(n,t))}}function bi(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},l=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;Fo("source",c,u,e,r,s),Fo("target",c,l,e,i,a),t.set(o.id,o)}}function _i(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:_i(n,t):!1}function jo(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Nd(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!_i(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const a=e.get(i);a&&r.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 r}function yn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,position:a.position,dragging:o})}if(!e)return[r[0],r];const i=n.get(e)?.internals.userNode;return[i?{...i,position:t.get(e)?.position||i.position,dragging:o}:r[0],r]}function Cd({dragItems:e,snapGrid:t,x:n,y:o}){const r=e.values().next().value;if(!r)return null;const i={x:n-r.distance.x,y:o-r.distance.y},s=Et(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Md({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,c=!1,l={x:0,y:0},u=null,d=!1,f=null,h=!1,g=!1,v=null;function x({noDragClassName:_,handleSelector:p,domNode:w,isSelectable:N,nodeId:b,nodeClickDistance:C=0}){f=ce(w);function I({x:L,y:z}){const{nodeLookup:y,nodeExtent:E,snapGrid:S,snapToGrid:M,nodeOrigin:D,onNodeDrag:$,onSelectionDrag:O,onError:V,updateNodePositions:R}=t();i={x:L,y:z};let X=!1;const j=a.size>1,W=j&&E?Tn(_t(a)):null,Q=j&&M?Cd({dragItems:a,snapGrid:S,x:L,y:z}):null;for(const[q,H]of a){if(!y.has(q))continue;let F={x:L-H.distance.x,y:z-H.distance.y};M&&(F=Q?{x:Math.round(F.x+Q.x),y:Math.round(F.y+Q.y)}:Et(F,S));let K=null;if(j&&E&&!H.extent&&W){const{positionAbsolute:G}=H.internals,J=G.x-W.x+E[0][0],te=G.x+H.measured.width-W.x2+E[1][0],oe=G.y-W.y+E[0][1],se=G.y+H.measured.height-W.y2+E[1][1];K=[[J,oe],[te,se]]}const{position:U,positionAbsolute:Y}=ii({nodeId:q,nextPosition:F,nodeLookup:y,nodeExtent:K||E,nodeOrigin:D,onError:V});X=X||H.position.x!==U.x||H.position.y!==U.y,H.position=U,H.internals.positionAbsolute=Y}if(g=g||X,!!X&&(R(a,!0),v&&(o||$||!b&&O))){const[q,H]=yn({nodeId:b,dragItems:a,nodeLookup:y});o?.(v,a,q,H),$?.(v,q,H),b||O?.(v,H)}}async function A(){if(!u)return;const{transform:L,panBy:z,autoPanSpeed:y,autoPanOnNodeDrag:E}=t();if(!E){c=!1,cancelAnimationFrame(s);return}const[S,M]=Gn(l,u,y);(S!==0||M!==0)&&(i.x=(i.x??0)-S/L[2],i.y=(i.y??0)-M/L[2],await z({x:S,y:M})&&I(i)),s=requestAnimationFrame(A)}function B(L){const{nodeLookup:z,multiSelectionActive:y,nodesDraggable:E,transform:S,snapGrid:M,snapToGrid:D,selectNodesOnDrag:$,onNodeDragStart:O,onSelectionDragStart:V,unselectNodesAndEdges:R}=t();d=!0,(!$||!N)&&!y&&b&&(z.get(b)?.selected||R()),N&&$&&b&&e?.(b);const X=lt(L.sourceEvent,{transform:S,snapGrid:M,snapToGrid:D,containerBounds:u});if(i=X,a=Nd(z,E,X,b),a.size>0&&(n||O||!b&&V)){const[j,W]=yn({nodeId:b,dragItems:a,nodeLookup:z});n?.(L.sourceEvent,a,j,W),O?.(L.sourceEvent,j,W),b||V?.(L.sourceEvent,W)}}const T=Lr().clickDistance(C).on("start",L=>{const{domNode:z,nodeDragThreshold:y,transform:E,snapGrid:S,snapToGrid:M}=t();u=z?.getBoundingClientRect()||null,h=!1,g=!1,v=L.sourceEvent,y===0&&B(L),i=lt(L.sourceEvent,{transform:E,snapGrid:S,snapToGrid:M,containerBounds:u}),l=ge(L.sourceEvent,u)}).on("drag",L=>{const{autoPanOnNodeDrag:z,transform:y,snapGrid:E,snapToGrid:S,nodeDragThreshold:M,nodeLookup:D}=t(),$=lt(L.sourceEvent,{transform:y,snapGrid:E,snapToGrid:S,containerBounds:u});if(v=L.sourceEvent,(L.sourceEvent.type==="touchmove"&&L.sourceEvent.touches.length>1||b&&!D.has(b))&&(h=!0),!h){if(!c&&z&&d&&(c=!0,A()),!d){const O=ge(L.sourceEvent,u),V=O.x-l.x,R=O.y-l.y;Math.sqrt(V*V+R*R)>M&&B(L)}(i.x!==$.xSnapped||i.y!==$.ySnapped)&&a&&d&&(l=ge(L.sourceEvent,u),I($))}}).on("end",L=>{if(!d||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(c=!1,d=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:z,updateNodePositions:y,onNodeDragStop:E,onSelectionDragStop:S}=t();if(g&&(y(a,!1),g=!1),r||E||!b&&S){const[M,D]=yn({nodeId:b,dragItems:a,nodeLookup:z,dragging:!1});r?.(L.sourceEvent,a,M,D),E?.(L.sourceEvent,M,D),b||S?.(L.sourceEvent,D)}}}).filter(L=>{const z=L.target;return!L.button&&(!_||!jo(z,`.${_}`,w))&&(!p||jo(z,p,w))});f.call(T)}function m(){f?.on(".drag",null)}return{update:x,destroy:m}}function Id(e,t,n){const o=[],r={x:e.x-n,y:e.y-n,width:n*2,height:n*2};for(const i of t.values())qt(r,mt(i))>0&&o.push(i);return o}const kd=250;function Ad(e,t,n,o){let r=[],i=1/0;const s=Id(e,n,t+kd);for(const a of s){const c=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const l of c){if(o.nodeId===l.nodeId&&o.type===l.type&&o.id===l.id)continue;const{x:u,y:d}=Ye(a,l,l.position,!0),f=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(d-e.y,2));f>t||(f<i?(r=[{...l,x:u,y:d}],i=f):f===i&&r.push({...l,x:u,y:d}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(c=>c.type===a)??r[0]}return r[0]}function Ei(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const a=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?a?.find(l=>l.id===n):a?.[0])??null;return c&&i?{...c,...Ye(s,c,c.position,!0)}:c}function Si(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function $d(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Ni=()=>!0;function Pd(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:c,lib:l,autoPanOnConnect:u,flowId:d,panBy:f,cancelConnection:h,onConnectStart:g,onConnect:v,onConnectEnd:x,isValidConnection:m=Ni,onReconnectEnd:_,updateConnection:p,getTransform:w,getFromHandle:N,autoPanSpeed:b,dragThreshold:C=1,handleDomNode:I}){const A=fi(e.target);let B=0,T;const{x:L,y:z}=ge(e),y=Si(i,I),E=a?.getBoundingClientRect();let S=!1;if(!E||!y)return;const M=Ei(r,y,o,c,t);if(!M)return;let D=ge(e,E),$=!1,O=null,V=!1,R=null;function X(){if(!u||!E)return;const[U,Y]=Gn(D,E,b);f({x:U,y:Y}),B=requestAnimationFrame(X)}const j={...M,nodeId:r,type:y,position:M.position},W=c.get(r);let q={inProgress:!0,isValid:null,from:Ye(W,j,Z.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:W,to:D,toHandle:null,toPosition:$o[j.position],toNode:null,pointer:D};function H(){S=!0,p(q),g?.(e,{nodeId:r,handleId:o,handleType:y})}C===0&&H();function F(U){if(!S){const{x:se,y:Ee}=ge(U),ye=se-L,xe=Ee-z;if(!(ye*ye+xe*xe>C*C))return;H()}if(!N()||!j){K(U);return}const Y=w();D=ge(U,E),T=Ad(St(D,Y,!1,[1,1]),n,c,j),$||(X(),$=!0);const G=Ci(U,{handle:T,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:m,doc:A,lib:l,flowId:d,nodeLookup:c});R=G.handleDomNode,O=G.connection,V=$d(!!T,G.isValid);const J=c.get(r),te=J?Ye(J,j,Z.Left,!0):q.from,oe={...q,from:te,isValid:V,to:G.toHandle&&V?tt({x:G.toHandle.x,y:G.toHandle.y},Y):D,toHandle:G.toHandle,toPosition:V&&G.toHandle?G.toHandle.position:$o[j.position],toNode:G.toHandle?c.get(G.toHandle.nodeId):null,pointer:D};p(oe),q=oe}function K(U){if(!("touches"in U&&U.touches.length>0)){if(S){(T||R)&&O&&V&&v?.(O);const{inProgress:Y,...G}=q,J={...G,toPosition:q.toHandle?q.toPosition:null};x?.(U,J),i&&_?.(U,J)}h(),cancelAnimationFrame(B),$=!1,V=!1,O=null,R=null,A.removeEventListener("mousemove",F),A.removeEventListener("mouseup",K),A.removeEventListener("touchmove",F),A.removeEventListener("touchend",K)}}A.addEventListener("mousemove",F),A.addEventListener("mouseup",K),A.addEventListener("touchmove",F),A.addEventListener("touchend",K)}function Ci(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:c,isValidConnection:l=Ni,nodeLookup:u}){const d=i==="target",f=t?s.querySelector(`.${a}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=ge(e),v=s.elementFromPoint(h,g),x=v?.classList.contains(`${a}-flow__handle`)?v:f,m={handleDomNode:x,isValid:!1,connection:null,toHandle:null};if(x){const _=Si(void 0,x),p=x.getAttribute("data-nodeid"),w=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),b=x.classList.contains("connectableend");if(!p||!_)return m;const C={source:d?p:o,sourceHandle:d?w:r,target:d?o:p,targetHandle:d?r:w};m.connection=C;const A=N&&b&&(n===Je.Strict?d&&_==="source"||!d&&_==="target":p!==o||w!==r);m.isValid=A&&l(C),m.toHandle=Ei(p,_,w,u,n,!0)}return m}const Ln={onPointerDown:Pd,isValid:Ci};function Dd({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:c,height:l,zoomStep:u=1,pannable:d=!0,zoomable:f=!0,inversePan:h=!1}){const g=p=>{if(p.sourceEvent.type!=="wheel"||!t)return;const w=n(),N=p.sourceEvent.ctrlKey&&yt()?10:1,b=-p.sourceEvent.deltaY*(p.sourceEvent.deltaMode===1?.05:p.sourceEvent.deltaMode?1:.002)*u,C=w[2]*Math.pow(2,b*N);t.scaleTo(C)};let v=[0,0];const x=p=>{(p.sourceEvent.type==="mousedown"||p.sourceEvent.type==="touchstart")&&(v=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY])},m=p=>{const w=n();if(p.sourceEvent.type!=="mousemove"&&p.sourceEvent.type!=="touchmove"||!t)return;const N=[p.sourceEvent.clientX??p.sourceEvent.touches[0].clientX,p.sourceEvent.clientY??p.sourceEvent.touches[0].clientY],b=[N[0]-v[0],N[1]-v[1]];v=N;const C=o()*Math.max(w[2],Math.log(w[2]))*(h?-1:1),I={x:w[0]-b[0]*C,y:w[1]-b[1]*C},A=[[0,0],[c,l]];t.setViewportConstrained({x:I.x,y:I.y,zoom:w[2]},A,a)},_=Jr().on("start",x).on("zoom",d?m:null).on("zoom.wheel",f?g:null);r.call(_,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:de}}const rn=e=>({x:e.x,y:e.y,zoom:e.k}),xn=({x:e,y:t,zoom:n})=>tn.translate(e,t).scale(n),We=(e,t)=>e.target.closest(`.${t}`),Mi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Td=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,wn=(e,t=0,n=Td,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ii=e=>{const t=e.ctrlKey&&yt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function zd({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:c,onPanZoomEnd:l}){return u=>{if(We(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const d=n.property("__zoom").k||1;if(u.ctrlKey&&s){const x=de(u),m=Ii(u),_=d*Math.pow(2,m);o.scaleTo(n,_,x,u);return}const f=u.deltaMode===1?20:1;let h=r===Oe.Vertical?0:u.deltaX*f,g=r===Oe.Horizontal?0:u.deltaY*f;!yt()&&u.shiftKey&&r!==Oe.Vertical&&(h=u.deltaY*f,g=0),o.translateBy(n,-(h/d)*i,-(g/d)*i,{internal:!0});const v=rn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?c?.(u,v):(e.isPanScrolling=!0,a?.(u,v)),e.panScrollTimeout=setTimeout(()=>{l?.(u,v),e.isPanScrolling=!1},150)}}function Hd({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=We(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Rd({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=rn(o.transform);e.mouseButton=o.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=r,o.sourceEvent?.type==="mousedown"&&t(!0),n&&n?.(o.sourceEvent,r)}}function Ld({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Mi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,rn(i.transform))}}function Vd({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Mi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=rn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Od({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:c,lib:l,connectionInProgress:u}){return d=>{const f=e||t,h=n&&d.ctrlKey,g=d.type==="wheel";if(d.button===1&&d.type==="mousedown"&&(We(d,`${l}-flow__node`)||We(d,`${l}-flow__edge`)))return!0;if(!o&&!f&&!r&&!i&&!n||s||u&&!g||We(d,a)&&g||We(d,c)&&(!g||r&&g&&!e)||!n&&d.ctrlKey&&g)return!1;if(!n&&d.type==="touchstart"&&d.touches?.length>1)return d.preventDefault(),!1;if(!f&&!r&&!h&&g||!o&&(d.type==="mousedown"||d.type==="touchstart")||Array.isArray(o)&&!o.includes(d.button)&&d.type==="mousedown")return!1;const v=Array.isArray(o)&&o.includes(d.button)||!d.button||d.button<=1;return(!d.ctrlKey||g)&&v}}function Bd({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:c}){const l={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let d=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(z=>{const y=z[0];y&&(d=[[0,0],[y.contentRect.width,y.contentRect.height]])}):null)?.observe(e);const h=Jr().extent(()=>d).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);w({x:r.x,y:r.y,zoom:et(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const v=g.on("wheel.zoom"),x=g.on("dblclick.zoom");h.wheelDelta(Ii);async function m(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).transform(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}function _({noWheelClassName:z,noPanClassName:y,onPaneContextMenu:E,userSelectionActive:S,panOnScroll:M,panOnDrag:D,panOnScrollMode:$,panOnScrollSpeed:O,preventScrolling:V,zoomOnPinch:R,zoomOnScroll:X,zoomOnDoubleClick:j,zoomActivationKeyPressed:W,lib:Q,onTransformChange:q,connectionInProgress:H,paneClickDistance:F,selectionOnDrag:K}){S&&!l.isZoomingOrPanning&&p();const U=M&&!W&&!S;h.clickDistance(K?1/0:!he(F)||F<0?0:F);const Y=U?zd({zoomPanValues:l,noWheelClassName:z,d3Selection:g,d3Zoom:h,panOnScrollMode:$,panOnScrollSpeed:O,zoomOnPinch:R,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):Hd({noWheelClassName:z,preventScrolling:V,d3ZoomHandler:v});g.on("wheel.zoom",Y,{passive:!1});const G=Rd({zoomPanValues:l,onDraggingChange:c,onPanZoomStart:s});h.on("start",G);const J=Ld({zoomPanValues:l,panOnDrag:D,onPaneContextMenu:!!E,onPanZoom:i,onTransformChange:q});h.on("zoom",J);const te=Vd({zoomPanValues:l,panOnDrag:D,panOnScroll:M,onPaneContextMenu:E,onPanZoomEnd:a,onDraggingChange:c});h.on("end",te);const oe=Od({zoomActivationKeyPressed:W,panOnDrag:D,zoomOnScroll:X,panOnScroll:M,zoomOnDoubleClick:j,zoomOnPinch:R,userSelectionActive:S,noPanClassName:y,noWheelClassName:z,lib:Q,connectionInProgress:H});h.filter(oe),j?g.on("dblclick.zoom",x):g.on("dblclick.zoom",null)}function p(){h.on("zoom",null)}async function w(z,y,E){const S=xn(z),M=h?.constrain()(S,y,E);return M&&await m(M),M}async function N(z,y){const E=xn(z);return await m(E,y),E}function b(z){if(g){const y=xn(z),E=g.property("__zoom");(E.k!==z.zoom||E.x!==z.x||E.y!==z.y)&&h?.transform(g,y,null,{sync:!0})}}function C(){const z=g?Qr(g.node()):{x:0,y:0,k:1};return{x:z.x,y:z.y,zoom:z.k}}async function I(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleTo(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}async function A(z,y){return g?new Promise(E=>{h?.interpolate(y?.interpolate==="linear"?ct:zt).scaleBy(wn(g,y?.duration,y?.ease,()=>E(!0)),z)}):!1}function B(z){h?.scaleExtent(z)}function T(z){h?.translateExtent(z)}function L(z){const y=!he(z)||z<0?0:z;h?.clickDistance(y)}return{update:_,destroy:p,setViewport:N,setViewportConstrained:w,getViewport:C,scaleTo:I,scaleBy:A,setScaleExtent:B,setTranslateExtent:T,syncViewport:b,setClickDistance:L}}var nt;(function(e){e.Line="line",e.Handle="handle"})(nt||(nt={}));function Fd({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,c=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(c[0]=c[0]*-1),a&&i&&(c[1]=c[1]*-1),c}function Xo(e){const t=e.includes("right")||e.includes("left"),n=e.includes("bottom")||e.includes("top"),o=e.includes("left"),r=e.includes("top");return{isHorizontal:t,isVertical:n,affectsX:o,affectsY:r}}function Ae(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function $t(e,t,n){return Math.max(0,t-e,e-n)}function Yo(e,t){return e?!t:t}function jd(e,t,n,o,r,i,s,a){let{affectsX:c,affectsY:l}=t;const{isHorizontal:u,isVertical:d}=t,f=u&&d,{xSnapped:h,ySnapped:g}=n,{minWidth:v,maxWidth:x,minHeight:m,maxHeight:_}=o,{x:p,y:w,width:N,height:b,aspectRatio:C}=e;let I=Math.floor(u?h-e.pointerX:0),A=Math.floor(d?g-e.pointerY:0);const B=N+(c?-I:I),T=b+(l?-A:A),L=-i[0]*N,z=-i[1]*b;let y=$t(B,v,x),E=$t(T,m,_);if(s){let D=0,$=0;c&&I<0?D=Ae(p+I+L,s[0][0]):!c&&I>0&&(D=$e(p+B+L,s[1][0])),l&&A<0?$=Ae(w+A+z,s[0][1]):!l&&A>0&&($=$e(w+T+z,s[1][1])),y=Math.max(y,D),E=Math.max(E,$)}if(a){let D=0,$=0;c&&I>0?D=$e(p+I,a[0][0]):!c&&I<0&&(D=Ae(p+B,a[1][0])),l&&A>0?$=$e(w+A,a[0][1]):!l&&A<0&&($=Ae(w+T,a[1][1])),y=Math.max(y,D),E=Math.max(E,$)}if(r){if(u){const D=$t(B/C,m,_)*C;if(y=Math.max(y,D),s){let $=0;!c&&!l||c&&!l&&f?$=$e(w+z+B/C,s[1][1])*C:$=Ae(w+z+(c?I:-I)/C,s[0][1])*C,y=Math.max(y,$)}if(a){let $=0;!c&&!l||c&&!l&&f?$=Ae(w+B/C,a[1][1])*C:$=$e(w+(c?I:-I)/C,a[0][1])*C,y=Math.max(y,$)}}if(d){const D=$t(T*C,v,x)/C;if(E=Math.max(E,D),s){let $=0;!c&&!l||l&&!c&&f?$=$e(p+T*C+L,s[1][0])/C:$=Ae(p+(l?A:-A)*C+L,s[0][0])/C,E=Math.max(E,$)}if(a){let $=0;!c&&!l||l&&!c&&f?$=Ae(p+T*C,a[1][0])/C:$=$e(p+(l?A:-A)*C,a[0][0])/C,E=Math.max(E,$)}}}A=A+(A<0?E:-E),I=I+(I<0?y:-y),r&&(f?B>T*C?A=(Yo(c,l)?-I:I)/C:I=(Yo(c,l)?-A:A)*C:u?(A=I/C,l=c):(I=A*C,c=l));const S=c?p+I:p,M=l?w+A:w;return{width:N+(c?-I:I),height:b+(l?-A:A),x:i[0]*I*(c?-1:1)+S,y:i[1]*A*(l?-1:1)+M}}const ki={width:0,height:0,x:0,y:0},Xd={...ki,pointerX:0,pointerY:0,aspectRatio:1};function Yd(e,t,n){const o=t.position.x+e.position.x,r=t.position.y+e.position.y,i=e.measured.width??0,s=e.measured.height??0,a=n[0]*i,c=n[1]*s;return[[o-a,r-c],[o+i-a,r+s-c]]}function Zd({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:Xo("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:l,boundaries:u,keepAspectRatio:d,resizeDirection:f,onResizeStart:h,onResize:g,onResizeEnd:v,shouldResize:x}){let m={...ki},_={...Xd};s={boundaries:u,resizeDirection:f,keepAspectRatio:d,controlDirection:Xo(l)};let p,w=null,N=[],b,C,I,A=!1;const B=Lr().on("start",T=>{const{nodeLookup:L,transform:z,snapGrid:y,snapToGrid:E,nodeOrigin:S,paneDomNode:M}=n();if(p=L.get(t),!p)return;w=M?.getBoundingClientRect()??null;const{xSnapped:D,ySnapped:$}=lt(T.sourceEvent,{transform:z,snapGrid:y,snapToGrid:E,containerBounds:w});m={width:p.measured.width??0,height:p.measured.height??0,x:p.position.x??0,y:p.position.y??0},_={...m,pointerX:D,pointerY:$,aspectRatio:m.width/m.height},b=void 0,C=Xe(p.extent)?p.extent:void 0,p.parentId&&(p.extent==="parent"||p.expandParent)&&(b=L.get(p.parentId)),b&&p.extent==="parent"&&(C=[[0,0],[b.measured.width,b.measured.height]]),N=[],I=void 0;for(const[O,V]of L)if(V.parentId===t&&(N.push({id:O,position:{...V.position},extent:V.extent}),V.extent==="parent"||V.expandParent)){const R=Yd(V,p,V.origin??S);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?.(T,{...m})}).on("drag",T=>{const{transform:L,snapGrid:z,snapToGrid:y,nodeOrigin:E}=n(),S=lt(T.sourceEvent,{transform:L,snapGrid:z,snapToGrid:y,containerBounds:w}),M=[];if(!p)return;const{x:D,y:$,width:O,height:V}=m,R={},X=p.origin??E,{width:j,height:W,x:Q,y:q}=jd(_,s.controlDirection,S,s.boundaries,s.keepAspectRatio,X,C,I),H=j!==O,F=W!==V,K=Q!==D&&H,U=q!==$&&F;if(!K&&!U&&!H&&!F)return;if((K||U||X[0]===1||X[1]===1)&&(R.x=K?Q:m.x,R.y=U?q:m.y,m.x=R.x,m.y=R.y,N.length>0)){const te=Q-D,oe=q-$;for(const se of N)se.position={x:se.position.x-te+X[0]*(j-O),y:se.position.y-oe+X[1]*(W-V)},M.push(se)}if((H||F)&&(R.width=H&&(!s.resizeDirection||s.resizeDirection==="horizontal")?j:m.width,R.height=F&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:m.height,m.width=R.width,m.height=R.height),b&&p.expandParent){const te=X[0]*(R.width??0);R.x&&R.x<te&&(m.x=te,_.x=_.x-(R.x-te));const oe=X[1]*(R.height??0);R.y&&R.y<oe&&(m.y=oe,_.y=_.y-(R.y-oe))}const Y=Fd({width:m.width,prevWidth:O,height:m.height,prevHeight:V,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),G={...m,direction:Y};x?.(T,G)!==!1&&(A=!0,g?.(T,G),o(R,M))}).on("end",T=>{A&&(v?.(T,{...m}),r?.({...m}),A=!1)});i.call(B)}function c(){i.on(".drag",null)}return{update:a,destroy:c}}var vn={exports:{}},bn={},_n={exports:{}},En={};var Zo;function Wd(){if(Zo)return En;Zo=1;var e=Er();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,o=e.useState,r=e.useEffect,i=e.useLayoutEffect,s=e.useDebugValue;function a(d,f){var h=f(),g=o({inst:{value:h,getSnapshot:f}}),v=g[0].inst,x=g[1];return i(function(){v.value=h,v.getSnapshot=f,c(v)&&x({inst:v})},[d,h,f]),r(function(){return c(v)&&x({inst:v}),d(function(){c(v)&&x({inst:v})})},[d]),s(h),h}function c(d){var f=d.getSnapshot;d=d.value;try{var h=f();return!n(d,h)}catch{return!0}}function l(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?l:a;return En.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,En}var Wo;function qd(){return Wo||(Wo=1,_n.exports=Wd()),_n.exports}var qo;function Gd(){if(qo)return bn;qo=1;var e=Er(),t=qd();function n(l,u){return l===u&&(l!==0||1/l===1/u)||l!==l&&u!==u}var o=typeof Object.is=="function"?Object.is:n,r=t.useSyncExternalStore,i=e.useRef,s=e.useEffect,a=e.useMemo,c=e.useDebugValue;return bn.useSyncExternalStoreWithSelector=function(l,u,d,f,h){var g=i(null);if(g.current===null){var v={hasValue:!1,value:null};g.current=v}else v=g.current;g=a(function(){function m(b){if(!_){if(_=!0,p=b,b=f(b),h!==void 0&&v.hasValue){var C=v.value;if(h(C,b))return w=C}return w=b}if(C=w,o(p,b))return C;var I=f(b);return h!==void 0&&h(C,I)?(p=b,C):(p=b,w=I)}var _=!1,p,w,N=d===void 0?null:d;return[function(){return m(u())},N===null?void 0:function(){return m(N())}]},[u,d,f,h]);var x=r(l,g[0],g[1]);return s(function(){v.hasValue=!0,v.value=x},[x]),c(x),x},bn}var Go;function Ud(){return Go||(Go=1,vn.exports=Gd()),vn.exports}var Kd=Ud();const Qd=ga(Kd),Jd={},Uo=e=>{let t;const n=new Set,o=(u,d)=>{const f=typeof u=="function"?u(t):u;if(!Object.is(f,t)){const h=t;t=d??(typeof f!="object"||f===null)?f:Object.assign({},t,f),n.forEach(g=>g(t,h))}},r=()=>t,c={setState:o,getState:r,getInitialState:()=>l,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Jd?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},l=t=e(o,r,c);return c},ef=e=>e?Uo(e):Uo,{useDebugValue:tf}=pa,{useSyncExternalStoreWithSelector:nf}=Qd,of=e=>e;function Ai(e,t=of,n){const o=nf(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return tf(o),o}const Ko=(e,t)=>{const n=ef(e),o=(r,i=t)=>Ai(n,r,i);return Object.assign(o,n),o},rf=(e,t)=>e?Ko(e,t):Ko;function re(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[o,r]of e)if(!Object.is(r,t.get(o)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const o of e)if(!t.has(o))return!1;return!0}const n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(t,o)||!Object.is(e[o],t[o]))return!1;return!0}const sn=P.createContext(null),sf=sn.Provider,$i=pe.error001("react");function ee(e,t){const n=P.useContext(sn);if(n===null)throw new Error($i);return Ai(n,e,t)}function ne(){const e=P.useContext(sn);if(e===null)throw new Error($i);return P.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const Qo={display:"none"},af={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Pi="react-flow__node-desc",Di="react-flow__edge-desc",cf="react-flow__aria-live",lf=e=>e.ariaLiveMessage,uf=e=>e.ariaLabelConfig;function df({rfId:e}){const t=ee(lf);return k.jsx("div",{id:`${cf}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:af,children:t})}function ff({rfId:e,disableKeyboardA11y:t}){const n=ee(uf);return k.jsxs(k.Fragment,{children:[k.jsx("div",{id:`${Pi}-${e}`,style:Qo,children:t?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),k.jsx("div",{id:`${Di}-${e}`,style:Qo,children:n["edge.a11yDescription.default"]}),!t&&k.jsx(df,{rfId:e})]})}const an=P.forwardRef(({position:e="top-left",children:t,className:n,style:o,...r},i)=>{const s=`${e}`.split("-");return k.jsx("div",{className:ie(["react-flow__panel",n,...s]),style:o,ref:i,...r,children:t})});an.displayName="Panel";const Jo="https://reactflow.dev?utm_source=attribution";function hf({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:k.jsx(an,{position:t,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${Jo}`,children:k.jsx("a",{href:Jo,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const gf=e=>{const t=[],n=[];for(const[,o]of e.nodeLookup)o.selected&&t.push(o.internals.userNode);for(const[,o]of e.edgeLookup)o.selected&&n.push(o);return{selectedNodes:t,selectedEdges:n}},Pt=e=>e.id;function pf(e,t){return re(e.selectedNodes.map(Pt),t.selectedNodes.map(Pt))&&re(e.selectedEdges.map(Pt),t.selectedEdges.map(Pt))}function mf({onSelectionChange:e}){const t=ne(),{selectedNodes:n,selectedEdges:o}=ee(gf,pf);return P.useEffect(()=>{const r={nodes:n,edges:o};e?.(r),t.getState().onSelectionChangeHandlers.forEach(i=>i(r))},[n,o,e]),null}const yf=e=>!!e.onSelectionChangeHandlers;function xf({onSelectionChange:e}){const t=ee(yf);return e||t?k.jsx(mf,{onSelectionChange:e}):null}const Ti=[0,0],wf={x:0,y:0,zoom:1},vf=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],er=[...vf,"rfId"],bf=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),tr={translateExtent:gt,nodeOrigin:Ti,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function _f(e){const{setNodes:t,setEdges:n,setMinZoom:o,setMaxZoom:r,setTranslateExtent:i,setNodeExtent:s,reset:a,setDefaultNodesAndEdges:c}=ee(bf,re),l=ne();P.useEffect(()=>(c(e.defaultNodes,e.defaultEdges),()=>{u.current=tr,a()}),[]);const u=P.useRef(tr);return P.useEffect(()=>{for(const d of er){const f=e[d],h=u.current[d];f!==h&&(typeof e[d]>"u"||(d==="nodes"?t(f):d==="edges"?n(f):d==="minZoom"?o(f):d==="maxZoom"?r(f):d==="translateExtent"?i(f):d==="nodeExtent"?s(f):d==="ariaLabelConfig"?l.setState({ariaLabelConfig:id(f)}):d==="fitView"?l.setState({fitViewQueued:f}):d==="fitViewOptions"?l.setState({fitViewOptions:f}):l.setState({[d]:f})))}u.current=e},er.map(d=>e[d])),null}function nr(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function Ef(e){const[t,n]=P.useState(e==="system"?null:e);return P.useEffect(()=>{if(e!=="system"){n(e);return}const o=nr(),r=()=>n(o?.matches?"dark":"light");return r(),o?.addEventListener("change",r),()=>{o?.removeEventListener("change",r)}},[e]),t!==null?t:nr()?.matches?"dark":"light"}const or=typeof document<"u"?document:null;function xt(e=null,t={target:or,actInsideInputWithModifier:!0}){const[n,o]=P.useState(!1),r=P.useRef(!1),i=P.useRef(new Set([])),[s,a]=P.useMemo(()=>{if(e!==null){const l=(Array.isArray(e)?e:[e]).filter(d=>typeof d=="string").map(d=>d.replace("+",`
|
|
2
2
|
`).replace(`
|
|
3
3
|
|
|
4
4
|
`,`
|