1import"../chunks/DsnmJJEf.js";import{S as Di,bq as Ai,bF as Ti,a5 as Oi,i as Hi,m as Ri,J as Li,a3 as Vi,a4 as dt,bd as Bi,bc as ao,be as xr,p as te,ai as Ki,a as V,b as ne,f as ee,g as a,c as X,n as St,r as Z,u as m,aJ as Kt,e as ae,s as W,t as ie,at as _n,bE as br,ak as Xe,I as z,ap as ue,aq as Zi,aH as me,d as xe,bG as pe,aI as Ce,bH as Yi,ax as At,aT as Xi}from"../chunks/CYGRAPIB.js";import{s as fe,b as be,e as ot,d as Zt,r as lo,o as Mo}from"../chunks/D9UuDnCi.js";import{s as Fi,e as Wi}from"../chunks/fab_PpXt.js";import{k as Qe,C as co,S as kn,s as J,a as We,c as lt,b as Pe,d as zo,r as qi}from"../chunks/BEZvtooX.js";import{m as Wn,ao as Io,ap as Do,aq as Gi,c as Ao,ar as _r,as as kr,W as Ui,P as Qi,S as Ji,A as ji,L as $i,at as es,au as ts,av as ns,aw as os,ax as rs,ay as On,az as To,X as is}from"../chunks/GyLEs51S.js";import{B as ss,b as as}from"../chunks/CpWhE398.js";import{S as ls}from"../chunks/D0T9t0sD.js";import{P as cs}from"../chunks/CtgGnEb9.js";import{p as L,r as Je,i as le,s as et}from"../chunks/nU4rHKDQ.js";import{P as ft}from"../chunks/T8_RqQZ_.js";import{s as Ne}from"../chunks/B1WxC4rU.js";import{M as us}from"../chunks/Bu5lJkuo.js";import{a as we}from"../chunks/BvFEN88R.js";import{b as Yt}from"../chunks/C0dlyk-o.js";import{e as Ct}from"../chunks/DTvJC0Jp.js";import"../chunks/CK3AoaC7.js";import{i as ds}from"../chunks/BA65WU6K.js";import{c as Sn}from"../chunks/0CuVPpBj.js";const fs=[];function Sr(e,t=!1,n=!1){return on(e,new Map,"",fs,null,n)}function on(e,t,n,o,r=null,i=!1){if(typeof e=="object"&&e!==null){var s=t.get(e);if(s!==void 0)return s;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(Di(e)){var l=Array(e.length);t.set(e,l),r!==null&&t.set(r,l);for(var c=0;c<e.length;c+=1){var d=e[c];c in e&&(l[c]=on(d,t,n,o,null,i))}return l}if(Ai(e)===Ti){l={},t.set(e,l),r!==null&&t.set(r,l);for(var f of Object.keys(e))l[f]=on(e[f],t,n,o,null,i);return l}if(e instanceof Date)return structuredClone(e);if(typeof e.toJSON=="function"&&!i)return on(e.toJSON(),t,n,o,e)}if(e instanceof EventTarget)return e;try{return structuredClone(e)}catch{return e}}function hs(e,t){Hi&&Ri(Li(e)),Oi(()=>{var n=t();for(var o in n){var r=n[o];r?e.style.setProperty(o,r):e.style.removeProperty(o)}})}class uo{#e=new WeakMap;#t;#n;static entries=new WeakMap;constructor(t){this.#n=t}observe(t,n){var o=this.#e.get(t)||new Set;return o.add(n),this.#e.set(t,o),this.#o().observe(t,this.#n),()=>{var r=this.#e.get(t);r.delete(n),r.size===0&&(this.#e.delete(t),this.#t.unobserve(t))}}#o(){return this.#t??(this.#t=new ResizeObserver(t=>{for(var n of t){uo.entries.set(n.target,n);for(var o of this.#e.get(n.target)||[])o(n)}}))}}var gs=new uo({box:"border-box"});function Oo(e,t,n){var o=gs.observe(e,()=>n(e[t]));Vi(()=>(dt(()=>n(e[t])),o))}const ms=!0,Lh=Object.freeze(Object.defineProperty({__proto__:null,prerender:ms},Symbol.toStringTag,{value:"Module"})),ys={get url(){return Wi.url}};Fi.updated.check;const vs=ys;var ps={value:()=>{}};function Cn(){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 rn(n)}function rn(e){this._=e}function ws(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}})}rn.prototype=Cn.prototype={constructor:rn,on:function(e,t){var n=this._,o=ws(e+"",n),r,i=-1,s=o.length;if(arguments.length<2){for(;++i<s;)if((r=(e=o[i]).type)&&(r=xs(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]=Ho(n[r],e.name,t);else if(t==null)for(r in n)n[r]=Ho(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 rn(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 xs(e,t){for(var n=0,o=e.length,r;n<o;++n)if((r=e[n]).name===t)return r.value}
vendor: 6,698 bytes, line 1
1function Ho(e,t,n){for(var o=0,r=e.length;o<r;++o)if(e[o].name===t){e[o]=ps,e=e.slice(0,o).concat(e.slice(o+1));break}return n!=null&&e.push({name:t,value:n}),e}var qn="http://www.w3.org/1999/xhtml";const Ro={svg:"http://www.w3.org/2000/svg",xhtml:qn,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function En(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Ro.hasOwnProperty(t)?{space:Ro[t],local:e}:e}function bs(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===qn&&t.documentElement.namespaceURI===qn?t.createElement(e):t.createElementNS(n,e)}}function _s(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function Cr(e){var t=En(e);return(t.local?_s:bs)(t)}function ks(){}function fo(e){return e==null?ks:function(){return this.querySelector(e)}}function Ss(e){typeof e!="function"&&(e=fo(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,l=o[r]=new Array(s),c,d,f=0;f<s;++f)(c=i[f])&&(d=e.call(c,c.__data__,f,i))&&("__data__"in c&&(d.__data__=c.__data__),l[f]=d);return new Se(o,this._parents)}function Cs(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function Es(){return[]}function Er(e){return e==null?Es:function(){return this.querySelectorAll(e)}}function Ns(e){return function(){return Cs(e.apply(this,arguments))}}function Ps(e){typeof e=="function"?e=Ns(e):e=Er(e);for(var t=this._groups,n=t.length,o=[],r=[],i=0;i<n;++i)for(var s=t[i],l=s.length,c,d=0;d<l;++d)(c=s[d])&&(o.push(e.call(c,c.__data__,d,s)),r.push(c));return new Se(o,r)}function Nr(e){return function(){return this.matches(e)}}function Pr(e){return function(t){return t.matches(e)}}var Ms=Array.prototype.find;function zs(e){return function(){return Ms.call(this.children,e)}}function Is(){return this.firstElementChild}function Ds(e){return this.select(e==null?Is:zs(typeof e=="function"?e:Pr(e)))}var As=Array.prototype.filter;function Ts(){return Array.from(this.children)}function Os(e){return function(){return As.call(this.children,e)}}function Hs(e){return this.selectAll(e==null?Ts:Os(typeof e=="function"?e:Pr(e)))}function Rs(e){typeof e!="function"&&(e=Nr(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,l=o[r]=[],c,d=0;d<s;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new Se(o,this._parents)}function Mr(e){return new Array(e.length)}function Ls(){return new Se(this._enter||this._groups.map(Mr),this._parents)}function un(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}un.prototype={constructor:un,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 Vs(e){return function(){return e}}function Bs(e,t,n,o,r,i){for(var s=0,l,c=t.length,d=i.length;s<d;++s)(l=t[s])?(l.__data__=i[s],o[s]=l):n[s]=new un(e,i[s]);for(;s<c;++s)(l=t[s])&&(r[s]=l)}function Ks(e,t,n,o,r,i,s){var l,c,d=new Map,f=t.length,h=i.length,u=new Array(f),y;for(l=0;l<f;++l)(c=t[l])&&(u[l]=y=s.call(c,c.__data__,l,t)+"",d.has(y)?r[l]=c:d.set(y,c));for(l=0;l<h;++l)y=s.call(e,i[l],l,i)+"",(c=d.get(y))?(o[l]=c,c.__data__=i[l],d.delete(y)):n[l]=new un(e,i[l]);for(l=0;l<f;++l)(c=t[l])&&d.get(u[l])===c&&(r[l]=c)}function Zs(e){return e.__data__}function Ys(e,t){if(!arguments.length)return Array.from(this,Zs);var n=t?Ks:Bs,o=this._parents,r=this._groups;typeof e!="function"&&(e=Vs(e));for(var i=r.length,s=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var f=o[d],h=r[d],u=h.length,y=Xs(e.call(f,f&&f.__data__,d,o)),v=y.length,p=l[d]=new Array(v),w=s[d]=new Array(v),k=c[d]=new Array(u);n(f,h,p,w,k,y,t);for(var N=0,P=0,S,D;N<v;++N)if(S=p[N]){for(N>=P&&(P=N+1);!(D=w[P])&&++P<v;);S._next=D||null}}return s=new Se(s,o),s._enter=l,s._exit=c,s}function Xs(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Fs(){return new Se(this._exit||this._groups.map(Mr),this._parents)}function Ws(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 qs(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),l=new Array(r),c=0;c<s;++c)for(var d=n[c],f=o[c],h=d.length,u=l[c]=new Array(h),y,v=0;v<h;++v)(y=d[v]||f[v])&&(u[v]=y);for(;c<r;++c)l[c]=n[c];return new Se(l,this._parents)}function Gs(){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 Us(e){e||(e=Qs);function t(h,u){return h&&u?e(h.__data__,u.__data__):!h-!u}for(var n=this._groups,o=n.length,r=new Array(o),i=0;i<o;++i){for(var s=n[i],l=s.length,c=r[i]=new Array(l),d,f=0;f<l;++f)(d=s[f])&&(c[f]=d);c.sort(t)}return new Se(r,this._parents).order()}function Qs(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Js(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function js(){return Array.from(this)}function $s(){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 ea(){let e=0;for(const t of this)++e;return e}function ta(){return!this.node()}function na(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var r=t[n],i=0,s=r.length,l;i<s;++i)(l=r[i])&&e.call(l,l.__data__,i,r);return this}function oa(e){return function(){this.removeAttribute(e)}}function ra(e){return function(){this.removeAttributeNS(e.space,e.local)}}function ia(e,t){return function(){this.setAttribute(e,t)}}function sa(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function aa(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function la(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 ca(e,t){var n=En(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?ra:oa:typeof t=="function"?n.local?la:aa:n.local?sa:ia)(n,t))}function zr(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function ua(e){return function(){this.style.removeProperty(e)}}
vendor: 5,454 bytes, line 1
1function da(e,t,n){return function(){this.style.setProperty(e,t,n)}}function fa(e,t,n){return function(){var o=t.apply(this,arguments);o==null?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ha(e,t,n){return arguments.length>1?this.each((t==null?ua:typeof t=="function"?fa:da)(e,t,n??"")):vt(this.node(),e)}function vt(e,t){return e.style.getPropertyValue(t)||zr(e).getComputedStyle(e,null).getPropertyValue(t)}function ga(e){return function(){delete this[e]}}function ma(e,t){return function(){this[e]=t}}function ya(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function va(e,t){return arguments.length>1?this.each((t==null?ga:typeof t=="function"?ya:ma)(e,t)):this.node()[e]}function Ir(e){return e.trim().split(/^|\s+/)}function ho(e){return e.classList||new Dr(e)}function Dr(e){this._node=e,this._names=Ir(e.getAttribute("class")||"")}Dr.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 Ar(e,t){for(var n=ho(e),o=-1,r=t.length;++o<r;)n.add(t[o])}function Tr(e,t){for(var n=ho(e),o=-1,r=t.length;++o<r;)n.remove(t[o])}function pa(e){return function(){Ar(this,e)}}function wa(e){return function(){Tr(this,e)}}function xa(e,t){return function(){(t.apply(this,arguments)?Ar:Tr)(this,e)}}function ba(e,t){var n=Ir(e+"");if(arguments.length<2){for(var o=ho(this.node()),r=-1,i=n.length;++r<i;)if(!o.contains(n[r]))return!1;return!0}return this.each((typeof t=="function"?xa:t?pa:wa)(n,t))}function _a(){this.textContent=""}function ka(e){return function(){this.textContent=e}}function Sa(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function Ca(e){return arguments.length?this.each(e==null?_a:(typeof e=="function"?Sa:ka)(e)):this.node().textContent}function Ea(){this.innerHTML=""}function Na(e){return function(){this.innerHTML=e}}function Pa(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function Ma(e){return arguments.length?this.each(e==null?Ea:(typeof e=="function"?Pa:Na)(e)):this.node().innerHTML}function za(){this.nextSibling&&this.parentNode.appendChild(this)}function Ia(){return this.each(za)}function Da(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Aa(){return this.each(Da)}function Ta(e){var t=typeof e=="function"?e:Cr(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Oa(){return null}function Ha(e,t){var n=typeof e=="function"?e:Cr(e),o=t==null?Oa:typeof t=="function"?t:fo(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function Ra(){var e=this.parentNode;e&&e.removeChild(this)}function La(){return this.each(Ra)}function Va(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ba(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Ka(e){return this.select(e?Ba:Va)}function Za(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Ya(e){return function(t){e.call(this,t,this.__data__)}}function Xa(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 Fa(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 Wa(e,t,n){return function(){var o=this.__on,r,i=Ya(t);if(o){for(var s=0,l=o.length;s<l;++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 qa(e,t,n){var o=Xa(e+""),r,i=o.length,s;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,f;c<d;++c)for(r=0,f=l[c];r<i;++r)if((s=o[r]).type===f.type&&s.name===f.name)return f.value}return}for(l=t?Wa:Fa,r=0;r<i;++r)this.each(l(o[r],t,n));return this}function Or(e,t,n){var o=zr(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 Ga(e,t){return function(){return Or(this,e,t)}}function Ua(e,t){return function(){return Or(this,e,t.apply(this,arguments))}}function Qa(e,t){return this.each((typeof t=="function"?Ua:Ga)(e,t))}function*Ja(){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 Hr=[null];function Se(e,t){this._groups=e,this._parents=t}function Xt(){return new Se([[document.documentElement]],Hr)}function ja(){return this}Se.prototype=Xt.prototype={constructor:Se,select:Ss,selectAll:Ps,selectChild:Ds,selectChildren:Hs,filter:Rs,data:Ys,enter:Ls,exit:Fs,join:Ws,merge:qs,selection:ja,order:Gs,sort:Us,call:Js,nodes:js,node:$s,size:ea,empty:ta,each:na,attr:ca,style:ha,property:va,classed:ba,text:Ca,html:Ma,raise:I
vendor: 4,461 bytes, line 1
1a,lower:Aa,append:Ta,insert:Ha,remove:La,clone:Ka,datum:Za,on:qa,dispatch:Qa,[Symbol.iterator]:Ja};function Ee(e){return typeof e=="string"?new Se([[document.querySelector(e)]],[document.documentElement]):new Se([[e]],Hr)}function $a(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Me(e,t){if(e=$a(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 el={passive:!1},Tt={capture:!0,passive:!1};function Hn(e){e.stopImmediatePropagation()}function gt(e){e.preventDefault(),e.stopImmediatePropagation()}function Rr(e){var t=e.document.documentElement,n=Ee(e).on("dragstart.drag",gt,Tt);"onselectstart"in t?n.on("selectstart.drag",gt,Tt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Lr(e,t){var n=e.document.documentElement,o=Ee(e).on("dragstart.drag",null);t&&(o.on("click.drag",gt,Tt),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 Qt=e=>()=>e;function Gn(e,{sourceEvent:t,subject:n,target:o,identifier:r,active:i,x:s,y:l,dx:c,dy:d,dispatch:f}){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:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:f}})}Gn.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function tl(e){return!e.ctrlKey&&!e.button}function nl(){return this.parentNode}function ol(e,t){return t??{x:e.x,y:e.y}}function rl(){return navigator.maxTouchPoints||"ontouchstart"in this}function il(){var e=tl,t=nl,n=ol,o=rl,r={},i=Cn("start","drag","end"),s=0,l,c,d,f,h=0;function u(S){S.on("mousedown.drag",y).filter(o).on("touchstart.drag",w).on("touchmove.drag",k,el).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function y(S,D){if(!(f||!e.call(this,S,D))){var I=P(this,t.call(this,S,D),S,D,"mouse");I&&(Ee(S.view).on("mousemove.drag",v,Tt).on("mouseup.drag",p,Tt),Rr(S.view),Hn(S),d=!1,l=S.clientX,c=S.clientY,I("start",S))}}function v(S){if(gt(S),!d){var D=S.clientX-l,I=S.clientY-c;d=D*D+I*I>h}r.mouse("drag",S)}function p(S){Ee(S.view).on("mousemove.drag mouseup.drag",null),Lr(S.view,d),gt(S),r.mouse("end",S)}function w(S,D){if(e.call(this,S,D)){var I=S.changedTouches,R=t.call(this,S,D),T=I.length,K,Q;for(K=0;K<T;++K)(Q=P(this,R,S,D,I[K].identifier,I[K]))&&(Hn(S),Q("start",S,I[K]))}}function k(S){var D=S.changedTouches,I=D.length,R,T;for(R=0;R<I;++R)(T=r[D[R].identifier])&&(gt(S),T("drag",S,D[R]))}function N(S){var D=S.changedTouches,I=D.length,R,T;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),R=0;R<I;++R)(T=r[D[R].identifier])&&(Hn(S),T("end",S,D[R]))}function P(S,D,I,R,T,K){var Q=i.copy(),E=Me(K||I,D),_,C,g;if((g=n.call(S,new Gn("beforestart",{sourceEvent:I,target:u,identifier:T,active:s,x:E[0],y:E[1],dx:0,dy:0,dispatch:Q}),R))!=null)return _=g.x-E[0]||0,C=g.y-E[1]||0,function x(b,M,O){var A=E,H;switch(b){case"start":r[T]=x,H=s++;break;case"end":delete r[T],--s;case"drag":E=Me(O||M,D),H=s;break}Q.call(b,S,new Gn(b,{sourceEvent:M,subject:g,target:u,identifier:T,active:H,x:E[0]+_,y:E[1]+C,dx:E[0]-A[0],dy:E[1]-A[1],dispatch:Q}),R)}}return u.filter=function(S){return arguments.length?(e=typeof S=="function"?S:Qt(!!S),u):e},u.container=function(S){return arguments.length?(t=typeof S=="function"?S:Qt(S),u):t},u.subject=function(S){return arguments.length?(n=typeof S=="function"?S:Qt(S),u):n},u.touchable=function(S){return arguments.length?(o=typeof S=="function"?S:Qt(!!S),u):o},u.on=function(){var S=i.on.apply(i,arguments);return S===i?u:S},u.clickDistance=function(S){return arguments.length?(h=(S=+S)*S,u):Math.sqrt(h)},u}function go(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Vr(e,t){var n=Object.create(e.prototype);
vendor: 6,638 bytes, line 1
1for(var o in t)n[o]=t[o];return n}function Ft(){}var Ot=.7,dn=1/Ot,mt="\\s*([+-]?\\d+)\\s*",Ht="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",He="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",sl=/^#([0-9a-f]{3,8})$/,al=new RegExp(`^rgb\\(${mt},${mt},${mt}\\)$`),ll=new RegExp(`^rgb\\(${He},${He},${He}\\)$`),cl=new RegExp(`^rgba\\(${mt},${mt},${mt},${Ht}\\)$`),ul=new RegExp(`^rgba\\(${He},${He},${He},${Ht}\\)$`),dl=new RegExp(`^hsl\\(${Ht},${He},${He}\\)$`),fl=new RegExp(`^hsla\\(${Ht},${He},${He},${Ht}\\)$`),Lo={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};go(Ft,rt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Vo,formatHex:Vo,formatHex8:hl,formatHsl:gl,formatRgb:Bo,toString:Bo});function Vo(){return this.rgb().formatHex()}function hl(){return this.rgb().formatHex8()}function gl(){return Br(this).formatHsl()}function Bo(){return this.rgb().formatRgb()}function rt(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=sl.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Ko(t):n===3?new _e(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Jt(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Jt(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=al.exec(e))?new _e(t[1],t[2],t[3],1):(t=ll.exec(e))?new _e(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=cl.exec(e))?Jt(t[1],t[2],t[3],t[4]):(t=ul.exec(e))?Jt(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dl.exec(e))?Xo(t[1],t[2]/100,t[3]/100,1):(t=fl.exec(e))?Xo(t[1],t[2]/100,t[3]/100,t[4]):Lo.hasOwnProperty(e)?Ko(Lo[e]):e==="transparent"?new _e(NaN,NaN,NaN,0):null}function Ko(e){return new _e(e>>16&255,e>>8&255,e&255,1)}function Jt(e,t,n,o){return o<=0&&(e=t=n=NaN),new _e(e,t,n,o)}function ml(e){return e instanceof Ft||(e=rt(e)),e?(e=e.rgb(),new _e(e.r,e.g,e.b,e.opacity)):new _e}function Un(e,t,n,o){return arguments.length===1?ml(e):new _e(e,t,n,o??1)}function _e(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}go(_e,Un,Vr(Ft,{brighter(e){return e=e==null?dn:Math.pow(dn,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Ot:Math.pow(Ot,e),new _e(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new _e(nt(this.r),nt(this.g),nt(this.b),fn(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:Zo,formatHex:Zo,formatHex8:yl,formatRgb:Yo,toString:Yo}));function Zo(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}`}function yl(){return`#${tt(this.r)}${tt(this.g)}${tt(this.b)}${tt((isNaN(this.opacity)?1:this.opacity)*255)}`}function Yo(){const e=fn(this.opacity);return`${e===1?"rgb(":"rgba("}${nt(this.r)}, ${nt(this.g)}, ${nt(this.b)}${e===1?")":`, ${e})`}`}function fn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function nt(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function tt(e){return e=nt(e),(e<16?"0":"")+e.toString(16)}function Xo(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ze(e,t,n,o)}function Br(e){if(e instanceof ze)return new ze(e.h,e.s,e.l,e.opacity);if(e instanceof Ft||(e=rt(e)),!e)return new ze;if(e instanceof ze)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,l=i-r,c=(i+r)/2;return l?(t===i?s=(n-o)/l+(n<o)*6:n===i?s=(o-t)/l+2:s=(t-n)/l+4,l/=c<.5?i+r:2-i-r,s*=60):l=c>0&&c<1?0:s,new ze(s,l,c,e.opacity)}function vl(e,t,n,o){return arguments.length===1?Br(e):new ze(e,t,n,o??1)}function ze(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}go(ze,vl,Vr(Ft,{brighter(e){return e=e==null?dn:Math.pow(dn,e),new ze(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Ot:Math.pow(Ot,e),new ze(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 _e(Rn(e>=240?e-240:e+120,r,o),Rn(e,r,o),Rn(e<120?e+240:e-120,r,o),this.opacity)}
vendor: 9,305 bytes, line 1
1,clamp(){return new ze(Fo(this.h),jt(this.s),jt(this.l),fn(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=fn(this.opacity);return`${e===1?"hsl(":"hsla("}${Fo(this.h)}, ${jt(this.s)*100}%, ${jt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function Fo(e){return e=(e||0)%360,e<0?e+360:e}function jt(e){return Math.max(0,Math.min(1,e||0))}function Rn(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 mo=e=>()=>e;function pl(e,t){return function(n){return e+n*t}}function wl(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(o){return Math.pow(e+o*t,n)}}function xl(e){return(e=+e)==1?Kr:function(t,n){return n-t?wl(t,n,e):mo(isNaN(t)?n:t)}}function Kr(e,t){var n=t-e;return n?pl(e,n):mo(isNaN(e)?t:e)}const hn=(function e(t){var n=xl(t);function o(r,i){var s=n((r=Un(r)).r,(i=Un(i)).r),l=n(r.g,i.g),c=n(r.b,i.b),d=Kr(r.opacity,i.opacity);return function(f){return r.r=s(f),r.g=l(f),r.b=c(f),r.opacity=d(f),r+""}}return o.gamma=e,o})(1);function bl(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 _l(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function kl(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]=Dt(e[s],t[s]);for(;s<n;++s)i[s]=t[s];return function(l){for(s=0;s<o;++s)i[s]=r[s](l);return i}}function Sl(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function Oe(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Cl(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]=Dt(e[r],t[r]):o[r]=t[r];return function(i){for(r in n)o[r]=n[r](i);return o}}var Qn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ln=new RegExp(Qn.source,"g");function El(e){return function(){return e}}function Nl(e){return function(t){return e(t)+""}}function Zr(e,t){var n=Qn.lastIndex=Ln.lastIndex=0,o,r,i,s=-1,l=[],c=[];for(e=e+"",t=t+"";(o=Qn.exec(e))&&(r=Ln.exec(t));)(i=r.index)>n&&(i=t.slice(n,i),l[s]?l[s]+=i:l[++s]=i),(o=o[0])===(r=r[0])?l[s]?l[s]+=r:l[++s]=r:(l[++s]=null,c.push({i:s,x:Oe(o,r)})),n=Ln.lastIndex;return n<t.length&&(i=t.slice(n),l[s]?l[s]+=i:l[++s]=i),l.length<2?c[0]?Nl(c[0].x):El(t):(t=c.length,function(d){for(var f=0,h;f<t;++f)l[(h=c[f]).i]=h.x(d);return l.join("")})}function Dt(e,t){var n=typeof t,o;return t==null||n==="boolean"?mo(t):(n==="number"?Oe:n==="string"?(o=rt(t))?(t=o,hn):Zr:t instanceof rt?hn:t instanceof Date?Sl:_l(t)?bl:Array.isArray(t)?kl:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?Cl:Oe)(e,t)}var Wo=180/Math.PI,Jn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Yr(e,t,n,o,r,i){var s,l,c;return(s=Math.sqrt(e*e+t*t))&&(e/=s,t/=s),(c=e*n+t*o)&&(n-=e*c,o-=t*c),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,c/=l),e*o<t*n&&(e=-e,t=-t,c=-c,s=-s),{translateX:r,translateY:i,rotate:Math.atan2(t,e)*Wo,skewX:Math.atan(c)*Wo,scaleX:s,scaleY:l}}var $t;function Pl(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Jn:Yr(t.a,t.b,t.c,t.d,t.e,t.f)}function Ml(e){return e==null||($t||($t=document.createElementNS("http://www.w3.org/2000/svg","g")),$t.setAttribute("transform",e),!(e=$t.transform.baseVal.consolidate()))?Jn:(e=e.matrix,Yr(e.a,e.b,e.c,e.d,e.e,e.f))}function Xr(e,t,n,o){function r(d){return d.length?d.pop()+" ":""}function i(d,f,h,u,y,v){if(d!==h||f!==u){var p=y.push("translate(",null,t,null,n);v.push({i:p-4,x:Oe(d,h)},{i:p-2,x:Oe(f,u)})}else(h||u)&&y.push("translate("+h+t+u+n)}function s(d,f,h,u){d!==f?(d-f>180?f+=360:f-d>180&&(d+=360),u.push({i:h.push(r(h)+"rotate(",null,o)-2,x:Oe(d,f)})):f&&h.push(r(h)+"rotate("+f+o)}function l(d,f,h,u){d!==f?u.push({i:h.push(r(h)+"skewX(",null,o)-2,x:Oe(d,f)}):f&&h.push(r(h)+"skewX("+f+o)}function c(d,f,h,u,y,v){if(d!==h||f!==u){var p=y.push(r(y)+"scale(",null,",",null,")");v.push({i:p-4,x:Oe(d,h)},{i:p-2,x:Oe(f,u)})}else(h!==1||u!==1)&&y.push(r(y)+"scale("+h+","+u+")")}return function(d,f){var h=[],u=[];return d=e(d),f=e(f),i(d.translateX,d.translateY,f.translateX,f.translateY,h,u),s(d.rotate,f.rotate,h,u),l(d.skewX,f.skewX,h,u),c(d.scaleX,d.scaleY,f.scaleX,f.scaleY,h,u),d=f=null,function(y){for(var v=-1,p=u.length,w;++v<p;)h[(w=u[v]).i]=w.x(y);return h.join("")}}}var zl=Xr(Pl,"px, ","px)","deg)"),Il=Xr(Ml,", ",")",")"),Dl=1e-12;function qo(e){return((e=Math.exp(e))+1/e)/2}function Al(e){return((e=Math.exp(e))-1/e)/2}function Tl(e){return((e=Math.exp(2*e))-1)/(e+1)}const sn=(function e(t,n,o){function r(i,s){var l=i[0],c=i[1],d=i[2],f=s[0],h=s[1],u=s[2],y=f-l,v=h-c,p=y*y+v*v,w,k;if(p<Dl)k=Math.log(u/d)/t,w=function(R){return[l+R*y,c+R*v,d*Math.exp(t*R*k)]};else{var N=Math.sqrt(p),P=(u*u-d*d+o*p)/(2*d*n*N),S=(u*u-d*d-o*p)/(2*u*n*N),D=Math.log(Math.sqrt(P*P+1)-P),I=Math.log(Math.sqrt(S*S+1)-S);k=(I-D)/t,w=function(R){var T=R*k,K=qo(D),Q=d/(n*N)*(K*Tl(t*T+D)-Al(D));return[l+Q*y,c+Q*v,d*K/qo(t*T+D)]}}return w.duration=k*1e3*t/Math.SQRT2,w}return r.rho=function(i){var s=Math.max(.001,+i),l=s*s,c=l*l;return e(s,l,c)},r})(Math.SQRT2,2,4);var pt=0,zt=0,Pt=0,Fr=1e3,gn,It,mn=0,it=0,Nn=0,Rt=typeof performance=="object"&&performance.now?performance:Date,Wr=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function yo(){return it||(Wr(Ol),it=Rt.now()+Nn)}function Ol(){it=0}function yn(){this._call=this._time=this._next=null}yn.prototype=qr.prototype={constructor:yn,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?yo():+n)+(t==null?0:+t),!this._next&&It!==this&&(It?It._next=this:gn=this,It=this),this._call=e,this._time=n,jn()},stop:function(){this._call&&(this._call=null,this._time=1/0,jn())}};function qr(e,t,n){var o=new yn;return o.restart(e,t,n),o}function Hl(){yo(),++pt;for(var e=gn,t;e;)(t=it-e._time)>=0&&e._call.call(void 0,t),e=e._next;--pt}function Go(){it=(mn=Rt.now())+Nn,pt=zt=0;try{Hl()}finally{pt=0,Ll(),it=0}}function Rl(){var e=Rt.now(),t=e-mn;t>Fr&&(Nn-=t,mn=e)}function Ll(){for(var e,t=gn,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:gn=n);It=e,jn(o)}function jn(e){if(!pt){zt&&(zt=clearTimeout(zt));var t=e-it;t>24?(e<1/0&&(zt=setTimeout(Go,e-Rt.now()-Nn)),Pt&&(Pt=clearInterval(Pt))):(Pt||(mn=Rt.now(),Pt=setInterval(Rl,Fr)),pt=1,Wr(Go))}}function Uo(e,t,n){var o=new yn;return t=t==null?0:+t,o.restart(r=>{o.stop(),e(r+t)},t,n),o}var Vl=Cn("start","end","cancel","interrupt"),Bl=[],Gr=0,Qo=1,$n=2,an=3,Jo=4,eo=5,ln=6;function Pn(e,t,n,o,r,i){var s=e.__transition;if(!s)e.__transition={};else if(n in s)return;Kl(e,n,{name:t,index:o,group:r,on:Vl,tween:Bl,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:Gr})}function vo(e,t){var n=De(e,t);if(n.state>Gr)throw new Error("too late; already scheduled");return n}function Le(e,t){var n=De(e,t);if(n.state>an)throw new Error("too late; already running");return n}function De(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function Kl(e,t,n){var o=e.__transition,r;o[t]=n,n.timer=qr(i,0,n.time);function i(d){n.state=Qo,n.timer.restart(s,n.delay,n.time),n.delay<=d&&s(d-n.delay)}function s(d){var f,h,u,y;if(n.state!==Qo)return c();for(f in o)if(y=o[f],y.name===n.name){if(y.state===an)return Uo(s);y.state===Jo?(y.state=ln,y.timer.stop(),y.on.call("interrupt",e,e.__data__,y.index,y.group),delete o[f]):+f<t&&(y.state=ln,y.timer.stop(),y.on.call("cancel",e,e.__data__,y.index,y.group),delete o[f])}if(Uo(function(){n.state===an&&(n.state=Jo,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=$n,n.on.call("start",e,e.__data__,n.index,n.group),n.state===$n){for(n.state=an,r=new Array(u=n.tween.length),f=0,h=-1;f<u;++f)(y=n.tween[f].value.call(e,e.__data__,n.index,n.group))&&(r[++h]=y);r.length=h+1}}function l(d){for(var f=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=eo,1),h=-1,u=r.length;++h<u;)r[h].call(e,f);n.state===eo&&(n.on.call("end",e,e.__data__,n.index,n.group),c())}function c(){n.state=ln,n.timer.stop(),delete o[t];for(var d in o)return;delete e.__transition}}function cn(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>$n&&o.state<eo,o.state=ln,o.timer.stop(),o.on.call(r?"interrupt":"cancel",e,e.__data__,o.index,o.group),delete n[s]}i&&delete e.__transition}}function Zl(e){return this.each(function(){cn(this,e)})}function Yl(e,t){var n,o;return function(){var r=Le(this,e),i=r.tween;if(i!==n){o=n=i;for(var s=0,l=o.length;s<l;++s)if(o[s].name===t){o=o.slice(),o.splice(s,1);break}}r.tween=o}}function Xl(e,t,n){var o,r;if(typeof n!="function")throw new Error;return function(){var i=Le(this,e),s=i.tween;if(s!==o){r=(o=s).slice();for(var l={name:t,value:n},c=0,d=r.length;c<d;++c)if(r[c].name===t){r[c]=l;break}c===d&&r.push(l)}i.tween=r}}function Fl(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o=De(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?Yl:Xl)(n,e,t))}
vendor: 5,636 bytes, line 1
1function po(e,t,n){var o=e._id;return e.each(function(){var r=Le(this,o);(r.value||(r.value={}))[t]=n.apply(this,arguments)}),function(r){return De(r,o).value[t]}}function Ur(e,t){var n;return(typeof t=="number"?Oe:t instanceof rt?hn:(n=rt(t))?(t=n,hn):Zr)(e,t)}function Wl(e){return function(){this.removeAttribute(e)}}function ql(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Gl(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 Ul(e,t,n){var o,r=n+"",i;return function(){var s=this.getAttributeNS(e.space,e.local);return s===r?null:s===o?i:i=t(o=s,n)}}function Ql(e,t,n){var o,r,i;return function(){var s,l=n(this),c;return l==null?void this.removeAttribute(e):(s=this.getAttribute(e),c=l+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,l)))}}function Jl(e,t,n){var o,r,i;return function(){var s,l=n(this),c;return l==null?void this.removeAttributeNS(e.space,e.local):(s=this.getAttributeNS(e.space,e.local),c=l+"",s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,l)))}}function jl(e,t){var n=En(e),o=n==="transform"?Il:Ur;return this.attrTween(e,typeof t=="function"?(n.local?Jl:Ql)(n,o,po(this,"attr."+e,t)):t==null?(n.local?ql:Wl)(n):(n.local?Ul:Gl)(n,o,t))}function $l(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}function ec(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}function tc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&ec(e,i)),n}return r._value=t,r}function nc(e,t){var n,o;function r(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&$l(e,i)),n}return r._value=t,r}function oc(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=En(e);return this.tween(n,(o.local?tc:nc)(o,t))}function rc(e,t){return function(){vo(this,e).delay=+t.apply(this,arguments)}}function ic(e,t){return t=+t,function(){vo(this,e).delay=t}}function sc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?rc:ic)(t,e)):De(this.node(),t).delay}function ac(e,t){return function(){Le(this,e).duration=+t.apply(this,arguments)}}function lc(e,t){return t=+t,function(){Le(this,e).duration=t}}function cc(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?ac:lc)(t,e)):De(this.node(),t).duration}function uc(e,t){if(typeof t!="function")throw new Error;return function(){Le(this,e).ease=t}}function dc(e){var t=this._id;return arguments.length?this.each(uc(t,e)):De(this.node(),t).ease}function fc(e,t){return function(){var n=t.apply(this,arguments);if(typeof n!="function")throw new Error;Le(this,e).ease=n}}function hc(e){if(typeof e!="function")throw new Error;return this.each(fc(this._id,e))}function gc(e){typeof e!="function"&&(e=Nr(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,l=o[r]=[],c,d=0;d<s;++d)(c=i[d])&&e.call(c,c.__data__,d,i)&&l.push(c);return new Fe(o,this._parents,this._name,this._id)}function mc(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),l=0;l<i;++l)for(var c=t[l],d=n[l],f=c.length,h=s[l]=new Array(f),u,y=0;y<f;++y)(u=c[y]||d[y])&&(h[y]=u);for(;l<o;++l)s[l]=t[l];return new Fe(s,this._parents,this._name,this._id)}function yc(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 vc(e,t,n){var o,r,i=yc(t)?vo:Le;return function(){var s=i(this,e),l=s.on;l!==o&&(r=(o=l).copy()).on(t,n),s.on=r}}function pc(e,t){var n=this._id;return arguments.length<2?De(this.node(),n).on.on(e):this.each(vc(n,e,t))}function wc(e){return function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}}function xc(){return this.on("end.remove",wc(this._id))}function bc(e){var t=this._name,n=this._id;typeof e!="function"&&(e=fo(e));for(var o=this._groups,r=o.length,i=new Array(r),s=0;s<r;++s)for(var l=o[s],c=l.length,d=i[s]=new Array(c),f,h,u=0;u<c;++u)(f=l[u])&&(h=e.call(f,f.__data__,u,l))&&("__data__"in f&&(h.__data__=f.__data__),d[u]=h,Pn(d[u],t,n,u,d,De(f,n)));return new Fe(i,this._parents,t,n)}function _c(e){var t=this._name,n=this._id;typeof e!="function"&&(e=Er(e));for(var o=this._groups,r=o.length,i=[],s=[],l=0;l<r;++l)for(var c=o[l],d=c.length,f,h=0;h<d;++h)if(f=c[h]){for(var u=e.call(f,f.__data__,h,c),y,v=De(f,n),p=0,w=u.length;p<w;++p)(y=u[p])&&Pn(y,t,n,p,u,v);i.push(u),s.push(f)}return new Fe(i,s,t,n)}var kc=Xt.prototype.constructor;function Sc(){return new kc(this._groups,this._parents)}function Cc(e,t){var n,o,r;return function(){var i=vt(this,e),s=(this.style.removeProperty(e),vt(this,e));return i===s?null:i===n&&s===o?r:r=t(n=i,o=s)}}function Qr(e){return function(){this.style.removeProperty(e)}}function Ec(e,t,n){var o,r=n+"",i;return function(){var s=vt(this,e);return s===r?null:s===o?i:i=t(o=s,n)}}function Nc(e,t,n){var o,r,i;return function(){var s=vt(this,e),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(e),vt(this,e))),s===c?null:s===o&&c===r?i:(r=c,i=t(o=s,l))}}function Pc(e,t){var n,o,r,i="style."+t,s="end."+i,l;return function(){var c=Le(this,e),d=c.on,f=c.value[i]==null?l||(l=Qr(t)):void 0;(d!==n||r!==f)&&(o=(n=d).copy()).on(s,r=f),c.on=o}}function Mc(e,t,n){var o=(e+="")=="transform"?zl:Ur;return t==null?this.styleTween(e,Cc(e,o)).on("end.style."+e,Qr(e)):typeof t=="function"?this.styleTween(e,Nc(e,o,po(this,"style."+e,t))).each(Pc(this._id,e)):this.styleTween(e,Ec(e,o,t),n).on("end.style."+e,null)}
vendor: 8,892 bytes, line 1
1function zc(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}function Ic(e,t,n){var o,r;function i(){var s=t.apply(this,arguments);return s!==r&&(o=(r=s)&&zc(e,s,n)),o}return i._value=t,i}function Dc(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,Ic(e,t,n??""))}function Ac(e){return function(){this.textContent=e}}function Tc(e){return function(){var t=e(this);this.textContent=t??""}}function Oc(e){return this.tween("text",typeof e=="function"?Tc(po(this,"text",e)):Ac(e==null?"":e+""))}function Hc(e){return function(t){this.textContent=e.call(this,t)}}function Rc(e){var t,n;function o(){var r=e.apply(this,arguments);return r!==n&&(t=(n=r)&&Hc(r)),t}return o._value=e,o}function Lc(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,Rc(e))}function Vc(){for(var e=this._name,t=this._id,n=Jr(),o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],l=s.length,c,d=0;d<l;++d)if(c=s[d]){var f=De(c,t);Pn(c,e,n,d,s,{time:f.time+f.delay+f.duration,delay:0,duration:f.duration,ease:f.ease})}return new Fe(o,this._parents,e,n)}function Bc(){var e,t,n=this,o=n._id,r=n.size();return new Promise(function(i,s){var l={value:s},c={value:function(){--r===0&&i()}};n.each(function(){var d=Le(this,o),f=d.on;f!==e&&(t=(e=f).copy(),t._.cancel.push(l),t._.interrupt.push(l),t._.end.push(c)),d.on=t}),r===0&&i()})}var Kc=0;function Fe(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Jr(){return++Kc}var Be=Xt.prototype;Fe.prototype={constructor:Fe,select:bc,selectAll:_c,selectChild:Be.selectChild,selectChildren:Be.selectChildren,filter:gc,merge:mc,selection:Sc,transition:Vc,call:Be.call,nodes:Be.nodes,node:Be.node,size:Be.size,empty:Be.empty,each:Be.each,on:pc,attr:jl,attrTween:oc,style:Mc,styleTween:Dc,text:Oc,textTween:Lc,remove:xc,tween:Fl,delay:sc,duration:cc,ease:dc,easeVarying:hc,end:Bc,[Symbol.iterator]:Be[Symbol.iterator]};function Zc(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var Yc={time:null,delay:0,duration:250,ease:Zc};function Xc(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 Fc(e){var t,n;e instanceof Fe?(t=e._id,e=e._name):(t=Jr(),(n=Yc).time=yo(),e=e==null?null:e+"");for(var o=this._groups,r=o.length,i=0;i<r;++i)for(var s=o[i],l=s.length,c,d=0;d<l;++d)(c=s[d])&&Pn(c,e,t,d,s,n||Xc(c,t));return new Fe(o,this._parents,e,t)}Xt.prototype.interrupt=Zl;Xt.prototype.transition=Fc;const en=e=>()=>e;function Wc(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 Ke(e,t,n){this.k=e,this.x=t,this.y=n}Ke.prototype={constructor:Ke,scale:function(e){return e===1?this:new Ke(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Ke(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 Mn=new Ke(1,0,0);jr.prototype=Ke.prototype;function jr(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Mn;return e.__zoom}function Vn(e){e.stopImmediatePropagation()}function Mt(e){e.preventDefault(),e.stopImmediatePropagation()}function qc(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function Gc(){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 jo(){return this.__zoom||Mn}function Uc(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Qc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Jc(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 $r(){var e=qc,t=Gc,n=Jc,o=Uc,r=Qc,i=[0,1/0],s=[[-1/0,-1/0],[1/0,1/0]],l=250,c=sn,d=Cn("start","zoom","end"),f,h,u,y=500,v=150,p=0,w=10;function k(g){g.property("__zoom",jo).on("wheel.zoom",T,{passive:!1}).on("mousedown.zoom",K).on("dblclick.zoom",Q).filter(r).on("touchstart.zoom",E).on("touchmove.zoom",_).on("touchend.zoom touchcancel.zoom",C).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}k.transform=function(g,x,b,M){var O=g.selection?g.selection():g;O.property("__zoom",jo),g!==O?D(g,x,b,M):O.interrupt().each(function(){I(this,arguments).event(M).start().zoom(null,typeof x=="function"?x.apply(this,arguments):x).end()})},k.scaleBy=function(g,x,b,M){k.scaleTo(g,function(){var O=this.__zoom.k,A=typeof x=="function"?x.apply(this,arguments):x;return O*A},b,M)},k.scaleTo=function(g,x,b,M){k.transform(g,function(){var O=t.apply(this,arguments),A=this.__zoom,H=b==null?S(O):typeof b=="function"?b.apply(this,arguments):b,B=A.invert(H),F=typeof x=="function"?x.apply(this,arguments):x;return n(P(N(A,F),H,B),O,s)},b,M)},k.translateBy=function(g,x,b,M){k.transform(g,function(){return n(this.__zoom.translate(typeof x=="function"?x.apply(this,arguments):x,typeof b=="function"?b.apply(this,arguments):b),t.apply(this,arguments),s)},null,M)},k.translateTo=function(g,x,b,M,O){k.transform(g,function(){var A=t.apply(this,arguments),H=this.__zoom,B=M==null?S(A):typeof M=="function"?M.apply(this,arguments):M;return n(Mn.translate(B[0],B[1]).scale(H.k).translate(typeof x=="function"?-x.apply(this,arguments):-x,typeof b=="function"?-b.apply(this,arguments):-b),A,s)},M,O)};function N(g,x){return x=Math.max(i[0],Math.min(i[1],x)),x===g.k?g:new Ke(x,g.x,g.y)}function P(g,x,b){var M=x[0]-b[0]*g.k,O=x[1]-b[1]*g.k;return M===g.x&&O===g.y?g:new Ke(g.k,M,O)}function S(g){return[(+g[0][0]+ +g[1][0])/2,(+g[0][1]+ +g[1][1])/2]}function D(g,x,b,M){g.on("start.zoom",function(){I(this,arguments).event(M).start()}).on("interrupt.zoom end.zoom",function(){I(this,arguments).event(M).end()}).tween("zoom",function(){var O=this,A=arguments,H=I(O,A).event(M),B=t.apply(O,A),F=b==null?S(B):typeof b=="function"?b.apply(O,A):b,q=Math.max(B[1][0]-B[0][0],B[1][1]-B[0][1]),Y=O.__zoom,oe=typeof x=="function"?x.apply(O,A):x,G=c(Y.invert(F).concat(q/Y.k),oe.invert(F).concat(q/oe.k));return function(j){if(j===1)j=oe;else{var U=G(j),re=q/U[2];j=new Ke(re,F[0]-U[0]*re,F[1]-U[1]*re)}H.zoom(null,j)}})}function I(g,x,b){return!b&&g.__zooming||new R(g,x)}function R(g,x){this.that=g,this.args=x,this.active=0,this.sourceEvent=null,this.extent=t.apply(g,x),this.taps=0}R.prototype={event:function(g){return g&&(this.sourceEvent=g),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(g,x){return this.mouse&&g!=="mouse"&&(this.mouse[1]=x.invert(this.mouse[0])),this.touch0&&g!=="touch"&&(this.touch0[1]=x.invert(this.touch0[0])),this.touch1&&g!=="touch"&&(this.touch1[1]=x.invert(this.touch1[0])),this.that.__zoom=x,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(g){var x=Ee(this.that).datum();d.call(g,this.that,new Wc(g,{sourceEvent:this.sourceEvent,target:k,transform:this.that.__zoom,dispatch:d}),x)}};function T(g,...x){if(!e.apply(this,arguments))return;var b=I(this,x).event(g),M=this.__zoom,O=Math.max(i[0],Math.min(i[1],M.k*Math.pow(2,o.apply(this,arguments)))),A=Me(g);if(b.wheel)(b.mouse[0][0]!==A[0]||b.mouse[0][1]!==A[1])&&(b.mouse[1]=M.invert(b.mouse[0]=A)),clearTimeout(b.wheel);else{if(M.k===O)return;b.mouse=[A,M.invert(A)],cn(this),b.start()}Mt(g),b.wheel=setTimeout(H,v),b.zoom("mouse",n(P(N(M,O),b.mouse[0],b.mouse[1]),b.extent,s));function H(){b.wheel=null,b.end()}}function K(g,...x){if(u||!e.apply(this,arguments))return;var b=g.currentTarget,M=I(this,x,!0).event(g),O=Ee(g.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",q,!0),A=Me(g,b),H=g.clientX,B=g.clientY;Rr(g.view),Vn(g),M.mouse=[A,this.__zoom.invert(A)],cn(this),M.start();function F(Y){if(Mt(Y),!M.moved){var oe=Y.clientX-H,G=Y.clientY-B;M.moved=oe*oe+G*G>p}
1M.event(Y).zoom("mouse",n(P(M.that.__zoom,M.mouse[0]=Me(Y,b),M.mouse[1]),M.extent,s))}function q(Y){O.on("mousemove.zoom mouseup.zoom",null),Lr(Y.view,M.moved),Mt(Y),M.event(Y).end()}}function Q(g,...x){if(e.apply(this,arguments)){var b=this.__zoom,M=Me(g.changedTouches?g.changedTouches[0]:g,this),O=b.invert(M),A=b.k*(g.shiftKey?.5:2),H=n(P(N(b,A),M,O),t.apply(this,x),s);Mt(g),l>0?Ee(this).transition().duration(l).call(D,H,M,g):Ee(this).call(k.transform,H,M,g)}}function E(g,...x){if(e.apply(this,arguments)){var b=g.touches,M=b.length,O=I(this,x,g.changedTouches.length===M).event(g),A,H,B,F;for(Vn(g),H=0;H<M;++H)B=b[H],F=Me(B,this),F=[F,this.__zoom.invert(F),B.identifier],O.touch0?!O.touch1&&O.touch0[2]!==F[2]&&(O.touch1=F,O.taps=0):(O.touch0=F,A=!0,O.taps=1+!!f);f&&(f=clearTimeout(f)),A&&(O.taps<2&&(h=F[0],f=setTimeout(function(){f=null},y)),cn(this),O.start())}}function _(g,...x){if(this.__zooming){var b=I(this,x).event(g),M=g.changedTouches,O=M.length,A,H,B,F;for(Mt(g),A=0;A<O;++A)H=M[A],B=Me(H,this),b.touch0&&b.touch0[2]===H.identifier?b.touch0[0]=B:b.touch1&&b.touch1[2]===H.identifier&&(b.touch1[0]=B);if(H=b.that.__zoom,b.touch1){var q=b.touch0[0],Y=b.touch0[1],oe=b.touch1[0],G=b.touch1[1],j=(j=oe[0]-q[0])*j+(j=oe[1]-q[1])*j,U=(U=G[0]-Y[0])*U+(U=G[1]-Y[1])*U;H=N(H,Math.sqrt(j/U)),B=[(q[0]+oe[0])/2,(q[1]+oe[1])/2],F=[(Y[0]+G[0])/2,(Y[1]+G[1])/2]}else if(b.touch0)B=b.touch0[0],F=b.touch0[1];else return;b.zoom("touch",n(P(H,B,F),b.extent,s))}}function C(g,...x){if(this.__zooming){var b=I(this,x).event(g),M=g.changedTouches,O=M.length,A,H;for(Vn(g),u&&clearTimeout(u),u=setTimeout(function(){u=null},y),A=0;A<O;++A)H=M[A],b.touch0&&b.touch0[2]===H.identifier?delete b.touch0:b.touch1&&b.touch1[2]===H.identifier&&delete b.touch1;if(b.touch1&&!b.touch0&&(b.touch0=b.touch1,delete b.touch1),b.touch0)b.touch0[1]=this.__zoom.invert(b.touch0[0]);else if(b.end(),b.taps===2&&(H=Me(H,this),Math.hypot(h[0]-H[0],h[1]-H[1])<w)){var B=Ee(this).on("dblclick.zoom");B&&B.apply(this,arguments)}}}return k.wheelDelta=function(g){return arguments.length?(o=typeof g=="function"?g:en(+g),k):o},k.filter=function(g){return arguments.length?(e=typeof g=="function"?g:en(!!g),k):e},k.touchable=function(g){return arguments.length?(r=typeof g=="function"?g:en(!!g),k):r},k.extent=function(g){return arguments.length?(t=typeof g=="function"?g:en([[+g[0][0],+g[0][1]],[+g[1][0],+g[1][1]]]),k):t},k.scaleExtent=function(g){return arguments.length?(i[0]=+g[0],i[1]=+g[1],k):[i[0],i[1]]},k.translateExtent=function(g){return arguments.length?(s[0][0]=+g[0][0],s[1][0]=+g[1][0],s[0][1]=+g[0][1],s[1][1]=+g[1][1],k):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},k.constrain=function(g){return arguments.length?(n=g,k):n},k.duration=function(g){return arguments.length?(l=+g,k):l},k.interpolate=function(g){return arguments.length?(c=g,k):c},k.on=function(){var g=d.on.apply(d,arguments);return g===d?k:g},k.clickDistance=function(g){return arguments.length?(p=(g=+g)*g,k):Math.sqrt(p)},k.tapDistance=function(g){return arguments.length?(w=+g,k):w},k}const Lt={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:n,targetHandle: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."},to=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ei=["Enter"," ","Escape"],jc={"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 wt;(function(e){e.Strict="strict",e.Loose="loose"})(wt||(wt={}));var yt;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(yt||(yt={}));var vn;(function(e){e.Partial="partial",e.Full="full"})(vn||(vn={}));const no={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ue;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ue||(Ue={}));var pn;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(pn||(pn={}));var $;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})($||($={}));const $o={[$.Left]:$.Right,[$.Right]:$.Left,[$.Top]:$.Bottom,[$.Bottom]:$.Top};function $c(e,t){if(!e&&!t)return!0;
1if(!e||!t||e.size!==t.size)return!1;if(!e.size&&!t.size)return!0;for(const n of e.keys())if(!t.has(n))return!1;return!0}function er(e,t,n){if(!n)return;const o=[];e.forEach((r,i)=>{t?.has(i)||o.push(r)}),o.length&&n(o)}function eu(e){return e===null?null:e?"valid":"invalid"}const ti=e=>"id"in e&&"source"in e&&"target"in e,tu=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),wo=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),Wt=(e,t=[0,0])=>{const{width:n,height:o}=je(e),r=e.origin??t,i=n*r[0],s=o*r[1];return{x:e.position.x-i,y:e.position.y-s}},nu=(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):wo(r)?r:t.nodeLookup.get(r.id));const l=s?wn(s,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return zn(o,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return In(n)},qt=(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=zn(n,wn(r)),o=!0)}),o?In(n):{x:0,y:0,width:0,height:0}},xo=(e,t,[n,o,r]=[0,0,1],i=!1,s=!1)=>{const l={...Ut(t,[n,o,r]),width:t.width/r,height:t.height/r},c=[];for(const d of e.values()){const{measured:f,selectable:h=!0,hidden:u=!1}=d;if(s&&!h||u)continue;const y=f.width??d.width??d.initialWidth??null,v=f.height??d.height??d.initialHeight??null,p=Vt(l,bt(d)),w=(y??0)*(v??0),k=i&&p>0;(!d.internals.handleBounds||k||p>=w||d.dragging)&&c.push(d)}return c},ou=(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 ru(e,t){const n=new Map,o=t?.nodes?new Set(t.nodes.map(r=>r.id)):null;return e.forEach(r=>{r.measured.width&&r.measured.height&&(t?.includeHiddenNodes||!r.hidden)&&(!o||o.has(r.id))&&n.set(r.id,r)}),n}
1async function iu({nodes:e,width:t,height:n,panZoom:o,minZoom:r,maxZoom:i},s){if(e.size===0)return Promise.resolve(!0);const l=ru(e,s),c=qt(l),d=bo(c,t,n,s?.minZoom??r,s?.maxZoom??i,s?.padding??.1);return await o.setViewport(d,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)}function ni({nodeId:e,nextPosition:t,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:r,onError:i}){const s=n.get(e),l=s.parentId?n.get(s.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},f=s.origin??o;let h=s.extent||r;if(s.extent==="parent"&&!s.expandParent)if(!l)i?.("005",Lt.error005());else{const y=l.measured.width,v=l.measured.height;y&&v&&(h=[[c,d],[c+y,d+v]])}else l&&_t(s.extent)&&(h=[[s.extent[0][0]+c,s.extent[0][1]+d],[s.extent[1][0]+c,s.extent[1][1]+d]]);const u=_t(h)?st(t,h,s.measured):t;return(s.measured.width===void 0||s.measured.height===void 0)&&i?.("015",Lt.error015()),{position:{x:u.x-c+(s.measured.width??0)*f[0],y:u.y-d+(s.measured.height??0)*f[1]},positionAbsolute:u}}async function su({nodesToRemove:e=[],edgesToRemove:t=[],nodes:n,edges:o,onBeforeDelete:r}){const i=new Set(e.map(u=>u.id)),s=[];for(const u of n){if(u.deletable===!1)continue;const y=i.has(u.id),v=!y&&u.parentId&&s.find(p=>p.id===u.parentId);(y||v)&&s.push(u)}const l=new Set(t.map(u=>u.id)),c=o.filter(u=>u.deletable!==!1),f=ou(s,c);for(const u of c)l.has(u.id)&&!f.find(v=>v.id===u.id)&&f.push(u);if(!r)return{edges:f,nodes:s};const h=await r({nodes:s,edges:f});return typeof h=="boolean"?h?{edges:f,nodes:s}:{edges:[],nodes:[]}:h}const xt=(e,t=0,n=1)=>Math.min(Math.max(e,t),n),st=(e={x:0,y:0},t,n)=>({x:xt(e.x,t[0][0],t[1][0]-(n?.width??0)),y:xt(e.y,t[0][1],t[1][1]-(n?.height??0))});function oi(e,t,n){const{width:o,height:r}=je(n),{x:i,y:s}=n.internals.positionAbsolute;return st(e,[[i,s],[i+o,s+r]],t)}const tr=(e,t,n)=>e<t?xt(Math.abs(e-t),1,t)/t:e>n?-xt(Math.abs(e-n),1,t)/t:0,ri=(e,t,n=15,o=40)=>{const r=tr(e.x,o,t.width-o)*n,i=tr(e.y,o,t.height-o)*n;return[r,i]},zn=(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)}),oo=({x:e,y:t,width:n,height:o})=>({x:e,y:t,x2:e+n,y2:t+o}),In=({x:e,y:t,x2:n,y2:o})=>({x:e,y:t,width:n-e,height:o-t}),bt=(e,t=[0,0])=>{const{x:n,y:o}=wo(e)?e.internals.positionAbsolute:Wt(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}},wn=(e,t=[0,0])=>{const{x:n,y:o}=wo(e)?e.internals.positionAbsolute:Wt(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)}},ii=(e,t)=>In(zn(oo(e),oo(t))),Vt=(e,t)=>{const n=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),o=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(n*o)},nr=e=>Ze(e.width)&&Ze(e.height)&&Ze(e.x)&&Ze(e.y),Ze=e=>!isNaN(e)&&isFinite(e),au=(e,t)=>{},Gt=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Ut=({x:e,y:t},[n,o,r],i=!1,s=[1,1])=>{const l={x:(e-n)/r,y:(t-o)/r};return i?Gt(l,s):l},xn=({x:e,y:t},[n,o,r])=>({x:e*r+n,y:t*r+o});function ut(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(n)}if(typeof e=="string"&&e.endsWith("%")){const n=parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function lu(e,t,n){if(typeof e=="string"||typeof e=="number"){const o=ut(e,n),r=ut(e,t);return{top:o,right:r,bottom:o,left:r,x:r*2,y:o*2}}if(typeof e=="object"){const o=ut(e.top??e.y??0,n),r=ut(e.bottom??e.y??0,n),i=ut(e.left??e.x??0,t),s=ut(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 cu(e,t,n,o,r,i){const{x:s,y:l}=xn(e,[t,n,o]),{x:c,y:d}=xn({x:e.x+e.width,y:e.y+e.height},[t,n,o]),f=r-c,h=i-d;return{left:Math.floor(s),top:Math.floor(l),right:Math.floor(f),bottom:Math.floor(h)}}const bo=(e,t,n,o,r,i)=>{const s=lu(i,t,n),l=(t-s.x)/e.width,c=(n-s.y)/e.height,d=Math.min(l,c),f=xt(d,o,r),h=e.x+e.width/2,u=e.y+e.height/2,y=t/2-h*f,v=n/2-u*f,p=cu(e,y,v,f,t,n),w={left:Math.min(p.left-s.left,0),top:Math.min(p.top-s.top,0),right:Math.min(p.right-s.right,0),bottom:Math.min(p.bottom-s.bottom,0)};return{x:y-w.left+w.right,y:v-w.top+w.bottom,zoom:f}},Bt=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function _t(e){return e!=null&&e!=="parent"}function je(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function si(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function uu(e,t={width:0,height:0},n,o,r){const i={...e},s=o.get(n);if(s){const l=s.origin||r;i.x+=s.internals.positionAbsolute.x-(t.width??0)*l[0],i.y+=s.internals.positionAbsolute.y-(t.height??0)*l[1]}return i}function du(e){return{...jc,...e||{}}}
1function Bn(e,{snapGrid:t=[0,0],snapToGrid:n=!1,transform:o,containerBounds:r}){const{x:i,y:s}=Ie(e),l=Ut({x:i-(r?.left??0),y:s-(r?.top??0)},o),{x:c,y:d}=n?Gt(l,t):l;return{xSnapped:c,ySnapped:d,...l}}const ai=e=>({width:e.offsetWidth,height:e.offsetHeight}),li=e=>e?.getRootNode?.()||window?.document,fu=["INPUT","SELECT","TEXTAREA"];function ci(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:fu.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const ui=e=>"clientX"in e,Ie=(e,t)=>{const n=ui(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)}},or=(e,t,n,o,r)=>{const i=t.querySelectorAll(`.${e}`);return!i||!i.length?null:Array.from(i).map(s=>{const l=s.getBoundingClientRect();return{id:s.getAttribute("data-handleid"),type:e,nodeId:r,position:s.getAttribute("data-handlepos"),x:(l.left-n.left)/o,y:(l.top-n.top)/o,...ai(s)}})};function hu({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:r,sourceControlY:i,targetControlX:s,targetControlY:l}){const c=e*.125+r*.375+s*.375+n*.125,d=t*.125+i*.375+l*.375+o*.125,f=Math.abs(c-e),h=Math.abs(d-t);return[c,d,f,h]}function tn(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function rr({pos:e,x1:t,y1:n,x2:o,y2:r,c:i}){switch(e){case $.Left:return[t-tn(t-o,i),n];case $.Right:return[t+tn(o-t,i),n];case $.Top:return[t,n-tn(n-r,i)];case $.Bottom:return[t,n+tn(r-n,i)]}}function di({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:o,targetY:r,targetPosition:i=$.Top,curvature:s=.25}){const[l,c]=rr({pos:n,x1:e,y1:t,x2:o,y2:r,c:s}),[d,f]=rr({pos:i,x1:o,y1:r,x2:e,y2:t,c:s}),[h,u,y,v]=hu({sourceX:e,sourceY:t,targetX:o,targetY:r,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:f});return[`M${e},${t} C${l},${c} ${d},${f} ${o},${r}`,h,u,y,v]}function fi({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,l=o<t?o+s:o-s;return[i,l,r,s]}function gu({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,l=Math.max(e.parentId||r&&e.selected?e.internals.z:0,t.parentId||r&&t.selected?t.internals.z:0);return s+l}function mu({sourceNode:e,targetNode:t,width:n,height:o,transform:r}){const i=zn(wn(e),wn(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 Vt(s,In(i))>0}const yu=({source:e,sourceHandle:t,target:n,targetHandle:o})=>`xy-edge__${e}${t||""}-${n}${o||""}`,vu=(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)),pu=(e,t,n={})=>{if(!e.source||!e.target)return t;const o=n.getEdgeId||yu;let r;return ti(e)?r={...e}:r={...e,id:o(e)},vu(r,t)?t:(r.sourceHandle===null&&delete r.sourceHandle,r.targetHandle===null&&delete r.targetHandle,t.concat(r))};function hi({sourceX:e,sourceY:t,targetX:n,targetY:o}){const[r,i,s,l]=fi({sourceX:e,sourceY:t,targetX:n,targetY:o});return[`M ${e},${t}L ${n},${o}`,r,i,s,l]}const ir={[$.Left]:{x:-1,y:0},[$.Right]:{x:1,y:0},[$.Top]:{x:0,y:-1},[$.Bottom]:{x:0,y:1}},wu=({source:e,sourcePosition:t=$.Bottom,target:n})=>t===$.Left||t===$.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},sr=(e,t)=>
1Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function xu({source:e,sourcePosition:t=$.Bottom,target:n,targetPosition:o=$.Top,center:r,offset:i,stepPosition:s}){const l=ir[t],c=ir[o],d={x:e.x+l.x*i,y:e.y+l.y*i},f={x:n.x+c.x*i,y:n.y+c.y*i},h=wu({source:d,sourcePosition:t,target:f}),u=h.x!==0?"x":"y",y=h[u];let v=[],p,w;const k={x:0,y:0},N={x:0,y:0},[,,P,S]=fi({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(l[u]*c[u]===-1){u==="x"?(p=r.x??d.x+(f.x-d.x)*s,w=r.y??(d.y+f.y)/2):(p=r.x??(d.x+f.x)/2,w=r.y??d.y+(f.y-d.y)*s);const T=[{x:p,y:d.y},{x:p,y:f.y}],K=[{x:d.x,y:w},{x:f.x,y:w}];l[u]===y?v=u==="x"?T:K:v=u==="x"?K:T}else{const T=[{x:d.x,y:f.y}],K=[{x:f.x,y:d.y}];if(u==="x"?v=l.x===y?K:T:v=l.y===y?T:K,t===o){const g=Math.abs(e[u]-n[u]);if(g<=i){const x=Math.min(i-1,i-g);l[u]===y?k[u]=(d[u]>e[u]?-1:1)*x:N[u]=(f[u]>n[u]?-1:1)*x}}if(t!==o){const g=u==="x"?"y":"x",x=l[u]===c[g],b=d[g]>f[g],M=d[g]<f[g];(l[u]===1&&(!x&&b||x&&M)||l[u]!==1&&(!x&&M||x&&b))&&(v=u==="x"?T:K)}const Q={x:d.x+k.x,y:d.y+k.y},E={x:f.x+N.x,y:f.y+N.y},_=Math.max(Math.abs(Q.x-v[0].x),Math.abs(E.x-v[0].x)),C=Math.max(Math.abs(Q.y-v[0].y),Math.abs(E.y-v[0].y));_>=C?(p=(Q.x+E.x)/2,w=v[0].y):(p=v[0].x,w=(Q.y+E.y)/2)}const D={x:d.x+k.x,y:d.y+k.y},I={x:f.x+N.x,y:f.y+N.y};return[[e,...D.x!==v[0].x||D.y!==v[0].y?[D]:[],...v,...I.x!==v[v.length-1].x||I.y!==v[v.length-1].y?[I]:[],n],p,w,P,S]}function bu(e,t,n,o){const r=Math.min(sr(e,t)/2,sr(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 d=e.x<n.x?-1:1,f=e.y<n.y?1:-1;return`L ${i+r*d},${s}Q ${i},${s} ${i},${s+r*f}`}const l=e.x<n.x?1:-1,c=e.y<n.y?-1:1;return`L ${i},${s+r*c}Q ${i},${s} ${i+r*l},${s}`}function _o({sourceX:e,sourceY:t,sourcePosition:n=$.Bottom,targetX:o,targetY:r,targetPosition:i=$.Top,borderRadius:s=5,centerX:l,centerY:c,offset:d=20,stepPosition:f=.5}){const[h,u,y,v,p]=xu({source:{x:e,y:t},sourcePosition:n,target:{x:o,y:r},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:f});let w=`M${h[0].x} ${h[0].y}`;for(let k=1;k<h.length-1;k++)w+=bu(h[k-1],h[k],h[k+1],s);return w+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[w,u,y,v,p]}function ar(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function _u(e){const{sourceNode:t,targetNode:n}=e;if(!ar(t)||!ar(n))return null;const o=t.internals.handleBounds||lr(t.handles),r=n.internals.handleBounds||lr(n.handles),i=cr(o?.source??[],e.sourceHandle),s=cr(e.connectionMode===wt.Strict?r?.target??[]:(r?.target??[]).concat(r?.source??[]),e.targetHandle);if(!i||!s)return e.onError?.("008",Lt.error008(i?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const l=i?.position||$.Bottom,c=s?.position||$.Top,d=at(t,i,l),f=at(n,s,c);return{sourceX:d.x,sourceY:d.y,targetX:f.x,targetY:f.y,sourcePosition:l,targetPosition:c}}function lr(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 at(e,t,n=$.Left,o=!1){const r=(t?.x??0)+e.internals.positionAbsolute.x,i=(t?.y??0)+e.internals.positionAbsolute.y,{width:s,height:l}=t??je(e);if(o)return{x:r+s/2,y:i+l/2};switch(t?.position??n){case $.Top:return{x:r+s/2,y:i};case $.Right:return{x:r+s,y:i+l/2};case $.Bottom:return{x:r+s/2,y:i+l};case $.Left:return{x:r,y:i+l/2}}}function cr(e,t){return e&&(t?e.find(n=>n.id===t):e[0])||null}function ro(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(o=>`${o}=${e[o]}`).join("&")}`:""}function ku(e,{id:t,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:r}){const i=new Set;return e.reduce((s,l)=>([l.markerStart||o,l.markerEnd||r].forEach(c=>{if(c&&typeof c=="object"){const d=ro(c,t);i.has(d)||(s.push({id:d,color:c.color||n,...c}),i.add(d))}}),s),[]).sort((s,l)=>s.id.localeCompare(l.id))}const gi=1e3,Su=10,ko={nodeOrigin:[0,0],nodeExtent:to,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},Cu={...ko,checkEquality:!0};function So(e,t){const n={...e};
1for(const o in t)t[o]!==void 0&&(n[o]=t[o]);return n}function Eu(e,t,n){const o=So(ko,n);for(const r of e.values())if(r.parentId)Eo(r,e,t,o);else{const i=Wt(r,o.nodeOrigin),s=_t(r.extent)?r.extent:o.nodeExtent,l=st(i,s,je(r));r.internals.positionAbsolute=l}}function Nu(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 Co(e){return e==="manual"}function Pu(e,t,n,o={}){const r=So(Cu,o),i={i:0},s=new Map(t),l=r?.elevateNodesOnSelect&&!Co(r.zIndexMode)?gi:0;let c=e.length>0,d=!1;t.clear(),n.clear();for(const f of e){let h=s.get(f.id);if(r.checkEquality&&f===h?.internals.userNode)t.set(f.id,h);else{const u=Wt(f,r.nodeOrigin),y=_t(f.extent)?f.extent:r.nodeExtent,v=st(u,y,je(f));h={...r.defaults,...f,measured:{width:f.measured?.width,height:f.measured?.height},internals:{positionAbsolute:v,handleBounds:Nu(f,h),z:mi(f,l,r.zIndexMode),userNode:f}},t.set(f.id,h)}(h.measured===void 0||h.measured.width===void 0||h.measured.height===void 0)&&!h.hidden&&(c=!1),f.parentId&&Eo(h,t,n,o,i),d||=f.selected??!1}return{nodesInitialized:c,hasSelectedNodes:d}}function Mu(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 Eo(e,t,n,o,r){const{elevateNodesOnSelect:i,nodeOrigin:s,nodeExtent:l,zIndexMode:c}=So(ko,o),d=e.parentId,f=t.get(d);if(!f){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}Mu(e,n),r&&!f.parentId&&f.internals.rootParentIndex===void 0&&c==="auto"&&(f.internals.rootParentIndex=++r.i,f.internals.z=f.internals.z+r.i*Su),r&&f.internals.rootParentIndex!==void 0&&(r.i=f.internals.rootParentIndex);const h=i&&!Co(c)?gi:0,{x:u,y,z:v}=zu(e,f,s,l,h,c),{positionAbsolute:p}=e.internals,w=u!==p.x||y!==p.y;(w||v!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:w?{x:u,y}:p,z:v}})}function mi(e,t,n){const o=Ze(e.zIndex)?e.zIndex:0;return Co(n)?o:o+(e.selected?t:0)}function zu(e,t,n,o,r,i){const{x:s,y:l}=t.internals.positionAbsolute,c=je(e),d=Wt(e,n),f=_t(e.extent)?st(d,e.extent,c):d;let h=st({x:s+f.x,y:l+f.y},o,c);e.extent==="parent"&&(h=oi(h,c,t));const u=mi(e,r,i),y=t.internals.z??0;return{x:h.x,y:h.y,z:y>=u?y+1:u}}function Iu(e,t,n,o=[0,0]){const r=[],i=new Map;for(const s of e){const l=t.get(s.parentId);if(!l)continue;const c=i.get(s.parentId)?.expandedRect??bt(l),d=ii(c,s.rect);i.set(s.parentId,{expandedRect:d,parent:l})}return i.size>0&&i.forEach(({expandedRect:s,parent:l},c)=>{const d=l.internals.positionAbsolute,f=je(l),h=l.origin??o,u=s.x<d.x?Math.round(Math.abs(d.x-s.x)):0,y=s.y<d.y?Math.round(Math.abs(d.y-s.y)):0,v=Math.max(f.width,Math.round(s.width)),p=Math.max(f.height,Math.round(s.height)),w=(v-f.width)*h[0],k=(p-f.height)*h[1];(u>0||y>0||w||k)&&(r.push({id:c,type:"position",position:{x:l.position.x-u+w,y:l.position.y-y+k}}),n.get(c)?.forEach(N=>{e.some(P=>P.id===N.id)||r.push({id:N.id,type:"position",position:{x:N.position.x+u,y:N.position.y+y}})})),(f.width<s.width||f.height<s.height||u||y)&&r.push({id:c,type:"dimensions",setAttributes:!0,dimensions:{width:v+(u?h[0]*u-w:0),height:p+(y?h[1]*y-k:0)}})}),r}function Du(e,t,n,o,r,i,s){const l=o?.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],f=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(f.transform),u=[];for(const y of e.values()){const v=t.get(y.id);if(!v)continue;if(v.hidden){t.set(v.id,{...v,internals:{...v.internals,handleBounds:void 0}}),c=!0;continue}const p=ai(y.nodeElement),w=v.measured.width!==p.width||v.measured.height!==p.height;if(!!(p.width&&p.height&&(w||!v.internals.handleBounds||y.force))){const N=y.nodeElement.getBoundingClientRect(),P=_t(v.extent)?v.extent:i;let{positionAbsolute:S}=v.internals;v.parentId&&v.extent==="parent"?S=oi(S,p,t.get(v.parentId)):P&&(S=st(S,P,p));const D={...v,measured:p,internals:{...v.internals,positionAbsolute:S,handleBounds:{source:or("source",y.nodeElement,N,h,v.id),target:or("target",y.nodeElement,N,h,v.id)}}};t.set(v.id,D),v.parentId&&Eo(D,t,n,{nodeOrigin:r,zIndexMode:s}),c=!0,w&&(d.push({id:v.id,type:"dimensions",dimensions:p}),v.expandParent&&v.parentId&&u.push({id:v.id,parentId:v.parentId,rect:bt(D,r)}))}}if(u.length>0){const y=Iu(u,t,n,r);d.push(...y)}return{changes:d,updatedInternals:c}}async function Au({delta:e,panZoom:t,transform:n,translateExtent:o,width:r,height:i}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const s=await t.setViewportConstrained({x:n[0]+e.x,y:n[1]+e.y,zoom:n[2]},[[0,0],[r,i]],o),l=!!s&&(s.x!==n[0]||s.y!==n[1]||s.k!==n[2]);return Promise.resolve(l)}function ur(e,t,n,o,r,i){let s=r;const l=o.get(s)||new Map;o.set(s,l.set(n,t)),s=`${r}-${e}`;const c=o.get(s)||new Map;if(o.set(s,c.set(n,t)),i){s=`${r}-${e}-${i}`;const d=o.get(s)||new Map;o.set(s,d.set(n,t))}}function Tu(e,t,n){e.clear(),t.clear();for(const o of n){const{source:r,target:i,sourceHandle:s=null,targetHandle:l=null}=o,c={edgeId:o.id,source:r,target:i,sourceHandle:s,targetHandle:l},d=`${r}-${s}--${i}-${l}`,f=`${i}-${l}--${r}-${s}`;ur("source",c,f,e,r,s),ur("target",c,d,e,i,l),t.set(o.id,o)}}function yi(e,t){if(!e.parentId)return!1;const n=t.get(e.parentId);return n?n.selected?!0:yi(n,t):!1}function dr(e,t,n){let o=e;do{if(o?.matches?.(t))return!0;
1if(o===n)return!1;o=o?.parentElement}while(o);return!1}function Ou(e,t,n,o){const r=new Map;for(const[i,s]of e)if((s.selected||s.id===o)&&(!s.parentId||!yi(s,e))&&(s.draggable||t&&typeof s.draggable>"u")){const l=e.get(i);l&&r.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return r}function Kn({nodeId:e,dragItems:t,nodeLookup:n,dragging:o=!0}){const r=[];for(const[s,l]of t){const c=n.get(s)?.internals.userNode;c&&r.push({...c,position:l.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 Hu({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=Gt(i,t);return{x:s.x-i.x,y:s.y-i.y}}function Ru({onNodeMouseDown:e,getStoreItems:t,onDragStart:n,onDrag:o,onDragStop:r}){let i={x:null,y:null},s=0,l=new Map,c=!1,d={x:0,y:0},f=null,h=!1,u=null,y=!1,v=!1,p=null;function w({noDragClassName:N,handleSelector:P,domNode:S,isSelectable:D,nodeId:I,nodeClickDistance:R=0}){u=Ee(S);function T({x:_,y:C}){const{nodeLookup:g,nodeExtent:x,snapGrid:b,snapToGrid:M,nodeOrigin:O,onNodeDrag:A,onSelectionDrag:H,onError:B,updateNodePositions:F}=t();i={x:_,y:C};let q=!1;const Y=l.size>1,oe=Y&&x?oo(qt(l)):null,G=Y&&M?Hu({dragItems:l,snapGrid:b,x:_,y:C}):null;for(const[j,U]of l){if(!g.has(j))continue;let re={x:_-U.distance.x,y:C-U.distance.y};M&&(re=G?{x:Math.round(re.x+G.x),y:Math.round(re.y+G.y)}:Gt(re,b));let he=null;if(Y&&x&&!U.extent&&oe){const{positionAbsolute:de}=U.internals,ke=de.x-oe.x+x[0][0],Ae=de.x+U.measured.width-oe.x2+x[1][0],Ge=de.y-oe.y+x[0][1],$e=de.y+U.measured.height-oe.y2+x[1][1];he=[[ke,Ge],[Ae,$e]]}const{position:se,positionAbsolute:ve}=ni({nodeId:j,nextPosition:re,nodeLookup:g,nodeExtent:he||x,nodeOrigin:O,onError:B});q=q||U.position.x!==se.x||U.position.y!==se.y,U.position=se,U.internals.positionAbsolute=ve}if(v=v||q,!!q&&(F(l,!0),p&&(o||A||!I&&H))){const[j,U]=Kn({nodeId:I,dragItems:l,nodeLookup:g});o?.(p,l,j,U),A?.(p,j,U),I||H?.(p,U)}}async function K(){if(!f)return;const{transform:_,panBy:C,autoPanSpeed:g,autoPanOnNodeDrag:x}=t();if(!x){c=!1,cancelAnimationFrame(s);return}const[b,M]=ri(d,f,g);(b!==0||M!==0)&&(i.x=(i.x??0)-b/_[2],i.y=(i.y??0)-M/_[2],await C({x:b,y:M})&&T(i)),s=requestAnimationFrame(K)}function Q(_){const{nodeLookup:C,multiSelectionActive:g,nodesDraggable:x,transform:b,snapGrid:M,snapToGrid:O,selectNodesOnDrag:A,onNodeDragStart:H,onSelectionDragStart:B,unselectNodesAndEdges:F}=t();h=!0,(!A||!D)&&!g&&I&&(C.get(I)?.selected||F()),D&&A&&I&&e?.(I);const q=Bn(_.sourceEvent,{transform:b,snapGrid:M,snapToGrid:O,containerBounds:f});if(i=q,l=Ou(C,x,q,I),l.size>0&&(n||H||!I&&B)){const[Y,oe]=Kn({nodeId:I,dragItems:l,nodeLookup:C});n?.(_.sourceEvent,l,Y,oe),H?.(_.sourceEvent,Y,oe),I||B?.(_.sourceEvent,oe)}}const E=il().clickDistance(R).on("start",_=>{const{domNode:C,nodeDragThreshold:g,transform:x,snapGrid:b,snapToGrid:M}=t();f=C?.getBoundingClientRect()||null,y=!1,v=!1,p=_.sourceEvent,g===0&&Q(_),i=Bn(_.sourceEvent,{transform:x,snapGrid:b,snapToGrid:M,containerBounds:f}),d=Ie(_.sourceEvent,f)}).on("drag",_=>{const{autoPanOnNodeDrag:C,transform:g,snapGrid:x,snapToGrid:b,nodeDragThreshold:M,nodeLookup:O}=t(),A=Bn(_.sourceEvent,{transform:g,snapGrid:x,snapToGrid:b,containerBounds:f});if(p=_.sourceEvent,(_.sourceEvent.type==="touchmove"&&_.sourceEvent.touches.length>1||I&&!O.has(I))&&(y=!0),!y){if(!c&&C&&h&&(c=!0,K()),!h){const H=Ie(_.sourceEvent,f),B=H.x-d.x,F=H.y-d.y;Math.sqrt(B*B+F*F)>M&&Q(_)}(i.x!==A.xSnapped||i.y!==A.ySnapped)&&l&&h&&(d=Ie(_.sourceEvent,f),T(A))}}).on("end",_=>{if(!(!h||y)&&(c=!1,h=!1,cancelAnimationFrame(s),l.size>0)){const{nodeLookup:C,updateNodePositions:g,onNodeDragStop:x,onSelectionDragStop:b}=t();if(v&&(g(l,!1),v=!1),r||x||!I&&b){const[M,O]=Kn({nodeId:I,dragItems:l,nodeLookup:C,dragging:!1});r?.(_.sourceEvent,l,M,O),x?.(_.sourceEvent,M,O),I||b?.(_.sourceEvent,O)}}}).filter(_=>{const C=_.target;return!_.button&&(!N||!dr(C,`.${N}`,S))&&(!P||dr(C,P,S))});u.call(E)}function k(){u?.on(".drag",null)}return{update:w,destroy:k}}function Lu(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())Vt(r,bt(i))>0&&o.push(i);return o}const Vu=250;function Bu(e,t,n,o){let r=[],i=1/0;const s=Lu(e,n,t+Vu);for(const l of s){const c=[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]];for(const d of c){if(o.nodeId===d.nodeId&&o.type===d.type&&o.id===d.id)continue;const{x:f,y:h}=at(l,d,d.position,!0),u=Math.sqrt(Math.pow(f-e.x,2)+Math.pow(h-e.y,2));u>t||(u<i?(r=[{...d,x:f,y:h}],i=u):u===i&&r.push({...d,x:f,y:h}))}}if(!r.length)return null;if(r.length>1){const l=o.type==="source"?"target":"source";return r.find(c=>c.type===l)??r[0]}return r[0]}function vi(e,t,n,o,r,i=!1){const s=o.get(e);if(!s)return null;const l=r==="strict"?s.internals.handleBounds?.[t]:[...s.internals.handleBounds?.source??[],...s.internals.handleBounds?.target??[]],c=(n?l?.find(d=>d.id===n):l?.[0])??null;return c&&i?{...c,...at(s,c,c.position,!0)}:c}function pi(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"
1source":null)}function Ku(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}const wi=()=>!0;function Zu(e,{connectionMode:t,connectionRadius:n,handleId:o,nodeId:r,edgeUpdaterType:i,isTarget:s,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:f,flowId:h,panBy:u,cancelConnection:y,onConnectStart:v,onConnect:p,onConnectEnd:w,isValidConnection:k=wi,onReconnectEnd:N,updateConnection:P,getTransform:S,getFromHandle:D,autoPanSpeed:I,dragThreshold:R=1,handleDomNode:T}){const K=li(e.target);let Q=0,E;const{x:_,y:C}=Ie(e),g=pi(i,T),x=l?.getBoundingClientRect();let b=!1;if(!x||!g)return;const M=vi(r,g,o,c,t);if(!M)return;let O=Ie(e,x),A=!1,H=null,B=!1,F=null;function q(){if(!f||!x)return;const[se,ve]=ri(O,x,I);u({x:se,y:ve}),Q=requestAnimationFrame(q)}const Y={...M,nodeId:r,type:g,position:M.position},oe=c.get(r);let j={inProgress:!0,isValid:null,from:at(oe,Y,$.Left,!0),fromHandle:Y,fromPosition:Y.position,fromNode:oe,to:O,toHandle:null,toPosition:$o[Y.position],toNode:null,pointer:O};function U(){b=!0,P(j),v?.(e,{nodeId:r,handleId:o,handleType:g})}R===0&&U();function re(se){if(!b){const{x:$e,y:ce}=Ie(se),ye=$e-_,Ve=ce-C;if(!(ye*ye+Ve*Ve>R*R))return;U()}if(!D()||!Y){he(se);return}const ve=S();O=Ie(se,x),E=Bu(Ut(O,ve,!1,[1,1]),n,c,Y),A||(q(),A=!0);const de=xi(se,{handle:E,connectionMode:t,fromNodeId:r,fromHandleId:o,fromType:s?"target":"source",isValidConnection:k,doc:K,lib:d,flowId:h,nodeLookup:c});F=de.handleDomNode,H=de.connection,B=Ku(!!E,de.isValid);const ke=c.get(r),Ae=ke?at(ke,Y,$.Left,!0):j.from,Ge={...j,from:Ae,isValid:B,to:de.toHandle&&B?xn({x:de.toHandle.x,y:de.toHandle.y},ve):O,toHandle:de.toHandle,toPosition:B&&de.toHandle?de.toHandle.position:$o[Y.position],toNode:de.toHandle?c.get(de.toHandle.nodeId):null,pointer:O};P(Ge),j=Ge}function he(se){if(!("touches"in se&&se.touches.length>0)){if(b){(E||F)&&H&&B&&p?.(H);const{inProgress:ve,...de}=j,ke={...de,toPosition:j.toHandle?j.toPosition:null};w?.(se,ke),i&&N?.(se,ke)}y(),cancelAnimationFrame(Q),A=!1,B=!1,H=null,F=null,K.removeEventListener("mousemove",re),K.removeEventListener("mouseup",he),K.removeEventListener("touchmove",re),K.removeEventListener("touchend",he)}}K.addEventListener("mousemove",re),K.addEventListener("mouseup",he),K.addEventListener("touchmove",re),K.addEventListener("touchend",he)}function xi(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:r,fromType:i,doc:s,lib:l,flowId:c,isValidConnection:d=wi,nodeLookup:f}){const h=i==="target",u=t?s.querySelector(`.${l}-flow__handle[data-id="${c}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x:y,y:v}=Ie(e),p=s.elementFromPoint(y,v),w=p?.classList.contains(`${l}-flow__handle`)?p:u,k={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const N=pi(void 0,w),P=w.getAttribute("data-nodeid"),S=w.getAttribute("data-handleid"),D=w.classList.contains("connectable"),I=w.classList.contains("connectableend");if(!P||!N)return k;const R={source:h?P:o,sourceHandle:h?S:r,target:h?o:P,targetHandle:h?r:S};k.connection=R;const K=D&&I&&(n===wt.Strict?h&&N==="source"||!h&&N==="target":P!==o||S!==r);k.isValid=K&&d(R),k.toHandle=vi(P,N,S,f,n,!0)}return k}const fr={onPointerDown:Zu,isValid:xi};function Yu({domNode:e,panZoom:t,getTransform:n,getViewScale:o}){const r=Ee(e);function i({translateExtent:l,width:c,height:d,zoomStep:f=1,pannable:h=!0,zoomable:u=!0,inversePan:y=!1}){const v=P=>{if(P.sourceEvent.type!=="wheel"||!t)return;const S=n(),D=P.sourceEvent.ctrlKey&&Bt()?10:1,I=-P.sourceEvent.deltaY*(P.sourceEvent.deltaMode===1?.05:P.sourceEvent.deltaMode?1:.002)*f,R=S[2]*Math.pow(2,I*D);t.scaleTo(R)};let p=[0,0];const w=P=>{(P.sourceEvent.type==="mousedown"||P.sourceEvent.type==="touchstart")&&(p=[P.sourceEvent.clientX??P.sourceEvent.touches[0].clientX,P.sourceEvent.clientY??P.sourceEvent.touches[0].clientY])},k=P=>{const S=n();if(P.sourceEvent.type!=="mousemove"&&P.sourceEvent.type!=="touchmove"||!t)return;const D=[P.sourceEvent.clientX??P.sourceEvent.touches[0].clientX,P.sourceEvent.clientY??P.sourceEvent.touches[0].clientY],I=[D[0]-p[0],D[1]-p[1]];p=D;const R=o()*Math.max(S[2],Math.log(S[2]))*(y?-1:1),T={x:S[0]-I[0]*R,y:S[1]-I[1]*R},K=[[0,0],[c,d]];t.setViewportConstrained({x:T.x,y:T.y,zoom:S[2]},K,l)},N=$r().on("start",w).on("zoom",h?k:null).on("zoom.wheel",u?v:null);r.call(N,{})}function s(){r.on("zoom",null)}return{update:i,destroy:s,pointer:Me}}const Dn=e=>({x:e.x,y:e.y,zoom:e.k}),Zn=({x:e,y:t,zoom:n})=>Mn.translate(e,t).scale(n),ht=(e,t)=>
1e.target.closest(`.${t}`),bi=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),Xu=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Yn=(e,t=0,n=Xu,o=()=>{})=>{const r=typeof t=="number"&&t>0;return r||o(),r?e.transition().duration(t).ease(n).on("end",o):e},_i=e=>{const t=e.ctrlKey&&Bt()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function Fu({zoomPanValues:e,noWheelClassName:t,d3Selection:n,d3Zoom:o,panOnScrollMode:r,panOnScrollSpeed:i,zoomOnPinch:s,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return f=>{if(ht(f,t))return f.ctrlKey&&f.preventDefault(),!1;f.preventDefault(),f.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(f.ctrlKey&&s){const w=Me(f),k=_i(f),N=h*Math.pow(2,k);o.scaleTo(n,N,w,f);return}const u=f.deltaMode===1?20:1;let y=r===yt.Vertical?0:f.deltaX*u,v=r===yt.Horizontal?0:f.deltaY*u;!Bt()&&f.shiftKey&&r!==yt.Vertical&&(y=f.deltaY*u,v=0),o.translateBy(n,-(y/h)*i,-(v/h)*i,{internal:!0});const p=Dn(n.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(c?.(f,p),e.panScrollTimeout=setTimeout(()=>{d?.(f,p),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,l?.(f,p))}}function Wu({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:n}){return function(o,r){const i=o.type==="wheel",s=!t&&i&&!o.ctrlKey,l=ht(o,e);if(o.ctrlKey&&i&&l&&o.preventDefault(),s||l)return null;o.preventDefault(),n.call(this,o,r)}}function qu({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const r=Dn(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 Gu({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:n,onTransformChange:o,onPanZoom:r}){return i=>{e.usedRightMouseButton=!!(n&&bi(t,e.mouseButton??0)),i.sourceEvent?.sync||o([i.transform.x,i.transform.y,i.transform.k]),r&&!i.sourceEvent?.internal&&r?.(i.sourceEvent,Dn(i.transform))}}function Uu({zoomPanValues:e,panOnDrag:t,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:r,onPaneContextMenu:i}){return s=>{if(!s.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,i&&bi(t,e.mouseButton??0)&&!e.usedRightMouseButton&&s.sourceEvent&&i(s.sourceEvent),e.usedRightMouseButton=!1,o(!1),r)){const l=Dn(s.transform);e.prevViewport=l,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{r?.(s.sourceEvent,l)},n?150:0)}}}function Qu({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:n,panOnDrag:o,panOnScroll:r,zoomOnDoubleClick:i,userSelectionActive:s,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:f}){return h=>{const u=e||t,y=n&&h.ctrlKey,v=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(ht(h,`${d}-flow__node`)||ht(h,`${d}-flow__edge`)))return!0;if(!o&&!u&&!r&&!i&&!n||s||f&&!v||ht(h,l)&&v||ht(h,c)&&(!v||r&&v&&!e)||!n&&h.ctrlKey&&v)return!1;if(!n&&h.type==="touchstart"&&h.touches?.length>1)return h.preventDefault(),!1;if(!u&&!r&&!y&&v||!o&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(o)&&!o.includes(h.button)&&h.type==="mousedown")return!1;const p=Array.isArray(o)&&o.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||v)&&p}}function Ju({domNode:e,minZoom:t,maxZoom:n,translateExtent:o,viewport:r,onPanZoom:i,onPanZoomStart:s,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},f=e.getBoundingClientRect(),h=$r().scaleExtent([t,n]).translateExtent(o),u=Ee(e).call(h);N({x:r.x,y:r.y,zoom:xt(r.zoom,t,n)},[[0,0],[f.width,f.height]],o);const y=u.on("wheel.zoom"),v=u.on("dblclick.zoom");h.wheelDelta(_i);function p(E,_){return u?new Promise(C=>{h?.interpolate(_?.interpolate==="linear"?Dt:sn).transform(Yn(u,_?.duration,_?.ease,()=>C(!0)),E)}):Promise.resolve(!1)}function w({noWheelClassName:E,noPanClassName:_,onPaneContextMenu:C,userSelectionActive:g,panOnScroll:x,panOnDrag:b,panOnScrollMode:M,panOnScrollSpeed:O,preventScrolling:A,zoomOnPinch:H,zoomOnScroll:B,zoomOnDoubleClick:F,zoomActivationKeyPressed:q,lib:Y,onTransformChange:oe,connectionInProgress:G,paneClickDistance:j,selectionOnDrag:U}){g&&!d.isZoomingOrPanning&&k();const re=x&&!q&&!g;h.clickDistance(U?1/0:!Ze(j)||j<0?0:j);const he=re?Fu({zoomPanValues:d,noWheelClassName:E,d3Selection:u,d3Zoom:h,panOnScrollMode:M,panOnScrollSpeed:O,zoomOnPinch:H,onPanZoomStart:s,onPanZoom:i,onPanZoomEnd:l}):Wu({noWheelClassName:E,preventScrolling:A,d3ZoomHandler:y});if(u.on("wheel.zoom",he,{passive:!1}),!g){const ve=qu({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:s});h.on("start",ve);const de=Gu({zoomPanValues:d,panOnDrag:b,onPaneContextMenu:!!C,onPanZoom:i,onTransformChange:oe});h.on("zoom",de);const ke=Uu({zoomPanValues:d,panOnDrag:b,panOnScroll:x,onPaneContextMenu:C,onPanZoomEnd:l,onDraggingChange:c});h.on("end",ke)}const se=Qu({zoomActivationKeyPressed:q,panOnDrag:b,zoomOnScroll:B,panOnScroll:x,zoomOnDoubleClick:F,zoomOnPinch:H,userSelectionActive:g,noPanClassName:_,noWheelClassName:E,lib:Y,connectionInProgress:G});h.filter(se),F?u.on("dblclick.zoom",v):u.on("dblclick.zoom",null)}function k(){h.on("zoom",null)}async function N(E,_,C){const g=Zn(E),x=h?.constrain()(g,_,C);return x&&await p(x),new Promise(b=>
1b(x))}async function P(E,_){const C=Zn(E);return await p(C,_),new Promise(g=>g(C))}function S(E){if(u){const _=Zn(E),C=u.property("__zoom");(C.k!==E.zoom||C.x!==E.x||C.y!==E.y)&&h?.transform(u,_,null,{sync:!0})}}function D(){const E=u?jr(u.node()):{x:0,y:0,k:1};return{x:E.x,y:E.y,zoom:E.k}}function I(E,_){return u?new Promise(C=>{h?.interpolate(_?.interpolate==="linear"?Dt:sn).scaleTo(Yn(u,_?.duration,_?.ease,()=>C(!0)),E)}):Promise.resolve(!1)}function R(E,_){return u?new Promise(C=>{h?.interpolate(_?.interpolate==="linear"?Dt:sn).scaleBy(Yn(u,_?.duration,_?.ease,()=>C(!0)),E)}):Promise.resolve(!1)}function T(E){h?.scaleExtent(E)}function K(E){h?.translateExtent(E)}function Q(E){const _=!Ze(E)||E<0?0:E;h?.clickDistance(_)}return{update:w,destroy:k,setViewport:P,setViewportConstrained:N,getViewport:D,scaleTo:I,scaleBy:R,setScaleExtent:T,setTranslateExtent:K,syncViewport:S,setClickDistance:Q}}var hr;(function(e){e.Line="line",e.Handle="handle"})(hr||(hr={}));function No(){const e={};return[t=>{if(t&&!Bi(e))throw new Error(t);return ao(e)},t=>xr(e,t)]}const[ju,$u]=No(),[ed,td]=No(),[nd,od]=No();var rd=ee("<div><!></div>");function kt(e,t){te(t,!0);let n=L(t,"id",3,null),o=L(t,"type",3,"source"),r=L(t,"position",19,()=>$.Top),i=L(t,"isConnectableStart",3,!0),s=L(t,"isConnectableEnd",3,!0),l=Je(t,["$$slots","$$events","$$legacy","id","type","position","style","class","isConnectable","isConnectableStart","isConnectableEnd","isValidConnection","onconnect","ondisconnect","children"]);const c=ju("Handle must be used within a Custom Node component"),d=ed("Handle must be used within a Custom Node component");let f=m(()=>o()==="target"),h=m(()=>t.isConnectable!==void 0?t.isConnectable:d.value),u=qe(),y=m(()=>u.ariaLabelConfig),v=null;Ki(()=>{if(t.onconnect||t.ondisconnect){u.edges;let _=u.connectionLookup.get(`${c}-${o()}${n()?`-${n()}`:""}`);if(v&&!$c(_,v)){const C=_??new Map;er(v,C,t.ondisconnect),er(C,v,t.onconnect)}v=new Map(_)}});let p=m(()=>{if(!u.connection.inProgress)return[!1,!1,!1,!1,null];const{fromHandle:_,toHandle:C,isValid:g}=u.connection,x=_&&_.nodeId===c&&_.type===o()&&_.id===n(),b=C&&C.nodeId===c&&C.type===o()&&C.id===n(),M=u.connectionMode===wt.Strict?_?.type!==o():c!==_?.nodeId||n()!==_?.id;return[!0,x,b,M,b&&g]}),w=m(()=>Kt(a(p),5)),k=m(()=>a(w)[0]),N=m(()=>a(w)[1]),P=m(()=>a(w)[2]),S=m(()=>a(w)[3]),D=m(()=>a(w)[4]);function I(_){const C=u.onbeforeconnect?u.onbeforeconnect(_):_;C&&(u.addEdge(C),u.onconnect?.(_))}function R(_){const C=ui(_);_.currentTarget&&(C&&_.button===0||!C)&&fr.onPointerDown(_,{handleId:n(),nodeId:c,isTarget:a(f),connectionRadius:u.connectionRadius,domNode:u.domNode,nodeLookup:u.nodeLookup,connectionMode:u.connectionMode,lib:"svelte",autoPanOnConnect:u.autoPanOnConnect,autoPanSpeed:u.autoPanSpeed,flowId:u.flowId,isValidConnection:t.isValidConnection||((...g)=>u.isValidConnection?.(...g)??!0),updateConnection:u.updateConnection,cancelConnection:u.cancelConnection,panBy:u.panBy,onConnect:I,onConnectStart:u.onconnectstart,onConnectEnd:(...g)=>u.onconnectend?.(...g),getTransform:()=>[u.viewport.x,u.viewport.y,u.viewport.zoom],getFromHandle:()=>u.connection.fromHandle,dragThreshold:u.connectionDragThreshold,handleDomNode:_.currentTarget})}function T(_){if(!c||!u.clickConnectStartHandle&&!i())return;if(!u.clickConnectStartHandle){u.onclickconnectstart?.(_,{nodeId:c,handleId:n(),handleType:o()}),u.clickConnectStartHandle={nodeId:c,type:o(),id:n()};return}const C=li(_.target),g=t.isValidConnection??u.isValidConnection,{connectionMode:x,clickConnectStartHandle:b,flowId:M,nodeLookup:O}=u,{connection:A,isValid:H}=fr.isValid(_,{handle:{nodeId:c,id:n(),type:o()},connectionMode:x,fromNodeId:b.nodeId,fromHandleId:b.id??null,fromType:b.type,isValidConnection:g,flowId:M,doc:C,lib:"svelte",nodeLookup:O});H&&A&&I(A);const B=structuredClone(Sr(u.connection));delete B.inProgress,B.toPosition=B.toHandle?B.toHandle.position:null,u.onclickconnectend?.(_,B),u.clickConnectStartHandle=null}var K=rd(),Q=()=>{};Qe(K,()=>({"data-handleid":n(),"data-nodeid":c,"data-handlepos":r(),"data-id":`${u.flowId??""}-${c??""}-${n()??"null"??""}-${o()??""}`,class:["svelte-flow__handle",`svelte-flow__handle-${r()}`,u.noDragClass,u.noPanClass,r(),t.class],onmousedown:R,ontouchstart:R,onclick:u.clickConnect?T:void 0,onkeypress:Q,style:t.style,role:"button","aria-label":a(y)["handle.ariaLabel"],tabindex:"-1",...l,[co]:{valid:a(D),connectingto:a(P),connectingfrom:a(N),source:!a(f),target:a(f),connectablestart:i(),connectableend:s(),connectable:a(h),connectionindicator:a(h)&&(!a(k)||a(S))&&(a(k)||u.clickConnectStartHandle?s():i())}}));var E=X(K);Ne(E,()=>t.children??St),Z(K),V(e,K),ne()}var id=ee("<!> <!>",1);function ki(e,t){te(t,!0);let n=L(t,"targetPosition",19,()=>$.Top),o=L(t,"sourcePosition",19,()=>$.Bottom);var r=id(),i=ae(r);kt(i,{type:"target",get position(){return n()}});var s=W(i),l=W(s);kt(l,{type:"source",get position(){return o()}}),ie(()=>fe(s,` ${t.data?.label??""} `)),V(e,r),ne()}var sd=ee(" <!>",1);function ad(e,t){te(t,!0);let n=L(t,"data",19,()=>({label:"Node"})),o=L(t,"sourcePosition",19,()=>$.Bottom);_n();var r=sd(),i=ae(r),s=W(i);kt(s,{type:"source",get position(){return o()}}),ie(()=>fe(i,`${n()?.label??""} `)),V(e,r),ne()}var ld=ee(" <!>",1);function cd(e,t){te(t,!0);let n=L(t,"data",19,()=>({label:"Node"})),o=L(t,"targetPosition",19,()=>$.Top);_n();var r=ld(),i=ae(r),s=W(i);kt(s,{type:"target",get position(){return o()}}),ie(()=>fe(i,`${n()?.label??""} `)),V(e,r),ne()}function ud(e,t){}function Xn(e,t,n){if(!n||!t)return;const o=n==="root"?t:t.querySelector(`.svelte-flow__${n}`);o&&o.appendChild(e)}function dd(e,t){const n=m(qe),o=m(()=>
1a(n).domNode);let r;return a(o)?Xn(e,a(o),t):r=br(()=>{Xe(()=>{Xn(e,a(o),t),r?.()})}),{async update(i){Xn(e,a(o),i)},destroy(){e.parentNode&&e.parentNode.removeChild(e),r?.()}}}function fd(){let e=ue(typeof window>"u");if(a(e)){const t=br(()=>{Xe(()=>{z(e,!1),t?.()})})}return{get value(){return a(e)}}}const gr=e=>tu(e),hd=e=>ti(e);function Re(e){return e===void 0?void 0:`${e}px`}const bn={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var gd=ee("<div><!></div>");function md(e,t){te(t,!0);let n=L(t,"x",3,0),o=L(t,"y",3,0),r=L(t,"selectEdgeOnClick",3,!1),i=L(t,"transparent",3,!1),s=Je(t,["$$slots","$$events","$$legacy","x","y","width","height","selectEdgeOnClick","transparent","class","children"]);const l=qe(),c=nd("EdgeLabel must be used within a Custom Edge component");let d=m(()=>l.visible.edges.get(c)?.zIndex);var f=gd(),h=()=>{r()&&c&&l.handleEdgeSelection(c)};Qe(f,y=>({class:["svelte-flow__edge-label",{transparent:i()},t.class],tabindex:"-1",onclick:h,...s,[kn]:y}),[()=>({display:fd().value?"none":void 0,cursor:r()?"pointer":void 0,transform:`translate(-50%, -50%) translate(${n()??""}px,${o()??""}px)`,"pointer-events":"all",width:Re(t.width),height:Re(t.height),"z-index":a(d)})],void 0,void 0,"svelte-1wg91mu");var u=X(f);Ne(u,()=>t.children??St),Z(f),we(f,(y,v)=>dd?.(y,v),()=>"edge-labels"),V(e,f),ne()}var yd=me("<path></path>"),vd=me('<path fill="none"></path><!><!>',1);function An(e,t){let n=L(t,"interactionWidth",3,20),o=Je(t,["$$slots","$$events","$$legacy","id","path","label","labelX","labelY","labelStyle","markerStart","markerEnd","style","interactionWidth","class"]);var r=vd(),i=ae(r),s=W(i);{var l=f=>{var h=yd();Qe(h,()=>({d:t.path,"stroke-opacity":0,"stroke-width":n(),fill:"none",class:"svelte-flow__edge-interaction",...o})),V(f,h)};le(s,f=>{n()>0&&f(l)})}var c=W(s);{var d=f=>{md(f,{get x(){return t.labelX},get y(){return t.labelY},get style(){return t.labelStyle},selectEdgeOnClick:!0,children:(h,u)=>{_n();var y=Zi();ie(()=>fe(y,t.label)),V(h,y)},$$slots:{default:!0}})};le(c,f=>{t.label&&f(d)})}ie(()=>{J(i,"id",t.id),J(i,"d",t.path),We(i,0,lt(["svelte-flow__edge-path",t.class])),J(i,"marker-start",t.markerStart),J(i,"marker-end",t.markerEnd),Pe(i,t.style)}),V(e,r)}function Si(e,t){te(t,!0);let n=m(()=>di({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,curvature:t.pathOptions?.curvature})),o=m(()=>Kt(a(n),3)),r=m(()=>a(o)[0]),i=m(()=>a(o)[1]),s=m(()=>a(o)[2]);An(e,{get id(){return t.id},get path(){return a(r)},get labelX(){return a(i)},get labelY(){return a(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),ne()}function pd(e,t){te(t,!0);let n=m(()=>_o({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition})),o=m(()=>Kt(a(n),3)),r=m(()=>a(o)[0]),i=m(()=>a(o)[1]),s=m(()=>a(o)[2]);An(e,{get path(){return a(r)},get labelX(){return a(i)},get labelY(){return a(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),ne()}function wd(e,t){te(t,!0);let n=m(()=>hi({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY})),o=m(()=>Kt(a(n),3)),r=m(()=>a(o)[0]),i=m(()=>a(o)[1]),s=m(()=>a(o)[2]);An(e,{get path(){return a(r)},get labelX(){return a(i)},get labelY(){return a(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),ne()}function xd(e,t){te(t,!0);let n=m(()=>_o({sourceX:t.sourceX,sourceY:t.sourceY,targetX:t.targetX,targetY:t.targetY,sourcePosition:t.sourcePosition,targetPosition:t.targetPosition,borderRadius:0})),o=m(()=>Kt(a(n),3)),r=m(()=>a(o)[0]),i=m(()=>a(o)[1]),s=m(()=>a(o)[2]);An(e,{get path(){return a(r)},get labelX(){return a(i)},get labelY(){return a(s)},get label(){return t.label},get labelStyle(){return t.labelStyle},get markerStart(){return t.markerStart},get markerEnd(){return t.markerEnd},get interactionWidth(){return t.interactionWidth},get style(){return t.style}}),ne()}function bd(e,t,n,o){const r=new Map;return xo(e,{x:0,y:0,width:n,height:o}
1,t,!0).forEach(i=>{r.set(i.id,i)}),r}function mr(e){const{edges:t,defaultEdgeOptions:n,nodeLookup:o,previousEdges:r,connectionMode:i,onerror:s,onlyRenderVisible:l,elevateEdgesOnSelect:c,zIndexMode:d}=e,f=new Map;for(const h of t){const u=o.get(h.source),y=o.get(h.target);if(!u||!y)continue;if(l){const{visibleNodes:w,transform:k,width:N,height:P}=e;if(mu({sourceNode:u,targetNode:y,width:N,height:P,transform:k}))w.set(u.id,u),w.set(y.id,y);else continue}const v=r.get(h.id);if(v&&h===v.edge&&u==v.sourceNode&&y==v.targetNode){f.set(h.id,v);continue}const p=_u({id:h.id,sourceNode:u,targetNode:y,sourceHandle:h.sourceHandle||null,targetHandle:h.targetHandle||null,connectionMode:i,onError:s});p&&f.set(h.id,{...n,...h,...p,zIndex:gu({selected:h.selected,zIndex:h.zIndex??n.zIndex,sourceNode:u,targetNode:y,elevateOnSelect:c,zIndexMode:d}),sourceNode:u,targetNode:y,edge:h})}return f}const Ci={input:ad,output:cd,default:ki,group:ud},Ei={straight:wd,smoothstep:pd,default:Si,step:xd};function _d(e,t,n,o,r,i){if(t&&!n&&o&&r){const s=qt(i,{filter:l=>!!((l.width||l.initialWidth)&&(l.height||l.initialHeight))});return bo(s,o,r,.5,2,.1)}else return n??{x:0,y:0,zoom:1}}function kd(e){class t{#e=m(()=>e.props.id??"1");get flowId(){return a(this.#e)}set flowId(o){z(this.#e,o)}#t=ue(null);get domNode(){return a(this.#t)}set domNode(o){z(this.#t,o)}#n=ue(null);get panZoom(){return a(this.#n)}set panZoom(o){z(this.#n,o)}#o=ue(e.width??0);get width(){return a(this.#o)}set width(o){z(this.#o,o)}#r=ue(e.height??0);get height(){return a(this.#r)}set height(o){z(this.#r,o)}#i=ue(e.props.zIndexMode??"basic");get zIndexMode(){return a(this.#i)}set zIndexMode(o){z(this.#i,o)}#s=m(()=>{const{nodesInitialized:o}=Pu(e.nodes,this.nodeLookup,this.parentLookup,{nodeExtent:this.nodeExtent,nodeOrigin:this.nodeOrigin,elevateNodesOnSelect:e.props.elevateNodesOnSelect??!0,checkEquality:!0,zIndexMode:this.zIndexMode});return this.fitViewQueued&&o&&(this.fitViewOptions?.duration?this.resolveFitView():queueMicrotask(()=>{this.resolveFitView()})),o});get nodesInitialized(){return a(this.#s)}set nodesInitialized(o){z(this.#s,o)}#a=m(()=>this.panZoom!==null);get viewportInitialized(){return a(this.#a)}set viewportInitialized(o){z(this.#a,o)}#l=m(()=>(Tu(this.connectionLookup,this.edgeLookup,e.edges),e.edges));get _edges(){return a(this.#l)}set _edges(o){z(this.#l,o)}get nodes(){return this.nodesInitialized,e.nodes}set nodes(o){e.nodes=o}get edges(){return this._edges}set edges(o){e.edges=o}_prevSelectedNodes=[];_prevSelectedNodeIds=new Set;#c=m(()=>{const o=this._prevSelectedNodeIds.size,r=new Set,i=this.nodes.filter(s=>(s.selected&&(r.add(s.id),this._prevSelectedNodeIds.delete(s.id)),s.selected));return(o!==r.size||this._prevSelectedNodeIds.size>0)&&(this._prevSelectedNodes=i),this._prevSelectedNodeIds=r,this._prevSelectedNodes});get selectedNodes(){return a(this.#c)}set selectedNodes(o){z(this.#c,o)}_prevSelectedEdges=[];_prevSelectedEdgeIds=new Set;#u=m(()=>{const o=this._prevSelectedEdgeIds.size,r=new Set,i=this.edges.filter(s=>(s.selected&&(r.add(s.id),this._prevSelectedEdgeIds.delete(s.id)),s.selected));return(o!==r.size||this._prevSelectedEdgeIds.size>0)&&(this._prevSelectedEdges=i),this._prevSelectedEdgeIds=r,this._prevSelectedEdges});get selectedEdges(){return a(this.#u)}set selectedEdges(o){z(this.#u,o)}selectionChangeHandlers=new Map;nodeLookup=new Map;parentLookup=new Map;connectionLookup=new Map;edgeLookup=new Map;_prevVisibleEdges=new Map;#d=m(()=>{const{nodes:o,_edges:r,_prevVisibleEdges:i,nodeLookup:s,connectionMode:l,onerror:c,onlyRenderVisibleElements:d,defaultEdgeOptions:f,zIndexMode:h}=this;let u,y;const v={edges:r,defaultEdgeOptions:f,previousEdges:i,nodeLookup:s,connectionMode:l,elevateEdgesOnSelect:e.props.elevateEdgesOnSelect??!0,zIndexMode:h,onerror:c};if(d){const{viewport:p,width:w,height:k}=this,N=[p.x,p.y,p.zoom];u=bd(s,N,w,k),y=mr({...v,onlyRenderVisible:!0,visibleNodes:u,transform:N,width:w,height:k})}else u=this.nodeLookup,y=mr(v);return{nodes:u,edges:y}});get visible(){return a(this.#d)}set visible(o){z(this.#d,o)}#f=m(()=>e.props.nodesDraggable??!0);get nodesDraggable(){return a(this.#f)}set nodesDraggable(o){z(this.#f,o)}#h=m(()=>e.props.nodesConnectable??!0);get nodesConnectable(){return a(this.#h)}set nodesConnectable(o){z(this.#h,o)}#g=m(()=>e.props.elementsSelectable??!0);get elementsSelectable(){return a(this.#g)}
1set elementsSelectable(o){z(this.#g,o)}#m=m(()=>e.props.nodesFocusable??!0);get nodesFocusable(){return a(this.#m)}set nodesFocusable(o){z(this.#m,o)}#y=m(()=>e.props.edgesFocusable??!0);get edgesFocusable(){return a(this.#y)}set edgesFocusable(o){z(this.#y,o)}#v=m(()=>e.props.disableKeyboardA11y??!1);get disableKeyboardA11y(){return a(this.#v)}set disableKeyboardA11y(o){z(this.#v,o)}#p=m(()=>e.props.minZoom??.5);get minZoom(){return a(this.#p)}set minZoom(o){z(this.#p,o)}#w=m(()=>e.props.maxZoom??2);get maxZoom(){return a(this.#w)}set maxZoom(o){z(this.#w,o)}#x=m(()=>e.props.nodeOrigin??[0,0]);get nodeOrigin(){return a(this.#x)}set nodeOrigin(o){z(this.#x,o)}#b=m(()=>e.props.nodeExtent??to);get nodeExtent(){return a(this.#b)}set nodeExtent(o){z(this.#b,o)}#_=m(()=>e.props.translateExtent??to);get translateExtent(){return a(this.#_)}set translateExtent(o){z(this.#_,o)}#k=m(()=>e.props.defaultEdgeOptions??{});get defaultEdgeOptions(){return a(this.#k)}set defaultEdgeOptions(o){z(this.#k,o)}#S=m(()=>e.props.nodeDragThreshold??1);get nodeDragThreshold(){return a(this.#S)}set nodeDragThreshold(o){z(this.#S,o)}#C=m(()=>e.props.autoPanOnNodeDrag??!0);get autoPanOnNodeDrag(){return a(this.#C)}set autoPanOnNodeDrag(o){z(this.#C,o)}#E=m(()=>e.props.autoPanOnConnect??!0);get autoPanOnConnect(){return a(this.#E)}set autoPanOnConnect(o){z(this.#E,o)}#N=m(()=>e.props.autoPanOnNodeFocus??!0);get autoPanOnNodeFocus(){return a(this.#N)}set autoPanOnNodeFocus(o){z(this.#N,o)}#P=m(()=>e.props.autoPanSpeed??15);get autoPanSpeed(){return a(this.#P)}set autoPanSpeed(o){z(this.#P,o)}#M=m(()=>e.props.connectionDragThreshold??1);get connectionDragThreshold(){return a(this.#M)}set connectionDragThreshold(o){z(this.#M,o)}fitViewQueued=e.props.fitView??!1;fitViewOptions=e.props.fitViewOptions;fitViewResolver=null;#z=m(()=>e.props.snapGrid??null);get snapGrid(){return a(this.#z)}set snapGrid(o){z(this.#z,o)}#I=ue(!1);get dragging(){return a(this.#I)}set dragging(o){z(this.#I,o)}#D=ue(null);get selectionRect(){return a(this.#D)}set selectionRect(o){z(this.#D,o)}#A=ue(!1);get selectionKeyPressed(){return a(this.#A)}set selectionKeyPressed(o){z(this.#A,o)}#T=ue(!1);get multiselectionKeyPressed(){return a(this.#T)}set multiselectionKeyPressed(o){z(this.#T,o)}#O=ue(!1);get deleteKeyPressed(){return a(this.#O)}set deleteKeyPressed(o){z(this.#O,o)}#H=ue(!1);get panActivationKeyPressed(){return a(this.#H)}set panActivationKeyPressed(o){z(this.#H,o)}#R=ue(!1);get zoomActivationKeyPressed(){return a(this.#R)}set zoomActivationKeyPressed(o){z(this.#R,o)}#L=ue(null);get selectionRectMode(){return a(this.#L)}set selectionRectMode(o){z(this.#L,o)}#V=ue("");get ariaLiveMessage(){return a(this.#V)}set ariaLiveMessage(o){z(this.#V,o)}#B=m(()=>e.props.selectionMode??vn.Partial);get selectionMode(){return a(this.#B)}set selectionMode(o){z(this.#B,o)}#K=m(()=>({...Ci,...e.props.nodeTypes}));get nodeTypes(){return a(this.#K)}set nodeTypes(o){z(this.#K,o)}#Z=m(()=>({...Ei,...e.props.edgeTypes}));get edgeTypes(){return a(this.#Z)}set edgeTypes(o){z(this.#Z,o)}#Y=m(()=>e.props.noPanClass??"nopan");get noPanClass(){return a(this.#Y)}set noPanClass(o){z(this.#Y,o)}#X=m(()=>e.props.noDragClass??"nodrag");get noDragClass(){return a(this.#X)}set noDragClass(o){z(this.#X,o)}#F=m(()=>e.props.noWheelClass??"nowheel");get noWheelClass(){return a(this.#F)}set noWheelClass(o){z(this.#F,o)}#W=m(()=>du(e.props.ariaLabelConfig));get ariaLabelConfig(){return a(this.#W)}set ariaLabelConfig(o){z(this.#W,o)}#q=ue(_d(this.nodesInitialized,e.props.fitView,e.props.initialViewport,this.width,this.height,this.nodeLookup));get _viewport(){return a(this.#q)}set _viewport(o){z(this.#q,o)}get viewport(){return e.viewport??this._viewport}set viewport(o){e.viewport&&(e.viewport=o),this._viewport=o}#G=ue(no);get _connection(){return a(this.#G)}set _connection(o){z(this.#G,o)}#U=m(()=>this._connection.inProgress?{...this._connection,to:Ut(this._connection.to,[this.viewport.x,this.viewport.y,this.viewport.zoom])}:this._connection);get connection(){return a(this.#U)}set connection(o){z(this.#U,o)}#Q=m(()=>e.props.connectionMode??wt.Strict);get connectionMode(){return a(this.#Q)}set connectionMode(o){z(this.#Q,o)}#J=m(()=>e.props.connectionRadius??20);get connectionRadius(){return a(this.#J)}set connectionRadius(o){z(this.#J,o)}#j=m(()=>e.props.isValidConnection??(()=>!0));get isValidConnection(){return a(this.#j)}set isValidConnection(o){z(this.#j,o)}#$=m(()=>e.props.selectNodesOnDrag??!0);get selectNodesOnDrag(){return a(this.#$)}set selectNodesOnDrag(o){z(this.#$,o)}#ee=m(()=>e.props.defaultMarkerColor===void 0?"#b1b1b7":e.props.defaultMarkerColor);get defaultMarkerColor(){return a(this.#ee)}set defaultMarkerColor(o){z(this.#ee,o)}#te=m(()=>ku(e.edges,{defaultColor:this.defaultMarkerColor,id:this.flowId,defaultMarkerStart:this.defaultEdgeOptions.markerStart,defaultMarkerEnd:this.defaultEdgeOptions.markerEnd}));get markers(){return a(this.#te)}set markers(o){z(this.#te,o)}#ne=m(()=>e.props.onlyRenderVisibleElements??!1);get onlyRenderVisibleElements(){return a(this.#ne)}set onlyRenderVisibleElements(o){z(this.#ne,o)}#oe=m(()=>e.props.onflowerror??au);
1get onerror(){return a(this.#oe)}set onerror(o){z(this.#oe,o)}#re=m(()=>e.props.ondelete);get ondelete(){return a(this.#re)}set ondelete(o){z(this.#re,o)}#ie=m(()=>e.props.onbeforedelete);get onbeforedelete(){return a(this.#ie)}set onbeforedelete(o){z(this.#ie,o)}#se=m(()=>e.props.onbeforeconnect);get onbeforeconnect(){return a(this.#se)}set onbeforeconnect(o){z(this.#se,o)}#ae=m(()=>e.props.onconnect);get onconnect(){return a(this.#ae)}set onconnect(o){z(this.#ae,o)}#le=m(()=>e.props.onconnectstart);get onconnectstart(){return a(this.#le)}set onconnectstart(o){z(this.#le,o)}#ce=m(()=>e.props.onconnectend);get onconnectend(){return a(this.#ce)}set onconnectend(o){z(this.#ce,o)}#ue=m(()=>e.props.onbeforereconnect);get onbeforereconnect(){return a(this.#ue)}set onbeforereconnect(o){z(this.#ue,o)}#de=m(()=>e.props.onreconnect);get onreconnect(){return a(this.#de)}set onreconnect(o){z(this.#de,o)}#fe=m(()=>e.props.onreconnectstart);get onreconnectstart(){return a(this.#fe)}set onreconnectstart(o){z(this.#fe,o)}#he=m(()=>e.props.onreconnectend);get onreconnectend(){return a(this.#he)}set onreconnectend(o){z(this.#he,o)}#ge=m(()=>e.props.clickConnect??!0);get clickConnect(){return a(this.#ge)}set clickConnect(o){z(this.#ge,o)}#me=m(()=>e.props.onclickconnectstart);get onclickconnectstart(){return a(this.#me)}set onclickconnectstart(o){z(this.#me,o)}#ye=m(()=>e.props.onclickconnectend);get onclickconnectend(){return a(this.#ye)}set onclickconnectend(o){z(this.#ye,o)}#ve=ue(null);get clickConnectStartHandle(){return a(this.#ve)}set clickConnectStartHandle(o){z(this.#ve,o)}#pe=m(()=>e.props.onselectiondrag);get onselectiondrag(){return a(this.#pe)}set onselectiondrag(o){z(this.#pe,o)}#we=m(()=>e.props.onselectiondragstart);get onselectiondragstart(){return a(this.#we)}set onselectiondragstart(o){z(this.#we,o)}#xe=m(()=>e.props.onselectiondragstop);get onselectiondragstop(){return a(this.#xe)}set onselectiondragstop(o){z(this.#xe,o)}resolveFitView=async()=>{this.panZoom&&(await iu({nodes:this.nodeLookup,width:this.width,height:this.height,panZoom:this.panZoom,minZoom:this.minZoom,maxZoom:this.maxZoom},this.fitViewOptions),this.fitViewResolver?.resolve(!0),this.fitViewQueued=!1,this.fitViewOptions=void 0,this.fitViewResolver=null)};_prefersDark=new us("(prefers-color-scheme: dark)",e.props.colorModeSSR==="dark");#be=m(()=>e.props.colorMode==="system"?this._prefersDark.current?"dark":"light":e.props.colorMode??"light");get colorMode(){return a(this.#be)}set colorMode(o){z(this.#be,o)}constructor(){}resetStoreValues(){this.dragging=!1,this.selectionRect=null,this.selectionRectMode=null,this.selectionKeyPressed=!1,this.multiselectionKeyPressed=!1,this.deleteKeyPressed=!1,this.panActivationKeyPressed=!1,this.zoomActivationKeyPressed=!1,this._connection=no,this.clickConnectStartHandle=null,this.viewport=e.props.initialViewport??{x:0,y:0,zoom:1},this.ariaLiveMessage=""}}return new t}function qe(){const e=ao(io);if(!e)throw new Error("To call useStore outside of <SvelteFlow /> you need to wrap your component in a <SvelteFlowProvider />");return e.getStore()}const io=Symbol();function Sd(e){const t=kd(e);function n(E){t.nodeTypes={...Ci,...E}}function o(E){t.edgeTypes={...Ei,...E}}function r(E){t.edges=pu(E,t.edges)}const i=(E,_=!1)=>{t.nodes=t.nodes.map(C=>{if(t.connection.inProgress&&t.connection.fromNode.id===C.id){const x=t.nodeLookup.get(C.id);x&&(t.connection={...t.connection,from:at(x,t.connection.fromHandle,$.Left,!0)})}const g=E.get(C.id);return g?{...C,position:g.position,dragging:_}:C})};function s(E){const{changes:_,updatedInternals:C}=Du(E,t.nodeLookup,t.parentLookup,t.domNode,t.nodeOrigin,t.nodeExtent,t.zIndexMode);if(!C)return;Eu(t.nodeLookup,t.parentLookup,{nodeOrigin:t.nodeOrigin,nodeExtent:t.nodeExtent,zIndexMode:t.zIndexMode}),t.fitViewQueued&&t.resolveFitView();const g=new Map;for(const x of _){const b=t.nodeLookup.get(x.id)?.internals.userNode;if(!b)continue;const M={...b};switch(x.type){case"dimensions":{const O={...M.measured,...x.dimensions};x.setAttributes&&(M.width=x.dimensions?.width??M.width,M.height=x.dimensions?.height??M.height),M.measured=O;break}case"position":M.position=x.position??M.position;break}g.set(x.id,M)}t.nodes=t.nodes.map(x=>g.get(x.id)??x)}function l(E){const _=t.fitViewResolver??Promise.withResolvers();return t.fitViewQueued=!0,t.fitViewOptions=E,t.fitViewResolver=_,t.nodes=[...t.n
1odes],_.promise}async function c(E,_,C){const g=typeof C?.zoom<"u"?C.zoom:t.maxZoom,x=t.panZoom;return x?(await x.setViewport({x:t.width/2-E*g,y:t.height/2-_*g,zoom:g},{duration:C?.duration,ease:C?.ease,interpolate:C?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)}function d(E,_){const C=t.panZoom;return C?C.scaleBy(E,_):Promise.resolve(!1)}function f(E){return d(1.2,E)}function h(E){return d(1/1.2,E)}function u(E){const _=t.panZoom;_&&(_.setScaleExtent([E,t.maxZoom]),t.minZoom=E)}function y(E){const _=t.panZoom;_&&(_.setScaleExtent([t.minZoom,E]),t.maxZoom=E)}function v(E){const _=t.panZoom;_&&(_.setTranslateExtent(E),t.translateExtent=E)}function p(E,_=null){let C=!1;const g=E.map(x=>(_?_.has(x.id):!0)&&x.selected?(C=!0,{...x,selected:!1}):x);return[C,g]}function w(E){const _=E?.nodes?new Set(E.nodes.map(O=>O.id)):null,[C,g]=p(t.nodes,_);C&&(t.nodes=g);const x=E?.edges?new Set(E.edges.map(O=>O.id)):null,[b,M]=p(t.edges,x);b&&(t.edges=M)}function k(E){const _=t.multiselectionKeyPressed;t.nodes=t.nodes.map(C=>{const g=E.includes(C.id),x=_&&C.selected||g;return!!C.selected!==x?{...C,selected:x}:C}),_||w({nodes:[]})}function N(E){const _=t.multiselectionKeyPressed;t.edges=t.edges.map(C=>{const g=E.includes(C.id),x=_&&C.selected||g;return!!C.selected!==x?{...C,selected:x}:C}),_||w({edges:[]})}function P(E,_,C){const g=t.nodeLookup.get(E);if(!g){console.warn("012",Lt.error012(E));return}t.selectionRect=null,t.selectionRectMode=null,g.selected?(_||g.selected&&t.multiselectionKeyPressed)&&(w({nodes:[g],edges:[]}),requestAnimationFrame(()=>C?.blur())):k([E])}function S(E){const _=t.edgeLookup.get(E);if(!_){console.warn("012",Lt.error012(E));return}(_.selectable||t.elementsSelectable&&typeof _.selectable>"u")&&(t.selectionRect=null,t.selectionRectMode=null,_.selected?_.selected&&t.multiselectionKeyPressed&&w({nodes:[],edges:[_]}):N([E]))}function D(E,_){const{nodeExtent:C,snapGrid:g,nodeOrigin:x,nodeLookup:b,nodesDraggable:M,onerror:O}=t,A=new Map,H=g?.[0]??5,B=g?.[1]??5,F=E.x*H*_,q=E.y*B*_;for(const Y of b.values()){if(!(Y.selected&&(Y.draggable||M&&typeof Y.draggable>"u")))continue;let G={x:Y.internals.positionAbsolute.x+F,y:Y.internals.positionAbsolute.y+q};g&&(G=Gt(G,g));const{position:j,positionAbsolute:U}=ni({nodeId:Y.id,nextPosition:G,nodeLookup:b,nodeExtent:C,nodeOrigin:x,onError:O});Y.position=j,Y.internals.positionAbsolute=U,A.set(Y.id,Y)}i(A)}function I(E){return Au({delta:E,panZoom:t.panZoom,transform:[t.viewport.x,t.viewport.y,t.viewport.zoom],translateExtent:t.translateExtent,width:t.width,height:t.height})}const R=E=>{t._connection={...E}};function T(){t._connection=no}function K(){t.resetStoreValues(),w()}return Object.assign(t,{setNodeTypes:n,setEdgeTypes:o,addEdge:r,updateNodePositions:i,updateNodeInternals:s,zoomIn:f,zoomOut:h,fitView:l,setCenter:c,setMinZoom:u,setMaxZoom:y,setTranslateExtent:v,unselectNodesAndEdges:w,addSelectedNodes:k,addSelectedEdges:N,handleNodeSelection:P,handleEdgeSelection:S,moveSelectedNodes:D,panBy:I,updateConnection:R,cancelConnection:T,reset:K})}function Cd(e,t){const{minZoom:n,maxZoom:o,initialViewport:r,onPanZoomStart:i,onPanZoom:s,onPanZoomEnd:l,translateExtent:c,setPanZoomInstance:d,onDraggingChange:f,onTransformChange:h}=t,u=Ju({domNode:e,minZoom:n,maxZoom:o,translateExtent:c,viewport:r,onPanZoom:s,onPanZoomStart:i,onPanZoomEnd:l,onDraggingChange:f}),y=u.getViewport();return(r.x!==y.x||r.y!==y.y||r.zoom!==y.zoom)&&h([y.x,y.y,y.zoom]),d(u),u.update(t),{update(v){u.update(v)}}}var Ed=ee('<div class="svelte-flow__zoom svelte-flow__container"><!></div>');function Nd(e,t){te(t,!0);let n=L(t,"store",15),o=m(()=>n().panActivationKeyPressed||t.panOnDrag),r=m(()=>n().panActivationKeyPressed||t.panOnScroll);const{viewport:i}=n();let s=!1;Xe(()=>{!s&&n().viewportInitialized&&(t.oninit?.(),s=!0)});var l=Ed(),c=X(l);Ne(c,()=>t.children),Z(l),we(l,(d,f)=>Cd?.(d,f),()=>({viewport:n().viewport,minZoom:n().minZoom,maxZoom:n().maxZoom,initialViewport:i,onDraggingChange:d=>{n(n().dragging=d,!0)},setPanZoomInstance:d=>{n(n().panZoom=d,!0)},onPanZoomStart:t.onmovestart,onPanZoom:t.onmove,onPanZoomEnd:t.onmoveend,zoomOnScroll:t.zoomOnScroll,zoomOnDoubleClick:t.zoomOnDoubleClick,zoomOnPinch:t.zoomOnPinch,panOnScroll:a(r),panOnDrag:a(o),panOnScrollSpeed:t.panOnScrollSpeed,panOnScrollMode:t.panOnScrollMode,zoomActivationKeyPressed:n().zoomActivationKeyPressed,preventScrolling:typeof t.preventScrolling=="boolean"?t.preventScrolling:!0,noPanClassName:n().noPanClass,noWheelClassName:n().noWheelClass,userSelectionActive:!!n().selectionRect,translateExtent:n().translateExtent,lib:"svelte",paneClickDistance:t.paneClickDistance,selectionOnDrag:t.selectionOnDrag,onTransformChange:d=>{n(n().viewport={x:d[0],y:d[1],zoom:d[2]},!0)},connectionInProgress:n().connection.inProgress})),V(e,l),ne()}function yr(e,t){return n=>{n.target===t&&e?.(n)}}function vr(e){return t=>{const n=e.has(t.id);return!!t.selected!==n?{...t,selected:n}:t}}function pr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}
1var Pd=ee("<div><!></div>");function Md(e,t){te(t,!0);let n=L(t,"store",15),o=L(t,"panOnDrag",3,!0),r=L(t,"paneClickDistance",3,1),i,s=null,l=new Set,c=new Set,d=m(()=>n().panActivationKeyPressed||o()),f=m(()=>n().selectionKeyPressed||!!n().selectionRect||t.selectionOnDrag&&a(d)!==!0),h=m(()=>n().elementsSelectable&&(a(f)||n().selectionRectMode==="user")),u=!1;function y(T){if(s=i?.getBoundingClientRect(),!s)return;const K=T.target===i,Q=!K&&!!T.target.closest(".nokey"),E=t.selectionOnDrag&&K||n().selectionKeyPressed;if(Q||!a(f)||!E||T.button!==0||!T.isPrimary)return;T.target?.setPointerCapture?.(T.pointerId),u=!1;const{x:_,y:C}=Ie(T,s);n(n().selectionRect={width:0,height:0,startX:_,startY:C,x:_,y:C},!0),K||(T.stopPropagation(),T.preventDefault())}function v(T){if(!a(f)||!s||!n().selectionRect)return;const K=Ie(T,s),{startX:Q=0,startY:E=0}=n().selectionRect;if(!u){const b=n().selectionKeyPressed?0:r();if(Math.hypot(K.x-Q,K.y-E)<=b)return;n().unselectNodesAndEdges(),t.onselectionstart?.(T)}u=!0;const _={...n().selectionRect,x:K.x<Q?K.x:Q,y:K.y<E?K.y:E,width:Math.abs(K.x-Q),height:Math.abs(K.y-E)},C=l,g=c;l=new Set(xo(n().nodeLookup,_,[n().viewport.x,n().viewport.y,n().viewport.zoom],n().selectionMode===vn.Partial,!0).map(b=>b.id));const x=n().defaultEdgeOptions.selectable??!0;c=new Set;for(const b of l){const M=n().connectionLookup.get(b);if(M)for(const{edgeId:O}of M.values()){const A=n().edgeLookup.get(O);A&&(A.selectable??x)&&c.add(O)}}pr(C,l)||n(n().nodes=n().nodes.map(vr(l)),!0),pr(g,c)||n(n().edges=n().edges.map(vr(c)),!0),n(n().selectionRectMode="user",!0),n(n().selectionRect=_,!0)}function p(T){T.button===0&&(T.target?.releasePointerCapture?.(T.pointerId),!u&&T.target===i&&N?.(T),n(n().selectionRect=null,!0),u&&n(n().selectionRectMode=l.size>0?"nodes":null,!0),u&&t.onselectionend?.(T))}const w=T=>{if(Array.isArray(a(d))&&a(d).includes(2)){T.preventDefault();return}t.onpanecontextmenu?.({event:T})},k=T=>{u&&(T.stopPropagation(),u=!1)};function N(T){if(u||n().connection.inProgress){u=!1;return}t.onpaneclick?.({event:T}),n().unselectNodesAndEdges(),n(n().selectionRectMode=null,!0),n(n().selectionRect=null,!0)}var P=Pd();let S;var D=m(()=>a(h)?void 0:yr(N,i)),I=m(()=>yr(w,i)),R=X(P);Ne(R,()=>t.children),Z(P),Yt(P,T=>i=T,()=>i),ie(T=>S=We(P,1,"svelte-flow__pane svelte-flow__container",null,S,T),[()=>({draggable:o()===!0||Array.isArray(o())&&o().includes(0),dragging:n().dragging,selection:a(f)})]),be("click",P,function(...T){a(D)?.apply(this,T)}),ot("pointerdown",P,function(...T){(a(h)?y:void 0)?.apply(this,T)},!0),be("pointermove",P,function(...T){(a(h)?v:void 0)?.apply(this,T)}),be("pointerup",P,function(...T){(a(h)?p:void 0)?.apply(this,T)}),be("contextmenu",P,function(...T){a(I)?.apply(this,T)}),ot("click",P,function(...T){(a(h)?k:void 0)?.apply(this,T)},!0),V(e,P),ne()}Zt(["click","pointermove","pointerup","contextmenu"]);var zd=ee('<div class="svelte-flow__viewport xyflow__viewport svelte-flow__container"><!></div>');function Id(e,t){te(t,!0);var n=zd();let o;var r=X(n);Ne(r,()=>t.children),Z(n),ie(()=>o=Pe(n,"",o,{transform:`translate(${t.store.viewport.x??""}px, ${t.store.viewport.y??""}px) scale(${t.store.viewport.zoom??""})`})),V(e,n),ne()}function Ni(e,t){const{store:n,onDrag:o,onDragStart:r,onDragStop:i,onNodeMouseDown:s}=t,l=Ru({onDrag:o,onDragStart:r,onDragStop:i,onNodeMouseDown:s,getStoreItems:()=>{const{snapGrid:d,viewport:f}=n;return{nodes:n.nodes,nodeLookup:n.nodeLookup,edges:n.edges,nodeExtent:n.nodeExtent,snapGrid:d||[0,0],snapToGrid:!!d,nodeOrigin:n.nodeOrigin,multiSelectionActive:n.multiselectionKeyPressed,domNode:n.domNode,transform:[f.x,f.y,f.zoom],autoPanOnNodeDrag:n.autoPanOnNodeDrag,nodesDraggable:n.nodesDraggable,selectNodesOnDrag:n.selectNodesOnDrag,nodeDragThreshold:n.nodeDragThreshold,unselectNodesAndEdges:n.unselectNodesAndEdges,updateNodePositions:n.updateNodePositions,onSelectionDrag:n.onselectiondrag,onSelectionDragStart:n.onselectiondragstart,onSelectionDragStop:n.onselectiondragstop,panBy:n.panBy}}});function c(d,f){if(f.disabled){l.destroy();return}l.update({domNode:d,noDragClassName:f.noDragClass,handleSelector:f.handleSelector,nodeId:f.nodeId,isSelectable:f.isSelectable,no
1deClickDistance:f.nodeClickDistance})}return c(e,t),{update(d){c(e,d)},destroy(){l.destroy()}}}var Dd=ee('<div aria-live="assertive" aria-atomic="true" class="a11y-live-msg svelte-13pq11u"> </div>'),Ad=ee('<div class="a11y-hidden svelte-13pq11u"> </div> <div class="a11y-hidden svelte-13pq11u"> </div> <!>',1);function Td(e,t){te(t,!0);var n=Ad(),o=ae(n),r=X(o,!0);Z(o);var i=W(o,2),s=X(i,!0);Z(i);var l=W(i,2);{var c=d=>{var f=Dd(),h=X(f,!0);Z(f),ie(()=>{J(f,"id",`${Od}-${t.store.flowId}`),fe(h,t.store.ariaLiveMessage)}),V(d,f)};le(l,d=>{t.store.disableKeyboardA11y||d(c)})}ie(()=>{J(o,"id",`${Pi}-${t.store.flowId}`),fe(r,t.store.disableKeyboardA11y?t.store.ariaLabelConfig["node.a11yDescription.default"]:t.store.ariaLabelConfig["node.a11yDescription.keyboardDisabled"]),J(i,"id",`${Mi}-${t.store.flowId}`),fe(s,t.store.ariaLabelConfig["edge.a11yDescription.default"])}),V(e,n),ne()}const Pi="svelte-flow__node-desc",Mi="svelte-flow__edge-desc",Od="svelte-flow__aria-live";var Hd=ee("<div><!></div>");function Rd(e,t){te(t,!0);let n=L(t,"store",15),o=m(()=>pe(t.node.data,()=>({}),!0)),r=m(()=>pe(t.node.selected,!1)),i=m(()=>t.node.draggable),s=m(()=>t.node.selectable),l=m(()=>pe(t.node.deletable,!0)),c=m(()=>t.node.connectable),d=m(()=>t.node.focusable),f=m(()=>pe(t.node.hidden,!1)),h=m(()=>pe(t.node.dragging,!1)),u=m(()=>pe(t.node.style,"")),y=m(()=>t.node.class),v=m(()=>pe(t.node.type,"default")),p=m(()=>t.node.parentId),w=m(()=>t.node.sourcePosition),k=m(()=>t.node.targetPosition),N=m(()=>pe(t.node.measured,()=>({width:0,height:0}),!0).width),P=m(()=>pe(t.node.measured,()=>({width:0,height:0}),!0).height),S=m(()=>t.node.initialWidth),D=m(()=>t.node.initialHeight),I=m(()=>t.node.width),R=m(()=>t.node.height),T=m(()=>t.node.dragHandle),K=m(()=>pe(t.node.internals.z,0)),Q=m(()=>t.node.internals.positionAbsolute.x),E=m(()=>t.node.internals.positionAbsolute.y),_=m(()=>t.node.internals.userNode),{id:C}=t.node,g=m(()=>a(i)??n().nodesDraggable),x=m(()=>a(s)??n().elementsSelectable),b=m(()=>a(c)??n().nodesConnectable),M=m(()=>si(t.node)),O=m(()=>!!t.node.internals.handleBounds),A=m(()=>a(M)&&a(O)),H=m(()=>a(d)??n().nodesFocusable);function B(ce){return n().parentLookup.has(ce)}let F=m(()=>B(C)),q=ue(null),Y=null,oe=a(v),G=a(w),j=a(k),U=m(()=>n().nodeTypes[a(v)]??ki),re=m(()=>n().ariaLabelConfig),he={get value(){return a(b)}};$u(C),td(he);let se=m(()=>{const ce=a(N)===void 0?a(I)??a(S):a(I),ye=a(P)===void 0?a(R)??a(D):a(R);if(!(ce===void 0&&ye===void 0&&a(u)===void 0))return`${a(u)};${ce?`width:${Re(ce)};`:""}${ye?`height:${Re(ye)};`:""}`});Xe(()=>{(a(v)!==oe||a(w)!==G||a(k)!==j)&&a(q)!==null&&requestAnimationFrame(()=>{a(q)!==null&&n().updateNodeInternals(new Map([[C,{id:C,nodeElement:a(q),force:!0}]]))}),oe=a(v),G=a(w),j=a(k)}),Xe(()=>{t.resizeObserver&&(!a(A)||a(q)!==Y)&&(Y&&t.resizeObserver.unobserve(Y),a(q)&&t.resizeObserver.observe(a(q)),Y=a(q))}),lo(()=>{Y&&t.resizeObserver?.unobserve(Y)});function ve(ce){a(x)&&(!n().selectNodesOnDrag||!a(g)||n().nodeDragThreshold>0)&&n().handleNodeSelection(C),t.onnodeclick?.({node:a(_),event:ce})}function de(ce){if(!(ci(ce)||n().disableKeyboardA11y))if(ei.includes(ce.key)&&a(x)){const ye=ce.key==="Escape";n().handleNodeSelection(C,ye,a(q))}else a(g)&&t.node.selected&&Object.prototype.hasOwnProperty.call(bn,ce.key)&&(ce.preventDefault(),n(n().ariaLiveMessage=a(re)["node.a11yDescription.ariaLiveMessage"]({direction:ce.key.replace("Arrow","").toLowerCase(),x:~~t.node.internals.positionAbsolute.x,y:~~t.node.internals.positionAbsolute.y}),!0),n().moveSelectedNodes(bn[ce.key],ce.shiftKey?4:1))}const ke=()=>{if(n().disableKeyboardA11y||!n().autoPanOnNodeFocus||!a(q)?.matches(":focus-visible"))return;const{width:ce,height:ye,viewport:Ve}=n();xo(new Map([[C,t.node]]),{x:0,y:0,width:ce,height:ye},[Ve.x,Ve.y,Ve.zoom],!0).length>0||n().setCenter(t.node.position.x+(t.node.measured.width??0)/2,t.node.position.y+(t.node.measured.height??0)/2,{zoom:Ve.zoom})};var Ae=xe(),Ge=ae(Ae);{var $e=ce=>{var ye=Hd();Qe(ye,()=>({"data-id":C,class:["svelte-flow__node",`svelte-flow__node-${a(v)}`,a(y)],style:a(se),onclick:ve,onpointerenter:t.onnodepointerenter?ge=>t.onnodepointerenter({node:a(_),event:ge}):void 0,onpointerleave:t.onnodepointerleave?ge=>t.onnodepointerleave({node:a(_),event:ge}):void 0,onpointermove:t.onnodepointermove?ge=>t.onnodepointermove({node:a(_),event:ge}):void 0,oncontextmenu:t.onnodecontextmenu?ge=>t.onnodecontextmenu({node:a(_),event:ge}):void 0,onkeydown:a(H)?de:void 0,onfocus:a(H)?ke:void 0,tabIndex:a(H)?0:void 0,role:t.node.ariaRole??(a(H)?"group":void 0),"aria-roledescription":"node","aria-describedby":n().disableKeyboardA11y?void 0:`${Pi}-${n().flowId}`,...t.node.domAttributes,[co]:{dragging:a(h),selected:a(r),draggable:a(g),connectable:a(b),selectable:a(x),nopan:a(g),parent:a(F)},[kn]:{"z-index":a(K),transform:`translate(${a(Q)??""}px, ${a(E)??""}px)`,visibility:a(M)?"visible":"hidden"}}));var Ve=X(ye);Sn(Ve,()=>a(U),(ge,ct)=>{ct(ge,{get data(){return a(o)},get id(){return C},get selected(){return a(r)},get selectable(){return a(x)},get deletable(){return a(l)},get sourcePosition(){return a(w)},get targetPosition(){return a(k)},get zIndex(){return a(K)},get dragging(){return a(h)},get draggable(){return a(g)},get dragHandle(){return a(T)},get parentId(){return a(p)}
1,get type(){return a(v)},get isConnectable(){return a(b)},get positionAbsoluteX(){return a(Q)},get positionAbsoluteY(){return a(E)},get width(){return a(I)},get height(){return a(R)}})}),Z(ye),we(ye,(ge,ct)=>Ni?.(ge,ct),()=>({nodeId:C,isSelectable:a(x),disabled:!a(g),handleSelector:a(T),noDragClass:n().noDragClass,nodeClickDistance:t.nodeClickDistance,onNodeMouseDown:n().handleNodeSelection,onDrag:(ge,ct,Et,Nt)=>{t.onnodedrag?.({event:ge,targetNode:Et,nodes:Nt})},onDragStart:(ge,ct,Et,Nt)=>{t.onnodedragstart?.({event:ge,targetNode:Et,nodes:Nt})},onDragStop:(ge,ct,Et,Nt)=>{t.onnodedragstop?.({event:ge,targetNode:Et,nodes:Nt})},store:n()})),Yt(ye,ge=>z(q,ge),()=>a(q)),V(ce,ye)};le(Ge,ce=>{a(f)||ce($e)})}V(e,Ae),ne()}var Ld=ee('<div class="svelte-flow__nodes"></div>');function Vd(e,t){te(t,!0);let n=L(t,"store",15);const o=typeof ResizeObserver>"u"?null:new ResizeObserver(i=>{const s=new Map;i.forEach(l=>{const c=l.target.getAttribute("data-id");s.set(c,{id:c,nodeElement:l.target,force:!0})}),n().updateNodeInternals(s)});lo(()=>{o?.disconnect()});var r=Ld();Ct(r,21,()=>n().visible.nodes.values(),i=>i.id,(i,s)=>{Rd(i,{get node(){return a(s)},get resizeObserver(){return o},get nodeClickDistance(){return t.nodeClickDistance},get onnodeclick(){return t.onnodeclick},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get onnodecontextmenu(){return t.onnodecontextmenu},get store(){return n()},set store(l){n(l)}})}),Z(r),V(e,r),ne()}var Bd=me('<svg class="svelte-flow__edge-wrapper"><g><!></g></svg>');function Kd(e,t){te(t,!0);let n=m(()=>t.edge.id),o=m(()=>t.edge.source),r=m(()=>t.edge.target),i=m(()=>t.edge.sourceX),s=m(()=>t.edge.sourceY),l=m(()=>t.edge.targetX),c=m(()=>t.edge.targetY),d=m(()=>t.edge.sourcePosition),f=m(()=>t.edge.targetPosition),h=m(()=>pe(t.edge.animated,!1)),u=m(()=>pe(t.edge.selected,!1)),y=m(()=>t.edge.label),v=m(()=>t.edge.labelStyle),p=m(()=>pe(t.edge.data,()=>({}),!0)),w=m(()=>t.edge.style),k=m(()=>t.edge.interactionWidth),N=m(()=>pe(t.edge.type,"default")),P=m(()=>t.edge.sourceHandle),S=m(()=>t.edge.targetHandle),D=m(()=>t.edge.markerStart),I=m(()=>t.edge.markerEnd),R=m(()=>t.edge.selectable),T=m(()=>t.edge.focusable),K=m(()=>pe(t.edge.deletable,!0)),Q=m(()=>t.edge.hidden),E=m(()=>t.edge.zIndex),_=m(()=>t.edge.class),C=m(()=>t.edge.ariaLabel);od(a(n));let g=null,x=m(()=>a(R)??t.store.elementsSelectable),b=m(()=>a(T)??t.store.edgesFocusable),M=m(()=>t.store.edgeTypes[a(N)]??Si),O=m(()=>a(D)?`url('#${ro(a(D),t.store.flowId)}')`:void 0),A=m(()=>a(I)?`url('#${ro(a(I),t.store.flowId)}')`:void 0);function H(G){const j=t.store.edgeLookup.get(a(n));j&&(a(x)&&t.store.handleEdgeSelection(a(n)),t.onedgeclick?.({event:G,edge:j}))}function B(G,j){const U=t.store.edgeLookup.get(a(n));U&&j({event:G,edge:U})}function F(G){if(!t.store.disableKeyboardA11y&&ei.includes(G.key)&&a(x)){const{unselectNodesAndEdges:j,addSelectedEdges:U}=t.store;G.key==="Escape"?(g?.blur(),j({edges:[t.edge]})):U([a(n)])}}var q=xe(),Y=ae(q);{var oe=G=>{var j=Bd();let U;var re=X(j);Qe(re,()=>({class:["svelte-flow__edge",a(_)],"data-id":a(n),onclick:H,oncontextmenu:t.onedgecontextmenu?se=>{B(se,t.onedgecontextmenu)}:void 0,onpointerenter:t.onedgepointerenter?se=>{B(se,t.onedgepointerenter)}:void 0,onpointerleave:t.onedgepointerleave?se=>{B(se,t.onedgepointerleave)}:void 0,"aria-label":a(C)===null?void 0:a(C)?a(C):`Edge from ${a(o)} to ${a(r)}`,"aria-describedby":a(b)?`${Mi}-${t.store.flowId}`:void 0,role:t.edge.ariaRole??(a(b)?"group":"img"),"aria-roledescription":"edge",onkeydown:a(b)?F:void 0,tabindex:a(b)?0:void 0,...t.edge.domAttributes,[co]:{animated:a(h),selected:a(u),selectable:a(x)}}));var he=X(re);Sn(he,()=>a(M),(se,ve)=>{ve(se,{get id(){return a(n)},get source(){return a(o)},get target(){return a(r)},get sourceX(){return a(i)},get sourceY(){return a(s)},get targetX(){return a(l)},get targetY(){return a(c)},get sourcePosition(){return a(d)},get targetPosition(){return a(f)},get animated(){return a(h)},get selected(){return a(u)},get label(){return a(y)},get labelStyle(){return a(v)},get data(){return a(p)},get style(){return a(w)},get interactionWidth(){return a(k)},get selectable(){return a(x)},get deletable(){return a(K)}
1,get type(){return a(N)},get sourceHandleId(){return a(P)},get targetHandleId(){return a(S)},get markerStart(){return a(O)},get markerEnd(){return a(A)}})}),Z(re),Yt(re,se=>g=se,()=>g),Z(j),ie(()=>U=Pe(j,"",U,{"z-index":a(E)})),V(G,j)};le(Y,G=>{a(Q)||G(oe)})}V(e,q),ne()}var Zd=me("<defs></defs>");function Yd(e,t){te(t,!1);const n=qe();ds();var o=Zd();Ct(o,5,()=>n.markers,r=>r.id,(r,i)=>{qd(r,et(()=>a(i)))}),Z(o),V(e,o),ne()}var Xd=me('<polyline class="arrow" fill="none" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4"></polyline>'),Fd=me('<polyline class="arrowclosed" stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4"></polyline>'),Wd=me('<marker class="svelte-flow__arrowhead" viewBox="-10 -10 20 20" refX="0" refY="0"><!></marker>');function qd(e,t){te(t,!0);let n=L(t,"width",3,12.5),o=L(t,"height",3,12.5),r=L(t,"markerUnits",3,"strokeWidth"),i=L(t,"orient",3,"auto-start-reverse"),s=L(t,"color",3,"none");var l=Wd(),c=X(l);{var d=h=>{var u=Xd();let y;ie(()=>{J(u,"stroke-width",t.strokeWidth),y=Pe(u,"",y,{stroke:s()})}),V(h,u)},f=h=>{var u=Fd();let y;ie(()=>{J(u,"stroke-width",t.strokeWidth),y=Pe(u,"",y,{stroke:s(),fill:s()})}),V(h,u)};le(c,h=>{t.type===pn.Arrow?h(d):t.type===pn.ArrowClosed&&h(f,1)})}Z(l),ie(()=>{J(l,"id",t.id),J(l,"markerWidth",`${n()}`),J(l,"markerHeight",`${o()}`),J(l,"markerUnits",r()),J(l,"orient",i())}),V(e,l),ne()}var Gd=ee('<div class="svelte-flow__edges"><svg class="svelte-flow__marker"><!></svg> <!></div>');function Ud(e,t){te(t,!0);let n=L(t,"store",15);var o=Gd(),r=X(o),i=X(r);Yd(i,{}),Z(r);var s=W(r,2);Ct(s,17,()=>n().visible.edges.values(),l=>l.id,(l,c)=>{Kd(l,{get edge(){return a(c)},get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return n()},set store(d){n(d)}})}),Z(o),V(e,o),ne()}var Qd=ee('<div class="svelte-flow__selection svelte-1vr3gfi"></div>');function zi(e,t){te(t,!0);let n=L(t,"x",3,0),o=L(t,"y",3,0),r=L(t,"width",3,0),i=L(t,"height",3,0),s=L(t,"isVisible",3,!0);var l=xe(),c=ae(l);{var d=f=>{var h=Qd();let u;ie(y=>u=Pe(h,"",u,y),[()=>({width:typeof r()=="string"?r():Re(r()),height:typeof i()=="string"?i():Re(i()),transform:`translate(${n()}px, ${o()}px)`})]),V(f,h)};le(c,f=>{s()&&f(d)})}V(e,l),ne()}var Jd=ee("<div><!></div>");function jd(e,t){te(t,!0);let n=ue(void 0);Xe(()=>{t.store.disableKeyboardA11y||a(n)?.focus({preventScroll:!0})});let o=m(()=>{if(t.store.selectionRectMode==="nodes"){t.store.nodes;const h=qt(t.store.nodeLookup,{filter:u=>!!u.selected});if(h.width>0&&h.height>0)return h}return null});function r(h){const u=t.store.nodes.filter(y=>y.selected);t.onselectioncontextmenu?.({nodes:u,event:h})}function i(h){const u=t.store.nodes.filter(y=>y.selected);t.onselectionclick?.({nodes:u,event:h})}function s(h){Object.prototype.hasOwnProperty.call(bn,h.key)&&(h.preventDefault(),t.store.moveSelectedNodes(bn[h.key],h.shiftKey?4:1))}var l=xe(),c=ae(l);{var d=h=>{var u=Jd();let y;var v=X(u);zi(v,{width:"100%",height:"100%",x:0,y:0}),Z(u),we(u,(p,w)=>Ni?.(p,w),()=>({disabled:!1,store:t.store,onDrag:(p,w,k,N)=>{t.onnodedrag?.({event:p,targetNode:null,nodes:N})},onDragStart:(p,w,k,N)=>{t.onnodedragstart?.({event:p,targetNode:null,nodes:N})},onDragStop:(p,w,k,N)=>{t.onnodedragstop?.({event:p,targetNode:null,nodes:N})}})),Yt(u,p=>z(n,p),()=>a(n)),ie(p=>{We(u,1,lt(["svelte-flow__selection-wrapper",t.store.noPanClass]),"svelte-sf2y5e"),J(u,"role",t.store.disableKeyboardA11y?void 0:"button"),J(u,"tabindex",t.store.disableKeyboardA11y?void 0:-1),y=Pe(u,"",y,p)},[()=>({width:Re(a(o).width),height:Re(a(o).height),transform:`translate(${a(o).x??""}px, ${a(o).y??""}px)`})]),be("contextmenu",u,r),be("click",u,i),be("keydown",u,function(...p){(t.store.disableKeyboardA11y?void 0:s)?.apply(this,p)}),V(h,u)},f=m(()=>t.store.selectionRectMode==="nodes"&&a(o)&&Ze(a(o).x)&&Ze(a(o).y));le(c,h=>{a(f)&&h(d)})}V(e,l),ne()}Zt(["contextmenu","click","keydown"]);function $d(e){switch(e){case"ctrl":return 8;case"shift":return 4;case"alt":return 2;case"meta":return 1}}function Te(e,t){let{enabled:n=!0,trigger:o,type:r="keydown"}=t;function i(l){const c=Array.isArray(o)?o:[o],d=[l.metaKey,l.altKey,l.shiftKey,l.ctrlKey].reduce((f,h,u)=>
1h?f|1<<u:f,0);for(const f of c){const h={preventDefault:!1,enabled:!0,...f},{modifier:u,key:y,callback:v,preventDefault:p,enabled:w}=h;if(w){if(l.key!==y)continue;if(u===null||u===!1){if(d!==0)continue}else if(u!==void 0&&u?.[0]?.length>0){const N=Array.isArray(u)?u:[u];let P=!1;for(const S of N)if((Array.isArray(S)?S:[S]).reduce((I,R)=>I|$d(R),0)===d){P=!0;break}if(!P)continue}p&&l.preventDefault();const k={node:e,trigger:h,originalEvent:l};e.dispatchEvent(new CustomEvent("shortcut",{detail:k})),v?.(k)}}}let s;return n&&(s=Mo(e,r,i)),{update:l=>{const{enabled:c=!0,type:d="keydown"}=l;n&&(!c||r!==d)?s?.():!n&&c&&(s=Mo(e,d,i)),n=c,r=d,o=l.trigger},destroy:()=>{s?.()}}}function ef(){const e=m(qe),t=i=>{const s=gr(i)?i:a(e).nodeLookup.get(i.id),l=s.parentId?uu(s.position,s.measured,s.parentId,a(e).nodeLookup,a(e).nodeOrigin):s.position,c={...s,position:l,width:s.measured?.width??s.width,height:s.measured?.height??s.height};return bt(c)};function n(i,s,l={replace:!1}){a(e).nodes=dt(()=>a(e).nodes).map(c=>{if(c.id===i){const d=typeof s=="function"?s(c):s;return l?.replace&&gr(d)?d:{...c,...d}}return c})}function o(i,s,l={replace:!1}){a(e).edges=dt(()=>a(e).edges).map(c=>{if(c.id===i){const d=typeof s=="function"?s(c):s;return l.replace&&hd(d)?d:{...c,...d}}return c})}const r=i=>a(e).nodeLookup.get(i);return{zoomIn:a(e).zoomIn,zoomOut:a(e).zoomOut,getInternalNode:r,getNode:i=>r(i)?.internals.userNode,getNodes:i=>i===void 0?a(e).nodes:wr(a(e).nodeLookup,i),getEdge:i=>a(e).edgeLookup.get(i),getEdges:i=>i===void 0?a(e).edges:wr(a(e).edgeLookup,i),setZoom:(i,s)=>{const l=a(e).panZoom;return l?l.scaleTo(i,s):Promise.resolve(!1)},getZoom:()=>a(e).viewport.zoom,setViewport:async(i,s)=>{const l=a(e).viewport;return a(e).panZoom?(await a(e).panZoom.setViewport({x:i.x??l.x,y:i.y??l.y,zoom:i.zoom??l.zoom},s),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>Sr(a(e).viewport),setCenter:async(i,s,l)=>a(e).setCenter(i,s,l),fitView:i=>a(e).fitView(i),fitBounds:async(i,s)=>{if(!a(e).panZoom)return Promise.resolve(!1);const l=bo(i,a(e).width,a(e).height,a(e).minZoom,a(e).maxZoom,s?.padding??.1);return await a(e).panZoom.setViewport(l,{duration:s?.duration,ease:s?.ease,interpolate:s?.interpolate}),Promise.resolve(!0)},getIntersectingNodes:(i,s=!0,l)=>{const c=nr(i),d=c?i:t(i);return d?(l||a(e).nodes).filter(f=>{const h=a(e).nodeLookup.get(f.id);if(!h||!c&&f.id===i.id)return!1;const u=bt(h),y=Vt(u,d);return s&&y>0||y>=u.width*u.height||y>=d.width*d.height}):[]},isNodeIntersecting:(i,s,l=!0)=>{const d=nr(i)?i:t(i);if(!d)return!1;const f=Vt(d,s);return l&&f>0||f>=s.width*s.height||f>=d.width*d.height},deleteElements:async({nodes:i=[],edges:s=[]})=>{const{nodes:l,edges:c}=await su({nodesToRemove:i,edgesToRemove:s,nodes:a(e).nodes,edges:a(e).edges,onBeforeDelete:a(e).onbeforedelete});return l&&(a(e).nodes=dt(()=>a(e).nodes).filter(d=>!l.some(({id:f})=>f===d.id))),c&&(a(e).edges=dt(()=>a(e).edges).filter(d=>!c.some(({id:f})=>f===d.id))),(l.length>0||c.length>0)&&a(e).ondelete?.({nodes:l,edges:c}),{deletedNodes:l,deletedEdges:c}},screenToFlowPosition:(i,s={snapToGrid:!0})=>{if(!a(e).domNode)return i;
1const l=s.snapToGrid?a(e).snapGrid:!1,{x:c,y:d,zoom:f}=a(e).viewport,{x:h,y:u}=a(e).domNode.getBoundingClientRect(),y={x:i.x-h,y:i.y-u};return Ut(y,[c,d,f],l!==null,l||[1,1])},flowToScreenPosition:i=>{if(!a(e).domNode)return i;const{x:s,y:l,zoom:c}=a(e).viewport,{x:d,y:f}=a(e).domNode.getBoundingClientRect(),h=xn(i,[s,l,c]);return{x:h.x+d,y:h.y+f}},toObject:()=>structuredClone({nodes:[...a(e).nodes],edges:[...a(e).edges],viewport:{...a(e).viewport}}),updateNode:n,updateNodeData:(i,s,l)=>{const c=a(e).nodeLookup.get(i)?.internals.userNode;if(!c)return;const d=typeof s=="function"?s(c):s;n(i,f=>({...f,data:l?.replace?d:{...f.data,...d}}))},updateEdge:o,getNodesBounds:i=>nu(i,{nodeLookup:a(e).nodeLookup,nodeOrigin:a(e).nodeOrigin}),getHandleConnections:({type:i,id:s,nodeId:l})=>Array.from(a(e).connectionLookup.get(`${l}-${i}-${s??null}`)?.values()??[])}}function wr(e,t){const n=[];for(const o of t){const r=e.get(o);if(r){const i="internals"in r?r.internals?.userNode:r;n.push(i)}}return n}function tf(e,t){te(t,!0);let n=L(t,"store",15),o=L(t,"selectionKey",3,"Shift"),r=L(t,"multiSelectionKey",19,()=>Bt()?"Meta":"Control"),i=L(t,"deleteKey",3,"Backspace"),s=L(t,"panActivationKey",3," "),l=L(t,"zoomActivationKey",19,()=>Bt()?"Meta":"Control"),{deleteElements:c}=ef();function d(p){return p!==null&&typeof p=="object"}function f(p){return d(p)?p.modifier||[]:[]}function h(p){return p==null?"":d(p)?p.key:p}function u(p,w){return(Array.isArray(p)?p:[p]).map(N=>{const P=h(N);return{key:P,modifier:f(N),enabled:P!==null,callback:w}})}function y(){n(n().selectionRect=null,!0),n(n().selectionKeyPressed=!1,!0),n(n().multiselectionKeyPressed=!1,!0),n(n().deleteKeyPressed=!1,!0),n(n().panActivationKeyPressed=!1,!0),n(n().zoomActivationKeyPressed=!1,!0)}function v(){const p=n().nodes.filter(k=>k.selected),w=n().edges.filter(k=>k.selected);c({nodes:p,edges:w})}ot("blur",Ce,y),ot("contextmenu",Ce,y),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(o(),()=>n(n().selectionKeyPressed=!0,!0)),type:"keydown"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(o(),()=>n(n().selectionKeyPressed=!1,!0)),type:"keyup"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(r(),()=>{n(n().multiselectionKeyPressed=!0,!0)}),type:"keydown"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(r(),()=>n(n().multiselectionKeyPressed=!1,!0)),type:"keyup"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(i(),p=>{!(p.originalEvent.ctrlKey||p.originalEvent.metaKey||p.originalEvent.shiftKey)&&!ci(p.originalEvent)&&(n(n().deleteKeyPressed=!0,!0),v())}),type:"keydown"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(i(),()=>n(n().deleteKeyPressed=!1,!0)),type:"keyup"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(s(),()=>n(n().panActivationKeyPressed=!0,!0)),type:"keydown"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(s(),()=>n(n().panActivationKeyPressed=!1,!0)),type:"keyup"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(l(),()=>n(n().zoomActivationKeyPressed=!0,!0)),type:"keydown"})),we(Ce,(p,w)=>Te?.(p,w),()=>({trigger:u(l(),()=>n(n().zoomActivationKeyPressed=!1,!0)),type:"keyup"})),ne()}var nf=me('<path fill="none" class="svelte-flow__connection-path"></path>'),of=me('<svg class="svelte-flow__connectionline"><g><!></g></svg>');function rf(e,t){te(t,!0);let n=m(()=>{if(!t.store.connection.inProgress)return"";const s={sourceX:t.store.connection.from.x,sourceY:t.store.connection.from.y,sourcePosition:t.store.connection.fromPosition,targetX:t.store.connection.to.x,targetY:t.store.connection.to.y,targetPosition:t.store.connection.toPosition};switch(t.type){case Ue.Bezier:{const[l]=di(s);return l}case Ue.Straight:{const[l]=hi(s);return l}case Ue.Step:case Ue.SmoothStep:{const[l]=_o({...s,borderRadius:t.type===Ue.Step?0:void 0});return l}}});var o=xe(),r=ae(o);{var i=s=>{var l=of(),c=X(l),d=X(c);{var f=u=>{var y=xe(),v=ae(y);Sn(v,()=>t.LineComponent,(p,w)=>{w(p,{})}),V(u,y)},h=u=>{var y=nf();ie(()=>{J(y,"d",a(n)),Pe(y,t.style)}),V(u,y)};le(d,u=>{t.LineComponent?u(f):u(h,-1)})}Z(c),Z(l),ie(u=>{J(l,"width",t.store.width),J(l,"height",t.store.height),Pe(l,t.containerStyle),We(c,0,u)},[()=>lt(["svelte-flow__connection",eu(t.store.connection.isValid)])]),V(s,l)};le(r,s=>{t.store.connection.inProgress&&s(i)})}V(e,o),ne()}var sf=ee("<div><!></div>");function Po(e,t){te(t,!0);let n=L(t,"position",3,"top-right"),o=Je(t,["$$slots","$$events","$$legacy","position","style","class","children"]),r=m(()=>`${n()}`.split("-"));var i=sf();Qe(i,l=>({class:l,style:t.style,...o}
1),[()=>["svelte-flow__panel",t.class,...a(r)]]);var s=X(i);Ne(s,()=>t.children??St),Z(i),V(e,i),ne()}var af=ee('<a href="https://svelteflow.dev" target="_blank" rel="noopener noreferrer" aria-label="Svelte Flow attribution">Svelte Flow</a>');function lf(e,t){te(t,!0);let n=L(t,"position",3,"bottom-right");var o=xe(),r=ae(o);{var i=s=>{Po(s,{get position(){return n()},class:"svelte-flow__attribution","data-message":"Feel free to remove the attribution or check out how you could support us: https://svelteflow.dev/support-us",children:(l,c)=>{var d=af();V(l,d)},$$slots:{default:!0}})};le(r,s=>{t.proOptions?.hideAttribution||s(i)})}V(e,o),ne()}var cf=ee("<div><!></div>");function uf(e,t){te(t,!0);let n=L(t,"domNode",15),o=L(t,"clientWidth",15),r=L(t,"clientHeight",15),i=m(()=>t.rest.class),s=m(()=>Yi(t.rest,["id","class","nodeTypes","edgeTypes","colorMode","isValidConnection","onmove","onmovestart","onmoveend","onflowerror","ondelete","onbeforedelete","onbeforeconnect","onconnect","onconnectstart","onconnectend","onbeforereconnect","onreconnect","onreconnectstart","onreconnectend","onclickconnectstart","onclickconnectend","oninit","onselectionchange","onselectiondragstart","onselectiondrag","onselectiondragstop","onselectionstart","onselectionend","clickConnect","fitView","fitViewOptions","nodeOrigin","nodeDragThreshold","connectionDragThreshold","minZoom","maxZoom","initialViewport","connectionRadius","connectionMode","selectionMode","selectNodesOnDrag","snapGrid","defaultMarkerColor","translateExtent","nodeExtent","onlyRenderVisibleElements","autoPanOnConnect","autoPanOnNodeDrag","colorModeSSR","defaultEdgeOptions","elevateNodesOnSelect","elevateEdgesOnSelect","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","elementsSelectable","nodesFocusable","edgesFocusable","disableKeyboardA11y","noDragClass","noPanClass","noWheelClass","ariaLabelConfig","autoPanSpeed","panOnScrollSpeed","zIndexMode"]));function l(f){f.currentTarget.scrollTo({top:0,left:0,behavior:"auto"}),t.rest.onscroll&&t.rest.onscroll(f)}var c=cf();Qe(c,f=>({class:["svelte-flow","svelte-flow__container",a(i),t.colorMode],"data-testid":"svelte-flow__wrapper",role:"application",onscroll:l,...a(s),[kn]:f}),[()=>({width:Re(t.width),height:Re(t.height)})],void 0,void 0,"svelte-mkap6j");var d=X(c);Ne(d,()=>t.children??St),Z(c),Yt(c,f=>n(f),()=>n()),Oo(c,"clientHeight",r),Oo(c,"clientWidth",o),V(e,c),ne()}var df=ee('<div class="svelte-flow__viewport-back svelte-flow__container"></div> <!> <div class="svelte-flow__edge-labels svelte-flow__container"></div> <!> <!> <!> <div class="svelte-flow__viewport-front svelte-flow__container"></div>',1),ff=ee("<!> <!>",1),hf=ee("<!> <!> <!> <!> <!>",1);function gf(e,t){te(t,!0);let n=L(t,"paneClickDistance",3,1),o=L(t,"nodeClickDistance",3,1),r=L(t,"panOnScrollMode",19,()=>yt.Free),i=L(t,"preventScrolling",3,!0),s=L(t,"zoomOnScroll",3,!0),l=L(t,"zoomOnDoubleClick",3,!0),c=L(t,"zoomOnPinch",3,!0),d=L(t,"panOnScroll",3,!1),f=L(t,"panOnScrollSpeed",3,.5),h=L(t,"panOnDrag",3,!0),u=L(t,"selectionOnDrag",3,!1),y=L(t,"connectionLineType",19,()=>Ue.Bezier),v=L(t,"nodes",31,()=>At([])),p=L(t,"edges",31,()=>At([])),w=L(t,"viewport",15,void 0),k=Je(t,["$$slots","$$events","$$legacy","width","height","proOptions","selectionKey","deleteKey","panActivationKey","multiSelectionKey","zoomActivationKey","paneClickDistance","nodeClickDistance","onmovestart","onmoveend","onmove","oninit","onnodeclick","onnodecontextmenu","onnodedrag","onnodedragstart","onnodedragstop","onnodepointerenter","onnodepointermove","onnodepointerleave","onselectionclick","onselectioncontextmenu","onselectionstart","onselectionend","onedgeclick","onedgecontextmenu","onedgepointerenter","onedgepointerleave","onpaneclick","onpanecontextmenu","panOnScrollMode","preventScrolling","zoomOnScroll","zoomOnDoubleClick","zoomOnPinch","panOnScroll","panOnScrollSpeed","panOnDrag","selectionOnDrag","connectionLineComponent","connectionLineStyle","connectionLineContainerStyle","connectionLineType","attributionPosition","children","nodes","edges","viewport"]),N=Sd({props:k,width:t.width,height:t.height,get nodes(){return v()},set nodes(S){v(S)},get edges(){return p()},set edges(S){p(S)},get viewport(){return w()},set viewport(S){w(S)}});const P=ao(io);P&&P.setStore&&P.setStore(N),xr(io,{provider:!1,getStore(){return N}}),Xe(()=>{const S={nodes:N.selectedNodes,edges:N.selectedEdges};dt(()=>t.onselectionchange)?.(S);for(const D of N.selectionChangeHandlers.values())D(S)}),lo(()=>{N.reset()}),uf(e,{get colorMode(){return N.colorMode},get width(){return t.width},get height(){return t.height},get rest(){return k},get domNode(){return N.domNode},set domNode(S){N.domNode=S},get clientWidth(){return N.width},set clientWidth(S){N.width=S},get clientHeight(){return N.height},set clientHeight(S){N.height=S}
1,children:(S,D)=>{var I=hf(),R=ae(I);tf(R,{get selectionKey(){return t.selectionKey},get deleteKey(){return t.deleteKey},get panActivationKey(){return t.panActivationKey},get multiSelectionKey(){return t.multiSelectionKey},get zoomActivationKey(){return t.zoomActivationKey},get store(){return N},set store(_){N=_}});var T=W(R,2);Nd(T,{get panOnScrollMode(){return r()},get preventScrolling(){return i()},get zoomOnScroll(){return s()},get zoomOnDoubleClick(){return l()},get zoomOnPinch(){return c()},get panOnScroll(){return d()},get panOnScrollSpeed(){return f()},get panOnDrag(){return h()},get paneClickDistance(){return n()},get selectionOnDrag(){return u()},get onmovestart(){return t.onmovestart},get onmove(){return t.onmove},get onmoveend(){return t.onmoveend},get oninit(){return t.oninit},get store(){return N},set store(_){N=_},children:(_,C)=>{Md(_,{get onpaneclick(){return t.onpaneclick},get onpanecontextmenu(){return t.onpanecontextmenu},get onselectionstart(){return t.onselectionstart},get onselectionend(){return t.onselectionend},get panOnDrag(){return h()},get paneClickDistance(){return n()},get selectionOnDrag(){return u()},get store(){return N},set store(g){N=g},children:(g,x)=>{var b=ff(),M=ae(b);Id(M,{get store(){return N},set store(A){N=A},children:(A,H)=>{var B=df(),F=W(ae(B),2);Ud(F,{get onedgeclick(){return t.onedgeclick},get onedgecontextmenu(){return t.onedgecontextmenu},get onedgepointerenter(){return t.onedgepointerenter},get onedgepointerleave(){return t.onedgepointerleave},get store(){return N},set store(G){N=G}});var q=W(F,4);rf(q,{get type(){return y()},get LineComponent(){return t.connectionLineComponent},get containerStyle(){return t.connectionLineContainerStyle},get style(){return t.connectionLineStyle},get store(){return N},set store(G){N=G}});var Y=W(q,2);Vd(Y,{get nodeClickDistance(){return o()},get onnodeclick(){return t.onnodeclick},get onnodecontextmenu(){return t.onnodecontextmenu},get onnodepointerenter(){return t.onnodepointerenter},get onnodepointermove(){return t.onnodepointermove},get onnodepointerleave(){return t.onnodepointerleave},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return N},set store(G){N=G}});var oe=W(Y,2);jd(oe,{get onselectionclick(){return t.onselectionclick},get onselectioncontextmenu(){return t.onselectioncontextmenu},get onnodedrag(){return t.onnodedrag},get onnodedragstart(){return t.onnodedragstart},get onnodedragstop(){return t.onnodedragstop},get store(){return N},set store(G){N=G}}),_n(2),V(A,B)},$$slots:{default:!0}});var O=W(M,2);{let A=m(()=>!!(N.selectionRect&&N.selectionRectMode==="user")),H=m(()=>N.selectionRect?.width),B=m(()=>N.selectionRect?.height),F=m(()=>N.selectionRect?.x),q=m(()=>N.selectionRect?.y);zi(O,{get isVisible(){return a(A)},get width(){return a(H)},get height(){return a(B)},get x(){return a(F)},get y(){return a(q)}})}V(g,b)},$$slots:{default:!0}})},$$slots:{default:!0}});var K=W(T,2);lf(K,{get proOptions(){return t.proOptions},get position(){return t.attributionPosition}});var Q=W(K,2);Td(Q,{get store(){return N}});var E=W(Q,2);Ne(E,()=>t.children??St),V(S,I)},$$slots:{default:!0}}),ne()}var mf=ee("<button><!></button>");function nn(e,t){let n=Je(t,["$$slots","$$events","$$legacy","class","bgColor","bgColorHover","color","colorHover","borderColor","onclick","children"]);var o=mf();Qe(o,()=>({type:"button",onclick:t.onclick,class:["svelte-flow__controls-button",t.class],...n,[kn]:{"--xy-controls-button-background-color-props":t.bgColor,"--xy-controls-button-background-color-hover-props":t.bgColorHover,"--xy-controls-button-color-props":t.color,"--xy-controls-button-color-hover-props":t.colorHover,"--xy-controls-button-border-color-props":t.borderColor}}));var r=X(o);Ne(r,()=>t.children??St),Z(o),V(e,o)}var yf=me('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"></path></svg>');function vf(e){var t=yf();V(e,t)}var pf=me('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 5"><path d="M0 0h32v4.2H0z"></path></svg>');function wf(e){var t=pf();V(e,t)}var xf=me('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30"><path d="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"></path></svg>');function bf(e){var t=xf();V(e,t)}var _f=me('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"></path></svg>');function kf(e){var t=_f();V(e,t)}var Sf=me('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"></path></svg>');function Cf(e){var t=Sf();V(e,t)}var Ef=ee("<!> <!>",1),Nf=ee("<!> <!> <!> <!> <!> <!>",1);function Pf(e,t){te(t,!0);let n=L(t,"position",3,"bottom-left"),o=L(t,"orientation",3,"vertical"),r=L(t,"showZoom",3,!0),i=L(t,"showFitView",3,!0),s=L(t,"showLock",3,!0),l=Je(t,["$$slots","$$events","$$legacy","position","orientation","showZoom","showFitView","showLock","style","class","buttonBgColor","buttonBgColorHover","buttonColor","buttonColorHover","buttonBorderColor","fitViewOptions","children","before","after"]),c=m(qe);const d={bgColor:t.buttonBgColor,bgColorHover:t.buttonBgColorHover,color:t.buttonColor,colorHover:t.buttonColorHover,borderColor:t.buttonBorderColor};let f=m(()=>a(c).nodesDraggable||a(c).nodesConnectable||a(c).elementsSelectable),h=m(()=>
1a(c).viewport.zoom<=a(c).minZoom),u=m(()=>a(c).viewport.zoom>=a(c).maxZoom),y=m(()=>a(c).ariaLabelConfig),v=m(()=>o()==="horizontal"?"horizontal":"vertical");const p=()=>{a(c).zoomIn()},w=()=>{a(c).zoomOut()},k=()=>{a(c).fitView(t.fitViewOptions)},N=()=>{let P=!a(f);a(c).nodesDraggable=P,a(c).nodesConnectable=P,a(c).elementsSelectable=P};{let P=m(()=>["svelte-flow__controls",a(v),t.class]);Po(e,et({get class(){return a(P)},get position(){return n()},"data-testid":"svelte-flow__controls",get"aria-label"(){return a(y)["controls.ariaLabel"]},get style(){return t.style}},()=>l,{children:(S,D)=>{var I=Nf(),R=ae(I);{var T=A=>{var H=xe(),B=ae(H);Ne(B,()=>t.before),V(A,H)};le(R,A=>{t.before&&A(T)})}var K=W(R,2);{var Q=A=>{var H=Ef(),B=ae(H);nn(B,et({onclick:p,class:"svelte-flow__controls-zoomin",get title(){return a(y)["controls.zoomIn.ariaLabel"]},get"aria-label"(){return a(y)["controls.zoomIn.ariaLabel"]},get disabled(){return a(u)}},()=>d,{children:(q,Y)=>{vf(q)},$$slots:{default:!0}}));var F=W(B,2);nn(F,et({onclick:w,class:"svelte-flow__controls-zoomout",get title(){return a(y)["controls.zoomOut.ariaLabel"]},get"aria-label"(){return a(y)["controls.zoomOut.ariaLabel"]},get disabled(){return a(h)}},()=>d,{children:(q,Y)=>{wf(q)},$$slots:{default:!0}})),V(A,H)};le(K,A=>{r()&&A(Q)})}var E=W(K,2);{var _=A=>{nn(A,et({class:"svelte-flow__controls-fitview",onclick:k,get title(){return a(y)["controls.fitView.ariaLabel"]},get"aria-label"(){return a(y)["controls.fitView.ariaLabel"]}},()=>d,{children:(H,B)=>{bf(H)},$$slots:{default:!0}}))};le(E,A=>{i()&&A(_)})}var C=W(E,2);{var g=A=>{nn(A,et({class:"svelte-flow__controls-interactive",onclick:N,get title(){return a(y)["controls.interactive.ariaLabel"]},get"aria-label"(){return a(y)["controls.interactive.ariaLabel"]}},()=>d,{children:(H,B)=>{var F=xe(),q=ae(F);{var Y=G=>{Cf(G)},oe=G=>{kf(G)};le(q,G=>{a(f)?G(Y):G(oe,-1)})}V(H,F)},$$slots:{default:!0}}))};le(C,A=>{s()&&A(g)})}var x=W(C,2);{var b=A=>{var H=xe(),B=ae(H);Ne(B,()=>t.children),V(A,H)};le(x,A=>{t.children&&A(b)})}var M=W(x,2);{var O=A=>{var H=xe(),B=ae(H);Ne(B,()=>t.after),V(A,H)};le(M,A=>{t.after&&A(O)})}V(S,I)},$$slots:{default:!0}}))}ne()}var Ye;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Ye||(Ye={}));var Mf=me("<circle></circle>");function zf(e,t){var n=Mf();ie(()=>{J(n,"cx",t.radius),J(n,"cy",t.radius),J(n,"r",t.radius),We(n,0,lt(["svelte-flow__background-pattern","dots",t.class]))}),V(e,n)}var If=me("<path></path>");function Df(e,t){te(t,!0);var n=If();ie(()=>{J(n,"stroke-width",t.lineWidth),J(n,"d",`M${t.dimensions[0]/2} 0 V${t.dimensions[1]} M0 ${t.dimensions[1]/2} H${t.dimensions[0]}`),We(n,0,lt(["svelte-flow__background-pattern",t.variant,t.class]))}),V(e,n),ne()}const Af={[Ye.Dots]:1,[Ye.Lines]:1,[Ye.Cross]:6};var Tf=me('<svg data-testid="svelte-flow__background"><pattern patternUnits="userSpaceOnUse"><!></pattern><rect x="0" y="0" width="100%" height="100%"></rect></svg>');function Of(e,t){te(t,!0);let n=L(t,"variant",19,()=>Ye.Dots),o=L(t,"gap",3,20),r=L(t,"lineWidth",3,1),i=m(qe),s=m(()=>n()===Ye.Dots),l=m(()=>n()===Ye.Cross),c=m(()=>Array.isArray(o())?o():[o(),o()]),d=m(()=>`background-pattern-${a(i).flowId}-${t.id??""}`),f=m(()=>[a(c)[0]*a(i).viewport.zoom||1,a(c)[1]*a(i).viewport.zoom||1]),h=m(()=>(t.size??Af[n()])*a(i).viewport.zoom),u=m(()=>a(l)?[a(h),a(h)]:a(f)),y=m(()=>a(s)?[a(h)/2,a(h)/2]:[a(u)[0]/2,a(u)[1]/2]);var v=Tf();let p;var w=X(v),k=X(w);{var N=D=>{{let I=m(()=>a(h)/2);zf(D,{get radius(){return a(I)},get class(){return t.patternClass}})}},P=D=>{Df(D,{get dimensions(){return a(u)},get variant(){return n()},get lineWidth(){return r()},get class(){return t.patternClass}})};le(k,D=>{a(s)?D(N):D(P,-1)})}Z(w);var S=W(w);Z(v),ie(()=>{We(v,0,lt(["svelte-flow__background","svelte-flow__container",t.class])),p=Pe(v,"",p,{"--xy-background-color-props":t.bgColor,"--xy-background-pattern-color-props":t.patternColor}),J(w,"id",a(d)),J(w,"x",a(i).viewport.x%a(f)[0]),J(w,"y",a(i).viewport.y%a(f)[1]),J(w,"width",a(f)[0]),J(w,"height",a(f)[1]),J(w,"patternTransform",`translate(-${a(y)[0]},-${a(y)[1]})`),J(S,"fill",`url(#${a(d)})`)}),V(e,v),ne()}function Hf(e){const t=m(qe),n=m(()=>a(t).nodeLookup),o=m(()=>a(t).nodes),r=m(()=>(a(o),a(n).get(e)));return{get current(){return a(r)}}}var Rf=me("<rect></rect>");function Lf(e,t){te(t,!0);let n=L(t,"borderRadius",3,5),o=L(t,"strokeWidth",3,2),r=m(()=>Hf(t.id)),i=m(()=>{if(!a(r).current)return{width:0,height:0,x:0,y:0};const{width:v,height:p}=je(a(r).current);return{width:t.width??v,height:t.height??p,x:t.x??a(r).current.internals.positionAbsolute.x,y:t.y??a(r).current.internals.positionAbsolute.y}}),s=m(()=>a(i).width),l=m(()=>a(i).height),c=m(()=>a(i).x),d=m(()=>a(i).y);var f=xe(),h=ae(f);{var u=v=>{const p=m(()=>t.nodeComponent);var w=xe(),k=ae(w);Sn(k,()=>a(p),(N,P)=>{P(N,{get id(){return t.id},get x(){return a(c)},get y(){return a(d)},get width(){return a(s)},get height(){return a(l)},get borderRadius(){return n()},get class(){return t.class},get color(){return t.color},get shapeRendering(){return t.shapeRendering},get strokeColor(){return t.strokeColor},get strokeWidth(){return o()},get selected(){return t.selected}})}),V(v,w)},y=v=>{var p=Rf();let w,k;ie(()=>{w=We(p,0,lt(["svelte-flow__minimap-node",t.class]),null,w,{selected:t.selected}
1),J(p,"x",a(c)),J(p,"y",a(d)),J(p,"rx",n()),J(p,"ry",n()),J(p,"width",a(s)),J(p,"height",a(l)),J(p,"shape-rendering",t.shapeRendering),k=Pe(p,"",k,{fill:t.color,stroke:t.strokeColor,"stroke-width":o()})}),V(v,p)};le(h,v=>{t.nodeComponent?v(u):v(y,-1)})}V(e,f),ne()}function Vf(e,t){const n=Yu({domNode:e,panZoom:t.panZoom,getTransform:()=>{const{viewport:r}=t.store;return[r.x,r.y,r.zoom]},getViewScale:t.getViewScale});n.update({translateExtent:t.translateExtent,width:t.width,height:t.height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:t.pannable,zoomable:t.zoomable});function o(r){n.update({translateExtent:r.translateExtent,width:r.width,height:r.height,inversePan:r.inversePan,zoomStep:r.zoomStep,pannable:r.pannable,zoomable:r.zoomable})}return{update:o,destroy(){n.destroy()}}}const Fn=e=>e instanceof Function?e:()=>e;var Bf=me("<title> </title>"),Kf=me('<svg class="svelte-flow__minimap-svg" role="img"><!><!><path class="svelte-flow__minimap-mask" fill-rule="evenodd" pointer-events="none"></path></svg>'),Zf=ee('<svelte-css-wrapper style="display: contents"><!></svelte-css-wrapper>',1);function Yf(e,t){te(t,!0);let n=L(t,"position",3,"bottom-right"),o=L(t,"nodeStrokeColor",3,"transparent"),r=L(t,"nodeClass",3,""),i=L(t,"nodeBorderRadius",3,5),s=L(t,"nodeStrokeWidth",3,2),l=L(t,"width",3,200),c=L(t,"height",3,150),d=L(t,"pannable",3,!0),f=L(t,"zoomable",3,!0),h=Je(t,["$$slots","$$events","$$legacy","position","ariaLabel","nodeStrokeColor","nodeColor","nodeClass","nodeBorderRadius","nodeStrokeWidth","nodeComponent","bgColor","maskColor","maskStrokeColor","maskStrokeWidth","width","height","pannable","zoomable","inversePan","zoomStep","class"]),u=m(qe),y=m(()=>a(u).ariaLabelConfig);const v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";let p=m(()=>`svelte-flow__minimap-desc-${a(u).flowId}`),w=m(()=>({x:-a(u).viewport.x/a(u).viewport.zoom,y:-a(u).viewport.y/a(u).viewport.zoom,width:a(u).width/a(u).viewport.zoom,height:a(u).height/a(u).viewport.zoom})),k=m(()=>ii(qt(a(u).nodeLookup,{filter:x=>!x.hidden}),a(w))),N=m(()=>a(k).width/l()),P=m(()=>a(k).height/c()),S=m(()=>Math.max(a(N),a(P))),D=m(()=>a(S)*l()),I=m(()=>a(S)*c()),R=m(()=>5*a(S)),T=m(()=>a(k).x-(a(D)-a(k).width)/2-a(R)),K=m(()=>a(k).y-(a(I)-a(k).height)/2-a(R)),Q=m(()=>a(D)+a(R)*2),E=m(()=>a(I)+a(R)*2);const _=()=>a(S);var C=Zf(),g=ae(C);{let x=m(()=>["svelte-flow__minimap",t.class]);hs(g,()=>({"--xy-minimap-background-color-props":t.bgColor})),Po(g.lastChild,et({get position(){return n()},get class(){return a(x)},"data-testid":"svelte-flow__minimap"},()=>h,{children:(b,M)=>{var O=xe(),A=ae(O);{var H=B=>{var F=Kf();let q;var Y=X(F);{var oe=U=>{var re=Bf(),he=X(re,!0);Z(re),ie(()=>{J(re,"id",a(p)),fe(he,t.ariaLabel??a(y)["minimap.ariaLabel"])}),V(U,re)};le(Y,U=>{(t.ariaLabel??a(y)["minimap.ariaLabel"])&&U(oe)})}var G=W(Y);Ct(G,17,()=>a(u).nodes,U=>U.id,(U,re)=>{const he=m(()=>a(u).nodeLookup.get(a(re).id));var se=xe(),ve=ae(se);{var de=Ae=>{{let Ge=m(()=>t.nodeColor===void 0?void 0:Fn(t.nodeColor)(a(re))),$e=m(()=>Fn(o())(a(re))),ce=m(()=>Fn(r())(a(re)));Lf(Ae,{get id(){return a(he).id},get selected(){return a(he).selected},get nodeComponent(){return t.nodeComponent},get color(){return a(Ge)},get borderRadius(){return i()},get strokeColor(){return a($e)},get strokeWidth(){return s()},get shapeRendering(){return v},get class(){return a(ce)}})}},ke=m(()=>a(he)&&si(a(he))&&!a(he).hidden);le(ve,Ae=>{a(ke)&&Ae(de)})}V(U,se)});var j=W(G);Z(F),we(F,(U,re)=>Vf?.(U,re),()=>({store:a(u),panZoom:a(u).panZoom,getViewScale:_,translateExtent:a(u).translateExtent,width:a(u).width,height:a(u).height,inversePan:t.inversePan,zoomStep:t.zoomStep,pannable:d(),zoomable:f()})),ie(()=>{J(F,"width",l()),J(F,"height",c()),J(F,"viewBox",`${a(T)??""} ${a(K)??""} ${a(Q)??""} ${a(E)??""}`),J(F,"aria-labelledby",a(p)),q=Pe(F,"",q,{"--xy-minimap-mask-background-color-props":t.maskColor,"--xy-minimap-mask-stroke-color-props":t.maskStrokeColor,"--xy-minimap-mask-stroke-width-props":t.maskStrokeWidth?t.maskStrokeWidth*a(S):void 0}),J(j,"d",`M${a(T)-a(R)},${a(K)-a(R)}h${a(Q)+a(R)*2}v${a(E)+a(R)*2}h${-a(Q)-a(R)*2}z 2 M${a(w).x??""},${a(w).y??""}h${a(w).width??""}v${a(w).height??""}h${-a(w).width}z`)}),V(B,F)};le(A,B=>{a(u).panZoom&&B(H)})}V(b,O)},$$slots:{default:!0}}
2)),Z(g)}V(e,C),ne()}const Ii=[{id:"say",titleKey:"demo_builder_node_say_title",descKey:"demo_builder_node_say_desc",iconName:"MessageSquare",toolName:null,inputs:[{key:"text",label:"Text",type:"textarea",placeholder:"What to say"}]},{id:"web_search",titleKey:"demo_builder_node_websearch_title",descKey:"demo_builder_node_websearch_desc",iconName:"Globe",toolName:"web_search",inputs:[{key:"q",label:"Query",type:"text",placeholder:"latency benchmarks 2026"}]},{id:"doc_render",titleKey:"demo_builder_node_doc_title",descKey:"demo_builder_node_doc_desc",iconName:"FileText",toolName:"doc_render",inputs:[{key:"title",label:"Title",type:"text"},{key:"bullets",label:"Bullets (one per line)",type:"textarea"}]},{id:"ticket_classify",titleKey:"demo_builder_node_classify_title",descKey:"demo_builder_node_classify_desc",iconName:"Brain",toolName:"ticket_classify",inputs:[{key:"text",label:"Ticket text",type:"textarea"}]}];function Tn(e){return Ii.find(t=>t.id===e)}var Xf=ee('<code class="mt-1 block text-xs opacity-70"> </code>'),Ff=ee('<div><div class="flex items-center gap-2 font-pixel text-sm"><!> <span> </span></div> <!> <!> <!></div>');function Wf(e,t){te(t,!0);const n=m(()=>t.data??{}),o=m(()=>Tn(a(n).kindId)),r=m(()=>a(o)?Wn[a(o).titleKey]?.()??a(o).id:"?");var i=Ff();let s;var l=X(i),c=X(l);{let p=m(()=>a(o)?.iconName??"Circle");ft(c,{get icon(){return a(p)},size:"sm"})}var d=W(c,2),f=X(d,!0);Z(d),Z(l);var h=W(l,2);{var u=p=>{var w=Xf(),k=X(w,!0);Z(w),ie(()=>fe(k,a(o).toolName)),V(p,w)};le(h,p=>{a(o)?.toolName&&p(u)})}var y=W(h,2);kt(y,{type:"target",get position(){return $.Left}});var v=W(y,2);kt(v,{type:"source",get position(){return $.Right}}),Z(i),ie(()=>{s=We(i,1,"card-pixel min-w-[180px] p-3",null,s,{"card-pixel-primary":t.selected}),fe(f,a(r))}),V(e,i),ne()}var qf=ee("<!> <!> <!>",1),Gf=ee('<div class="h-[600px] border-2 border-foreground" role="application" aria-label="Builder canvas"><!></div>');function Uf(e,t){te(t,!0);let n=L(t,"builder",7);const o={pixel:Wf},r="stroke: hsl(var(--foreground)); stroke-width: 2;";function i(u){!u.source||!u.target||(n().edges=[...n().edges,{id:crypto.randomUUID(),type:"straight",source:u.source,target:u.target,style:r,sourceHandle:u.sourceHandle,targetHandle:u.targetHandle}])}function s(u){u.preventDefault(),u.dataTransfer&&(u.dataTransfer.dropEffect="move")}function l(u){u.preventDefault();const y=u.dataTransfer?.getData("application/yanok-node-kind");if(!y)return;const v=u.currentTarget.getBoundingClientRect(),p=n().addNode(y,{x:u.clientX-v.left-80,y:u.clientY-v.top-30});n().select(p)}function c({node:u}){n().select(u.id)}function d(){n().select(null)}var f=Gf(),h=X(f);gf(h,{get nodeTypes(){return o},fitView:!0,onconnect:i,onnodeclick:c,onpaneclick:d,get nodes(){return n().nodes},set nodes(u){n().nodes=u},get edges(){return n().edges},set edges(u){n().edges=u},children:(u,y)=>{var v=qf(),p=ae(v);Of(p,{get variant(){return Ye.Dots}});var w=W(p,2);Yf(w,{});var k=W(w,2);Pf(k,{}),V(u,v)},$$slots:{default:!0}}),Z(f),ot("dragover",f,s),ot("drop",f,l),V(e,f),ne()}var Qf=ee('<button type="button" class="card-pixel cursor-grab p-3 text-left active:cursor-grabbing" draggable="true"><div class="flex items-center gap-2 font-pixel text-sm"><!> <span> </span></div> <p class="mt-1 text-xs opacity-70"> </p></button>'),Jf=ee('<aside class="grid gap-2 p-3"><h2 class="font-pixel text-sm"> </h2> <!></aside>');function jf(e,t){te(t,!0);const n=m(()=>Ii.map(c=>({...c,title:Wn[c.titleKey]?.()??c.id,description:Wn[c.descKey]?.()??""})));function o(c,d){c.dataTransfer?.setData("application/yanok-node-kind",d),c.dataTransfer&&(c.dataTransfer.effectAllowed="move")}var r=Jf(),i=X(r),s=X(i,!0);Z(i);var l=W(i,2);Ct(l,17,()=>a(n),c=>c.id,(c,d)=>{var f=Qf(),h=X(f),u=X(h);ft(u,{get icon(){return a(d).iconName},size:"sm"});var y=W(u,2),v=X(y,!0);Z(y),Z(h);var p=W(h,2),w=X(p,!0);Z(p),Z(f),ie(()=>{J(f,"aria-label",a(d).title),fe(v,a(d).title),fe(w,a(d).description)}),ot("dragstart",f,k=>o(k,a(d).id)),V(c,f)}),Z(r),ie((c,d)=>{J(r,"aria-label",c),fe(s,d)},[()=>Io(),()=>Io()]),V(e,r),ne()}var $f=ee('<p class="text-sm opacity-70"> </p>'),eh=ee('<textarea class="border-2 border-foreground bg-background p-2 text-sm" rows="3"></textarea>'),th=ee('<input type="text" class="border-2 border-foreground bg-background p-2 text-sm"/>'),nh=ee('<label class="grid gap-1 text-sm"><span class="font-pixel text-xs opacity-70"> </span> <!></label>'),oh=ee('<div class="grid gap-3"></div>'),rh=ee('<aside class="card-pixel h-full p-4"><h2 class="mb-3 font-pixel text-sm"> </h2> <!></aside>');function ih(e,t){te(t,!0);const n=m(()=>t.builder.nodes.find(h=>h.id===t.builder.selectedId)??null),o=m(()=>a(n)?Tn(a(n).data.kindId):null);function r(h,u){a(n)&&t.builder.setInputs(a(n).id,{[h]:u})}var i=rh(),s=X(i),l=X(s,!0);Z(s);var c=W(s,2);{var d=h=>{var u=$f(),y=X(u,!0);Z(u),ie(v=>fe(y,v),[()=>Gi()]),V(h,u)},f=h=>{var u=oh();Ct(u,21,()=>a(o).inputs,y=>y.key,(y,v)=>{var p=nh(),w=X(p),k=X(w,!0);Z(w);var N=W(w,2);{var P=D=>{var I=eh();Xi(I),ie(()=>{J(I,"placeholder",a(v).placeholder),zo(I,a(n).data.inputs[a(v).key]??"")}),be("input",I,R=>
2r(a(v).key,R.currentTarget.value)),V(D,I)},S=D=>{var I=th();qi(I),ie(()=>{J(I,"placeholder",a(v).placeholder),zo(I,a(n).data.inputs[a(v).key]??"")}),be("input",I,R=>r(a(v).key,R.currentTarget.value)),V(D,I)};le(N,D=>{a(v).type==="textarea"?D(P):D(S,-1)})}Z(p),ie(()=>fe(k,a(v).label)),V(y,p)}),Z(u),V(h,u)};le(c,h=>{!a(n)||!a(o)?h(d):h(f,-1)})}Z(i),ie((h,u)=>{J(i,"aria-label",h),fe(l,u)},[()=>Do(),()=>Do()]),V(e,i),ne()}Zt(["input"]);var sh=ee('<!> <!> <div class="grid gap-4 md:grid-cols-2"><!> <!></div>',1),ah=ee('<dialog open="" class="fixed inset-0 z-50 h-full w-full bg-background/95 p-4" aria-modal="true"><div class="mx-auto grid max-w-4xl gap-4"><header class="flex items-center"><h2 class="font-pixel text-lg"> </h2> <button type="button" class="btn-pixel-outline ml-auto">Close</button></header> <!></div></dialog>');function lh(e,t){te(t,!0);let n=ue(At(Ao(t.template)));Xe(()=>{const v=Ao(t.template);return a(n).destroy(),z(n,v,!0),()=>v.destroy()});const o=m(()=>a(n).template.steps[a(n).currentStepIndex]??null),r=m(()=>a(o)?a(n).stepStatus(a(o).id):"idle");var i=ah(),s=X(i),l=X(s),c=X(l),d=X(c,!0);Z(c);var f=W(c,2);Z(l);var h=W(l,2);{var u=v=>{var p=sh(),w=ae(p);Ui(w,{get template(){return t.template},get currentStepIndex(){return a(n).currentStepIndex},statusOf:D=>a(n).stepStatus(D)});var k=W(w,2);Qi(k,{get state(){return a(n).state},get speed(){return a(n).speed},onPlay:()=>a(n).play(),onPause:()=>a(n).pause(),onRestart:()=>a(n).restart(),onPrev:()=>a(n).prev(),onNext:()=>a(n).next(),onSkip:()=>a(n).skipToEnd(),onSpeed:D=>a(n).setSpeed(D)});var N=W(k,2),P=X(N);Ji(P,{get step(){return a(o)},get status(){return a(r)}});var S=W(P,2);{let D=m(()=>a(n).state==="playing"||a(r)==="running");ji(S,{get chunks(){return a(o).chunks},get playing(){return a(D)},reduceMotion:!1})}Z(N),V(v,p)},y=v=>{$i(v,{})};le(h,v=>{t.mode==="preview"&&a(o)?v(u):t.mode==="live"&&v(y,1)})}Z(s),Z(i),ie(v=>fe(d,v),[()=>t.mode==="preview"?_r():kr()]),be("click",f,function(...v){t.onClose?.apply(this,v)}),V(e,i),ne()}Zt(["click"]);var ch=ee('<span class="ml-auto text-xs opacity-80"> </span>'),uh=ee('<header class="flex flex-wrap items-center gap-2 border-b-2 border-foreground p-3"><button class="btn-pixel"><!> <span> </span></button> <button class="btn-pixel-outline"><!> <span> </span></button> <button class="btn-pixel-outline"><!> <span> </span></button> <button class="btn-pixel-outline"><!> <span> </span></button> <!></header> <!>',1);function dh(e,t){te(t,!0);let n=ue(null),o=ue("preview"),r=ue(null);function i(C){z(r,null);try{const g=t.builder.toTemplate();if(g.steps.length===0){z(r,ns(),!0);return}z(n,g,!0),z(o,C,!0)}catch(g){z(r,g instanceof Error?g.message:"unknown",!0)}}async function s(){try{const C=t.builder.toShareHash(),g=`${window.location.origin}/demo/builder?w=${C}`;await navigator.clipboard.writeText(g),z(r,os(),!0)}catch{z(r,rs(),!0)}}var l=uh(),c=ae(l),d=X(c),f=X(d);ft(f,{icon:"Play",size:"sm"});var h=W(f,2),u=X(h,!0);Z(h),Z(d);var y=W(d,2),v=X(y);ft(v,{icon:"Bot",size:"sm"});var p=W(v,2),w=X(p,!0);Z(p),Z(y);var k=W(y,2),N=X(k);ft(N,{icon:"GitBranch",size:"sm"});var P=W(N,2),S=X(P,!0);Z(P),Z(k);var D=W(k,2),I=X(D);ft(I,{icon:"RefreshCw",size:"sm"});var R=W(I,2),T=X(R,!0);Z(R),Z(D);var K=W(D,2);{var Q=C=>{var g=ch(),x=X(g,!0);Z(g),ie(()=>fe(x,a(r))),V(C,g)};le(K,C=>{a(r)&&C(Q)})}Z(c);var E=W(c,2);{var _=C=>
2{lh(C,{get template(){return a(n)},get mode(){return a(o)},onClose:()=>z(n,null)})};le(E,C=>{a(n)&&C(_)})}ie((C,g,x,b)=>{fe(u,C),fe(w,g),fe(S,x),fe(T,b)},[()=>_r(),()=>kr(),()=>es(),()=>ts()]),be("click",d,()=>i("preview")),be("click",y,()=>i("live")),be("click",k,s),be("click",D,()=>t.builder.clear()),V(e,l),ne()}Zt(["click"]);function so(){return crypto.randomUUID()}function fh(e){const t=new TextEncoder().encode(e);let n="";for(const o of t)n+=String.fromCharCode(o);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function hh(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),n=t+"=".repeat((4-t.length%4)%4),o=atob(n),r=Uint8Array.from(o,i=>i.charCodeAt(0));return new TextDecoder().decode(r)}function gh(e,t){const n=Tn(e);return n?n.toolName===null?[{kind:"text",value:t.text??"",delayMs:20}]:[{kind:"text",value:`Calling ${n.toolName}â¦`,delayMs:150},{kind:"tool",delayMs:300,value:{id:`preview_${so()}`,name:n.toolName,status:"success",input:t,output:{previewOnly:!0},durationMs:300}}]:[]}function mh(e,t){if(e.length===0)return[];const n={},o={},r={},i={};for(const d of e)n[d.id]=d,o[d.id]=0,r[d.id]=[],i[d.id]=!1;for(const d of t){if(!n[d.source]||!n[d.target])throw new Error("builder_edge_unknown_node");if(r[d.source].push(d.target),o[d.target]+=1,o[d.target]>1)throw new Error("builder_not_linear_merge")}const s=e.filter(d=>o[d.id]===0);if(s.length!==1)throw new Error("builder_not_linear_root");const l=[];let c=s[0];for(;c;){if(i[c.id])throw new Error("builder_cycle");i[c.id]=!0,l.push(c);const d=r[c.id]??[];if(d.length>1)throw new Error("builder_not_linear_branch");c=d.length===1?n[d[0]]:void 0}if(l.length!==e.length)throw new Error("builder_disconnected_or_cycle");return l}function yh(){let e=ue(At([])),t=ue(At([])),n=ue(null);return{get nodes(){return a(e)},set nodes(o){z(e,o,!0)},get edges(){return a(t)},set edges(o){z(t,o,!0)},get selectedId(){return a(n)},set selectedId(o){z(n,o,!0)},addNode(o,r){const i=so();return z(e,[...a(e),{id:i,type:"pixel",position:r,data:{kindId:o,inputs:{}},selected:!1}],!0),i},removeNode(o){z(e,a(e).filter(r=>r.id!==o),!0),z(t,a(t).filter(r=>r.source!==o&&r.target!==o),!0),a(n)===o&&z(n,null)},moveNode(o,r){z(e,a(e).map(i=>i.id===o?{...i,position:r}:i),!0)},setInputs(o,r){z(e,a(e).map(i=>i.id===o?{...i,data:{...i.data,inputs:{...i.data.inputs,...r}}}:i),!0)},addEdge(o,r){const i=so();return z(t,[...a(t),{id:i,source:o,target:r,type:"straight"}],!0),i},removeEdge(o){z(t,a(t).filter(r=>r.id!==o),!0)},select(o){z(n,o,!0),z(e,a(e).map(r=>({...r,selected:r.id===o})),!0)},clear(){z(e,[],!0),z(t,[],!0),z(n,null)},toTemplate(){return{id:"builder_custom",slug:"builder_custom",titleKey:"demo_builder_custom_title",descriptionKey:"demo_builder_custom_desc",iconName:"Workflow",steps:mh(a(e),a(t)).map((i,s)=>{const l=Tn(i.data.kindId);return{id:i.id,label:l?.toolName??l?.id??`step_${s+1}`,iconName:l?.iconName??"Circle",chunks:gh(i.data.kindId,i.data.inputs),inputs:i.data.inputs,outputs:{},durationMs:600}})}},toShareHash(){const o={v:1,nodes:a(e),edges:a(t)};return`v1${fh(JSON.stringify(o))}`},fromShareHash(o){if(!o.startsWith("v1"))throw new Error("builder_hash_bad_version");const r=hh(o.slice(2)),i=JSON.parse(r);if(i.v!==1)throw new Error("builder_hash_bad_version");if(!Array.isArray(i.nodes)||!Array.isArray(i.edges))throw new Error("builder_hash_bad_payload");z(e,i.nodes,!0),z(t,i.edges,!0),z(n,null)}}}var vh=ee('<section class="py-10"><header class="mb-6 text-center"><h1 class="font-pixel text-3xl md:text-5xl"> </h1> <p class="mx-auto mt-3 max-w-2xl opacity-80"> </p></header> <!> <div class="mt-3 grid grid-cols-12 gap-3"><div class="col-span-12 md:col-span-3"><!></div> <div class="col-span-12 md:col-span-6"><!></div> <div class="col-span-12 md:col-span-3"><!></div></div></section>'),ph=ee("<!> <!> <!>",1);function Vh(e,t){te(t,!0);const n=yh();Xe(()=>{const l=vs.url.searchParams.get("w");if(!l){n.clear();return}try{n.fromShareHash(l)}catch{n.clear()}});var o=ph(),r=ae(o);{let l=m(()=>On()),c=m(()=>To());ls(r,{get title(){return a(l)},get description(){return a(c)},canonicalPath:"/demo/builder"})}var i=W(r,2);{let l=m(()=>[{name:as(),url:"https://www.yanok.ai/"},{name:is(),url:"https://www.yanok.ai/demo"},{name:On(),url:"https://www.yanok.ai/demo/builder"}]);ss(i,{get items(){return a(l)}})}var s=W(i,2);cs(s,{children:(l,c)=>{var d=vh(),f=X(d),h=X(f),u=X(h,!0);Z(h);var y=W(h,2),v=X(y,!0);Z(y),Z(f);var p=W(f,2);dh(p,{get builder(){return n}});var w=W(p,2),k=X(w),N=X(k);jf(N,{}),Z(k);var P=W(k,2),S=X(P);Uf(S,{get builder(){return n}}),Z(P);var D=W(P,2),I=X(D);ih(I,{get builder(){return n}}),Z(D),Z(w),Z(d),ie((R,T)=>{fe(u,R),fe(v,T)},[()=>On(),()=>To()]),V(l,d)},$$slots:{default:!0}}),V(e,o),ne()}
2export{Vh as component,Lh as universal};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.