yamlover 0.3.49 → 0.3.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/bin/ga4.js +14 -1
- package/dist/agent-docs/AGENTS.md +10 -10
- package/dist/builtin-taxonomy/$defs/.yo/meta.yo +18 -23
- package/dist/builtin-taxonomy/$defs/annotation +6 -6
- package/dist/builtin-taxonomy/$defs/board +4 -4
- package/dist/builtin-taxonomy/$defs/bullets +2 -2
- package/dist/builtin-taxonomy/$defs/chapter +6 -7
- package/dist/builtin-taxonomy/$defs/chunk +4 -3
- package/dist/builtin-taxonomy/$defs/config +5 -5
- package/dist/builtin-taxonomy/$defs/fragment +2 -2
- package/dist/builtin-taxonomy/$defs/numbered +2 -2
- package/dist/builtin-taxonomy/$defs/{tag → onto} +6 -6
- package/dist/builtin-taxonomy/$defs/table +13 -12
- package/dist/builtin-taxonomy/$defs/task +6 -6
- package/dist/builtin-taxonomy/$defs/workflow +4 -4
- package/dist/builtin-taxonomy/ontos/.yo/body.yo +46 -0
- package/dist/client/assets/{decoded-D_YQdg1-.js → decoded-5u9KK4Nb.js} +1 -1
- package/dist/client/assets/{djvu-Di4fPA-J.js → djvu-CvRKxWcX.js} +1 -1
- package/dist/client/assets/{docx-BSduN32X.js → docx-CFqmrRMY.js} +1 -1
- package/dist/client/assets/{heic-DOAG7EsW.js → heic-P0RPecFK.js} +1 -1
- package/dist/client/assets/{imagemap-B8RthxNE.js → imagemap-BCrt0kPn.js} +1 -1
- package/dist/client/assets/index-_gAtxDG4.css +1 -0
- package/dist/client/assets/index-l1SxxFJR.js +754 -0
- package/dist/client/assets/{map-Cf7ar1_U.js → map-ClMfiQr8.js} +1 -1
- package/dist/client/assets/{openable-CCBlc-Ws.js → openable-9ABNW3A9.js} +1 -1
- package/dist/client/assets/{paged-bLurvatj.js → paged-UVifI3SC.js} +1 -1
- package/dist/client/assets/{pdf-D1ox8M9A.js → pdf-BGgu5LFZ.js} +1 -1
- package/dist/client/assets/{psd-AT50x-YR.js → psd-D15IXPVu.js} +1 -1
- package/dist/client/assets/{spreadsheet-DeQh5CNF.js → spreadsheet-CeOcWWb2.js} +1 -1
- package/dist/client/assets/{tiff-B3-awhzQ.js → tiff-pZPBtPPg.js} +1 -1
- package/dist/client/assets/{xyflow-DuQ4jjaq.js → xyflow-uN1JIC1A.js} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server.js +1420 -425
- package/package.json +1 -1
- package/dist/builtin-taxonomy/tags/.yo/body.yo +0 -46
- package/dist/client/assets/index-Bf2L7I9e.js +0 -752
- package/dist/client/assets/index-N41EyNG2.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as T,g as Zc,R as Wc,j as I,l as ft,m as Gc,n as qc,o as Kc,p as vi,q as Uc,t as Kn,v as bi,w as Qc,x as Jc}from"./index-Bf2L7I9e.js";import{a as el}from"./paged-bLurvatj.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var tl={value:()=>{}};function gn(){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 Gt(n)}function Gt(e){this._=e}function nl(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}})}Gt.prototype=gn.prototype={constructor:Gt,on:function(e,t){var n=this._,o=nl(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ol(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]=Wo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Wo(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 Gt(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 ol(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Wo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=tl,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Un="http://www.w3.org/1999/xhtml";const Go={svg:"http://www.w3.org/2000/svg",xhtml:Un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Go.hasOwnProperty(t)?{space:Go[t],local:e}:e}function rl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Un&&t.documentElement.namespaceURI===Un?t.createElement(e):t.createElementNS(n,e)}}function il(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ei(e){var t=pn(e);return(t.local?il:rl)(t)}function sl(){}function go(e){return e==null?sl:function(){return this.querySelector(e)}}function al(e){typeof e!="function"&&(e=go(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),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function cl(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ll(){return[]}function _i(e){return e==null?ll:function(){return this.querySelectorAll(e)}}function ul(e){return function(){return cl(e.apply(this,arguments))}}function dl(e){typeof e=="function"?e=ul(e):e=_i(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new le(o,r)}function Ni(e){return function(){return this.matches(e)}}function Si(e){return function(t){return t.matches(e)}}var fl=Array.prototype.find;function hl(e){return function(){return fl.call(this.children,e)}}function gl(){return this.firstElementChild}function pl(e){return this.select(e==null?gl:hl(typeof e=="function"?e:Si(e)))}var ml=Array.prototype.filter;function yl(){return Array.from(this.children)}function wl(e){return function(){return ml.call(this.children,e)}}function xl(e){return this.selectAll(e==null?yl:wl(typeof e=="function"?e:Si(e)))}function vl(e){typeof e!="function"&&(e=Ni(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]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new le(o,this._parents)}function ki(e){return new Array(e.length)}function bl(){return new le(this._enter||this._groups.map(ki),this._parents)}function en(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}en.prototype={constructor:en,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 El(e){return function(){return e}}function _l(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new en(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Nl(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(d[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new en(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function kl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?Nl:_l,o=this._parents,r=this._groups;typeof e!="function"&&(e=El(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],f=r[c],d=f.length,h=Cl(e.call(u,u&&u.__data__,c,o)),g=h.length,w=a[c]=new Array(g),m=s[c]=new Array(g),p=l[c]=new Array(d);n(u,f,w,m,p,h,t);for(var b=0,y=0,x,_;b<g;++b)if(x=w[b]){for(b>=y&&(y=b+1);!(_=m[y])&&++y<g;);x._next=_||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function Cl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ml(){return new le(this._exit||this._groups.map(ki),this._parents)}function Il(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 Ol(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),l=0;l<s;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Al(){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 Pl(e){e||(e=$l);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}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,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function $l(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dl(){return Array.from(this)}function Rl(){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 Ll(){let e=0;for(const t of this)++e;return e}function zl(){return!this.node()}function jl(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 Hl(e){return function(){this.removeAttribute(e)}}function Vl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bl(e,t){return function(){this.setAttribute(e,t)}}function Fl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Xl(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 Zl(e,t){var n=pn(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?Vl:Hl:typeof t=="function"?n.local?Xl:Yl:n.local?Fl:Bl)(n,t))}function Ci(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Wl(e){return function(){this.style.removeProperty(e)}}function Gl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Kl(e,t,n){return arguments.length>1?this.each((t==null?Wl:typeof t=="function"?ql:Gl)(e,t,n??"")):et(this.node(),e)}function et(e,t){return e.style.getPropertyValue(t)||Ci(e).getComputedStyle(e,null).getPropertyValue(t)}function Ul(e){return function(){delete this[e]}}function Ql(e,t){return function(){this[e]=t}}function Jl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eu(e,t){return arguments.length>1?this.each((t==null?Ul:typeof t=="function"?Jl:Ql)(e,t)):this.node()[e]}function Mi(e){return e.trim().split(/^|\s+/)}function po(e){return e.classList||new Ii(e)}function Ii(e){this._node=e,this._names=Mi(e.getAttribute("class")||"")}Ii.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 Oi(e,t){for(var n=po(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ai(e,t){for(var n=po(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function tu(e){return function(){Oi(this,e)}}function nu(e){return function(){Ai(this,e)}}function ou(e,t){return function(){(t.apply(this,arguments)?Oi:Ai)(this,e)}}function ru(e,t){var n=Mi(e+"");if(arguments.length<2){for(var o=po(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?ou:t?tu:nu)(n,t))}function iu(){this.textContent=""}function su(e){return function(){this.textContent=e}}function au(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cu(e){return arguments.length?this.each(e==null?iu:(typeof e=="function"?au:su)(e)):this.node().textContent}function lu(){this.innerHTML=""}function uu(e){return function(){this.innerHTML=e}}function du(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function fu(e){return arguments.length?this.each(e==null?lu:(typeof e=="function"?du:uu)(e)):this.node().innerHTML}function hu(){this.nextSibling&&this.parentNode.appendChild(this)}function gu(){return this.each(hu)}function pu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(pu)}function yu(e){var t=typeof e=="function"?e:Ei(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wu(){return null}function xu(e,t){var n=typeof e=="function"?e:Ei(e),o=t==null?wu:typeof t=="function"?t:go(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function vu(){var e=this.parentNode;e&&e.removeChild(this)}function bu(){return this.each(vu)}function Eu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nu(e){return this.select(e?_u:Eu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ku(e){return function(t){e.call(this,t,this.__data__)}}function Cu(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 Mu(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 Iu(e,t,n){return function(){var o=this.__on,r,i=ku(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 Ou(e,t,n){var o=Cu(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Iu:Mu,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Pi(e,t,n){var o=Ci(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 Au(e,t){return function(){return Pi(this,e,t)}}function Pu(e,t){return function(){return Pi(this,e,t.apply(this,arguments))}}function $u(e,t){return this.each((typeof t=="function"?Pu:Au)(e,t))}function*Tu(){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 $i=[null];function le(e,t){this._groups=e,this._parents=t}function Pt(){return new le([[document.documentElement]],$i)}function Du(){return this}le.prototype=Pt.prototype={constructor:le,select:al,selectAll:dl,selectChild:pl,selectChildren:xl,filter:vl,data:kl,enter:bl,exit:Ml,join:Il,merge:Ol,selection:Du,order:Al,sort:Pl,call:Tl,nodes:Dl,node:Rl,size:Ll,empty:zl,each:jl,attr:Zl,style:Kl,property:eu,classed:ru,text:cu,html:fu,raise:gu,lower:mu,append:yu,insert:xu,remove:bu,clone:Nu,datum:Su,on:Ou,dispatch:$u,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],$i)}function Ru(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Ru(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 Lu={passive:!1},vt={capture:!0,passive:!1};function An(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ti(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,vt);"onselectstart"in t?n.on("selectstart.drag",Qe,vt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Di(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Qe,vt),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 jt=e=>()=>e;function Qn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Qn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function zu(e){return!e.ctrlKey&&!e.button}function ju(){return this.parentNode}function Hu(e,t){return t??{x:e.x,y:e.y}}function Vu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ri(){var e=zu,t=ju,n=Hu,o=Vu,r={},i=gn("start","drag","end"),s=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",m).on("touchmove.drag",p,Lu).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,_){if(!(u||!e.call(this,x,_))){var E=y(this,t.call(this,x,_),x,_,"mouse");E&&(ce(x.view).on("mousemove.drag",g,vt).on("mouseup.drag",w,vt),Ti(x.view),An(x),c=!1,a=x.clientX,l=x.clientY,E("start",x))}}function g(x){if(Qe(x),!c){var _=x.clientX-a,E=x.clientY-l;c=_*_+E*E>f}r.mouse("drag",x)}function w(x){ce(x.view).on("mousemove.drag mouseup.drag",null),Di(x.view,c),Qe(x),r.mouse("end",x)}function m(x,_){if(e.call(this,x,_)){var E=x.changedTouches,S=t.call(this,x,_),C=E.length,A,z;for(A=0;A<C;++A)(z=y(this,S,x,_,E[A].identifier,E[A]))&&(An(x),z("start",x,E[A]))}}function p(x){var _=x.changedTouches,E=_.length,S,C;for(S=0;S<E;++S)(C=r[_[S].identifier])&&(Qe(x),C("drag",x,_[S]))}function b(x){var _=x.changedTouches,E=_.length,S,C;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<E;++S)(C=r[_[S].identifier])&&(An(x),C("end",x,_[S]))}function y(x,_,E,S,C,A){var z=i.copy(),P=fe(A||E,_),$,M,v;if((v=n.call(x,new Qn("beforestart",{sourceEvent:E,target:d,identifier:C,active:s,x:P[0],y:P[1],dx:0,dy:0,dispatch:z}),S))!=null)return $=v.x-P[0]||0,M=v.y-P[1]||0,function N(k,O,R){var D=P,V;switch(k){case"start":r[C]=N,V=s++;break;case"end":delete r[C],--s;case"drag":P=fe(R||O,_),V=s;break}z.call(k,x,new Qn(k,{sourceEvent:O,subject:v,target:d,identifier:C,active:V,x:P[0]+$,y:P[1]+M,dx:P[0]-D[0],dy:P[1]-D[1],dispatch:z}),S)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:jt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:jt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:jt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:jt(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}function mo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Li(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function $t(){}var bt=.7,tn=1/bt,Je="\\s*([+-]?\\d+)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Bu=/^#([0-9a-f]{3,8})$/,Fu=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Yu=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Xu=new RegExp(`^rgba\\(${Je},${Je},${Je},${Et}\\)$`),Zu=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${Et}\\)$`),Wu=new RegExp(`^hsl\\(${Et},${Ee},${Ee}\\)$`),Gu=new RegExp(`^hsla\\(${Et},${Ee},${Ee},${Et}\\)$`),qo={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};mo($t,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ko,formatHex:Ko,formatHex8:qu,formatHsl:Ku,formatRgb:Uo,toString:Uo});function Ko(){return this.rgb().formatHex()}function qu(){return this.rgb().formatHex8()}function Ku(){return zi(this).formatHsl()}function Uo(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Bu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Qo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ht(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ht(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=Fu.exec(e))?new ae(t[1],t[2],t[3],1):(t=Yu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Xu.exec(e))?Ht(t[1],t[2],t[3],t[4]):(t=Zu.exec(e))?Ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wu.exec(e))?tr(t[1],t[2]/100,t[3]/100,1):(t=Gu.exec(e))?tr(t[1],t[2]/100,t[3]/100,t[4]):qo.hasOwnProperty(e)?Qo(qo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Qo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ht(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function Uu(e){return e instanceof $t||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Jn(e,t,n,o){return arguments.length===1?Uu(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}mo(ae,Jn,Li($t,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,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),nn(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:Jo,formatHex:Jo,formatHex8:Qu,formatRgb:er,toString:er}));function Jo(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function Qu(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function er(){const e=nn(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function nn(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 He(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function tr(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function zi(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof $t||(e=Fe(e)),!e)return new he;if(e instanceof he)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,l=(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/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function Ju(e,t,n,o){return arguments.length===1?zi(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}mo(he,Ju,Li($t,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,e),new he(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(Pn(e>=240?e-240:e+120,r,o),Pn(e,r,o),Pn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(nr(this.h),Vt(this.s),Vt(this.l),nn(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=nn(this.opacity);return`${e===1?"hsl(":"hsla("}${nr(this.h)}, ${Vt(this.s)*100}%, ${Vt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function nr(e){return e=(e||0)%360,e<0?e+360:e}function Vt(e){return Math.max(0,Math.min(1,e||0))}function Pn(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 yo=e=>()=>e;function ed(e,t){return function(n){return e+n*t}}function td(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 nd(e){return(e=+e)==1?ji:function(t,n){return n-t?td(t,n,e):yo(isNaN(t)?n:t)}}function ji(e,t){var n=t-e;return n?ed(e,n):yo(isNaN(e)?t:e)}const on=function e(t){var n=nd(t);function o(r,i){var s=n((r=Jn(r)).r,(i=Jn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ji(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o}(1);function od(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 rd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function id(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]=wt(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 sd(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ad(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]=wt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var eo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$n=new RegExp(eo.source,"g");function cd(e){return function(){return e}}function ld(e){return function(t){return e(t)+""}}function Hi(e,t){var n=eo.lastIndex=$n.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=eo.exec(e))&&(r=$n.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,l.push({i:s,x:ve(o,r)})),n=$n.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?ld(l[0].x):cd(t):(t=l.length,function(c){for(var u=0,f;u<t;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function wt(e,t){var n=typeof t,o;return t==null||n==="boolean"?yo(t):(n==="number"?ve:n==="string"?(o=Fe(t))?(t=o,on):Hi:t instanceof Fe?on:t instanceof Date?sd:rd(t)?od:Array.isArray(t)?id:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ad:ve)(e,t)}var or=180/Math.PI,to={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vi(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*or,skewX:Math.atan(l)*or,scaleX:s,scaleY:a}}var Bt;function ud(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?to:Vi(t.a,t.b,t.c,t.d,t.e,t.f)}function dd(e){return e==null||(Bt||(Bt=document.createElementNS("http://www.w3.org/2000/svg","g")),Bt.setAttribute("transform",e),!(e=Bt.transform.baseVal.consolidate()))?to:(e=e.matrix,Vi(e.a,e.b,e.c,e.d,e.e,e.f))}function Bi(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,f,d,h,g){if(c!==f||u!==d){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:ve(c,f)},{i:w-2,x:ve(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:ve(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:ve(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,h,g){if(c!==f||u!==d){var w=h.push(r(h)+"scale(",null,",",null,")");g.push({i:w-4,x:ve(c,f)},{i:w-2,x:ve(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,d),s(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(h){for(var g=-1,w=d.length,m;++g<w;)f[(m=d[g]).i]=m.x(h);return f.join("")}}}var fd=Bi(ud,"px, ","px)","deg)"),hd=Bi(dd,", ",")",")"),gd=1e-12;function rr(e){return((e=Math.exp(e))+1/e)/2}function pd(e){return((e=Math.exp(e))-1/e)/2}function md(e){return((e=Math.exp(2*e))-1)/(e+1)}const qt=function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-l,w=h*h+g*g,m,p;if(w<gd)p=Math.log(d/c)/t,m=function(S){return[a+S*h,l+S*g,c*Math.exp(t*S*p)]};else{var b=Math.sqrt(w),y=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),_=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(x*x+1)-x);p=(E-_)/t,m=function(S){var C=S*p,A=rr(_),z=c/(n*b)*(A*md(t*C+_)-pd(_));return[a+z*h,l+z*g,c*A/rr(t*C+_)]}}return m.duration=p*1e3*t/Math.SQRT2,m}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r}(Math.SQRT2,2,4);var tt=0,pt=0,ht=0,Fi=1e3,rn,mt,sn=0,Ye=0,mn=0,_t=typeof performance=="object"&&performance.now?performance:Date,Yi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wo(){return Ye||(Yi(yd),Ye=_t.now()+mn)}function yd(){Ye=0}function an(){this._call=this._time=this._next=null}an.prototype=Xi.prototype={constructor:an,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?wo():+n)+(t==null?0:+t),!this._next&&mt!==this&&(mt?mt._next=this:rn=this,mt=this),this._call=e,this._time=n,no()},stop:function(){this._call&&(this._call=null,this._time=1/0,no())}};function Xi(e,t,n){var o=new an;return o.restart(e,t,n),o}function wd(){wo(),++tt;for(var e=rn,t;e;)(t=Ye-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tt}function ir(){Ye=(sn=_t.now())+mn,tt=pt=0;try{wd()}finally{tt=0,vd(),Ye=0}}function xd(){var e=_t.now(),t=e-sn;t>Fi&&(mn-=t,sn=e)}function vd(){for(var e,t=rn,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:rn=n);mt=e,no(o)}function no(e){if(!tt){pt&&(pt=clearTimeout(pt));var t=e-Ye;t>24?(e<1/0&&(pt=setTimeout(ir,e-_t.now()-mn)),ht&&(ht=clearInterval(ht))):(ht||(sn=_t.now(),ht=setInterval(xd,Fi)),tt=1,Yi(ir))}}function sr(e,t,n){var o=new an;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var bd=gn("start","end","cancel","interrupt"),Ed=[],Zi=0,ar=1,oo=2,Kt=3,cr=4,ro=5,Ut=6;function yn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;_d(e,n,{name:t,index:o,group:r,on:bd,tween:Ed,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zi})}function xo(e,t){var n=ye(e,t);if(n.state>Zi)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Kt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function _d(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Xi(i,0,n.time);function i(c){n.state=ar,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,d,h;if(n.state!==ar)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Kt)return sr(s);h.state===cr?(h.state=Ut,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Ut,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(sr(function(){n.state===Kt&&(n.state=cr,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=oo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===oo){for(n.state=Kt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=ro,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===ro&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ut,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Qt(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>oo&&o.state<ro,o.state=Ut,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Nd(e){return this.each(function(){Qt(this,e)})}function Sd(e,t){var n,o;return function(){var r=_e(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 kd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Cd(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(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?Sd:kd)(n,e,t))}function vo(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function Wi(e,t){var n;return(typeof t=="number"?ve:t instanceof Fe?on:(n=Fe(t))?(t=n,on):Hi)(e,t)}function Md(e){return function(){this.removeAttribute(e)}}function Id(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Od(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 Ad(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 Pd(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function $d(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Td(e,t){var n=pn(e),o=n==="transform"?hd:Wi;return this.attrTween(e,typeof t=="function"?(n.local?$d:Pd)(n,o,vo(this,"attr."+e,t)):t==null?(n.local?Id:Md)(n):(n.local?Ad:Od)(n,o,t))}function Dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Rd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ld(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Rd(e,i)),n}return r._value=t,r}function zd(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Dd(e,i)),n}return r._value=t,r}function jd(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=pn(e);return this.tween(n,(o.local?Ld:zd)(o,t))}function Hd(e,t){return function(){xo(this,e).delay=+t.apply(this,arguments)}}function Vd(e,t){return t=+t,function(){xo(this,e).delay=t}}function Bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hd:Vd)(t,e)):ye(this.node(),t).delay}function Fd(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Yd(e,t){return t=+t,function(){_e(this,e).duration=t}}function Xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Fd:Yd)(t,e)):ye(this.node(),t).duration}function Zd(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Wd(e){var t=this._id;return arguments.length?this.each(Zd(t,e)):ye(this.node(),t).ease}function Gd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function qd(e){if(typeof e!="function")throw new Error;return this.each(Gd(this._id,e))}function Kd(e){typeof e!="function"&&(e=Ni(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]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Ae(o,this._parents,this._name,this._id)}function Ud(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 l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function Qd(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 Jd(e,t,n){var o,r,i=Qd(t)?xo:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ef(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(Jd(n,e,t))}function tf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nf(){return this.on("end.remove",tf(this._id))}function of(e){var t=this._name,n=this._id;typeof e!="function"&&(e=go(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,yn(c[d],t,n,d,c,ye(u,n)));return new Ae(i,this._parents,t,n)}function rf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_i(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),h,g=ye(u,n),w=0,m=d.length;w<m;++w)(h=d[w])&&yn(h,t,n,w,d,g);i.push(d),s.push(u)}return new Ae(i,s,t,n)}var sf=Pt.prototype.constructor;function af(){return new sf(this._groups,this._parents)}function cf(e,t){var n,o,r;return function(){var i=et(this,e),s=(this.style.removeProperty(e),et(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Gi(e){return function(){this.style.removeProperty(e)}}function lf(e,t,n){var o,r=n+"",i;return function(){var s=et(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function uf(e,t,n){var o,r,i;return function(){var s=et(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),et(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function df(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),c=l.on,u=l.value[i]==null?a||(a=Gi(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function ff(e,t,n){var o=(e+="")=="transform"?fd:Wi;return t==null?this.styleTween(e,cf(e,o)).on("end.style."+e,Gi(e)):typeof t=="function"?this.styleTween(e,uf(e,o,vo(this,"style."+e,t))).each(df(this._id,e)):this.styleTween(e,lf(e,o,t),n).on("end.style."+e,null)}function hf(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function gf(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&hf(e,s,n)),o}return i._value=t,i}function pf(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,gf(e,t,n??""))}function mf(e){return function(){this.textContent=e}}function yf(e){return function(){var t=e(this);this.textContent=t??""}}function wf(e){return this.tween("text",typeof e=="function"?yf(vo(this,"text",e)):mf(e==null?"":e+""))}function xf(e){return function(t){this.textContent=e.call(this,t)}}function vf(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&xf(r)),t}return o._value=e,o}function bf(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,vf(e))}function Ef(){for(var e=this._name,t=this._id,n=qi(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=ye(l,t);yn(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ae(o,this._parents,e,n)}function _f(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=_e(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Nf=0;function Ae(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function qi(){return++Nf}var Ie=Pt.prototype;Ae.prototype={constructor:Ae,select:of,selectAll:rf,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Kd,merge:Ud,selection:af,transition:Ef,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:ef,attr:Td,attrTween:jd,style:ff,styleTween:pf,text:wf,textTween:bf,remove:nf,tween:Cd,delay:Bd,duration:Xd,ease:Wd,easeVarying:qd,end:_f,[Symbol.iterator]:Ie[Symbol.iterator]};function Sf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kf={time:null,delay:0,duration:250,ease:Sf};function Cf(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 Mf(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=qi(),(n=kf).time=wo(),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,l,c=0;c<a;++c)(l=s[c])&&yn(l,e,t,c,s,n||Cf(l,t));return new Ae(o,this._parents,e,t)}Pt.prototype.interrupt=Nd;Pt.prototype.transition=Mf;const Ft=e=>()=>e;function If(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 Oe(e,t,n){this.k=e,this.x=t,this.y=n}Oe.prototype={constructor:Oe,scale:function(e){return e===1?this:new Oe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Oe(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 wn=new Oe(1,0,0);Ki.prototype=Oe.prototype;function Ki(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wn;return e.__zoom}function Tn(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function Of(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Af(){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 lr(){return this.__zoom||wn}function Pf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $f(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tf(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 Ui(){var e=Of,t=Af,n=Tf,o=Pf,r=$f,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=qt,c=gn("start","zoom","end"),u,f,d,h=500,g=150,w=0,m=10;function p(v){v.property("__zoom",lr).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(v,N,k,O){var R=v.selection?v.selection():v;R.property("__zoom",lr),v!==R?_(v,N,k,O):R.interrupt().each(function(){E(this,arguments).event(O).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},p.scaleBy=function(v,N,k,O){p.scaleTo(v,function(){var R=this.__zoom.k,D=typeof N=="function"?N.apply(this,arguments):N;return R*D},k,O)},p.scaleTo=function(v,N,k,O){p.transform(v,function(){var R=t.apply(this,arguments),D=this.__zoom,V=k==null?x(R):typeof k=="function"?k.apply(this,arguments):k,H=D.invert(V),j=typeof N=="function"?N.apply(this,arguments):N;return n(y(b(D,j),V,H),R,s)},k,O)},p.translateBy=function(v,N,k,O){p.transform(v,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),s)},null,O)},p.translateTo=function(v,N,k,O,R){p.transform(v,function(){var D=t.apply(this,arguments),V=this.__zoom,H=O==null?x(D):typeof O=="function"?O.apply(this,arguments):O;return n(wn.translate(H[0],H[1]).scale(V.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof k=="function"?-k.apply(this,arguments):-k),D,s)},O,R)};function b(v,N){return N=Math.max(i[0],Math.min(i[1],N)),N===v.k?v:new Oe(N,v.x,v.y)}function y(v,N,k){var O=N[0]-k[0]*v.k,R=N[1]-k[1]*v.k;return O===v.x&&R===v.y?v:new Oe(v.k,O,R)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function _(v,N,k,O){v.on("start.zoom",function(){E(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(O).end()}).tween("zoom",function(){var R=this,D=arguments,V=E(R,D).event(O),H=t.apply(R,D),j=k==null?x(H):typeof k=="function"?k.apply(R,D):k,X=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),F=R.__zoom,W=typeof N=="function"?N.apply(R,D):N,Q=l(F.invert(j).concat(X/F.k),W.invert(j).concat(X/W.k));return function(G){if(G===1)G=W;else{var L=Q(G),B=X/L[2];G=new Oe(B,j[0]-L[0]*B,j[1]-L[1]*B)}V.zoom(null,G)}})}function E(v,N,k){return!k&&v.__zooming||new S(v,N)}function S(v,N){this.that=v,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,N),this.taps=0}S.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,N){return this.mouse&&v!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var N=ce(this.that).datum();c.call(v,this.that,new If(v,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:c}),N)}};function C(v,...N){if(!e.apply(this,arguments))return;var k=E(this,N).event(v),O=this.__zoom,R=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,o.apply(this,arguments)))),D=fe(v);if(k.wheel)(k.mouse[0][0]!==D[0]||k.mouse[0][1]!==D[1])&&(k.mouse[1]=O.invert(k.mouse[0]=D)),clearTimeout(k.wheel);else{if(O.k===R)return;k.mouse=[D,O.invert(D)],Qt(this),k.start()}gt(v),k.wheel=setTimeout(V,g),k.zoom("mouse",n(y(b(O,R),k.mouse[0],k.mouse[1]),k.extent,s));function V(){k.wheel=null,k.end()}}function A(v,...N){if(d||!e.apply(this,arguments))return;var k=v.currentTarget,O=E(this,N,!0).event(v),R=ce(v.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",X,!0),D=fe(v,k),V=v.clientX,H=v.clientY;Ti(v.view),Tn(v),O.mouse=[D,this.__zoom.invert(D)],Qt(this),O.start();function j(F){if(gt(F),!O.moved){var W=F.clientX-V,Q=F.clientY-H;O.moved=W*W+Q*Q>w}O.event(F).zoom("mouse",n(y(O.that.__zoom,O.mouse[0]=fe(F,k),O.mouse[1]),O.extent,s))}function X(F){R.on("mousemove.zoom mouseup.zoom",null),Di(F.view,O.moved),gt(F),O.event(F).end()}}function z(v,...N){if(e.apply(this,arguments)){var k=this.__zoom,O=fe(v.changedTouches?v.changedTouches[0]:v,this),R=k.invert(O),D=k.k*(v.shiftKey?.5:2),V=n(y(b(k,D),O,R),t.apply(this,N),s);gt(v),a>0?ce(this).transition().duration(a).call(_,V,O,v):ce(this).call(p.transform,V,O,v)}}function P(v,...N){if(e.apply(this,arguments)){var k=v.touches,O=k.length,R=E(this,N,v.changedTouches.length===O).event(v),D,V,H,j;for(Tn(v),V=0;V<O;++V)H=k[V],j=fe(H,this),j=[j,this.__zoom.invert(j),H.identifier],R.touch0?!R.touch1&&R.touch0[2]!==j[2]&&(R.touch1=j,R.taps=0):(R.touch0=j,D=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(R.taps<2&&(f=j[0],u=setTimeout(function(){u=null},h)),Qt(this),R.start())}}function $(v,...N){if(this.__zooming){var k=E(this,N).event(v),O=v.changedTouches,R=O.length,D,V,H,j;for(gt(v),D=0;D<R;++D)V=O[D],H=fe(V,this),k.touch0&&k.touch0[2]===V.identifier?k.touch0[0]=H:k.touch1&&k.touch1[2]===V.identifier&&(k.touch1[0]=H);if(V=k.that.__zoom,k.touch1){var X=k.touch0[0],F=k.touch0[1],W=k.touch1[0],Q=k.touch1[1],G=(G=W[0]-X[0])*G+(G=W[1]-X[1])*G,L=(L=Q[0]-F[0])*L+(L=Q[1]-F[1])*L;V=b(V,Math.sqrt(G/L)),H=[(X[0]+W[0])/2,(X[1]+W[1])/2],j=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(k.touch0)H=k.touch0[0],j=k.touch0[1];else return;k.zoom("touch",n(y(V,H,j),k.extent,s))}}function M(v,...N){if(this.__zooming){var k=E(this,N).event(v),O=v.changedTouches,R=O.length,D,V;for(Tn(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<R;++D)V=O[D],k.touch0&&k.touch0[2]===V.identifier?delete k.touch0:k.touch1&&k.touch1[2]===V.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(V=fe(V,this),Math.hypot(f[0]-V[0],f[1]-V[1])<m)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return p.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Ft(+v),p):o},p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Ft(!!v),p):e},p.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Ft(!!v),p):r},p.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Ft([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),p):t},p.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],p):[i[0],i[1]]},p.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(v){return arguments.length?(n=v,p):n},p.duration=function(v){return arguments.length?(a=+v,p):a},p.interpolate=function(v){return arguments.length?(l=v,p):l},p.on=function(){var v=c.on.apply(c,arguments);return v===c?p:v},p.clickDistance=function(v){return arguments.length?(w=(v=+v)*v,p):Math.sqrt(w)},p.tapDistance=function(v){return arguments.length?(m=+v,p):m},p}const me={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.`},Nt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qi=["Enter"," ","Escape"],Ji={"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 nt;(function(e){e.Strict="strict",e.Loose="loose"})(nt||(nt={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var St;(function(e){e.Partial="partial",e.Full="full"})(St||(St={}));const es={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Te;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Te||(Te={}));var kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(kt||(kt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const ur={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function ts(e){return e===null?null:e?"valid":"invalid"}const ns=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Df=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),bo=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Tt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Rf=(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):bo(r)?r:t.nodeLookup.get(r.id));const a=s?cn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return xn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vn(n)},Dt=(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=xn(n,cn(r)),o=!0)}),o?vn(n):{x:0,y:0,width:0,height:0}},Eo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,u=t.height/r,f=[];for(const d of e.values()){const{measured:h,selectable:g=!0,hidden:w=!1}=d;if(s&&!g||w)continue;const m=h.width??d.width??d.initialWidth??0,p=h.height??d.height??d.initialHeight??0,{x:b,y}=d.internals.positionAbsolute,x=ss(a,l,c,u,b,y,m,p),_=m*p,E=i&&x>0;(!d.internals.handleBounds||E||x>=_||d.dragging)&&f.push(d)}return f},Lf=(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 zf(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}=Ne(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 jf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=zf(e,s),l=Dt(a),c=No(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function os({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:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[l,c],[l+h,c+g]])}else a&&Ze(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=Ze(f)?Xe(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",me.error015()),{position:{x:d.x-l+(s.measured.width??0)*u[0],y:d.y-c+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Hf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(w=>w.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Lf(s,l);for(const d of l)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const ot=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:ot(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ot(e.y,t[0][1],t[1][1]-(n?.height??0))});function rs(e,t,n){const{width:o,height:r}=Ne(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const dr=(e,t,n)=>e<t?ot(Math.abs(e-t),1,t)/t:e>n?-ot(Math.abs(e-n),1,t)/t:0,_o=(e,t,n=15,o=40)=>{const r=dr(e.x,o,t.width-o)*n,i=dr(e.y,o,t.height-o)*n;return[r,i]},xn=(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)}),io=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),vn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ct=(e,t=[0,0])=>{const{x:n,y:o}=bo(e)?e.internals.positionAbsolute:Tt(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}},cn=(e,t=[0,0])=>{const{x:n,y:o}=bo(e)?e.internals.positionAbsolute:Tt(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)}},is=(e,t)=>vn(xn(io(e),io(t))),ss=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},ln=(e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),fr=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),as=(e,t)=>(n,o)=>{},Rt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Rt(a,s):a},rt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function qe(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 Vf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=qe(e,n),r=qe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=qe(e.top??e.y??0,n),r=qe(e.bottom??e.y??0,n),i=qe(e.left??e.x??0,t),s=qe(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 Bf(e,t,n,o,r,i){const{x:s,y:a}=rt(e,[t,n,o]),{x:l,y:c}=rt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const No=(e,t,n,o,r,i)=>{const s=Vf(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=ot(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,w=Bf(e,h,g,u,t,n),m={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-m.left+m.right,y:g-m.top+m.bottom,zoom:u}},Mt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ze(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ls(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 hr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ff(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Yf(e){return{...Ji,...e||{}}}function xt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=Lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Rt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const So=e=>({width:e.offsetWidth,height:e.offsetHeight}),us=e=>e?.getRootNode?.()||window?.document,Xf=["INPUT","SELECT","TEXTAREA"];function ds(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Xf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const fs=e=>"clientX"in e,pe=(e,t)=>{const n=fs(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)}},gr=(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,...So(s)}})};function hs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function Yt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function pr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-Yt(t-o,i),n];case Y.Right:return[t+Yt(o-t,i),n];case Y.Top:return[t,n-Yt(n-r,i)];case Y.Bottom:return[t,n+Yt(r-n,i)]}}function ko({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=pr({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=pr({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=hs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,h,g]}function gs({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 Zf({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 Wf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=xn(cn(e),cn(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 ln(s,vn(i))>0}const Gf=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,qf=(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)),Kf=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",me.error006()),t;const o=n.getEdgeId||Gf;let r;return ns(e)?r={...e}:r={...e,id:o(e)},qf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ps({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=gs({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const mr={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Uf=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},yr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Qf({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=mr[t],l=mr[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},f=Uf({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],w,m;const p={x:0,y:0},b={x:0,y:0},[,,y,x]=gs({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*s,m=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,m=r.y??c.y+(u.y-c.y)*s);const C=[{x:w,y:c.y},{x:w,y:u.y}],A=[{x:c.x,y:m},{x:u.x,y:m}];a[d]===h?g=d==="x"?C:A:g=d==="x"?A:C}else{const C=[{x:c.x,y:u.y}],A=[{x:u.x,y:c.y}];if(d==="x"?g=a.x===h?A:C:g=a.y===h?C:A,t===o){const v=Math.abs(e[d]-n[d]);if(v<=i){const N=Math.min(i-1,i-v);a[d]===h?p[d]=(c[d]>e[d]?-1:1)*N:b[d]=(u[d]>n[d]?-1:1)*N}}if(t!==o){const v=d==="x"?"y":"x",N=a[d]===l[v],k=c[v]>u[v],O=c[v]<u[v];(a[d]===1&&(!N&&k||N&&O)||a[d]!==1&&(!N&&O||N&&k))&&(g=d==="x"?C:A)}const z={x:c.x+p.x,y:c.y+p.y},P={x:u.x+b.x,y:u.y+b.y},$=Math.max(Math.abs(z.x-g[0].x),Math.abs(P.x-g[0].x)),M=Math.max(Math.abs(z.y-g[0].y),Math.abs(P.y-g[0].y));$>=M?(w=(z.x+P.x)/2,m=g[0].y):(w=g[0].x,m=(z.y+P.y)/2)}const _={x:c.x+p.x,y:c.y+p.y},E={x:u.x+b.x,y:u.y+b.y};return[[e,..._.x!==g[0].x||_.y!==g[0].y?[_]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],w,m,y,x]}function Jf(e,t,n,o){const r=Math.min(yr(e,t)/2,yr(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 c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function so({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,h,g,w]=Qf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});let m=`M${f[0].x} ${f[0].y}`;for(let p=1;p<f.length-1;p++)m+=Jf(f[p-1],f[p],f[p+1],s);return m+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[m,d,h,g,w]}function wr(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function eh(e){const{sourceNode:t,targetNode:n}=e;if(!wr(t)||!wr(n))return null;const o=t.internals.handleBounds||xr(t.handles),r=n.internals.handleBounds||xr(n.handles),i=vr(o?.source??[],e.sourceHandle),s=vr(e.connectionMode===nt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=We(t,i,a),u=We(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function xr(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 We(e,t,n=Y.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??Ne(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function vr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ao(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function th(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(l=>{if(l&&typeof l=="object"){const c=ao(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ms=1e3,nh=10,Co={nodeOrigin:[0,0],nodeExtent:Nt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},oh={...Co,checkEquality:!0};function Mo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function rh(e,t,n){const o=Mo(Co,n);for(const r of e.values())if(r.parentId)Oo(r,e,t,o);else{const i=Tt(r,o.nodeOrigin),s=Ze(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,Ne(r));r.internals.positionAbsolute=a}}function ih(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 Io(e){return e==="manual"}function co(e,t,n,o={}){const r=Mo(oh,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Io(r.zIndexMode)?ms:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{const d=Tt(u,r.nodeOrigin),h=Ze(u.extent)?u.extent:r.nodeExtent,g=Xe(d,h,Ne(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:ih(u,f),z:ys(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(l=!1),u.parentId&&Oo(f,t,n,o,i),c||=u.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function sh(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 Oo(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Mo(Co,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}sh(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*nh),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!Io(l)?ms:0,{x:d,y:h,z:g}=ah(e,u,s,a,f,l),{positionAbsolute:w}=e.internals,m=d!==w.x||h!==w.y;(m||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:w,z:g}})}function ys(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return Io(n)?o:o+(e.selected?t:0)}function ah(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Tt(e,n),u=Ze(e.extent)?Xe(c,e.extent,l):c;let f=Xe({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=rs(f,l,t));const d=ys(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Ao(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 l=i.get(s.parentId)?.expandedRect??Ct(a),c=is(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),f=a.origin??o,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),m=(g-u.width)*f[0],p=(w-u.height)*f[1];(d>0||h>0||m||p)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+p}}),n.get(l)?.forEach(b=>{e.some(y=>y.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-m:0),height:w+(h?f[1]*h-p:0)}})}),r}function ch(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];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}}),l=!0;continue}const w=So(h.nodeElement),m=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(m||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),y=Ze(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;if(g.parentId&&g.extent==="parent"){const E=t.get(g.parentId);E&&(x=rs(x,w,E))}else y&&(x=Xe(x,y,w));const _={...g,measured:w,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:gr("source",h.nodeElement,b,f,g.id),target:gr("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,_),g.parentId&&Oo(_,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,m&&(c.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ct(_,r)}))}}if(d.length>0){const h=Ao(d,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function lh({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 br(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 l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function ws(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;br("source",l,u,e,r,s),br("target",l,c,e,i,a),t.set(o.id,o)}}function xs(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xs(n,t):!1}function Er(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 uh(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xs(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 Dn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,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 dh({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=Rt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function fh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,w=null;function m({noDragClassName:b,handleSelector:y,domNode:x,isSelectable:_,nodeId:E,nodeClickDistance:S=0}){d=ce(x);function C({x:$,y:M}){const{nodeLookup:v,nodeExtent:N,snapGrid:k,snapToGrid:O,nodeOrigin:R,onNodeDrag:D,onSelectionDrag:V,onError:H,updateNodePositions:j}=t();i={x:$,y:M};let X=!1;const F=a.size>1,W=F&&N?io(Dt(a)):null,Q=F&&O?dh({dragItems:a,snapGrid:k,x:$,y:M}):null;for(const[G,L]of a){if(!v.has(G))continue;let B={x:$-L.distance.x,y:M-L.distance.y};O&&(B=Q?{x:Math.round(B.x+Q.x),y:Math.round(B.y+Q.y)}:Rt(B,k));let U=null;if(F&&N&&!L.extent&&W){const{positionAbsolute:q}=L.internals,J=q.x-W.x+N[0][0],te=q.x+L.measured.width-W.x2+N[1][0],oe=q.y-W.y+N[0][1],se=q.y+L.measured.height-W.y2+N[1][1];U=[[J,oe],[te,se]]}const{position:K,positionAbsolute:Z}=os({nodeId:G,nextPosition:B,nodeLookup:v,nodeExtent:U||N,nodeOrigin:R,onError:H});X=X||L.position.x!==K.x||L.position.y!==K.y,L.position=K,L.internals.positionAbsolute=Z}if(g=g||X,!!X&&(j(a,!0),w&&(o||D||!E&&V))){const[G,L]=Dn({nodeId:E,dragItems:a,nodeLookup:v});o?.(w,a,G,L),D?.(w,G,L),E||V?.(w,L)}}async function A(){if(!u)return;const{transform:$,panBy:M,autoPanSpeed:v,autoPanOnNodeDrag:N}=t();if(!N){l=!1,cancelAnimationFrame(s);return}const[k,O]=_o(c,u,v);(k!==0||O!==0)&&(i.x=(i.x??0)-k/$[2],i.y=(i.y??0)-O/$[2],await M({x:k,y:O})&&C(i)),s=requestAnimationFrame(A)}function z($){const{nodeLookup:M,multiSelectionActive:v,nodesDraggable:N,transform:k,snapGrid:O,snapToGrid:R,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:H,unselectNodesAndEdges:j}=t();f=!0,(!D||!_)&&!v&&E&&(M.get(E)?.selected||j()),_&&D&&E&&e?.(E);const X=xt($.sourceEvent,{transform:k,snapGrid:O,snapToGrid:R,containerBounds:u});if(i=X,a=uh(M,N,X,E),a.size>0&&(n||V||!E&&H)){const[F,W]=Dn({nodeId:E,dragItems:a,nodeLookup:M});n?.($.sourceEvent,a,F,W),V?.($.sourceEvent,F,W),E||H?.($.sourceEvent,W)}}const P=Ri().clickDistance(S).on("start",$=>{const{domNode:M,nodeDragThreshold:v,transform:N,snapGrid:k,snapToGrid:O}=t();u=M?.getBoundingClientRect()||null,h=!1,g=!1,w=$.sourceEvent,v===0&&z($),i=xt($.sourceEvent,{transform:N,snapGrid:k,snapToGrid:O,containerBounds:u}),c=pe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:M,transform:v,snapGrid:N,snapToGrid:k,nodeDragThreshold:O,nodeLookup:R}=t(),D=xt($.sourceEvent,{transform:v,snapGrid:N,snapToGrid:k,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!R.has(E))&&(h=!0),!h){if(!l&&M&&f&&(l=!0,A()),!f){const V=pe($.sourceEvent,u),H=V.x-c.x,j=V.y-c.y;Math.sqrt(H*H+j*j)>O&&z($)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&f&&(c=pe($.sourceEvent,u),C(D))}}).on("end",$=>{if(!f||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:M,updateNodePositions:v,onNodeDragStop:N,onSelectionDragStop:k}=t();if(g&&(v(a,!1),g=!1),r||N||!E&&k){const[O,R]=Dn({nodeId:E,dragItems:a,nodeLookup:M,dragging:!1});r?.($.sourceEvent,a,O,R),N?.($.sourceEvent,O,R),E||k?.($.sourceEvent,R)}}}).filter($=>{const M=$.target;return!$.button&&(!b||!Er(M,`.${b}`,x))&&(!y||Er(M,y,x))});d.call(P)}function p(){d?.on(".drag",null)}return{update:m,destroy:p}}function hh(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())ln(r,Ct(i))>0&&o.push(i);return o}const gh=250;function ph(e,t,n,o){let r=[],i=1/0;const s=hh(e,n,t+gh);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:f}=We(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...c,x:u,y:f}],i=d):d===i&&r.push({...c,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function vs(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??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...We(s,l,l.position,!0)}:l}function bs(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function mh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Es=()=>!0;function yh(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:m,isValidConnection:p=Es,onReconnectEnd:b,updateConnection:y,getTransform:x,getFromHandle:_,autoPanSpeed:E,dragThreshold:S=1,handleDomNode:C}){const A=us(e.target);let z=0,P;const{x:$,y:M}=pe(e),v=bs(i,C),N=a?.getBoundingClientRect();let k=!1;if(!N||!v)return;const O=vs(r,v,o,l,t);if(!O)return;let R=pe(e,N),D=!1,V=null,H=!1,j=null;function X(){if(!u||!N)return;const[K,Z]=_o(R,N,E);d({x:K,y:Z}),z=requestAnimationFrame(X)}const F={...O,nodeId:r,type:v,position:O.position},W=l.get(r);let G={inProgress:!0,isValid:null,from:We(W,F,Y.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:R,toHandle:null,toPosition:ur[F.position],toNode:null,pointer:R};function L(){k=!0,y(G),g?.(e,{nodeId:r,handleId:o,handleType:v})}S===0&&L();function B(K){if(!k){const{x:se,y:Se}=pe(K),we=se-$,xe=Se-M;if(!(we*we+xe*xe>S*S))return;L()}if(!_()||!F){U(K);return}const Z=x();R=pe(K,N),P=ph(Lt(R,Z,!1,[1,1]),n,l,F),D||(X(),D=!0);const q=_s(K,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:p,doc:A,lib:c,flowId:f,nodeLookup:l});j=q.handleDomNode,V=q.connection,H=mh(!!P,q.isValid);const J=l.get(r),te=J?We(J,F,Y.Left,!0):G.from,oe={...G,from:te,isValid:H,to:q.toHandle&&H?rt({x:q.toHandle.x,y:q.toHandle.y},Z):R,toHandle:q.toHandle,toPosition:H&&q.toHandle?q.toHandle.position:ur[F.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:R};y(oe),G=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(k){(P||j)&&V&&H&&w?.(V);const{inProgress:Z,...q}=G,J={...q,toPosition:G.toHandle?G.toPosition:null};m?.(K,J),i&&b?.(K,J)}h(),cancelAnimationFrame(z),D=!1,H=!1,V=null,j=null,A.removeEventListener("mousemove",B),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",B),A.removeEventListener("touchend",U)}}A.addEventListener("mousemove",B),A.addEventListener("mouseup",U),A.addEventListener("touchmove",B),A.addEventListener("touchend",U)}function _s(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Es,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=pe(e),w=s.elementFromPoint(h,g),m=w?.classList.contains(`${a}-flow__handle`)?w:d,p={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const b=bs(void 0,m),y=m.getAttribute("data-nodeid"),x=m.getAttribute("data-handleid"),_=m.classList.contains("connectable"),E=m.classList.contains("connectableend");if(!y||!b)return p;const S={source:f?y:o,sourceHandle:f?x:r,target:f?o:y,targetHandle:f?r:x};p.connection=S;const A=_&&E&&(n===nt.Strict?f&&b==="source"||!f&&b==="target":y!==o||x!==r);p.isValid=A&&c(S),p.toHandle=vs(y,b,x,u,n,!0)}return p}const lo={onPointerDown:yh,isValid:_s};function wh({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const x=n(),_=y.sourceEvent.ctrlKey&&Mt()?10:1,E=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*u,S=x[2]*Math.pow(2,E*_);t.scaleTo(S)};let w=[0,0];const m=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(w=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},p=y=>{const x=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const _=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],E=[_[0]-w[0],_[1]-w[1]];w=_;const S=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),C={x:x[0]-E[0]*S,y:x[1]-E[1]*S},A=[[0,0],[l,c]];t.setViewportConstrained({x:C.x,y:C.y,zoom:x[2]},A,a)},b=Ui().on("start",m).on("zoom",f?p:null).on("zoom.wheel",d?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const bn=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>wn.translate(e,t).scale(n),Ke=(e,t)=>e.target.closest(`.${t}`),Ns=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),xh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ln=(e,t=0,n=xh,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ss=e=>{const t=e.ctrlKey&&Mt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ke(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const m=fe(u),p=Ss(u),b=f*Math.pow(2,p);o.scaleTo(n,b,m,u);return}const d=u.deltaMode===1?20:1;let h=r===Be.Vertical?0:u.deltaX*d,g=r===Be.Horizontal?0:u.deltaY*d;!Mt()&&u.shiftKey&&r!==Be.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const w=bn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)}}function bh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Ke(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Eh({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=bn(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 _h({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ns(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,bn(i.transform))}}function Nh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ns(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=bn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Sh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ke(f,`${c}-flow__node`)||Ke(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||u&&!g||Ke(f,a)&&g||Ke(f,l)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&w}}function kh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{const v=M[0];v&&(f=[[0,0],[v.contentRect.width,v.contentRect.height]])}):null)?.observe(e);const h=Ui().extent(()=>f).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);x({x:r.x,y:r.y,zoom:ot(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const w=g.on("wheel.zoom"),m=g.on("dblclick.zoom");h.wheelDelta(Ss);async function p(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).transform(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}function b({noWheelClassName:M,noPanClassName:v,onPaneContextMenu:N,userSelectionActive:k,panOnScroll:O,panOnDrag:R,panOnScrollMode:D,panOnScrollSpeed:V,preventScrolling:H,zoomOnPinch:j,zoomOnScroll:X,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:Q,onTransformChange:G,connectionInProgress:L,paneClickDistance:B,selectionOnDrag:U}){k&&!c.isZoomingOrPanning&&y();const K=O&&!W&&!k;h.clickDistance(U?1/0:!ge(B)||B<0?0:B);const Z=K?vh({zoomPanValues:c,noWheelClassName:M,d3Selection:g,d3Zoom:h,panOnScrollMode:D,panOnScrollSpeed:V,zoomOnPinch:j,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):bh({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});g.on("wheel.zoom",Z,{passive:!1});const q=Eh({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",q);const J=_h({zoomPanValues:c,panOnDrag:R,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:G});h.on("zoom",J);const te=Nh({zoomPanValues:c,panOnDrag:R,panOnScroll:O,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=Sh({zoomActivationKeyPressed:W,panOnDrag:R,zoomOnScroll:X,panOnScroll:O,zoomOnDoubleClick:F,zoomOnPinch:j,userSelectionActive:k,noPanClassName:v,noWheelClassName:M,lib:Q,connectionInProgress:L});h.filter(oe),F?g.on("dblclick.zoom",m):g.on("dblclick.zoom",null)}function y(){h.on("zoom",null)}async function x(M,v,N){const k=Rn(M),O=h?.constrain()(k,v,N);return O&&await p(O),O}async function _(M,v){const N=Rn(M);return await p(N,v),N}function E(M){if(g){const v=Rn(M),N=g.property("__zoom");(N.k!==M.zoom||N.x!==M.x||N.y!==M.y)&&h?.transform(g,v,null,{sync:!0})}}function S(){const M=g?Ki(g.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function C(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).scaleTo(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}async function A(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).scaleBy(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}function z(M){h?.scaleExtent(M)}function P(M){h?.translateExtent(M)}function $(M){const v=!ge(M)||M<0?0:M;h?.clickDistance(v)}return{update:b,destroy:y,setViewport:_,setViewportConstrained:x,getViewport:S,scaleTo:C,scaleBy:A,setScaleExtent:z,setTranslateExtent:P,syncViewport:E,setClickDistance:$}}var it;(function(e){e.Line="line",e.Handle="handle"})(it||(it={}));function Ch({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function _r(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 Pe(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function Xt(e,t,n){return Math.max(0,t-e,e-n)}function Nr(e,t){return e?!t:t}function Mh(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:m,minHeight:p,maxHeight:b}=o,{x:y,y:x,width:_,height:E,aspectRatio:S}=e;let C=Math.floor(u?h-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const z=_+(l?-C:C),P=E+(c?-A:A),$=-i[0]*_,M=-i[1]*E;let v=Xt(z,w,m),N=Xt(P,p,b);if(s){let R=0,D=0;l&&C<0?R=Pe(y+C+$,s[0][0]):!l&&C>0&&(R=$e(y+z+$,s[1][0])),c&&A<0?D=Pe(x+A+M,s[0][1]):!c&&A>0&&(D=$e(x+P+M,s[1][1])),v=Math.max(v,R),N=Math.max(N,D)}if(a){let R=0,D=0;l&&C>0?R=$e(y+C,a[0][0]):!l&&C<0&&(R=Pe(y+z,a[1][0])),c&&A>0?D=$e(x+A,a[0][1]):!c&&A<0&&(D=Pe(x+P,a[1][1])),v=Math.max(v,R),N=Math.max(N,D)}if(r){if(u){const R=Xt(z/S,p,b)*S;if(v=Math.max(v,R),s){let D=0;!l&&!c||l&&!c&&d?D=$e(x+M+z/S,s[1][1])*S:D=Pe(x+M+(l?C:-C)/S,s[0][1])*S,v=Math.max(v,D)}if(a){let D=0;!l&&!c||l&&!c&&d?D=Pe(x+z/S,a[1][1])*S:D=$e(x+(l?C:-C)/S,a[0][1])*S,v=Math.max(v,D)}}if(f){const R=Xt(P*S,w,m)/S;if(N=Math.max(N,R),s){let D=0;!l&&!c||c&&!l&&d?D=$e(y+P*S+$,s[1][0])/S:D=Pe(y+(c?A:-A)*S+$,s[0][0])/S,N=Math.max(N,D)}if(a){let D=0;!l&&!c||c&&!l&&d?D=Pe(y+P*S,a[1][0])/S:D=$e(y+(c?A:-A)*S,a[0][0])/S,N=Math.max(N,D)}}}A=A+(A<0?N:-N),C=C+(C<0?v:-v),r&&(d?z>P*S?A=(Nr(l,c)?-C:C)/S:C=(Nr(l,c)?-A:A)*S:u?(A=C/S,c=l):(C=A*S,l=c));const k=l?y+C:y,O=c?x+A:x;return{width:_+(l?-C:C),height:E+(c?-A:A),x:i[0]*C*(l?-1:1)+k,y:i[1]*A*(c?-1:1)+O}}const ks={width:0,height:0,x:0,y:0},Ih={...ks,pointerX:0,pointerY:0,aspectRatio:1};function Oh(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,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Ah({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:_r("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:m}){let p={...ks},b={...Ih};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:_r(c)};let y,x=null,_=[],E,S,C,A=!1;const z=Ri().on("start",P=>{const{nodeLookup:$,transform:M,snapGrid:v,snapToGrid:N,nodeOrigin:k,paneDomNode:O}=n();if(y=$.get(t),!y)return;x=O?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:D}=xt(P.sourceEvent,{transform:M,snapGrid:v,snapToGrid:N,containerBounds:x});p={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},b={...p,pointerX:R,pointerY:D,aspectRatio:p.width/p.height},E=void 0,S=Ze(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(E=$.get(y.parentId)),E&&y.extent==="parent"&&(S=[[0,0],[E.measured.width,E.measured.height]]),_=[],C=void 0;for(const[V,H]of $)if(H.parentId===t&&(_.push({id:V,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const j=Oh(H,y,H.origin??k);C?C=[[Math.min(j[0][0],C[0][0]),Math.min(j[0][1],C[0][1])],[Math.max(j[1][0],C[1][0]),Math.max(j[1][1],C[1][1])]]:C=j}h?.(P,{...p})}).on("drag",P=>{const{transform:$,snapGrid:M,snapToGrid:v,nodeOrigin:N}=n(),k=xt(P.sourceEvent,{transform:$,snapGrid:M,snapToGrid:v,containerBounds:x}),O=[];if(!y)return;const{x:R,y:D,width:V,height:H}=p,j={},X=y.origin??N,{width:F,height:W,x:Q,y:G}=Mh(b,s.controlDirection,k,s.boundaries,s.keepAspectRatio,X,S,C),L=F!==V,B=W!==H,U=Q!==R&&L,K=G!==D&&B;if(!U&&!K&&!L&&!B)return;if((U||K||X[0]===1||X[1]===1)&&(j.x=U?Q:p.x,j.y=K?G:p.y,p.x=j.x,p.y=j.y,_.length>0)){const te=Q-R,oe=G-D;for(const se of _)se.position={x:se.position.x-te+X[0]*(F-V),y:se.position.y-oe+X[1]*(W-H)},O.push(se)}if((L||B)&&(j.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:p.width,j.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:p.height,p.width=j.width,p.height=j.height),E&&y.expandParent){const te=X[0]*(j.width??0);j.x&&j.x<te&&(p.x=te,b.x=b.x-(j.x-te));const oe=X[1]*(j.height??0);j.y&&j.y<oe&&(p.y=oe,b.y=b.y-(j.y-oe))}const Z=Ch({width:p.width,prevWidth:V,height:p.height,prevHeight:H,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...p,direction:Z};m?.(P,q)!==!1&&(A=!0,g?.(P,q),o(j,O))}).on("end",P=>{A&&(w?.(P,{...p}),r?.({...p}),A=!1)});i.call(z)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var Cs={exports:{}},Ms={},Is={exports:{}},Os={};/**
|
|
1
|
+
import{r as T,g as Zc,R as Wc,j as I,l as ft,m as Gc,n as qc,o as Kc,p as vi,q as Uc,t as Kn,v as bi,w as Qc,x as Jc}from"./index-l1SxxFJR.js";import{a as el}from"./paged-UVifI3SC.js";function ie(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let n=0,o;n<e.length;n++)(o=ie(e[n]))!==""&&(t+=(t&&" ")+o);else for(let n in e)e[n]&&(t+=(t&&" ")+n);return t}var tl={value:()=>{}};function gn(){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 Gt(n)}function Gt(e){this._=e}function nl(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}})}Gt.prototype=gn.prototype={constructor:Gt,on:function(e,t){var n=this._,o=nl(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=ol(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]=Wo(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Wo(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 Gt(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 ol(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}function Wo(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=tl,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var Un="http://www.w3.org/1999/xhtml";const Go={svg:"http://www.w3.org/2000/svg",xhtml:Un,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function pn(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Go.hasOwnProperty(t)?{space:Go[t],local:e}:e}function rl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Un&&t.documentElement.namespaceURI===Un?t.createElement(e):t.createElementNS(n,e)}}function il(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Ei(e){var t=pn(e);return(t.local?il:rl)(t)}function sl(){}function go(e){return e==null?sl:function(){return this.querySelector(e)}}function al(e){typeof e!="function"&&(e=go(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),l,c,u=0;u<s;++u)(l=i[u])&&(c=e.call(l,l.__data__,u,i))&&("__data__"in l&&(c.__data__=l.__data__),a[u]=c);return new le(o,this._parents)}function cl(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function ll(){return[]}function _i(e){return e==null?ll:function(){return this.querySelectorAll(e)}}function ul(e){return function(){return cl(e.apply(this,arguments))}}function dl(e){typeof e=="function"?e=ul(e):e=_i(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],a=s.length,l,c=0;c<a;++c)(l=s[c])&&(o.push(e.call(l,l.__data__,c,s)),r.push(l));return new le(o,r)}function Ni(e){return function(){return this.matches(e)}}function Si(e){return function(t){return t.matches(e)}}var fl=Array.prototype.find;function hl(e){return function(){return fl.call(this.children,e)}}function gl(){return this.firstElementChild}function pl(e){return this.select(e==null?gl:hl(typeof e=="function"?e:Si(e)))}var ml=Array.prototype.filter;function yl(){return Array.from(this.children)}function wl(e){return function(){return ml.call(this.children,e)}}function xl(e){return this.selectAll(e==null?yl:wl(typeof e=="function"?e:Si(e)))}function vl(e){typeof e!="function"&&(e=Ni(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]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new le(o,this._parents)}function ki(e){return new Array(e.length)}function bl(){return new le(this._enter||this._groups.map(ki),this._parents)}function en(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}en.prototype={constructor:en,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 El(e){return function(){return e}}function _l(e,t,n,o,r,i){for(var s=0,a,l=t.length,c=i.length;s<c;++s)(a=t[s])?(a.__data__=i[s],o[s]=a):n[s]=new en(e,i[s]);for(;s<l;++s)(a=t[s])&&(r[s]=a)}function Nl(e,t,n,o,r,i,s){var a,l,c=new Map,u=t.length,f=i.length,d=new Array(u),h;for(a=0;a<u;++a)(l=t[a])&&(d[a]=h=s.call(l,l.__data__,a,t)+"",c.has(h)?r[a]=l:c.set(h,l));for(a=0;a<f;++a)h=s.call(e,i[a],a,i)+"",(l=c.get(h))?(o[a]=l,l.__data__=i[a],c.delete(h)):n[a]=new en(e,i[a]);for(a=0;a<u;++a)(l=t[a])&&c.get(d[a])===l&&(r[a]=l)}function Sl(e){return e.__data__}function kl(e,t){if(!arguments.length)return Array.from(this,Sl);var n=t?Nl:_l,o=this._parents,r=this._groups;typeof e!="function"&&(e=El(e));for(var i=r.length,s=new Array(i),a=new Array(i),l=new Array(i),c=0;c<i;++c){var u=o[c],f=r[c],d=f.length,h=Cl(e.call(u,u&&u.__data__,c,o)),g=h.length,w=a[c]=new Array(g),m=s[c]=new Array(g),p=l[c]=new Array(d);n(u,f,w,m,p,h,t);for(var b=0,y=0,x,_;b<g;++b)if(x=w[b]){for(b>=y&&(y=b+1);!(_=m[y])&&++y<g;);x._next=_||null}}return s=new le(s,o),s._enter=a,s._exit=l,s}function Cl(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ml(){return new le(this._exit||this._groups.map(ki),this._parents)}function Il(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 Ol(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),l=0;l<s;++l)for(var c=n[l],u=o[l],f=c.length,d=a[l]=new Array(f),h,g=0;g<f;++g)(h=c[g]||u[g])&&(d[g]=h);for(;l<r;++l)a[l]=n[l];return new le(a,this._parents)}function Al(){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 Pl(e){e||(e=$l);function t(f,d){return f&&d?e(f.__data__,d.__data__):!f-!d}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,l=r[i]=new Array(a),c,u=0;u<a;++u)(c=s[u])&&(l[u]=c);l.sort(t)}return new le(r,this._parents).order()}function $l(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Tl(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dl(){return Array.from(this)}function Rl(){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 Ll(){let e=0;for(const t of this)++e;return e}function zl(){return!this.node()}function jl(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 Hl(e){return function(){this.removeAttribute(e)}}function Vl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Bl(e,t){return function(){this.setAttribute(e,t)}}function Fl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Yl(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Xl(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 Zl(e,t){var n=pn(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?Vl:Hl:typeof t=="function"?n.local?Xl:Yl:n.local?Fl:Bl)(n,t))}function Ci(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Wl(e){return function(){this.style.removeProperty(e)}}function Gl(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ql(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Kl(e,t,n){return arguments.length>1?this.each((t==null?Wl:typeof t=="function"?ql:Gl)(e,t,n??"")):et(this.node(),e)}function et(e,t){return e.style.getPropertyValue(t)||Ci(e).getComputedStyle(e,null).getPropertyValue(t)}function Ul(e){return function(){delete this[e]}}function Ql(e,t){return function(){this[e]=t}}function Jl(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function eu(e,t){return arguments.length>1?this.each((t==null?Ul:typeof t=="function"?Jl:Ql)(e,t)):this.node()[e]}function Mi(e){return e.trim().split(/^|\s+/)}function po(e){return e.classList||new Ii(e)}function Ii(e){this._node=e,this._names=Mi(e.getAttribute("class")||"")}Ii.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 Oi(e,t){for(var n=po(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Ai(e,t){for(var n=po(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function tu(e){return function(){Oi(this,e)}}function nu(e){return function(){Ai(this,e)}}function ou(e,t){return function(){(t.apply(this,arguments)?Oi:Ai)(this,e)}}function ru(e,t){var n=Mi(e+"");if(arguments.length<2){for(var o=po(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?ou:t?tu:nu)(n,t))}function iu(){this.textContent=""}function su(e){return function(){this.textContent=e}}function au(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function cu(e){return arguments.length?this.each(e==null?iu:(typeof e=="function"?au:su)(e)):this.node().textContent}function lu(){this.innerHTML=""}function uu(e){return function(){this.innerHTML=e}}function du(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function fu(e){return arguments.length?this.each(e==null?lu:(typeof e=="function"?du:uu)(e)):this.node().innerHTML}function hu(){this.nextSibling&&this.parentNode.appendChild(this)}function gu(){return this.each(hu)}function pu(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mu(){return this.each(pu)}function yu(e){var t=typeof e=="function"?e:Ei(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function wu(){return null}function xu(e,t){var n=typeof e=="function"?e:Ei(e),o=t==null?wu:typeof t=="function"?t:go(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function vu(){var e=this.parentNode;e&&e.removeChild(this)}function bu(){return this.each(vu)}function Eu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _u(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Nu(e){return this.select(e?_u:Eu)}function Su(e){return arguments.length?this.property("__data__",e):this.node().__data__}function ku(e){return function(t){e.call(this,t,this.__data__)}}function Cu(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 Mu(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 Iu(e,t,n){return function(){var o=this.__on,r,i=ku(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 Ou(e,t,n){var o=Cu(e+""),r,i=o.length,s;if(arguments.length<2){var a=this.node().__on;if(a){for(var l=0,c=a.length,u;l<c;++l)for(r=0,u=a[l];r<i;++r)if((s=o[r]).type===u.type&&s.name===u.name)return u.value}return}for(a=t?Iu:Mu,r=0;r<i;++r)this.each(a(o[r],t,n));return this}function Pi(e,t,n){var o=Ci(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 Au(e,t){return function(){return Pi(this,e,t)}}function Pu(e,t){return function(){return Pi(this,e,t.apply(this,arguments))}}function $u(e,t){return this.each((typeof t=="function"?Pu:Au)(e,t))}function*Tu(){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 $i=[null];function le(e,t){this._groups=e,this._parents=t}function Pt(){return new le([[document.documentElement]],$i)}function Du(){return this}le.prototype=Pt.prototype={constructor:le,select:al,selectAll:dl,selectChild:pl,selectChildren:xl,filter:vl,data:kl,enter:bl,exit:Ml,join:Il,merge:Ol,selection:Du,order:Al,sort:Pl,call:Tl,nodes:Dl,node:Rl,size:Ll,empty:zl,each:jl,attr:Zl,style:Kl,property:eu,classed:ru,text:cu,html:fu,raise:gu,lower:mu,append:yu,insert:xu,remove:bu,clone:Nu,datum:Su,on:Ou,dispatch:$u,[Symbol.iterator]:Tu};function ce(e){return typeof e=="string"?new le([[document.querySelector(e)]],[document.documentElement]):new le([[e]],$i)}function Ru(e){let t;for(;t=e.sourceEvent;)e=t;return e}function fe(e,t){if(e=Ru(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 Lu={passive:!1},vt={capture:!0,passive:!1};function An(e){e.stopImmediatePropagation()}function Qe(e){e.preventDefault(),e.stopImmediatePropagation()}function Ti(e){var t=e.document.documentElement,n=ce(e).on("dragstart.drag",Qe,vt);"onselectstart"in t?n.on("selectstart.drag",Qe,vt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Di(e,t){var n=e.document.documentElement,o=ce(e).on("dragstart.drag",null);t&&(o.on("click.drag",Qe,vt),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 jt=e=>()=>e;function Qn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:a,dx:l,dy:c,dispatch:u}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:s,enumerable:!0,configurable:!0},y:{value:a,enumerable:!0,configurable:!0},dx:{value:l,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:u}})}Qn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function zu(e){return!e.ctrlKey&&!e.button}function ju(){return this.parentNode}function Hu(e,t){return t??{x:e.x,y:e.y}}function Vu(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ri(){var e=zu,t=ju,n=Hu,o=Vu,r={},i=gn("start","drag","end"),s=0,a,l,c,u,f=0;function d(x){x.on("mousedown.drag",h).filter(o).on("touchstart.drag",m).on("touchmove.drag",p,Lu).on("touchend.drag touchcancel.drag",b).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function h(x,_){if(!(u||!e.call(this,x,_))){var E=y(this,t.call(this,x,_),x,_,"mouse");E&&(ce(x.view).on("mousemove.drag",g,vt).on("mouseup.drag",w,vt),Ti(x.view),An(x),c=!1,a=x.clientX,l=x.clientY,E("start",x))}}function g(x){if(Qe(x),!c){var _=x.clientX-a,E=x.clientY-l;c=_*_+E*E>f}r.mouse("drag",x)}function w(x){ce(x.view).on("mousemove.drag mouseup.drag",null),Di(x.view,c),Qe(x),r.mouse("end",x)}function m(x,_){if(e.call(this,x,_)){var E=x.changedTouches,S=t.call(this,x,_),C=E.length,A,z;for(A=0;A<C;++A)(z=y(this,S,x,_,E[A].identifier,E[A]))&&(An(x),z("start",x,E[A]))}}function p(x){var _=x.changedTouches,E=_.length,S,C;for(S=0;S<E;++S)(C=r[_[S].identifier])&&(Qe(x),C("drag",x,_[S]))}function b(x){var _=x.changedTouches,E=_.length,S,C;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),S=0;S<E;++S)(C=r[_[S].identifier])&&(An(x),C("end",x,_[S]))}function y(x,_,E,S,C,A){var z=i.copy(),P=fe(A||E,_),$,M,v;if((v=n.call(x,new Qn("beforestart",{sourceEvent:E,target:d,identifier:C,active:s,x:P[0],y:P[1],dx:0,dy:0,dispatch:z}),S))!=null)return $=v.x-P[0]||0,M=v.y-P[1]||0,function N(k,O,R){var D=P,V;switch(k){case"start":r[C]=N,V=s++;break;case"end":delete r[C],--s;case"drag":P=fe(R||O,_),V=s;break}z.call(k,x,new Qn(k,{sourceEvent:O,subject:v,target:d,identifier:C,active:V,x:P[0]+$,y:P[1]+M,dx:P[0]-D[0],dy:P[1]-D[1],dispatch:z}),S)}}return d.filter=function(x){return arguments.length?(e=typeof x=="function"?x:jt(!!x),d):e},d.container=function(x){return arguments.length?(t=typeof x=="function"?x:jt(x),d):t},d.subject=function(x){return arguments.length?(n=typeof x=="function"?x:jt(x),d):n},d.touchable=function(x){return arguments.length?(o=typeof x=="function"?x:jt(!!x),d):o},d.on=function(){var x=i.on.apply(i,arguments);return x===i?d:x},d.clickDistance=function(x){return arguments.length?(f=(x=+x)*x,d):Math.sqrt(f)},d}function mo(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Li(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function $t(){}var bt=.7,tn=1/bt,Je="\\s*([+-]?\\d+)\\s*",Et="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Ee="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Bu=/^#([0-9a-f]{3,8})$/,Fu=new RegExp(`^rgb\\(${Je},${Je},${Je}\\)$`),Yu=new RegExp(`^rgb\\(${Ee},${Ee},${Ee}\\)$`),Xu=new RegExp(`^rgba\\(${Je},${Je},${Je},${Et}\\)$`),Zu=new RegExp(`^rgba\\(${Ee},${Ee},${Ee},${Et}\\)$`),Wu=new RegExp(`^hsl\\(${Et},${Ee},${Ee}\\)$`),Gu=new RegExp(`^hsla\\(${Et},${Ee},${Ee},${Et}\\)$`),qo={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};mo($t,Fe,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ko,formatHex:Ko,formatHex8:qu,formatHsl:Ku,formatRgb:Uo,toString:Uo});function Ko(){return this.rgb().formatHex()}function qu(){return this.rgb().formatHex8()}function Ku(){return zi(this).formatHsl()}function Uo(){return this.rgb().formatRgb()}function Fe(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Bu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Qo(t):n===3?new ae(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Ht(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Ht(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=Fu.exec(e))?new ae(t[1],t[2],t[3],1):(t=Yu.exec(e))?new ae(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Xu.exec(e))?Ht(t[1],t[2],t[3],t[4]):(t=Zu.exec(e))?Ht(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Wu.exec(e))?tr(t[1],t[2]/100,t[3]/100,1):(t=Gu.exec(e))?tr(t[1],t[2]/100,t[3]/100,t[4]):qo.hasOwnProperty(e)?Qo(qo[e]):e==="transparent"?new ae(NaN,NaN,NaN,0):null}function Qo(e){return new ae(e>>16&255,e>>8&255,e&255,1)}function Ht(e,t,n,o){return o<=0&&(e=t=n=NaN),new ae(e,t,n,o)}function Uu(e){return e instanceof $t||(e=Fe(e)),e?(e=e.rgb(),new ae(e.r,e.g,e.b,e.opacity)):new ae}function Jn(e,t,n,o){return arguments.length===1?Uu(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}mo(ae,Jn,Li($t,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new ae(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,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),nn(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:Jo,formatHex:Jo,formatHex8:Qu,formatRgb:er,toString:er}));function Jo(){return`#${He(this.r)}${He(this.g)}${He(this.b)}`}function Qu(){return`#${He(this.r)}${He(this.g)}${He(this.b)}${He((isNaN(this.opacity)?1:this.opacity)*255)}`}function er(){const e=nn(this.opacity);return`${e===1?"rgb(":"rgba("}${Ve(this.r)}, ${Ve(this.g)}, ${Ve(this.b)}${e===1?")":`, ${e})`}`}function nn(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 He(e){return e=Ve(e),(e<16?"0":"")+e.toString(16)}function tr(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new he(e,t,n,o)}function zi(e){if(e instanceof he)return new he(e.h,e.s,e.l,e.opacity);if(e instanceof $t||(e=Fe(e)),!e)return new he;if(e instanceof he)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,l=(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/=l<.5?i+r:2-i-r,s*=60):a=l>0&&l<1?0:s,new he(s,a,l,e.opacity)}function Ju(e,t,n,o){return arguments.length===1?zi(e):new he(e,t,n,o??1)}function he(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}mo(he,Ju,Li($t,{brighter(e){return e=e==null?tn:Math.pow(tn,e),new he(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bt:Math.pow(bt,e),new he(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(Pn(e>=240?e-240:e+120,r,o),Pn(e,r,o),Pn(e<120?e+240:e-120,r,o),this.opacity)},clamp(){return new he(nr(this.h),Vt(this.s),Vt(this.l),nn(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=nn(this.opacity);return`${e===1?"hsl(":"hsla("}${nr(this.h)}, ${Vt(this.s)*100}%, ${Vt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function nr(e){return e=(e||0)%360,e<0?e+360:e}function Vt(e){return Math.max(0,Math.min(1,e||0))}function Pn(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 yo=e=>()=>e;function ed(e,t){return function(n){return e+n*t}}function td(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 nd(e){return(e=+e)==1?ji:function(t,n){return n-t?td(t,n,e):yo(isNaN(t)?n:t)}}function ji(e,t){var n=t-e;return n?ed(e,n):yo(isNaN(e)?t:e)}const on=function e(t){var n=nd(t);function o(r,i){var s=n((r=Jn(r)).r,(i=Jn(i)).r),a=n(r.g,i.g),l=n(r.b,i.b),c=ji(r.opacity,i.opacity);return function(u){return r.r=s(u),r.g=a(u),r.b=l(u),r.opacity=c(u),r+""}}return o.gamma=e,o}(1);function od(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 rd(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function id(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]=wt(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 sd(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function ve(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function ad(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]=wt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var eo=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,$n=new RegExp(eo.source,"g");function cd(e){return function(){return e}}function ld(e){return function(t){return e(t)+""}}function Hi(e,t){var n=eo.lastIndex=$n.lastIndex=0,o,r,i,s=-1,a=[],l=[];for(e=e+"",t=t+"";(o=eo.exec(e))&&(r=$n.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,l.push({i:s,x:ve(o,r)})),n=$n.lastIndex;return n<t.length&&(i=t.slice(n),a[s]?a[s]+=i:a[++s]=i),a.length<2?l[0]?ld(l[0].x):cd(t):(t=l.length,function(c){for(var u=0,f;u<t;++u)a[(f=l[u]).i]=f.x(c);return a.join("")})}function wt(e,t){var n=typeof t,o;return t==null||n==="boolean"?yo(t):(n==="number"?ve:n==="string"?(o=Fe(t))?(t=o,on):Hi:t instanceof Fe?on:t instanceof Date?sd:rd(t)?od:Array.isArray(t)?id:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?ad:ve)(e,t)}var or=180/Math.PI,to={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Vi(e,t,n,o,r,i){var s,a,l;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(l=e*n+t*o)&&(n-=e*l,o-=t*l),(a=Math.sqrt(n*n+o*o))&&(n/=a,o/=a,l/=a),e*o<t*n&&(e=-e,t=-t,l=-l,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*or,skewX:Math.atan(l)*or,scaleX:s,scaleY:a}}var Bt;function ud(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?to:Vi(t.a,t.b,t.c,t.d,t.e,t.f)}function dd(e){return e==null||(Bt||(Bt=document.createElementNS("http://www.w3.org/2000/svg","g")),Bt.setAttribute("transform",e),!(e=Bt.transform.baseVal.consolidate()))?to:(e=e.matrix,Vi(e.a,e.b,e.c,e.d,e.e,e.f))}function Bi(e,t,n,o){function r(c){return c.length?c.pop()+" ":""}function i(c,u,f,d,h,g){if(c!==f||u!==d){var w=h.push("translate(",null,t,null,n);g.push({i:w-4,x:ve(c,f)},{i:w-2,x:ve(u,d)})}else(f||d)&&h.push("translate("+f+t+d+n)}function s(c,u,f,d){c!==u?(c-u>180?u+=360:u-c>180&&(c+=360),d.push({i:f.push(r(f)+"rotate(",null,o)-2,x:ve(c,u)})):u&&f.push(r(f)+"rotate("+u+o)}function a(c,u,f,d){c!==u?d.push({i:f.push(r(f)+"skewX(",null,o)-2,x:ve(c,u)}):u&&f.push(r(f)+"skewX("+u+o)}function l(c,u,f,d,h,g){if(c!==f||u!==d){var w=h.push(r(h)+"scale(",null,",",null,")");g.push({i:w-4,x:ve(c,f)},{i:w-2,x:ve(u,d)})}else(f!==1||d!==1)&&h.push(r(h)+"scale("+f+","+d+")")}return function(c,u){var f=[],d=[];return c=e(c),u=e(u),i(c.translateX,c.translateY,u.translateX,u.translateY,f,d),s(c.rotate,u.rotate,f,d),a(c.skewX,u.skewX,f,d),l(c.scaleX,c.scaleY,u.scaleX,u.scaleY,f,d),c=u=null,function(h){for(var g=-1,w=d.length,m;++g<w;)f[(m=d[g]).i]=m.x(h);return f.join("")}}}var fd=Bi(ud,"px, ","px)","deg)"),hd=Bi(dd,", ",")",")"),gd=1e-12;function rr(e){return((e=Math.exp(e))+1/e)/2}function pd(e){return((e=Math.exp(e))-1/e)/2}function md(e){return((e=Math.exp(2*e))-1)/(e+1)}const qt=function e(t,n,o){function r(i,s){var a=i[0],l=i[1],c=i[2],u=s[0],f=s[1],d=s[2],h=u-a,g=f-l,w=h*h+g*g,m,p;if(w<gd)p=Math.log(d/c)/t,m=function(S){return[a+S*h,l+S*g,c*Math.exp(t*S*p)]};else{var b=Math.sqrt(w),y=(d*d-c*c+o*w)/(2*c*n*b),x=(d*d-c*c-o*w)/(2*d*n*b),_=Math.log(Math.sqrt(y*y+1)-y),E=Math.log(Math.sqrt(x*x+1)-x);p=(E-_)/t,m=function(S){var C=S*p,A=rr(_),z=c/(n*b)*(A*md(t*C+_)-pd(_));return[a+z*h,l+z*g,c*A/rr(t*C+_)]}}return m.duration=p*1e3*t/Math.SQRT2,m}return r.rho=function(i){var s=Math.max(.001,+i),a=s*s,l=a*a;return e(s,a,l)},r}(Math.SQRT2,2,4);var tt=0,pt=0,ht=0,Fi=1e3,rn,mt,sn=0,Ye=0,mn=0,_t=typeof performance=="object"&&performance.now?performance:Date,Yi=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function wo(){return Ye||(Yi(yd),Ye=_t.now()+mn)}function yd(){Ye=0}function an(){this._call=this._time=this._next=null}an.prototype=Xi.prototype={constructor:an,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?wo():+n)+(t==null?0:+t),!this._next&&mt!==this&&(mt?mt._next=this:rn=this,mt=this),this._call=e,this._time=n,no()},stop:function(){this._call&&(this._call=null,this._time=1/0,no())}};function Xi(e,t,n){var o=new an;return o.restart(e,t,n),o}function wd(){wo(),++tt;for(var e=rn,t;e;)(t=Ye-e._time)>=0&&e._call.call(void 0,t),e=e._next;--tt}function ir(){Ye=(sn=_t.now())+mn,tt=pt=0;try{wd()}finally{tt=0,vd(),Ye=0}}function xd(){var e=_t.now(),t=e-sn;t>Fi&&(mn-=t,sn=e)}function vd(){for(var e,t=rn,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:rn=n);mt=e,no(o)}function no(e){if(!tt){pt&&(pt=clearTimeout(pt));var t=e-Ye;t>24?(e<1/0&&(pt=setTimeout(ir,e-_t.now()-mn)),ht&&(ht=clearInterval(ht))):(ht||(sn=_t.now(),ht=setInterval(xd,Fi)),tt=1,Yi(ir))}}function sr(e,t,n){var o=new an;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var bd=gn("start","end","cancel","interrupt"),Ed=[],Zi=0,ar=1,oo=2,Kt=3,cr=4,ro=5,Ut=6;function yn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;_d(e,n,{name:t,index:o,group:r,on:bd,tween:Ed,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Zi})}function xo(e,t){var n=ye(e,t);if(n.state>Zi)throw new Error("too late; already scheduled");return n}function _e(e,t){var n=ye(e,t);if(n.state>Kt)throw new Error("too late; already running");return n}function ye(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function _d(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=Xi(i,0,n.time);function i(c){n.state=ar,n.timer.restart(s,n.delay,n.time),n.delay<=c&&s(c-n.delay)}function s(c){var u,f,d,h;if(n.state!==ar)return l();for(u in o)if(h=o[u],h.name===n.name){if(h.state===Kt)return sr(s);h.state===cr?(h.state=Ut,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete o[u]):+u<t&&(h.state=Ut,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete o[u])}if(sr(function(){n.state===Kt&&(n.state=cr,n.timer.restart(a,n.delay,n.time),a(c))}),n.state=oo,n.on.call("start",e,e.__data__,n.index,n.group),n.state===oo){for(n.state=Kt,r=new Array(d=n.tween.length),u=0,f=-1;u<d;++u)(h=n.tween[u].value.call(e,e.__data__,n.index,n.group))&&(r[++f]=h);r.length=f+1}}function a(c){for(var u=c<n.duration?n.ease.call(null,c/n.duration):(n.timer.restart(l),n.state=ro,1),f=-1,d=r.length;++f<d;)r[f].call(e,u);n.state===ro&&(n.on.call("end",e,e.__data__,n.index,n.group),l())}function l(){n.state=Ut,n.timer.stop(),delete o[t];for(var c in o)return;delete e.__transition}}function Qt(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>oo&&o.state<ro,o.state=Ut,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Nd(e){return this.each(function(){Qt(this,e)})}function Sd(e,t){var n,o;return function(){var r=_e(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 kd(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=_e(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var a={name:t,value:n},l=0,c=r.length;l<c;++l)if(r[l].name===t){r[l]=a;break}l===c&&r.push(a)}i.tween=r}}function Cd(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=ye(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?Sd:kd)(n,e,t))}function vo(e,t,n){var o=e._id;return e.each(function(){var r=_e(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return ye(r,o).value[t]}}function Wi(e,t){var n;return(typeof t=="number"?ve:t instanceof Fe?on:(n=Fe(t))?(t=n,on):Hi)(e,t)}function Md(e){return function(){this.removeAttribute(e)}}function Id(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Od(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 Ad(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 Pd(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttribute(e):(s=this.getAttribute(e),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function $d(e,t,n){var o,r,i;return function(){var s,a=n(this),l;return a==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),l=a+"",s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a)))}}function Td(e,t){var n=pn(e),o=n==="transform"?hd:Wi;return this.attrTween(e,typeof t=="function"?(n.local?$d:Pd)(n,o,vo(this,"attr."+e,t)):t==null?(n.local?Id:Md)(n):(n.local?Ad:Od)(n,o,t))}function Dd(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function Rd(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function Ld(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Rd(e,i)),n}return r._value=t,r}function zd(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&Dd(e,i)),n}return r._value=t,r}function jd(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=pn(e);return this.tween(n,(o.local?Ld:zd)(o,t))}function Hd(e,t){return function(){xo(this,e).delay=+t.apply(this,arguments)}}function Vd(e,t){return t=+t,function(){xo(this,e).delay=t}}function Bd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Hd:Vd)(t,e)):ye(this.node(),t).delay}function Fd(e,t){return function(){_e(this,e).duration=+t.apply(this,arguments)}}function Yd(e,t){return t=+t,function(){_e(this,e).duration=t}}function Xd(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Fd:Yd)(t,e)):ye(this.node(),t).duration}function Zd(e,t){if(typeof t!="function")throw new Error;return function(){_e(this,e).ease=t}}function Wd(e){var t=this._id;return arguments.length?this.each(Zd(t,e)):ye(this.node(),t).ease}function Gd(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;_e(this,e).ease=n}}function qd(e){if(typeof e!="function")throw new Error;return this.each(Gd(this._id,e))}function Kd(e){typeof e!="function"&&(e=Ni(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]=[],l,c=0;c<s;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&a.push(l);return new Ae(o,this._parents,this._name,this._id)}function Ud(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 l=t[a],c=n[a],u=l.length,f=s[a]=new Array(u),d,h=0;h<u;++h)(d=l[h]||c[h])&&(f[h]=d);for(;a<o;++a)s[a]=t[a];return new Ae(s,this._parents,this._name,this._id)}function Qd(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 Jd(e,t,n){var o,r,i=Qd(t)?xo:_e;return function(){var s=i(this,e),a=s.on;a!==o&&(r=(o=a).copy()).on(t,n),s.on=r}}function ef(e,t){var n=this._id;return arguments.length<2?ye(this.node(),n).on.on(e):this.each(Jd(n,e,t))}function tf(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function nf(){return this.on("end.remove",tf(this._id))}function of(e){var t=this._name,n=this._id;typeof e!="function"&&(e=go(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var a=o[s],l=a.length,c=i[s]=new Array(l),u,f,d=0;d<l;++d)(u=a[d])&&(f=e.call(u,u.__data__,d,a))&&("__data__"in u&&(f.__data__=u.__data__),c[d]=f,yn(c[d],t,n,d,c,ye(u,n)));return new Ae(i,this._parents,t,n)}function rf(e){var t=this._name,n=this._id;typeof e!="function"&&(e=_i(e));for(var o=this._groups,r=o.length,i=[],s=[],a=0;a<r;++a)for(var l=o[a],c=l.length,u,f=0;f<c;++f)if(u=l[f]){for(var d=e.call(u,u.__data__,f,l),h,g=ye(u,n),w=0,m=d.length;w<m;++w)(h=d[w])&&yn(h,t,n,w,d,g);i.push(d),s.push(u)}return new Ae(i,s,t,n)}var sf=Pt.prototype.constructor;function af(){return new sf(this._groups,this._parents)}function cf(e,t){var n,o,r;return function(){var i=et(this,e),s=(this.style.removeProperty(e),et(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Gi(e){return function(){this.style.removeProperty(e)}}function lf(e,t,n){var o,r=n+"",i;return function(){var s=et(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function uf(e,t,n){var o,r,i;return function(){var s=et(this,e),a=n(this),l=a+"";return a==null&&(l=a=(this.style.removeProperty(e),et(this,e))),s===l?null:s===o&&l===r?i:(r=l,i=t(o=s,a))}}function df(e,t){var n,o,r,i="style."+t,s="end."+i,a;return function(){var l=_e(this,e),c=l.on,u=l.value[i]==null?a||(a=Gi(t)):void 0;(c!==n||r!==u)&&(o=(n=c).copy()).on(s,r=u),l.on=o}}function ff(e,t,n){var o=(e+="")=="transform"?fd:Wi;return t==null?this.styleTween(e,cf(e,o)).on("end.style."+e,Gi(e)):typeof t=="function"?this.styleTween(e,uf(e,o,vo(this,"style."+e,t))).each(df(this._id,e)):this.styleTween(e,lf(e,o,t),n).on("end.style."+e,null)}function hf(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function gf(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&hf(e,s,n)),o}return i._value=t,i}function pf(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,gf(e,t,n??""))}function mf(e){return function(){this.textContent=e}}function yf(e){return function(){var t=e(this);this.textContent=t??""}}function wf(e){return this.tween("text",typeof e=="function"?yf(vo(this,"text",e)):mf(e==null?"":e+""))}function xf(e){return function(t){this.textContent=e.call(this,t)}}function vf(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&xf(r)),t}return o._value=e,o}function bf(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,vf(e))}function Ef(){for(var e=this._name,t=this._id,n=qi(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],a=s.length,l,c=0;c<a;++c)if(l=s[c]){var u=ye(l,t);yn(l,e,n,c,s,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new Ae(o,this._parents,e,n)}function _f(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var a={value:s},l={value:function(){--r===0&&i()}};n.each(function(){var c=_e(this,o),u=c.on;u!==e&&(t=(e=u).copy(),t._.cancel.push(a),t._.interrupt.push(a),t._.end.push(l)),c.on=t}),r===0&&i()})}var Nf=0;function Ae(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function qi(){return++Nf}var Ie=Pt.prototype;Ae.prototype={constructor:Ae,select:of,selectAll:rf,selectChild:Ie.selectChild,selectChildren:Ie.selectChildren,filter:Kd,merge:Ud,selection:af,transition:Ef,call:Ie.call,nodes:Ie.nodes,node:Ie.node,size:Ie.size,empty:Ie.empty,each:Ie.each,on:ef,attr:Td,attrTween:jd,style:ff,styleTween:pf,text:wf,textTween:bf,remove:nf,tween:Cd,delay:Bd,duration:Xd,ease:Wd,easeVarying:qd,end:_f,[Symbol.iterator]:Ie[Symbol.iterator]};function Sf(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var kf={time:null,delay:0,duration:250,ease:Sf};function Cf(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 Mf(e){var t,n;e instanceof Ae?(t=e._id,e=e._name):(t=qi(),(n=kf).time=wo(),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,l,c=0;c<a;++c)(l=s[c])&&yn(l,e,t,c,s,n||Cf(l,t));return new Ae(o,this._parents,e,t)}Pt.prototype.interrupt=Nd;Pt.prototype.transition=Mf;const Ft=e=>()=>e;function If(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 Oe(e,t,n){this.k=e,this.x=t,this.y=n}Oe.prototype={constructor:Oe,scale:function(e){return e===1?this:new Oe(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Oe(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 wn=new Oe(1,0,0);Ki.prototype=Oe.prototype;function Ki(e){for(;!e.__zoom;)if(!(e=e.parentNode))return wn;return e.__zoom}function Tn(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function Of(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Af(){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 lr(){return this.__zoom||wn}function Pf(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function $f(){return navigator.maxTouchPoints||"ontouchstart"in this}function Tf(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 Ui(){var e=Of,t=Af,n=Tf,o=Pf,r=$f,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],a=250,l=qt,c=gn("start","zoom","end"),u,f,d,h=500,g=150,w=0,m=10;function p(v){v.property("__zoom",lr).on("wheel.zoom",C,{passive:!1}).on("mousedown.zoom",A).on("dblclick.zoom",z).filter(r).on("touchstart.zoom",P).on("touchmove.zoom",$).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(v,N,k,O){var R=v.selection?v.selection():v;R.property("__zoom",lr),v!==R?_(v,N,k,O):R.interrupt().each(function(){E(this,arguments).event(O).start().zoom(null,typeof N=="function"?N.apply(this,arguments):N).end()})},p.scaleBy=function(v,N,k,O){p.scaleTo(v,function(){var R=this.__zoom.k,D=typeof N=="function"?N.apply(this,arguments):N;return R*D},k,O)},p.scaleTo=function(v,N,k,O){p.transform(v,function(){var R=t.apply(this,arguments),D=this.__zoom,V=k==null?x(R):typeof k=="function"?k.apply(this,arguments):k,H=D.invert(V),j=typeof N=="function"?N.apply(this,arguments):N;return n(y(b(D,j),V,H),R,s)},k,O)},p.translateBy=function(v,N,k,O){p.transform(v,function(){return n(this.__zoom.translate(typeof N=="function"?N.apply(this,arguments):N,typeof k=="function"?k.apply(this,arguments):k),t.apply(this,arguments),s)},null,O)},p.translateTo=function(v,N,k,O,R){p.transform(v,function(){var D=t.apply(this,arguments),V=this.__zoom,H=O==null?x(D):typeof O=="function"?O.apply(this,arguments):O;return n(wn.translate(H[0],H[1]).scale(V.k).translate(typeof N=="function"?-N.apply(this,arguments):-N,typeof k=="function"?-k.apply(this,arguments):-k),D,s)},O,R)};function b(v,N){return N=Math.max(i[0],Math.min(i[1],N)),N===v.k?v:new Oe(N,v.x,v.y)}function y(v,N,k){var O=N[0]-k[0]*v.k,R=N[1]-k[1]*v.k;return O===v.x&&R===v.y?v:new Oe(v.k,O,R)}function x(v){return[(+v[0][0]+ +v[1][0])/2,(+v[0][1]+ +v[1][1])/2]}function _(v,N,k,O){v.on("start.zoom",function(){E(this,arguments).event(O).start()}).on("interrupt.zoom end.zoom",function(){E(this,arguments).event(O).end()}).tween("zoom",function(){var R=this,D=arguments,V=E(R,D).event(O),H=t.apply(R,D),j=k==null?x(H):typeof k=="function"?k.apply(R,D):k,X=Math.max(H[1][0]-H[0][0],H[1][1]-H[0][1]),F=R.__zoom,W=typeof N=="function"?N.apply(R,D):N,Q=l(F.invert(j).concat(X/F.k),W.invert(j).concat(X/W.k));return function(G){if(G===1)G=W;else{var L=Q(G),B=X/L[2];G=new Oe(B,j[0]-L[0]*B,j[1]-L[1]*B)}V.zoom(null,G)}})}function E(v,N,k){return!k&&v.__zooming||new S(v,N)}function S(v,N){this.that=v,this.args=N,this.active=0,this.sourceEvent=null,this.extent=t.apply(v,N),this.taps=0}S.prototype={event:function(v){return v&&(this.sourceEvent=v),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(v,N){return this.mouse&&v!=="mouse"&&(this.mouse[1]=N.invert(this.mouse[0])),this.touch0&&v!=="touch"&&(this.touch0[1]=N.invert(this.touch0[0])),this.touch1&&v!=="touch"&&(this.touch1[1]=N.invert(this.touch1[0])),this.that.__zoom=N,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(v){var N=ce(this.that).datum();c.call(v,this.that,new If(v,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:c}),N)}};function C(v,...N){if(!e.apply(this,arguments))return;var k=E(this,N).event(v),O=this.__zoom,R=Math.max(i[0],Math.min(i[1],O.k*Math.pow(2,o.apply(this,arguments)))),D=fe(v);if(k.wheel)(k.mouse[0][0]!==D[0]||k.mouse[0][1]!==D[1])&&(k.mouse[1]=O.invert(k.mouse[0]=D)),clearTimeout(k.wheel);else{if(O.k===R)return;k.mouse=[D,O.invert(D)],Qt(this),k.start()}gt(v),k.wheel=setTimeout(V,g),k.zoom("mouse",n(y(b(O,R),k.mouse[0],k.mouse[1]),k.extent,s));function V(){k.wheel=null,k.end()}}function A(v,...N){if(d||!e.apply(this,arguments))return;var k=v.currentTarget,O=E(this,N,!0).event(v),R=ce(v.view).on("mousemove.zoom",j,!0).on("mouseup.zoom",X,!0),D=fe(v,k),V=v.clientX,H=v.clientY;Ti(v.view),Tn(v),O.mouse=[D,this.__zoom.invert(D)],Qt(this),O.start();function j(F){if(gt(F),!O.moved){var W=F.clientX-V,Q=F.clientY-H;O.moved=W*W+Q*Q>w}O.event(F).zoom("mouse",n(y(O.that.__zoom,O.mouse[0]=fe(F,k),O.mouse[1]),O.extent,s))}function X(F){R.on("mousemove.zoom mouseup.zoom",null),Di(F.view,O.moved),gt(F),O.event(F).end()}}function z(v,...N){if(e.apply(this,arguments)){var k=this.__zoom,O=fe(v.changedTouches?v.changedTouches[0]:v,this),R=k.invert(O),D=k.k*(v.shiftKey?.5:2),V=n(y(b(k,D),O,R),t.apply(this,N),s);gt(v),a>0?ce(this).transition().duration(a).call(_,V,O,v):ce(this).call(p.transform,V,O,v)}}function P(v,...N){if(e.apply(this,arguments)){var k=v.touches,O=k.length,R=E(this,N,v.changedTouches.length===O).event(v),D,V,H,j;for(Tn(v),V=0;V<O;++V)H=k[V],j=fe(H,this),j=[j,this.__zoom.invert(j),H.identifier],R.touch0?!R.touch1&&R.touch0[2]!==j[2]&&(R.touch1=j,R.taps=0):(R.touch0=j,D=!0,R.taps=1+!!u);u&&(u=clearTimeout(u)),D&&(R.taps<2&&(f=j[0],u=setTimeout(function(){u=null},h)),Qt(this),R.start())}}function $(v,...N){if(this.__zooming){var k=E(this,N).event(v),O=v.changedTouches,R=O.length,D,V,H,j;for(gt(v),D=0;D<R;++D)V=O[D],H=fe(V,this),k.touch0&&k.touch0[2]===V.identifier?k.touch0[0]=H:k.touch1&&k.touch1[2]===V.identifier&&(k.touch1[0]=H);if(V=k.that.__zoom,k.touch1){var X=k.touch0[0],F=k.touch0[1],W=k.touch1[0],Q=k.touch1[1],G=(G=W[0]-X[0])*G+(G=W[1]-X[1])*G,L=(L=Q[0]-F[0])*L+(L=Q[1]-F[1])*L;V=b(V,Math.sqrt(G/L)),H=[(X[0]+W[0])/2,(X[1]+W[1])/2],j=[(F[0]+Q[0])/2,(F[1]+Q[1])/2]}else if(k.touch0)H=k.touch0[0],j=k.touch0[1];else return;k.zoom("touch",n(y(V,H,j),k.extent,s))}}function M(v,...N){if(this.__zooming){var k=E(this,N).event(v),O=v.changedTouches,R=O.length,D,V;for(Tn(v),d&&clearTimeout(d),d=setTimeout(function(){d=null},h),D=0;D<R;++D)V=O[D],k.touch0&&k.touch0[2]===V.identifier?delete k.touch0:k.touch1&&k.touch1[2]===V.identifier&&delete k.touch1;if(k.touch1&&!k.touch0&&(k.touch0=k.touch1,delete k.touch1),k.touch0)k.touch0[1]=this.__zoom.invert(k.touch0[0]);else if(k.end(),k.taps===2&&(V=fe(V,this),Math.hypot(f[0]-V[0],f[1]-V[1])<m)){var H=ce(this).on("dblclick.zoom");H&&H.apply(this,arguments)}}}return p.wheelDelta=function(v){return arguments.length?(o=typeof v=="function"?v:Ft(+v),p):o},p.filter=function(v){return arguments.length?(e=typeof v=="function"?v:Ft(!!v),p):e},p.touchable=function(v){return arguments.length?(r=typeof v=="function"?v:Ft(!!v),p):r},p.extent=function(v){return arguments.length?(t=typeof v=="function"?v:Ft([[+v[0][0],+v[0][1]],[+v[1][0],+v[1][1]]]),p):t},p.scaleExtent=function(v){return arguments.length?(i[0]=+v[0],i[1]=+v[1],p):[i[0],i[1]]},p.translateExtent=function(v){return arguments.length?(s[0][0]=+v[0][0],s[1][0]=+v[1][0],s[0][1]=+v[0][1],s[1][1]=+v[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(v){return arguments.length?(n=v,p):n},p.duration=function(v){return arguments.length?(a=+v,p):a},p.interpolate=function(v){return arguments.length?(l=v,p):l},p.on=function(){var v=c.on.apply(c,arguments);return v===c?p:v},p.clickDistance=function(v){return arguments.length?(w=(v=+v)*v,p):Math.sqrt(w)},p.tapDistance=function(v){return arguments.length?(m=+v,p):m},p}const me={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.`},Nt=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Qi=["Enter"," ","Escape"],Ji={"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 nt;(function(e){e.Strict="strict",e.Loose="loose"})(nt||(nt={}));var Be;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(Be||(Be={}));var St;(function(e){e.Partial="partial",e.Full="full"})(St||(St={}));const es={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Te;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Te||(Te={}));var kt;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(kt||(kt={}));var Y;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Y||(Y={}));const ur={[Y.Left]:Y.Right,[Y.Right]:Y.Left,[Y.Top]:Y.Bottom,[Y.Bottom]:Y.Top};function ts(e){return e===null?null:e?"valid":"invalid"}const ns=e=>!!e&&typeof e=="object"&&"id"in e&&"source"in e&&"target"in e,Df=e=>!!e&&typeof e=="object"&&"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),bo=e=>!!e&&typeof e=="object"&&"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Tt=(e,t=[0,0])=>{const{width:n,height:o}=Ne(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},Rf=(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):bo(r)?r:t.nodeLookup.get(r.id));const a=s?cn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return xn(o,a)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return vn(n)},Dt=(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=xn(n,cn(r)),o=!0)}),o?vn(n):{x:0,y:0,width:0,height:0}},Eo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const a=(t.x-n)/r,l=(t.y-o)/r,c=t.width/r,u=t.height/r,f=[];for(const d of e.values()){const{measured:h,selectable:g=!0,hidden:w=!1}=d;if(s&&!g||w)continue;const m=h.width??d.width??d.initialWidth??0,p=h.height??d.height??d.initialHeight??0,{x:b,y}=d.internals.positionAbsolute,x=ss(a,l,c,u,b,y,m,p),_=m*p,E=i&&x>0;(!d.internals.handleBounds||E||x>=_||d.dragging)&&f.push(d)}return f},Lf=(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 zf(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}=Ne(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 jf({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return!0;const a=zf(e,s),l=Dt(a),c=No(l,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(c,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),!0}function os({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:l,y:c}=a?a.internals.positionAbsolute:{x:0,y:0},u=s.origin??o;let f=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!a)i?.("005",me.error005());else{const h=a.measured.width,g=a.measured.height;h&&g&&(f=[[l,c],[l+h,c+g]])}else a&&Ze(s.extent)&&(f=[[s.extent[0][0]+l,s.extent[0][1]+c],[s.extent[1][0]+l,s.extent[1][1]+c]]);const d=Ze(f)?Xe(t,f,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",me.error015()),{position:{x:d.x-l+(s.measured.width??0)*u[0],y:d.y-c+(s.measured.height??0)*u[1]},positionAbsolute:d}}async function Hf({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(d=>d.id)),s=[];for(const d of n){if(d.deletable===!1)continue;const h=i.has(d.id),g=!h&&d.parentId&&s.find(w=>w.id===d.parentId);(h||g)&&s.push(d)}const a=new Set(t.map(d=>d.id)),l=o.filter(d=>d.deletable!==!1),u=Lf(s,l);for(const d of l)a.has(d.id)&&!u.find(g=>g.id===d.id)&&u.push(d);if(!r)return{edges:u,nodes:s};const f=await r({nodes:s,edges:u});return typeof f=="boolean"?f?{edges:u,nodes:s}:{edges:[],nodes:[]}:f}const ot=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),Xe=(e={x:0,y:0},t,n)=>({x:ot(e.x,t[0][0],t[1][0]-(n?.width??0)),y:ot(e.y,t[0][1],t[1][1]-(n?.height??0))});function rs(e,t,n){const{width:o,height:r}=Ne(n),{x:i,y:s}=n.internals.positionAbsolute;return Xe(e,[[i,s],[i+o,s+r]],t)}const dr=(e,t,n)=>e<t?ot(Math.abs(e-t),1,t)/t:e>n?-ot(Math.abs(e-n),1,t)/t:0,_o=(e,t,n=15,o=40)=>{const r=dr(e.x,o,t.width-o)*n,i=dr(e.y,o,t.height-o)*n;return[r,i]},xn=(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)}),io=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),vn=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),Ct=(e,t=[0,0])=>{const{x:n,y:o}=bo(e)?e.internals.positionAbsolute:Tt(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}},cn=(e,t=[0,0])=>{const{x:n,y:o}=bo(e)?e.internals.positionAbsolute:Tt(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)}},is=(e,t)=>vn(xn(io(e),io(t))),ss=(e,t,n,o,r,i,s,a)=>{const l=Math.max(0,Math.min(e+n,r+s)-Math.max(e,r)),c=Math.max(0,Math.min(t+o,i+a)-Math.max(t,i));return Math.ceil(l*c)},ln=(e,t)=>ss(e.x,e.y,e.width,e.height,t.x,t.y,t.width,t.height),fr=e=>ge(e.width)&&ge(e.height)&&ge(e.x)&&ge(e.y),ge=e=>!isNaN(e)&&isFinite(e),as=(e,t)=>(n,o)=>{},Rt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Lt=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const a={x:(e-n)/r,y:(t-o)/r};return i?Rt(a,s):a},rt=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function qe(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 Vf(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=qe(e,n),r=qe(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=qe(e.top??e.y??0,n),r=qe(e.bottom??e.y??0,n),i=qe(e.left??e.x??0,t),s=qe(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 Bf(e,t,n,o,r,i){const{x:s,y:a}=rt(e,[t,n,o]),{x:l,y:c}=rt({x:e.x+e.width,y:e.y+e.height},[t,n,o]),u=r-l,f=i-c;return{left:Math.floor(s),top:Math.floor(a),right:Math.floor(u),bottom:Math.floor(f)}}const No=(e,t,n,o,r,i)=>{const s=Vf(i,t,n),a=(t-s.x)/e.width,l=(n-s.y)/e.height,c=Math.min(a,l),u=ot(c,o,r),f=e.x+e.width/2,d=e.y+e.height/2,h=t/2-f*u,g=n/2-d*u,w=Bf(e,h,g,u,t,n),m={left:Math.min(w.left-s.left,0),top:Math.min(w.top-s.top,0),right:Math.min(w.right-s.right,0),bottom:Math.min(w.bottom-s.bottom,0)};return{x:h-m.left+m.right,y:g-m.top+m.bottom,zoom:u}},Mt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Ze(e){return e!=null&&e!=="parent"}function Ne(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function cs(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function ls(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 hr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function Ff(){let e,t;return{promise:new Promise((o,r)=>{e=o,t=r}),resolve:e,reject:t}}function Yf(e){return{...Ji,...e||{}}}function xt(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=pe(e),a=Lt({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:l,y:c}=n?Rt(a,t):a;return{xSnapped:l,ySnapped:c,...a}}const So=e=>({width:e.offsetWidth,height:e.offsetHeight}),us=e=>e?.getRootNode?.()||window?.document,Xf=["INPUT","SELECT","TEXTAREA"];function ds(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:Xf.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const fs=e=>"clientX"in e,pe=(e,t)=>{const n=fs(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)}},gr=(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,...So(s)}})};function hs({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:a}){const l=e*.125+r*.375+s*.375+n*.125,c=t*.125+i*.375+a*.375+o*.125,u=Math.abs(l-e),f=Math.abs(c-t);return[l,c,u,f]}function Yt(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function pr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case Y.Left:return[t-Yt(t-o,i),n];case Y.Right:return[t+Yt(o-t,i),n];case Y.Top:return[t,n-Yt(n-r,i)];case Y.Bottom:return[t,n+Yt(r-n,i)]}}function ko({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,curvature:s=.25}){const[a,l]=pr({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[c,u]=pr({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[f,d,h,g]=hs({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:a,sourceControlY:l,targetControlX:c,targetControlY:u});return[`M${e},${t} C${a},${l} ${c},${u} ${o},${r}`,f,d,h,g]}function gs({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 Zf({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 Wf({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=xn(cn(e),cn(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 ln(s,vn(i))>0}const Gf=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,qf=(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)),Kf=(e,t,n={})=>{if(!e.source||!e.target)return n.onError?.("006",me.error006()),t;const o=n.getEdgeId||Gf;let r;return ns(e)?r={...e}:r={...e,id:o(e)},qf(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function ps({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,a]=gs({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,a]}const mr={[Y.Left]:{x:-1,y:0},[Y.Right]:{x:1,y:0},[Y.Top]:{x:0,y:-1},[Y.Bottom]:{x:0,y:1}},Uf=({source:e,sourcePosition:t=Y.Bottom,target:n})=>t===Y.Left||t===Y.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},yr=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function Qf({source:e,sourcePosition:t=Y.Bottom,target:n,targetPosition:o=Y.Top,center:r,offset:i,stepPosition:s}){const a=mr[t],l=mr[o],c={x:e.x+a.x*i,y:e.y+a.y*i},u={x:n.x+l.x*i,y:n.y+l.y*i},f=Uf({source:c,sourcePosition:t,target:u}),d=f.x!==0?"x":"y",h=f[d];let g=[],w,m;const p={x:0,y:0},b={x:0,y:0},[,,y,x]=gs({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){d==="x"?(w=r.x??c.x+(u.x-c.x)*s,m=r.y??(c.y+u.y)/2):(w=r.x??(c.x+u.x)/2,m=r.y??c.y+(u.y-c.y)*s);const C=[{x:w,y:c.y},{x:w,y:u.y}],A=[{x:c.x,y:m},{x:u.x,y:m}];a[d]===h?g=d==="x"?C:A:g=d==="x"?A:C}else{const C=[{x:c.x,y:u.y}],A=[{x:u.x,y:c.y}];if(d==="x"?g=a.x===h?A:C:g=a.y===h?C:A,t===o){const v=Math.abs(e[d]-n[d]);if(v<=i){const N=Math.min(i-1,i-v);a[d]===h?p[d]=(c[d]>e[d]?-1:1)*N:b[d]=(u[d]>n[d]?-1:1)*N}}if(t!==o){const v=d==="x"?"y":"x",N=a[d]===l[v],k=c[v]>u[v],O=c[v]<u[v];(a[d]===1&&(!N&&k||N&&O)||a[d]!==1&&(!N&&O||N&&k))&&(g=d==="x"?C:A)}const z={x:c.x+p.x,y:c.y+p.y},P={x:u.x+b.x,y:u.y+b.y},$=Math.max(Math.abs(z.x-g[0].x),Math.abs(P.x-g[0].x)),M=Math.max(Math.abs(z.y-g[0].y),Math.abs(P.y-g[0].y));$>=M?(w=(z.x+P.x)/2,m=g[0].y):(w=g[0].x,m=(z.y+P.y)/2)}const _={x:c.x+p.x,y:c.y+p.y},E={x:u.x+b.x,y:u.y+b.y};return[[e,..._.x!==g[0].x||_.y!==g[0].y?[_]:[],...g,...E.x!==g[g.length-1].x||E.y!==g[g.length-1].y?[E]:[],n],w,m,y,x]}function Jf(e,t,n,o){const r=Math.min(yr(e,t)/2,yr(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 c=e.x<n.x?-1:1,u=e.y<n.y?1:-1;return`L ${i+r*c},${s}Q ${i},${s} ${i},${s+r*u}`}const a=e.x<n.x?1:-1,l=e.y<n.y?-1:1;return`L ${i},${s+r*l}Q ${i},${s} ${i+r*a},${s}`}function so({sourceX:e,sourceY:t,sourcePosition:n=Y.Bottom,targetX:o,targetY:r,targetPosition:i=Y.Top,borderRadius:s=5,centerX:a,centerY:l,offset:c=20,stepPosition:u=.5}){const[f,d,h,g,w]=Qf({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:a,y:l},offset:c,stepPosition:u});let m=`M${f[0].x} ${f[0].y}`;for(let p=1;p<f.length-1;p++)m+=Jf(f[p-1],f[p],f[p+1],s);return m+=`L${f[f.length-1].x} ${f[f.length-1].y}`,[m,d,h,g,w]}function wr(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function eh(e){const{sourceNode:t,targetNode:n}=e;if(!wr(t)||!wr(n))return null;const o=t.internals.handleBounds||xr(t.handles),r=n.internals.handleBounds||xr(n.handles),i=vr(o?.source??[],e.sourceHandle),s=vr(e.connectionMode===nt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",me.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const a=i?.position||Y.Bottom,l=s?.position||Y.Top,c=We(t,i,a),u=We(n,s,l);return{sourceX:c.x,sourceY:c.y,targetX:u.x,targetY:u.y,sourcePosition:a,targetPosition:l}}function xr(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 We(e,t,n=Y.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??Ne(e);if(o)return{x:r+s/2,y:i+a/2};switch(t?.position??n){case Y.Top:return{x:r+s/2,y:i};case Y.Right:return{x:r+s,y:i+a/2};case Y.Bottom:return{x:r+s/2,y:i+a};case Y.Left:return{x:r,y:i+a/2}}}function vr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ao(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function th(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(l=>{if(l&&typeof l=="object"){const c=ao(l,t);i.has(c)||(s.push({id:c,color:l.color||n,...l}),i.add(c))}}),s),[]).sort((s,a)=>s.id.localeCompare(a.id))}const ms=1e3,nh=10,Co={nodeOrigin:[0,0],nodeExtent:Nt,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},oh={...Co,checkEquality:!0};function Mo(e,t){const n={...e};for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function rh(e,t,n){const o=Mo(Co,n);for(const r of e.values())if(r.parentId)Oo(r,e,t,o);else{const i=Tt(r,o.nodeOrigin),s=Ze(r.extent)?r.extent:o.nodeExtent,a=Xe(i,s,Ne(r));r.internals.positionAbsolute=a}}function ih(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 Io(e){return e==="manual"}function co(e,t,n,o={}){const r=Mo(oh,o),i={i:0},s=new Map(t),a=r?.elevateNodesOnSelect&&!Io(r.zIndexMode)?ms:0;let l=e.length>0,c=!1;t.clear(),n.clear();for(const u of e){let f=s.get(u.id);if(r.checkEquality&&u===f?.internals.userNode)t.set(u.id,f);else{const d=Tt(u,r.nodeOrigin),h=Ze(u.extent)?u.extent:r.nodeExtent,g=Xe(d,h,Ne(u));f={...r.defaults,...u,measured:{width:u.measured?.width,height:u.measured?.height},internals:{positionAbsolute:g,handleBounds:ih(u,f),z:ys(u,a,r.zIndexMode),userNode:u}},t.set(u.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(l=!1),u.parentId&&Oo(f,t,n,o,i),c||=u.selected??!1}return{nodesInitialized:l,hasSelectedNodes:c}}function sh(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 Oo(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:a,zIndexMode:l}=Mo(Co,o),c=e.parentId,u=t.get(c);if(!u){console.warn(`Parent node ${c} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}sh(e,n),r&&!u.parentId&&u.internals.rootParentIndex===void 0&&l==="auto"&&(u.internals.rootParentIndex=++r.i,u.internals.z=u.internals.z+r.i*nh),r&&u.internals.rootParentIndex!==void 0&&(r.i=u.internals.rootParentIndex);const f=i&&!Io(l)?ms:0,{x:d,y:h,z:g}=ah(e,u,s,a,f,l),{positionAbsolute:w}=e.internals,m=d!==w.x||h!==w.y;(m||g!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:m?{x:d,y:h}:w,z:g}})}function ys(e,t,n){const o=ge(e.zIndex)?e.zIndex:0;return Io(n)?o:o+(e.selected?t:0)}function ah(e,t,n,o,r,i){const{x:s,y:a}=t.internals.positionAbsolute,l=Ne(e),c=Tt(e,n),u=Ze(e.extent)?Xe(c,e.extent,l):c;let f=Xe({x:s+u.x,y:a+u.y},o,l);e.extent==="parent"&&(f=rs(f,l,t));const d=ys(e,r,i),h=t.internals.z??0;return{x:f.x,y:f.y,z:h>=d?h+1:d}}function Ao(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 l=i.get(s.parentId)?.expandedRect??Ct(a),c=is(l,s.rect);i.set(s.parentId,{expandedRect:c,parent:a})}return i.size>0&&i.forEach(({expandedRect:s,parent:a},l)=>{const c=a.internals.positionAbsolute,u=Ne(a),f=a.origin??o,d=s.x<c.x?Math.round(Math.abs(c.x-s.x)):0,h=s.y<c.y?Math.round(Math.abs(c.y-s.y)):0,g=Math.max(u.width,Math.round(s.width)),w=Math.max(u.height,Math.round(s.height)),m=(g-u.width)*f[0],p=(w-u.height)*f[1];(d>0||h>0||m||p)&&(r.push({id:l,type:"position",position:{x:a.position.x-d+m,y:a.position.y-h+p}}),n.get(l)?.forEach(b=>{e.some(y=>y.id===b.id)||r.push({id:b.id,type:"position",position:{x:b.position.x+d,y:b.position.y+h}})})),(u.width<s.width||u.height<s.height||d||h)&&r.push({id:l,type:"dimensions",setAttributes:!0,dimensions:{width:g+(d?f[0]*d-m:0),height:w+(h?f[1]*h-p:0)}})}),r}function ch(e,t,n,o,r,i,s){const a=o?.querySelector(".xyflow__viewport");let l=!1;if(!a)return{changes:[],updatedInternals:l};const c=[],u=window.getComputedStyle(a),{m22:f}=new window.DOMMatrixReadOnly(u.transform),d=[];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}}),l=!0;continue}const w=So(h.nodeElement),m=g.measured.width!==w.width||g.measured.height!==w.height;if(!!(w.width&&w.height&&(m||!g.internals.handleBounds||h.force))){const b=h.nodeElement.getBoundingClientRect(),y=Ze(g.extent)?g.extent:i;let{positionAbsolute:x}=g.internals;if(g.parentId&&g.extent==="parent"){const E=t.get(g.parentId);E&&(x=rs(x,w,E))}else y&&(x=Xe(x,y,w));const _={...g,measured:w,internals:{...g.internals,positionAbsolute:x,handleBounds:{source:gr("source",h.nodeElement,b,f,g.id),target:gr("target",h.nodeElement,b,f,g.id)}}};t.set(g.id,_),g.parentId&&Oo(_,t,n,{nodeOrigin:r,zIndexMode:s}),l=!0,m&&(c.push({id:g.id,type:"dimensions",dimensions:w}),g.expandParent&&g.parentId&&d.push({id:g.id,parentId:g.parentId,rect:Ct(_,r)}))}}if(d.length>0){const h=Ao(d,t,n,r);c.push(...h)}return{changes:c,updatedInternals:l}}async function lh({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 br(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 l=o.get(s)||new Map;if(o.set(s,l.set(n,t)),i){s=`${r}-${e}-${i}`;const c=o.get(s)||new Map;o.set(s,c.set(n,t))}}function ws(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:a=null}=o,l={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:a},c=`${r}-${s}--${i}-${a}`,u=`${i}-${a}--${r}-${s}`;br("source",l,u,e,r,s),br("target",l,c,e,i,a),t.set(o.id,o)}}function xs(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:xs(n,t):!1}function Er(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 uh(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!xs(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 Dn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,a]of t){const l=n.get(s)?.internals.userNode;l&&r.push({...l,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 dh({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=Rt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function fh({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,a=new Map,l=!1,c={x:0,y:0},u=null,f=!1,d=null,h=!1,g=!1,w=null;function m({noDragClassName:b,handleSelector:y,domNode:x,isSelectable:_,nodeId:E,nodeClickDistance:S=0}){d=ce(x);function C({x:$,y:M}){const{nodeLookup:v,nodeExtent:N,snapGrid:k,snapToGrid:O,nodeOrigin:R,onNodeDrag:D,onSelectionDrag:V,onError:H,updateNodePositions:j}=t();i={x:$,y:M};let X=!1;const F=a.size>1,W=F&&N?io(Dt(a)):null,Q=F&&O?dh({dragItems:a,snapGrid:k,x:$,y:M}):null;for(const[G,L]of a){if(!v.has(G))continue;let B={x:$-L.distance.x,y:M-L.distance.y};O&&(B=Q?{x:Math.round(B.x+Q.x),y:Math.round(B.y+Q.y)}:Rt(B,k));let U=null;if(F&&N&&!L.extent&&W){const{positionAbsolute:q}=L.internals,J=q.x-W.x+N[0][0],te=q.x+L.measured.width-W.x2+N[1][0],oe=q.y-W.y+N[0][1],se=q.y+L.measured.height-W.y2+N[1][1];U=[[J,oe],[te,se]]}const{position:K,positionAbsolute:Z}=os({nodeId:G,nextPosition:B,nodeLookup:v,nodeExtent:U||N,nodeOrigin:R,onError:H});X=X||L.position.x!==K.x||L.position.y!==K.y,L.position=K,L.internals.positionAbsolute=Z}if(g=g||X,!!X&&(j(a,!0),w&&(o||D||!E&&V))){const[G,L]=Dn({nodeId:E,dragItems:a,nodeLookup:v});o?.(w,a,G,L),D?.(w,G,L),E||V?.(w,L)}}async function A(){if(!u)return;const{transform:$,panBy:M,autoPanSpeed:v,autoPanOnNodeDrag:N}=t();if(!N){l=!1,cancelAnimationFrame(s);return}const[k,O]=_o(c,u,v);(k!==0||O!==0)&&(i.x=(i.x??0)-k/$[2],i.y=(i.y??0)-O/$[2],await M({x:k,y:O})&&C(i)),s=requestAnimationFrame(A)}function z($){const{nodeLookup:M,multiSelectionActive:v,nodesDraggable:N,transform:k,snapGrid:O,snapToGrid:R,selectNodesOnDrag:D,onNodeDragStart:V,onSelectionDragStart:H,unselectNodesAndEdges:j}=t();f=!0,(!D||!_)&&!v&&E&&(M.get(E)?.selected||j()),_&&D&&E&&e?.(E);const X=xt($.sourceEvent,{transform:k,snapGrid:O,snapToGrid:R,containerBounds:u});if(i=X,a=uh(M,N,X,E),a.size>0&&(n||V||!E&&H)){const[F,W]=Dn({nodeId:E,dragItems:a,nodeLookup:M});n?.($.sourceEvent,a,F,W),V?.($.sourceEvent,F,W),E||H?.($.sourceEvent,W)}}const P=Ri().clickDistance(S).on("start",$=>{const{domNode:M,nodeDragThreshold:v,transform:N,snapGrid:k,snapToGrid:O}=t();u=M?.getBoundingClientRect()||null,h=!1,g=!1,w=$.sourceEvent,v===0&&z($),i=xt($.sourceEvent,{transform:N,snapGrid:k,snapToGrid:O,containerBounds:u}),c=pe($.sourceEvent,u)}).on("drag",$=>{const{autoPanOnNodeDrag:M,transform:v,snapGrid:N,snapToGrid:k,nodeDragThreshold:O,nodeLookup:R}=t(),D=xt($.sourceEvent,{transform:v,snapGrid:N,snapToGrid:k,containerBounds:u});if(w=$.sourceEvent,($.sourceEvent.type==="touchmove"&&$.sourceEvent.touches.length>1||E&&!R.has(E))&&(h=!0),!h){if(!l&&M&&f&&(l=!0,A()),!f){const V=pe($.sourceEvent,u),H=V.x-c.x,j=V.y-c.y;Math.sqrt(H*H+j*j)>O&&z($)}(i.x!==D.xSnapped||i.y!==D.ySnapped)&&a&&f&&(c=pe($.sourceEvent,u),C(D))}}).on("end",$=>{if(!f||h){h&&a.size>0&&t().updateNodePositions(a,!1);return}if(l=!1,f=!1,cancelAnimationFrame(s),a.size>0){const{nodeLookup:M,updateNodePositions:v,onNodeDragStop:N,onSelectionDragStop:k}=t();if(g&&(v(a,!1),g=!1),r||N||!E&&k){const[O,R]=Dn({nodeId:E,dragItems:a,nodeLookup:M,dragging:!1});r?.($.sourceEvent,a,O,R),N?.($.sourceEvent,O,R),E||k?.($.sourceEvent,R)}}}).filter($=>{const M=$.target;return!$.button&&(!b||!Er(M,`.${b}`,x))&&(!y||Er(M,y,x))});d.call(P)}function p(){d?.on(".drag",null)}return{update:m,destroy:p}}function hh(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())ln(r,Ct(i))>0&&o.push(i);return o}const gh=250;function ph(e,t,n,o){let r=[],i=1/0;const s=hh(e,n,t+gh);for(const a of s){const l=[...a.internals.handleBounds?.source??[],...a.internals.handleBounds?.target??[]];for(const c of l){if(o.nodeId===c.nodeId&&o.type===c.type&&o.id===c.id)continue;const{x:u,y:f}=We(a,c,c.position,!0),d=Math.sqrt(Math.pow(u-e.x,2)+Math.pow(f-e.y,2));d>t||(d<i?(r=[{...c,x:u,y:f}],i=d):d===i&&r.push({...c,x:u,y:f}))}}if(!r.length)return null;if(r.length>1){const a=o.type==="source"?"target":"source";return r.find(l=>l.type===a)??r[0]}return r[0]}function vs(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??[]],l=(n?a?.find(c=>c.id===n):a?.[0])??null;return l&&i?{...l,...We(s,l,l.position,!0)}:l}function bs(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function mh(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const Es=()=>!0;function yh(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:a,nodeLookup:l,lib:c,autoPanOnConnect:u,flowId:f,panBy:d,cancelConnection:h,onConnectStart:g,onConnect:w,onConnectEnd:m,isValidConnection:p=Es,onReconnectEnd:b,updateConnection:y,getTransform:x,getFromHandle:_,autoPanSpeed:E,dragThreshold:S=1,handleDomNode:C}){const A=us(e.target);let z=0,P;const{x:$,y:M}=pe(e),v=bs(i,C),N=a?.getBoundingClientRect();let k=!1;if(!N||!v)return;const O=vs(r,v,o,l,t);if(!O)return;let R=pe(e,N),D=!1,V=null,H=!1,j=null;function X(){if(!u||!N)return;const[K,Z]=_o(R,N,E);d({x:K,y:Z}),z=requestAnimationFrame(X)}const F={...O,nodeId:r,type:v,position:O.position},W=l.get(r);let G={inProgress:!0,isValid:null,from:We(W,F,Y.Left,!0),fromHandle:F,fromPosition:F.position,fromNode:W,to:R,toHandle:null,toPosition:ur[F.position],toNode:null,pointer:R};function L(){k=!0,y(G),g?.(e,{nodeId:r,handleId:o,handleType:v})}S===0&&L();function B(K){if(!k){const{x:se,y:Se}=pe(K),we=se-$,xe=Se-M;if(!(we*we+xe*xe>S*S))return;L()}if(!_()||!F){U(K);return}const Z=x();R=pe(K,N),P=ph(Lt(R,Z,!1,[1,1]),n,l,F),D||(X(),D=!0);const q=_s(K,{handle:P,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:p,doc:A,lib:c,flowId:f,nodeLookup:l});j=q.handleDomNode,V=q.connection,H=mh(!!P,q.isValid);const J=l.get(r),te=J?We(J,F,Y.Left,!0):G.from,oe={...G,from:te,isValid:H,to:q.toHandle&&H?rt({x:q.toHandle.x,y:q.toHandle.y},Z):R,toHandle:q.toHandle,toPosition:H&&q.toHandle?q.toHandle.position:ur[F.position],toNode:q.toHandle?l.get(q.toHandle.nodeId):null,pointer:R};y(oe),G=oe}function U(K){if(!("touches"in K&&K.touches.length>0)){if(k){(P||j)&&V&&H&&w?.(V);const{inProgress:Z,...q}=G,J={...q,toPosition:G.toHandle?G.toPosition:null};m?.(K,J),i&&b?.(K,J)}h(),cancelAnimationFrame(z),D=!1,H=!1,V=null,j=null,A.removeEventListener("mousemove",B),A.removeEventListener("mouseup",U),A.removeEventListener("touchmove",B),A.removeEventListener("touchend",U)}}A.addEventListener("mousemove",B),A.addEventListener("mouseup",U),A.addEventListener("touchmove",B),A.addEventListener("touchend",U)}function _s(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:a,flowId:l,isValidConnection:c=Es,nodeLookup:u}){const f=i==="target",d=t?s.querySelector(`.${a}-flow__handle[data-id="${l}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:h,y:g}=pe(e),w=s.elementFromPoint(h,g),m=w?.classList.contains(`${a}-flow__handle`)?w:d,p={handleDomNode:m,isValid:!1,connection:null,toHandle:null};if(m){const b=bs(void 0,m),y=m.getAttribute("data-nodeid"),x=m.getAttribute("data-handleid"),_=m.classList.contains("connectable"),E=m.classList.contains("connectableend");if(!y||!b)return p;const S={source:f?y:o,sourceHandle:f?x:r,target:f?o:y,targetHandle:f?r:x};p.connection=S;const A=_&&E&&(n===nt.Strict?f&&b==="source"||!f&&b==="target":y!==o||x!==r);p.isValid=A&&c(S),p.toHandle=vs(y,b,x,u,n,!0)}return p}const lo={onPointerDown:yh,isValid:_s};function wh({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=ce(e);function i({translateExtent:a,width:l,height:c,zoomStep:u=1,pannable:f=!0,zoomable:d=!0,inversePan:h=!1}){const g=y=>{if(y.sourceEvent.type!=="wheel"||!t)return;const x=n(),_=y.sourceEvent.ctrlKey&&Mt()?10:1,E=-y.sourceEvent.deltaY*(y.sourceEvent.deltaMode===1?.05:y.sourceEvent.deltaMode?1:.002)*u,S=x[2]*Math.pow(2,E*_);t.scaleTo(S)};let w=[0,0];const m=y=>{(y.sourceEvent.type==="mousedown"||y.sourceEvent.type==="touchstart")&&(w=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY])},p=y=>{const x=n();if(y.sourceEvent.type!=="mousemove"&&y.sourceEvent.type!=="touchmove"||!t)return;const _=[y.sourceEvent.clientX??y.sourceEvent.touches[0].clientX,y.sourceEvent.clientY??y.sourceEvent.touches[0].clientY],E=[_[0]-w[0],_[1]-w[1]];w=_;const S=o()*Math.max(x[2],Math.log(x[2]))*(h?-1:1),C={x:x[0]-E[0]*S,y:x[1]-E[1]*S},A=[[0,0],[l,c]];t.setViewportConstrained({x:C.x,y:C.y,zoom:x[2]},A,a)},b=Ui().on("start",m).on("zoom",f?p:null).on("zoom.wheel",d?g:null);r.call(b,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:fe}}const bn=e=>({x:e.x,y:e.y,zoom:e.k}),Rn=({x:e,y:t,zoom:n})=>wn.translate(e,t).scale(n),Ke=(e,t)=>e.target.closest(`.${t}`),Ns=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),xh=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Ln=(e,t=0,n=xh,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},Ss=e=>{const t=e.ctrlKey&&Mt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function vh({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:a,onPanZoom:l,onPanZoomEnd:c}){return u=>{if(Ke(u,t))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const f=n.property("__zoom").k||1;if(u.ctrlKey&&s){const m=fe(u),p=Ss(u),b=f*Math.pow(2,p);o.scaleTo(n,b,m,u);return}const d=u.deltaMode===1?20:1;let h=r===Be.Vertical?0:u.deltaX*d,g=r===Be.Horizontal?0:u.deltaY*d;!Mt()&&u.shiftKey&&r!==Be.Vertical&&(h=u.deltaY*d,g=0),o.translateBy(n,-(h/f)*i,-(g/f)*i,{internal:!0});const w=bn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?l?.(u,w):(e.isPanScrolling=!0,a?.(u,w)),e.panScrollTimeout=setTimeout(()=>{c?.(u,w),e.isPanScrolling=!1},150)}}function bh({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,a=Ke(o,e);if(o.ctrlKey&&i&&a&&o.preventDefault(),s||a)return null;o.preventDefault(),n.call(this,o,r)}}function Eh({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=bn(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 _h({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&Ns(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,bn(i.transform))}}function Nh({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&Ns(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const a=bn(s.transform);e.prevViewport=a,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,a)},n?150:0)}}}function Sh({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:a,noPanClassName:l,lib:c,connectionInProgress:u}){return f=>{const d=e||t,h=n&&f.ctrlKey,g=f.type==="wheel";if(f.button===1&&f.type==="mousedown"&&(Ke(f,`${c}-flow__node`)||Ke(f,`${c}-flow__edge`)))return!0;if(!o&&!d&&!r&&!i&&!n||s||u&&!g||Ke(f,a)&&g||Ke(f,l)&&(!g||r&&g&&!e)||!n&&f.ctrlKey&&g)return!1;if(!n&&f.type==="touchstart"&&f.touches?.length>1)return f.preventDefault(),!1;if(!d&&!r&&!h&&g||!o&&(f.type==="mousedown"||f.type==="touchstart")||Array.isArray(o)&&!o.includes(f.button)&&f.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(f.button)||!f.button||f.button<=1;return(!f.ctrlKey||g)&&w}}function kh({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:a,onDraggingChange:l}){const c={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=e.getBoundingClientRect();let f=[[0,0],[u.width,u.height]];(typeof ResizeObserver<"u"?new ResizeObserver(M=>{const v=M[0];v&&(f=[[0,0],[v.contentRect.width,v.contentRect.height]])}):null)?.observe(e);const h=Ui().extent(()=>f).scaleExtent([t,n]).translateExtent(o),g=ce(e).call(h);x({x:r.x,y:r.y,zoom:ot(r.zoom,t,n)},[[0,0],[u.width,u.height]],o);const w=g.on("wheel.zoom"),m=g.on("dblclick.zoom");h.wheelDelta(Ss);async function p(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).transform(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}function b({noWheelClassName:M,noPanClassName:v,onPaneContextMenu:N,userSelectionActive:k,panOnScroll:O,panOnDrag:R,panOnScrollMode:D,panOnScrollSpeed:V,preventScrolling:H,zoomOnPinch:j,zoomOnScroll:X,zoomOnDoubleClick:F,zoomActivationKeyPressed:W,lib:Q,onTransformChange:G,connectionInProgress:L,paneClickDistance:B,selectionOnDrag:U}){k&&!c.isZoomingOrPanning&&y();const K=O&&!W&&!k;h.clickDistance(U?1/0:!ge(B)||B<0?0:B);const Z=K?vh({zoomPanValues:c,noWheelClassName:M,d3Selection:g,d3Zoom:h,panOnScrollMode:D,panOnScrollSpeed:V,zoomOnPinch:j,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:a}):bh({noWheelClassName:M,preventScrolling:H,d3ZoomHandler:w});g.on("wheel.zoom",Z,{passive:!1});const q=Eh({zoomPanValues:c,onDraggingChange:l,onPanZoomStart:s});h.on("start",q);const J=_h({zoomPanValues:c,panOnDrag:R,onPaneContextMenu:!!N,onPanZoom:i,onTransformChange:G});h.on("zoom",J);const te=Nh({zoomPanValues:c,panOnDrag:R,panOnScroll:O,onPaneContextMenu:N,onPanZoomEnd:a,onDraggingChange:l});h.on("end",te);const oe=Sh({zoomActivationKeyPressed:W,panOnDrag:R,zoomOnScroll:X,panOnScroll:O,zoomOnDoubleClick:F,zoomOnPinch:j,userSelectionActive:k,noPanClassName:v,noWheelClassName:M,lib:Q,connectionInProgress:L});h.filter(oe),F?g.on("dblclick.zoom",m):g.on("dblclick.zoom",null)}function y(){h.on("zoom",null)}async function x(M,v,N){const k=Rn(M),O=h?.constrain()(k,v,N);return O&&await p(O),O}async function _(M,v){const N=Rn(M);return await p(N,v),N}function E(M){if(g){const v=Rn(M),N=g.property("__zoom");(N.k!==M.zoom||N.x!==M.x||N.y!==M.y)&&h?.transform(g,v,null,{sync:!0})}}function S(){const M=g?Ki(g.node()):{x:0,y:0,k:1};return{x:M.x,y:M.y,zoom:M.k}}async function C(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).scaleTo(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}async function A(M,v){return g?new Promise(N=>{h?.interpolate(v?.interpolate==="linear"?wt:qt).scaleBy(Ln(g,v?.duration,v?.ease,()=>N(!0)),M)}):!1}function z(M){h?.scaleExtent(M)}function P(M){h?.translateExtent(M)}function $(M){const v=!ge(M)||M<0?0:M;h?.clickDistance(v)}return{update:b,destroy:y,setViewport:_,setViewportConstrained:x,getViewport:S,scaleTo:C,scaleBy:A,setScaleExtent:z,setTranslateExtent:P,syncViewport:E,setClickDistance:$}}var it;(function(e){e.Line="line",e.Handle="handle"})(it||(it={}));function Ch({width:e,prevWidth:t,height:n,prevHeight:o,affectsX:r,affectsY:i}){const s=e-t,a=n-o,l=[s>0?1:s<0?-1:0,a>0?1:a<0?-1:0];return s&&r&&(l[0]=l[0]*-1),a&&i&&(l[1]=l[1]*-1),l}function _r(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 Pe(e,t){return Math.max(0,t-e)}function $e(e,t){return Math.max(0,e-t)}function Xt(e,t,n){return Math.max(0,t-e,e-n)}function Nr(e,t){return e?!t:t}function Mh(e,t,n,o,r,i,s,a){let{affectsX:l,affectsY:c}=t;const{isHorizontal:u,isVertical:f}=t,d=u&&f,{xSnapped:h,ySnapped:g}=n,{minWidth:w,maxWidth:m,minHeight:p,maxHeight:b}=o,{x:y,y:x,width:_,height:E,aspectRatio:S}=e;let C=Math.floor(u?h-e.pointerX:0),A=Math.floor(f?g-e.pointerY:0);const z=_+(l?-C:C),P=E+(c?-A:A),$=-i[0]*_,M=-i[1]*E;let v=Xt(z,w,m),N=Xt(P,p,b);if(s){let R=0,D=0;l&&C<0?R=Pe(y+C+$,s[0][0]):!l&&C>0&&(R=$e(y+z+$,s[1][0])),c&&A<0?D=Pe(x+A+M,s[0][1]):!c&&A>0&&(D=$e(x+P+M,s[1][1])),v=Math.max(v,R),N=Math.max(N,D)}if(a){let R=0,D=0;l&&C>0?R=$e(y+C,a[0][0]):!l&&C<0&&(R=Pe(y+z,a[1][0])),c&&A>0?D=$e(x+A,a[0][1]):!c&&A<0&&(D=Pe(x+P,a[1][1])),v=Math.max(v,R),N=Math.max(N,D)}if(r){if(u){const R=Xt(z/S,p,b)*S;if(v=Math.max(v,R),s){let D=0;!l&&!c||l&&!c&&d?D=$e(x+M+z/S,s[1][1])*S:D=Pe(x+M+(l?C:-C)/S,s[0][1])*S,v=Math.max(v,D)}if(a){let D=0;!l&&!c||l&&!c&&d?D=Pe(x+z/S,a[1][1])*S:D=$e(x+(l?C:-C)/S,a[0][1])*S,v=Math.max(v,D)}}if(f){const R=Xt(P*S,w,m)/S;if(N=Math.max(N,R),s){let D=0;!l&&!c||c&&!l&&d?D=$e(y+P*S+$,s[1][0])/S:D=Pe(y+(c?A:-A)*S+$,s[0][0])/S,N=Math.max(N,D)}if(a){let D=0;!l&&!c||c&&!l&&d?D=Pe(y+P*S,a[1][0])/S:D=$e(y+(c?A:-A)*S,a[0][0])/S,N=Math.max(N,D)}}}A=A+(A<0?N:-N),C=C+(C<0?v:-v),r&&(d?z>P*S?A=(Nr(l,c)?-C:C)/S:C=(Nr(l,c)?-A:A)*S:u?(A=C/S,c=l):(C=A*S,l=c));const k=l?y+C:y,O=c?x+A:x;return{width:_+(l?-C:C),height:E+(c?-A:A),x:i[0]*C*(l?-1:1)+k,y:i[1]*A*(c?-1:1)+O}}const ks={width:0,height:0,x:0,y:0},Ih={...ks,pointerX:0,pointerY:0,aspectRatio:1};function Oh(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,l=n[1]*s;return[[o-a,r-l],[o+i-a,r+s-l]]}function Ah({domNode:e,nodeId:t,getStoreItems:n,onChange:o,onEnd:r}){const i=ce(e);let s={controlDirection:_r("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function a({controlPosition:c,boundaries:u,keepAspectRatio:f,resizeDirection:d,onResizeStart:h,onResize:g,onResizeEnd:w,shouldResize:m}){let p={...ks},b={...Ih};s={boundaries:u,resizeDirection:d,keepAspectRatio:f,controlDirection:_r(c)};let y,x=null,_=[],E,S,C,A=!1;const z=Ri().on("start",P=>{const{nodeLookup:$,transform:M,snapGrid:v,snapToGrid:N,nodeOrigin:k,paneDomNode:O}=n();if(y=$.get(t),!y)return;x=O?.getBoundingClientRect()??null;const{xSnapped:R,ySnapped:D}=xt(P.sourceEvent,{transform:M,snapGrid:v,snapToGrid:N,containerBounds:x});p={width:y.measured.width??0,height:y.measured.height??0,x:y.position.x??0,y:y.position.y??0},b={...p,pointerX:R,pointerY:D,aspectRatio:p.width/p.height},E=void 0,S=Ze(y.extent)?y.extent:void 0,y.parentId&&(y.extent==="parent"||y.expandParent)&&(E=$.get(y.parentId)),E&&y.extent==="parent"&&(S=[[0,0],[E.measured.width,E.measured.height]]),_=[],C=void 0;for(const[V,H]of $)if(H.parentId===t&&(_.push({id:V,position:{...H.position},extent:H.extent}),H.extent==="parent"||H.expandParent)){const j=Oh(H,y,H.origin??k);C?C=[[Math.min(j[0][0],C[0][0]),Math.min(j[0][1],C[0][1])],[Math.max(j[1][0],C[1][0]),Math.max(j[1][1],C[1][1])]]:C=j}h?.(P,{...p})}).on("drag",P=>{const{transform:$,snapGrid:M,snapToGrid:v,nodeOrigin:N}=n(),k=xt(P.sourceEvent,{transform:$,snapGrid:M,snapToGrid:v,containerBounds:x}),O=[];if(!y)return;const{x:R,y:D,width:V,height:H}=p,j={},X=y.origin??N,{width:F,height:W,x:Q,y:G}=Mh(b,s.controlDirection,k,s.boundaries,s.keepAspectRatio,X,S,C),L=F!==V,B=W!==H,U=Q!==R&&L,K=G!==D&&B;if(!U&&!K&&!L&&!B)return;if((U||K||X[0]===1||X[1]===1)&&(j.x=U?Q:p.x,j.y=K?G:p.y,p.x=j.x,p.y=j.y,_.length>0)){const te=Q-R,oe=G-D;for(const se of _)se.position={x:se.position.x-te+X[0]*(F-V),y:se.position.y-oe+X[1]*(W-H)},O.push(se)}if((L||B)&&(j.width=L&&(!s.resizeDirection||s.resizeDirection==="horizontal")?F:p.width,j.height=B&&(!s.resizeDirection||s.resizeDirection==="vertical")?W:p.height,p.width=j.width,p.height=j.height),E&&y.expandParent){const te=X[0]*(j.width??0);j.x&&j.x<te&&(p.x=te,b.x=b.x-(j.x-te));const oe=X[1]*(j.height??0);j.y&&j.y<oe&&(p.y=oe,b.y=b.y-(j.y-oe))}const Z=Ch({width:p.width,prevWidth:V,height:p.height,prevHeight:H,affectsX:s.controlDirection.affectsX,affectsY:s.controlDirection.affectsY}),q={...p,direction:Z};m?.(P,q)!==!1&&(A=!0,g?.(P,q),o(j,O))}).on("end",P=>{A&&(w?.(P,{...p}),r?.({...p}),A=!1)});i.call(z)}function l(){i.on(".drag",null)}return{update:a,destroy:l}}var Cs={exports:{}},Ms={},Is={exports:{}},Os={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* use-sync-external-store-shim.production.js
|
|
4
4
|
*
|
package/dist/client/index.html
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
try { t = localStorage.getItem("yamlover.theme") || t; } catch (e) {}
|
|
19
19
|
document.documentElement.dataset.theme = t;
|
|
20
20
|
</script>
|
|
21
|
-
<script type="module" crossorigin src="./assets/index-
|
|
22
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
21
|
+
<script type="module" crossorigin src="./assets/index-l1SxxFJR.js"></script>
|
|
22
|
+
<link rel="stylesheet" crossorigin href="./assets/index-_gAtxDG4.css">
|
|
23
23
|
</head>
|
|
24
24
|
<body>
|
|
25
25
|
<div id="root"></div>
|