| 1234567891011121314151617181920212223242526272829 |
- import{af as e,$ as t,bE as n,M as o,bt as i,aI as r,aL as a,u as l,I as u,bJ as s,aY as c,bk as d,aw as h,au as f,q as v,a0 as p,a1 as g,aG as m,ay as y,aD as w,v as _,F as b,aX as x,as as E,az as S,ag as k,s as N,t as M,aU as C,b7 as I,bf as $,bb as A,x as P,aS as T,ak as z,bg as D,J as O,aO as B,a5 as R,bh as V,ao as L,aT as H,aZ as Y,bl as X,ar as G,a$ as F,H as U,bF as j,av as Z}from"./@vue.DbmRtknU.js";function q(e){return!!g()&&(m(e),!0)}function W(e){return"function"==typeof e?e():d(e)}const K="undefined"!=typeof window&&"undefined"!=typeof document,J=Object.prototype.toString,Q=()=>{};const ee=e=>e();function te(e,t=!1,n="Timeout"){return new Promise((o,i)=>{t?setTimeout(()=>i(n),e):setTimeout(o,e)})}function ne(e,t,o={}){const{eventFilter:i=ee,...r}=o;return n(e,(a=i,l=t,function(...e){return new Promise((t,n)=>{Promise.resolve(a(()=>l.apply(this,e),{fn:l,thisArg:this,args:e})).then(t).catch(n)})}),r);var a,l}function oe(e,t,n={}){const{eventFilter:o,...i}=n,{eventFilter:r,pause:a,resume:l,isActive:u}=function(e=ee){const t=C(!0);return{isActive:H(t),pause:function(){t.value=!1},resume:function(){t.value=!0},eventFilter:(...n)=>{t.value&&e(...n)}}}(o);return{stop:ne(e,t,{...i,eventFilter:r}),pause:a,resume:l,isActive:u}}function ie(e,t={}){if(!z(e))return D(e);const n=Array.isArray(e.value)?Array.from({length:e.value.length}):{};for(const o in e.value)n[o]=O(()=>({get:()=>e.value[o],set(n){var i;if(null==(i=W(t.replaceRef))||i)if(Array.isArray(e.value)){const t=[...e.value];t[o]=n,e.value=t}else{const t={...e.value,[o]:n};Object.setPrototypeOf(t,Object.getPrototypeOf(e.value)),e.value=t}else e.value[o]=n}}));return n}function re(e,t=!1){function o(o,{flush:i="sync",deep:r=!1,timeout:a,throwOnTimeout:l}={}){let u=null;const s=[new Promise(a=>{u=n(e,e=>{o(e)!==t&&(null==u||u(),a(e))},{flush:i,deep:r,immediate:!0})})];return null!=a&&s.push(te(a,l).then(()=>W(e)).finally(()=>null==u?void 0:u())),Promise.race(s)}function i(i,r){if(!z(i))return o(e=>e===i,r);const{flush:a="sync",deep:l=!1,timeout:u,throwOnTimeout:s}=null!=r?r:{};let c=null;const d=[new Promise(o=>{c=n([e,i],([e,n])=>{t!==(e===n)&&(null==c||c(),o(e))},{flush:a,deep:l,immediate:!0})})];return null!=u&&d.push(te(u,s).then(()=>W(e)).finally(()=>(null==c||c(),W(e)))),Promise.race(d)}function r(e){return a(1,e)}function a(e=1,t){let n=-1;return o(()=>(n+=1,n>=e),t)}if(Array.isArray(W(e))){return{toMatch:o,toContains:function(e,t){return o(t=>{const n=Array.from(t);return n.includes(e)||n.includes(W(e))},t)},changed:r,changedTimes:a,get not(){return re(e,!t)}}}return{toMatch:o,toBe:i,toBeTruthy:function(e){return o(e=>Boolean(e),e)},toBeNull:function(e){return i(null,e)},toBeNaN:function(e){return o(Number.isNaN,e)},toBeUndefined:function(e){return i(void 0,e)},changed:r,changedTimes:a,get not(){return re(e,!t)}}}function ae(e){return re(e)}function le(e){var t;const n=W(e);return null!=(t=null==n?void 0:n.$el)?t:n}const ue=K?window:void 0;function se(...e){let t,o,i,r;if("string"==typeof e[0]||Array.isArray(e[0])?([o,i,r]=e,t=ue):[t,o,i,r]=e,!t)return Q;Array.isArray(o)||(o=[o]),Array.isArray(i)||(i=[i]);const a=[],l=()=>{a.forEach(e=>e()),a.length=0},u=n(()=>[le(t),W(r)],([e,t])=>{if(l(),!e)return;const n=(r=t,"[object Object]"===J.call(r)?{...t}:t);var r;a.push(...o.flatMap(t=>i.map(o=>((e,t,n,o)=>(e.addEventListener(t,n,o),()=>e.removeEventListener(t,n,o)))(e,t,o,n))))},{immediate:!0,flush:"post"}),s=()=>{u(),l()};return q(s),s}function ce(...e){let t,n,o={};3===e.length?(t=e[0],n=e[1],o=e[2]):2===e.length?"object"==typeof e[1]?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:i=ue,eventName:r="keydown",passive:a=!1,dedupe:l=!1}=o,u="function"==typeof(s=t)?s:"string"==typeof s?e=>e.key===s:Array.isArray(s)?e=>s.includes(e.key):()=>!0;var s;return se(i,r,e=>{e.repeat&&W(l)||u(e)&&n(e)},a)}function de(e,t,o,i={}){var r,a,l;const{clone:u=!1,passive:s=!1,eventName:c,deep:d=!1,defaultValue:h,shouldEmit:f}=i,g=p(),m=o||(null==g?void 0:g.emit)||(null==(r=null==g?void 0:g.$emit)?void 0:r.bind(g))||(null==(l=null==(a=null==g?void 0:g.proxy)?void 0:a.$emit)?void 0:l.bind(null==g?void 0:g.proxy));let y=c;t||(t="modelValue"),y=y||`update:${t.toString()}`;const w=e=>{return u?"function"==typeof u?u(e):(t=e,JSON.parse(JSON.stringify(t))):e;var t},_=()=>void 0!==e[t]?w(e[t]):h,b=e=>{f?f(e)&&m(y,e):m(y,e)};if(s){const o=_(),i=C(o);let r=!1;return n(()=>e[t],e=>{r||(r=!0,i.value=w(e),E(()=>r=!1))}),n(i,n=>{r||n===e[t]&&!d||b(n)},{deep:d}),i}return v({get:()=>_(),set(e){b(e)}})}var he={value:()=>{}};function fe(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new ve(o)}function ve(e){this._=e}function pe(e,t){for(var n,o=0,i=e.length;o<i;++o)if((n=e[o]).name===t)return n.value}function ge(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=he,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}ve.prototype=fe.prototype={constructor:ve,on:function(e,t){var n,o,i=this._,r=(o=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,l=r.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<l;)if(n=(e=r[a]).type)i[n]=ge(i[n],e.name,t);else if(null==t)for(n in i)i[n]=ge(i[n],e.name,null);return this}for(;++a<l;)if((n=(e=r[a]).type)&&(n=pe(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new ve(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,i=new Array(n),r=0;r<n;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=0,n=(o=this._[e]).length;r<n;++r)o[r].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};var me="http://www.w3.org/1999/xhtml";const ye={svg:"http://www.w3.org/2000/svg",xhtml:me,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function we(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),ye.hasOwnProperty(t)?{space:ye[t],local:e}:e}function _e(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===me&&t.documentElement.namespaceURI===me?t.createElement(e):t.createElementNS(n,e)}}function be(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function xe(e){var t=we(e);return(t.local?be:_e)(t)}function Ee(){}function Se(e){return null==e?Ee:function(){return this.querySelector(e)}}function ke(){return[]}function Ne(e){return null==e?ke:function(){return this.querySelectorAll(e)}}function Me(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function Ce(e){return function(){return this.matches(e)}}function Ie(e){return function(t){return t.matches(e)}}var $e=Array.prototype.find;function Ae(){return this.firstElementChild}var Pe=Array.prototype.filter;function Te(){return Array.from(this.children)}function ze(e){return new Array(e.length)}function De(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Oe(e,t,n,o,i,r){for(var a,l=0,u=t.length,s=r.length;l<s;++l)(a=t[l])?(a.__data__=r[l],o[l]=a):n[l]=new De(e,r[l]);for(;l<u;++l)(a=t[l])&&(i[l]=a)}function Be(e,t,n,o,i,r,a){var l,u,s,c=new Map,d=t.length,h=r.length,f=new Array(d);for(l=0;l<d;++l)(u=t[l])&&(f[l]=s=a.call(u,u.__data__,l,t)+"",c.has(s)?i[l]=u:c.set(s,u));for(l=0;l<h;++l)s=a.call(e,r[l],l,r)+"",(u=c.get(s))?(o[l]=u,u.__data__=r[l],c.delete(s)):n[l]=new De(e,r[l]);for(l=0;l<d;++l)(u=t[l])&&c.get(f[l])===u&&(i[l]=u)}function Re(e){return e.__data__}function Ve(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Le(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function He(e){return function(){this.removeAttribute(e)}}function Ye(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Xe(e,t){return function(){this.setAttribute(e,t)}}function Ge(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Fe(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function Ue(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function je(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Ze(e){return function(){this.style.removeProperty(e)}}function qe(e,t,n){return function(){this.style.setProperty(e,t,n)}}function We(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function Ke(e,t){return e.style.getPropertyValue(t)||je(e).getComputedStyle(e,null).getPropertyValue(t)}function Je(e){return function(){delete this[e]}}function Qe(e,t){return function(){this[e]=t}}function et(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function tt(e){return e.trim().split(/^|\s+/)}function nt(e){return e.classList||new ot(e)}function ot(e){this._node=e,this._names=tt(e.getAttribute("class")||"")}function it(e,t){for(var n=nt(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function rt(e,t){for(var n=nt(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function at(e){return function(){it(this,e)}}function lt(e){return function(){rt(this,e)}}function ut(e,t){return function(){(t.apply(this,arguments)?it:rt)(this,e)}}function st(){this.textContent=""}function ct(e){return function(){this.textContent=e}}function dt(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function ht(){this.innerHTML=""}function ft(e){return function(){this.innerHTML=e}}function vt(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function pt(){this.nextSibling&&this.parentNode.appendChild(this)}function gt(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mt(){return null}function yt(){var e=this.parentNode;e&&e.removeChild(this)}function wt(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function _t(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function bt(e){return function(){var t=this.__on;if(t){for(var n,o=0,i=-1,r=t.length;o<r;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function xt(e,t,n){return function(){var o,i=this.__on,r=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var a=0,l=i.length;a<l;++a)if((o=i[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=r,o.options=n),void(o.value=t);this.addEventListener(e.type,r,n),o={type:e.type,name:e.name,value:t,listener:r,options:n},i?i.push(o):this.__on=[o]}}function Et(e,t,n){var o=je(e),i=o.CustomEvent;"function"==typeof i?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function St(e,t){return function(){return Et(this,e,t)}}function kt(e,t){return function(){return Et(this,e,t.apply(this,arguments))}}De.prototype={constructor:De,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)}},ot.prototype={add:function(e){this._names.indexOf(e)<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}};var Nt=[null];function Mt(e,t){this._groups=e,this._parents=t}function Ct(){return new Mt([[document.documentElement]],Nt)}function It(e){return"string"==typeof e?new Mt([[document.querySelector(e)]],[document.documentElement]):new Mt([[e]],Nt)}function $t(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(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())).x,o.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}Mt.prototype=Ct.prototype={constructor:Mt,select:function(e){"function"!=typeof e&&(e=Se(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a,l=t[i],u=l.length,s=o[i]=new Array(u),c=0;c<u;++c)(r=l[c])&&(a=e.call(r,r.__data__,c,l))&&("__data__"in r&&(a.__data__=r.__data__),s[c]=a);return new Mt(o,this._parents)},selectAll:function(e){e="function"==typeof e?Me(e):Ne(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var a,l=t[r],u=l.length,s=0;s<u;++s)(a=l[s])&&(o.push(e.call(a,a.__data__,s,l)),i.push(a));return new Mt(o,i)},selectChild:function(e){return this.select(null==e?Ae:function(e){return function(){return $e.call(this.children,e)}}("function"==typeof e?e:Ie(e)))},selectChildren:function(e){return this.selectAll(null==e?Te:function(e){return function(){return Pe.call(this.children,e)}}("function"==typeof e?e:Ie(e)))},filter:function(e){"function"!=typeof e&&(e=Ce(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a=t[i],l=a.length,u=o[i]=[],s=0;s<l;++s)(r=a[s])&&e.call(r,r.__data__,s,a)&&u.push(r);return new Mt(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Re);var n,o=t?Be:Oe,i=this._parents,r=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=r.length,l=new Array(a),u=new Array(a),s=new Array(a),c=0;c<a;++c){var d=i[c],h=r[c],f=h.length,v=Ve(e.call(d,d&&d.__data__,c,i)),p=v.length,g=u[c]=new Array(p),m=l[c]=new Array(p);o(d,h,g,m,s[c]=new Array(f),v,t);for(var y,w,_=0,b=0;_<p;++_)if(y=g[_]){for(_>=b&&(b=_+1);!(w=m[b])&&++b<p;);y._next=w||null}}return(l=new Mt(l,i))._enter=u,l._exit=s,l},enter:function(){return new Mt(this._enter||this._groups.map(ze),this._parents)},exit:function(){return new Mt(this._exit||this._groups.map(ze),this._parents)},join:function(e,t,n){var o=this.enter(),i=this,r=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?r.remove():n(r),o&&i?o.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,a=Math.min(i,r),l=new Array(i),u=0;u<a;++u)for(var s,c=n[u],d=o[u],h=c.length,f=l[u]=new Array(h),v=0;v<h;++v)(s=c[v]||d[v])&&(f[v]=s);for(;u<i;++u)l[u]=n[u];return new Mt(l,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,i=e[t],r=i.length-1,a=i[r];--r>=0;)(o=i[r])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Le);for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a,l=n[r],u=l.length,s=i[r]=new Array(u),c=0;c<u;++c)(a=l[c])&&(s[c]=a);s.sort(t)}return new Mt(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var a=o[i];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i,r=t[n],a=0,l=r.length;a<l;++a)(i=r[a])&&e.call(i,i.__data__,a,r);return this},attr:function(e,t){var n=we(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?Ye:He:"function"==typeof t?n.local?Ue:Fe:n.local?Ge:Xe)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?Ze:"function"==typeof t?We:qe)(e,t,null==n?"":n)):Ke(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?Je:"function"==typeof t?et:Qe)(e,t)):this.node()[e]},classed:function(e,t){var n=tt(e+"");if(arguments.length<2){for(var o=nt(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?ut:t?at:lt)(n,t))},text:function(e){return arguments.length?this.each(null==e?st:("function"==typeof e?dt:ct)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?ht:("function"==typeof e?vt:ft)(e)):this.node().innerHTML},raise:function(){return this.each(pt)},lower:function(){return this.each(gt)},append:function(e){var t="function"==typeof e?e:xe(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:xe(e),o=null==t?mt:"function"==typeof t?t:Se(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(yt)},clone:function(e){return this.select(e?_t:wt)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,i,r=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=r.length;if(!(arguments.length<2)){for(l=t?xt:bt,o=0;o<a;++o)this.each(l(r[o],t,n));return this}var l=this.node().__on;if(l)for(var u,s=0,c=l.length;s<c;++s)for(o=0,u=l[s];o<a;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?kt:St)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,i=e[t],r=0,a=i.length;r<a;++r)(o=i[r])&&(yield o)}};const At={passive:!1},Pt={capture:!0,passive:!1};function Tt(e){e.stopImmediatePropagation()}function zt(e){e.preventDefault(),e.stopImmediatePropagation()}function Dt(e){var t=e.document.documentElement,n=It(e).on("dragstart.drag",zt,Pt);"onselectstart"in t?n.on("selectstart.drag",zt,Pt):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function Ot(e,t){var n=e.document.documentElement,o=It(e).on("dragstart.drag",null);t&&(o.on("click.drag",zt,Pt),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 Bt=e=>()=>e;function Rt(e,{sourceEvent:t,subject:n,target:o,identifier:i,active:r,x:a,y:l,dx:u,dy:s,dispatch:c}){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:i,enumerable:!0,configurable:!0},active:{value:r,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:s,enumerable:!0,configurable:!0},_:{value:c}})}function Vt(e){return!e.ctrlKey&&!e.button}function Lt(){return this.parentNode}function Ht(e,t){return null==t?{x:e.x,y:e.y}:t}function Yt(){return navigator.maxTouchPoints||"ontouchstart"in this}function Xt(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Gt(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Ft(){}Rt.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};var Ut=.7,jt=1/Ut,Zt="\\s*([+-]?\\d+)\\s*",qt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Wt="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Kt=/^#([0-9a-f]{3,8})$/,Jt=new RegExp(`^rgb\\(${Zt},${Zt},${Zt}\\)$`),Qt=new RegExp(`^rgb\\(${Wt},${Wt},${Wt}\\)$`),en=new RegExp(`^rgba\\(${Zt},${Zt},${Zt},${qt}\\)$`),tn=new RegExp(`^rgba\\(${Wt},${Wt},${Wt},${qt}\\)$`),nn=new RegExp(`^hsl\\(${qt},${Wt},${Wt}\\)$`),on=new RegExp(`^hsla\\(${qt},${Wt},${Wt},${qt}\\)$`),rn={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};function an(){return this.rgb().formatHex()}function ln(){return this.rgb().formatRgb()}function un(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=Kt.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?sn(t):3===n?new hn(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?cn(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?cn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Jt.exec(e))?new hn(t[1],t[2],t[3],1):(t=Qt.exec(e))?new hn(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=en.exec(e))?cn(t[1],t[2],t[3],t[4]):(t=tn.exec(e))?cn(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=nn.exec(e))?yn(t[1],t[2]/100,t[3]/100,1):(t=on.exec(e))?yn(t[1],t[2]/100,t[3]/100,t[4]):rn.hasOwnProperty(e)?sn(rn[e]):"transparent"===e?new hn(NaN,NaN,NaN,0):null}function sn(e){return new hn(e>>16&255,e>>8&255,255&e,1)}function cn(e,t,n,o){return o<=0&&(e=t=n=NaN),new hn(e,t,n,o)}function dn(e,t,n,o){return 1===arguments.length?((i=e)instanceof Ft||(i=un(i)),i?new hn((i=i.rgb()).r,i.g,i.b,i.opacity):new hn):new hn(e,t,n,null==o?1:o);var i}function hn(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function fn(){return`#${mn(this.r)}${mn(this.g)}${mn(this.b)}`}function vn(){const e=pn(this.opacity);return`${1===e?"rgb(":"rgba("}${gn(this.r)}, ${gn(this.g)}, ${gn(this.b)}${1===e?")":`, ${e})`}`}function pn(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function gn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function mn(e){return((e=gn(e))<16?"0":"")+e.toString(16)}function yn(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new _n(e,t,n,o)}function wn(e){if(e instanceof _n)return new _n(e.h,e.s,e.l,e.opacity);if(e instanceof Ft||(e=un(e)),!e)return new _n;if(e instanceof _n)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),a=NaN,l=r-i,u=(r+i)/2;return l?(a=t===r?(n-o)/l+6*(n<o):n===r?(o-t)/l+2:(t-n)/l+4,l/=u<.5?r+i:2-r-i,a*=60):l=u>0&&u<1?0:a,new _n(a,l,u,e.opacity)}function _n(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function bn(e){return(e=(e||0)%360)<0?e+360:e}function xn(e){return Math.max(0,Math.min(1,e||0))}function En(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Xt(Ft,un,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:an,
- // Deprecated! Use color.formatHex.
- formatHex:an,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return wn(this).formatHsl()},formatRgb:ln,toString:ln}),Xt(hn,dn,Gt(Ft,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Ut:Math.pow(Ut,e),new hn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new hn(gn(this.r),gn(this.g),gn(this.b),pn(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:fn,
- // Deprecated! Use color.formatHex.
- formatHex:fn,formatHex8:function(){return`#${mn(this.r)}${mn(this.g)}${mn(this.b)}${mn(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:vn,toString:vn})),Xt(_n,function(e,t,n,o){return 1===arguments.length?wn(e):new _n(e,t,n,null==o?1:o)},Gt(Ft,{brighter(e){return e=null==e?jt:Math.pow(jt,e),new _n(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Ut:Math.pow(Ut,e),new _n(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new hn(En(e>=240?e-240:e+120,i,o),En(e,i,o),En(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new _n(bn(this.h),xn(this.s),xn(this.l),pn(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=pn(this.opacity);return`${1===e?"hsl(":"hsla("}${bn(this.h)}, ${100*xn(this.s)}%, ${100*xn(this.l)}%${1===e?")":`, ${e})`}`}}));const Sn=e=>()=>e;function kn(e){return 1===(e=+e)?Nn:function(t,n){return n-t?function(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)}}(t,n,e):Sn(isNaN(t)?n:t)}}function Nn(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):Sn(isNaN(e)?t:e)}const Mn=function e(t){var n=kn(t);function o(e,t){var o=n((e=dn(e)).r,(t=dn(t)).r),i=n(e.g,t.g),r=n(e.b,t.b),a=Nn(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=i(t),e.b=r(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function Cn(e,t){t||(t=[]);var n,o=e?Math.min(t.length,e.length):0,i=t.slice();return function(r){for(n=0;n<o;++n)i[n]=e[n]*(1-r)+t[n]*r;return i}}function In(e,t){var n,o=t?t.length:0,i=e?Math.min(o,e.length):0,r=new Array(i),a=new Array(o);for(n=0;n<i;++n)r[n]=On(e[n],t[n]);for(;n<o;++n)a[n]=t[n];return function(e){for(n=0;n<i;++n)a[n]=r[n](e);return a}}function $n(e,t){var n=new Date;return e=+e,t=+t,function(o){return n.setTime(e*(1-o)+t*o),n}}function An(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Pn(e,t){var n,o={},i={};for(n in null!==e&&"object"==typeof e||(e={}),null!==t&&"object"==typeof t||(t={}),t)n in e?o[n]=On(e[n],t[n]):i[n]=t[n];return function(e){for(n in o)i[n]=o[n](e);return i}}var Tn=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,zn=new RegExp(Tn.source,"g");function Dn(e,t){var n,o,i,r=Tn.lastIndex=zn.lastIndex=0,a=-1,l=[],u=[];for(e+="",t+="";(n=Tn.exec(e))&&(o=zn.exec(t));)(i=o.index)>r&&(i=t.slice(r,i),l[a]?l[a]+=i:l[++a]=i),(n=n[0])===(o=o[0])?l[a]?l[a]+=o:l[++a]=o:(l[++a]=null,u.push({i:a,x:An(n,o)})),r=zn.lastIndex;return r<t.length&&(i=t.slice(r),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var n,o=0;o<t;++o)l[(n=u[o]).i]=n.x(e);return l.join("")})}function On(e,t){var n,o,i=typeof t;return null==t||"boolean"===i?Sn(t):("number"===i?An:"string"===i?(n=un(t))?(t=n,Mn):Dn:t instanceof un?Mn:t instanceof Date?$n:(o=t,!ArrayBuffer.isView(o)||o instanceof DataView?Array.isArray(t)?In:"function"!=typeof t.valueOf&&"function"!=typeof t.toString||isNaN(t)?Pn:An:Cn))(e,t)}var Bn,Rn=180/Math.PI,Vn={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ln(e,t,n,o,i,r){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,u/=l),e*o<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*Rn,skewX:Math.atan(u)*Rn,scaleX:a,scaleY:l}}function Hn(e,t,n,o){function i(e){return e.length?e.pop()+" ":""}return function(r,a){var l=[],u=[];return r=e(r),a=e(a),function(e,o,i,r,a,l){if(e!==i||o!==r){var u=a.push("translate(",null,t,null,n);l.push({i:u-4,x:An(e,i)},{i:u-2,x:An(o,r)})}else(i||r)&&a.push("translate("+i+t+r+n)}(r.translateX,r.translateY,a.translateX,a.translateY,l,u),function(e,t,n,r){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(i(n)+"rotate(",null,o)-2,x:An(e,t)})):t&&n.push(i(n)+"rotate("+t+o)}(r.rotate,a.rotate,l,u),function(e,t,n,r){e!==t?r.push({i:n.push(i(n)+"skewX(",null,o)-2,x:An(e,t)}):t&&n.push(i(n)+"skewX("+t+o)}(r.skewX,a.skewX,l,u),function(e,t,n,o,r,a){if(e!==n||t!==o){var l=r.push(i(r)+"scale(",null,",",null,")");a.push({i:l-4,x:An(e,n)},{i:l-2,x:An(t,o)})}else 1===n&&1===o||r.push(i(r)+"scale("+n+","+o+")")}(r.scaleX,r.scaleY,a.scaleX,a.scaleY,l,u),r=a=null,function(e){for(var t,n=-1,o=u.length;++n<o;)l[(t=u[n]).i]=t.x(e);return l.join("")}}}var Yn=Hn(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Vn:Ln(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Xn=Hn(function(e){return null==e?Vn:(Bn||(Bn=document.createElementNS("http://www.w3.org/2000/svg","g")),Bn.setAttribute("transform",e),(e=Bn.transform.baseVal.consolidate())?Ln((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):Vn)},", ",")",")");function Gn(e){return((e=Math.exp(e))+1/e)/2}const Fn=function e(t,n,o){function i(e,i){var r,a,l=e[0],u=e[1],s=e[2],c=i[0],d=i[1],h=i[2],f=c-l,v=d-u,p=f*f+v*v;if(p<1e-12)a=Math.log(h/s)/t,r=function(e){return[l+e*f,u+e*v,s*Math.exp(t*e*a)]};else{var g=Math.sqrt(p),m=(h*h-s*s+o*p)/(2*s*n*g),y=(h*h-s*s-o*p)/(2*h*n*g),w=Math.log(Math.sqrt(m*m+1)-m),_=Math.log(Math.sqrt(y*y+1)-y);a=(_-w)/t,r=function(e){var o,i=e*a,r=Gn(w),c=s/(n*g)*(r*(o=t*i+w,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[l+c*f,u+c*v,s*r/Gn(t*i+w)]}}return r.duration=1e3*a*t/Math.SQRT2,r}return i.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},i}(Math.SQRT2,2,4);var Un,jn,Zn=0,qn=0,Wn=0,Kn=0,Jn=0,Qn=0,eo="object"==typeof performance&&performance.now?performance:Date,to="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function no(){return Jn||(to(oo),Jn=eo.now()+Qn)}function oo(){Jn=0}function io(){this._call=this._time=this._next=null}function ro(e,t,n){var o=new io;return o.restart(e,t,n),o}function ao(){Jn=(Kn=eo.now())+Qn,Zn=qn=0;try{!function(){no(),++Zn;for(var e,t=Un;t;)(e=Jn-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Zn}()}finally{Zn=0,function(){var e,t,n=Un,o=Infinity;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Un=t);jn=e,uo(o)}(),Jn=0}}function lo(){var e=eo.now(),t=e-Kn;t>1e3&&(Qn-=t,Kn=e)}function uo(e){Zn||(qn&&(qn=clearTimeout(qn)),e-Jn>24?(e<Infinity&&(qn=setTimeout(ao,e-eo.now()-Qn)),Wn&&(Wn=clearInterval(Wn))):(Wn||(Kn=eo.now(),Wn=setInterval(lo,1e3)),Zn=1,to(ao)))}function so(e,t,n){var o=new io;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}io.prototype=ro.prototype={constructor:io,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?no():+n)+(null==t?0:+t),this._next||jn===this||(jn?jn._next=this:Un=this,jn=this),this._call=e,this._time=n,uo()},stop:function(){this._call&&(this._call=null,this._time=Infinity,uo())}};var co=fe("start","end","cancel","interrupt"),ho=[];function fo(e,t,n,o,i,r){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,i=e.__transition;function r(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(r){var s,c,d,h;if(1!==n.state)return u();for(s in i)if((h=i[s]).name===n.name){if(3===h.state)return so(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[s]):+s<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[s])}if(so(function(){3===n.state&&(n.state=4,n.timer.restart(l,n.delay,n.time),l(r))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),s=0,c=-1;s<d;++s)(h=n.tween[s].value.call(e,e.__data__,n.index,n.group))&&(o[++c]=h);o.length=c+1}}function l(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(u),n.state=5,1),r=-1,a=o.length;++r<a;)o[r].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){for(var o in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=ro(r,0,n.time)}(e,n,{name:t,index:o,
- // For context during callback.
- group:i,
- // For context during callback.
- on:co,tween:ho,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:0})}function vo(e,t){var n=go(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function po(e,t){var n=go(e,t);if(n.state>3)throw new Error("too late; already running");return n}function go(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function mo(e,t){var n,o,i,r=e.__transition,a=!0;if(r){for(i in t=null==t?null:t+"",r)(n=r[i]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[i]):a=!1;a&&delete e.__transition}}function yo(e,t){var n,o;return function(){var i=po(this,e),r=i.tween;if(r!==n)for(var a=0,l=(o=n=r).length;a<l;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}i.tween=o}}function wo(e,t,n){var o,i;if("function"!=typeof n)throw new Error;return function(){var r=po(this,e),a=r.tween;if(a!==o){i=(o=a).slice();for(var l={name:t,value:n},u=0,s=i.length;u<s;++u)if(i[u].name===t){i[u]=l;break}u===s&&i.push(l)}r.tween=i}}function _o(e,t,n){var o=e._id;return e.each(function(){var e=po(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return go(e,o).value[t]}}function bo(e,t){var n;return("number"==typeof t?An:t instanceof un?Mn:(n=un(t))?(t=n,Mn):Dn)(e,t)}function xo(e){return function(){this.removeAttribute(e)}}function Eo(e){return function(){this.removeAttributeNS(e.space,e.local)}}function So(e,t,n){var o,i,r=n+"";return function(){var a=this.getAttribute(e);return a===r?null:a===o?i:i=t(o=a,n)}}function ko(e,t,n){var o,i,r=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===r?null:a===o?i:i=t(o=a,n)}}function No(e,t,n){var o,i,r;return function(){var a,l,u=n(this);if(null!=u)return(a=this.getAttribute(e))===(l=u+"")?null:a===o&&l===i?r:(i=l,r=t(o=a,u));this.removeAttribute(e)}}function Mo(e,t,n){var o,i,r;return function(){var a,l,u=n(this);if(null!=u)return(a=this.getAttributeNS(e.space,e.local))===(l=u+"")?null:a===o&&l===i?r:(i=l,r=t(o=a,u));this.removeAttributeNS(e.space,e.local)}}function Co(e,t){var n,o;function i(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function Io(e,t){var n,o;function i(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function $o(e,t){return function(){vo(this,e).delay=+t.apply(this,arguments)}}function Ao(e,t){return t=+t,function(){vo(this,e).delay=t}}function Po(e,t){return function(){po(this,e).duration=+t.apply(this,arguments)}}function To(e,t){return t=+t,function(){po(this,e).duration=t}}var zo=Ct.prototype.constructor;function Do(e){return function(){this.style.removeProperty(e)}}var Oo=0;function Bo(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ro(){return++Oo}var Vo=Ct.prototype;Bo.prototype={constructor:Bo,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Se(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var l,u,s=o[a],c=s.length,d=r[a]=new Array(c),h=0;h<c;++h)(l=s[h])&&(u=e.call(l,l.__data__,h,s))&&("__data__"in l&&(u.__data__=l.__data__),d[h]=u,fo(d[h],t,n,h,d,go(l,n)));return new Bo(r,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Ne(e));for(var o=this._groups,i=o.length,r=[],a=[],l=0;l<i;++l)for(var u,s=o[l],c=s.length,d=0;d<c;++d)if(u=s[d]){for(var h,f=e.call(u,u.__data__,d,s),v=go(u,n),p=0,g=f.length;p<g;++p)(h=f[p])&&fo(h,t,n,p,f,v);r.push(f),a.push(u)}return new Bo(r,a,t,n)},selectChild:Vo.selectChild,selectChildren:Vo.selectChildren,filter:function(e){"function"!=typeof e&&(e=Ce(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a=t[i],l=a.length,u=o[i]=[],s=0;s<l;++s)(r=a[s])&&e.call(r,r.__data__,s,a)&&u.push(r);return new Bo(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),a=new Array(o),l=0;l<r;++l)for(var u,s=t[l],c=n[l],d=s.length,h=a[l]=new Array(d),f=0;f<d;++f)(u=s[f]||c[f])&&(h[f]=u);for(;l<o;++l)a[l]=t[l];return new Bo(a,this._parents,this._name,this._id)},selection:function(){return new zo(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Ro(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a,l=o[r],u=l.length,s=0;s<u;++s)if(a=l[s]){var c=go(a,t);fo(a,e,n,s,l,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Bo(o,this._parents,e,n)},call:Vo.call,nodes:Vo.nodes,node:Vo.node,size:Vo.size,empty:Vo.empty,each:Vo.each,on:function(e,t){var n=this._id;return arguments.length<2?go(this.node(),n).on.on(e):this.each(function(e,t,n){var o,i,r=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?vo:po;return function(){var a=r(this,e),l=a.on;l!==o&&(i=(o=l).copy()).on(t,n),a.on=i}}(n,e,t))},attr:function(e,t){var n=we(e),o="transform"===n?Xn:bo;return this.attrTween(e,"function"==typeof t?(n.local?Mo:No)(n,o,_o(this,"attr."+e,t)):null==t?(n.local?Eo:xo)(n):(n.local?ko:So)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=we(e);return this.tween(n,(o.local?Co:Io)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?Yn:bo;return null==t?this.styleTween(e,function(e,t){var n,o,i;return function(){var r=Ke(this,e),a=(this.style.removeProperty(e),Ke(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}(e,o)).on("end.style."+e,Do(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,i,r;return function(){var a=Ke(this,e),l=n(this),u=l+"";return null==l&&(this.style.removeProperty(e),u=l=Ke(this,e)),a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,l))}}(e,o,_o(this,"style."+e,t))).each(function(e,t){var n,o,i,r,a="style."+t,l="end."+a;return function(){var u=po(this,e),s=u.on,c=null==u.value[a]?r||(r=Do(t)):void 0;s===n&&i===c||(o=(n=s).copy()).on(l,i=c),u.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,i,r=n+"";return function(){var a=Ke(this,e);return a===r?null:a===o?i:i=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,i;function r(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,r,n)),o}return r._value=t,r}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(_o(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,i=go(this.node(),n).tween,r=0,a=i.length;r<a;++r)if((o=i[r]).name===e)return o.value;return null}return this.each((null==t?yo:wo)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?$o:Ao)(t,e)):go(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Po:To)(t,e)):go(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){po(this,e).ease=t}}(t,e)):go(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;po(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var l={value:a},u={value:function(){0===--i&&r()}};n.each(function(){var n=po(this,o),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),n.on=t}),0===i&&r()})},[Symbol.iterator]:Vo[Symbol.iterator]};var Lo={time:null,
- // Set on use.
- delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Ho(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Ct.prototype.interrupt=function(e){return this.each(function(){mo(this,e)})},Ct.prototype.transition=function(e){var t,n;e instanceof Bo?(t=e._id,e=e._name):(t=Ro(),(n=Lo).time=no(),e=null==e?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a,l=o[r],u=l.length,s=0;s<u;++s)(a=l[s])&&fo(a,e,t,s,l,n||Ho(a,t));return new Bo(o,this._parents,e,t)};const Yo=e=>()=>e;function Xo(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){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:i}})}function Go(e,t,n){this.k=e,this.x=t,this.y=n}Go.prototype={constructor:Go,scale:function(e){return 1===e?this:new Go(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Go(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 Fo=new Go(1,0,0);function Uo(e){e.stopImmediatePropagation()}function jo(e){e.preventDefault(),e.stopImmediatePropagation()}function Zo(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function qo(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Wo(){return this.__zoom||Fo}function Ko(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Jo(){return navigator.maxTouchPoints||"ontouchstart"in this}function Qo(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}Go.prototype;var ei=(e=>(e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom",e))(ei||{}),ti=(e=>(e.Partial="partial",e.Full="full",e))(ti||{}),ni=(e=>(e.Bezier="default",e.SimpleBezier="simple-bezier",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e))(ni||{}),oi=(e=>(e.Strict="strict",e.Loose="loose",e))(oi||{}),ii=(e=>(e.Arrow="arrow",e.ArrowClosed="arrowclosed",e))(ii||{}),ri=(e=>(e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal",e))(ri||{}),ai=(e=>(e.TopLeft="top-left",e.TopCenter="top-center",e.TopRight="top-right",e.BottomLeft="bottom-left",e.BottomCenter="bottom-center",e.BottomRight="bottom-right",e))(ai||{});const li=["INPUT","SELECT","TEXTAREA"],ui="undefined"!=typeof document?document:null;function si(e){var t,n;const o=(null==(n=null==(t=e.composedPath)?void 0:t.call(e))?void 0:n[0])||e.target,i="function"==typeof(null==o?void 0:o.hasAttribute)&&o.hasAttribute("contenteditable"),r="function"==typeof(null==o?void 0:o.closest)?o.closest(".nokey"):null;return li.includes(null==o?void 0:o.nodeName)||i||!!r}function ci(e,t,n,o){const i=t.replace("+","\n").replace("\n\n","\n+").split("\n").map(e=>e.trim().toLowerCase());if(1===i.length)return e.toLowerCase()===t.toLowerCase();o||n.add(e.toLowerCase());const r=i.every((e,t)=>n.has(e)&&Array.from(n.values())[t]===i[t]);return o&&n.delete(e.toLowerCase()),r}function di(e,t){const o=v(()=>V(null==t?void 0:t.target)??ui),i=I(!0===V(e));let r=!1;const a=new Set;let l=s(V(e));function u(){r=!1,a.clear(),i.value=!0===V(e)}function s(e){return null===e?(u(),()=>!1):"boolean"==typeof e?(u(),i.value=e,()=>!1):Array.isArray(e)||"string"==typeof e?function(e,t){return n=>{if(!n.code&&!n.key)return!1;const o=(i=n.code,e.includes(i)?"code":"key");var i;return Array.isArray(e)?e.some(e=>ci(n[o],e,t,"keyup"===n.type)):ci(n[o],e,t,"keyup"===n.type)}}(e,a):e}return n(()=>V(e),(e,t)=>{"boolean"==typeof t&&"boolean"!=typeof e&&u(),l=s(e)},{immediate:!0}),se(["blur","contextmenu"],u),ce((...e)=>l(...e),e=>{var n,o;const a=V(null==t?void 0:t.actInsideInputWithModifier)??!0,l=V(null==t?void 0:t.preventDefault)??!1;var u;r=(u=e).ctrlKey||u.metaKey||u.shiftKey||u.altKey;if((!r||r&&!a)&&si(e))return;const s=(null==(o=null==(n=e.composedPath)?void 0:n.call(e))?void 0:o[0])||e.target,c="BUTTON"===(null==s?void 0:s.nodeName)||"A"===(null==s?void 0:s.nodeName);l||!r&&c||e.preventDefault(),i.value=!0},{eventName:"keydown",target:o}),ce((...e)=>l(...e),e=>{const n=V(null==t?void 0:t.actInsideInputWithModifier)??!0;if(i.value){if((!r||r&&!n)&&si(e))return;r=!1,i.value=!1}},{eventName:"keyup",target:o}),i}const hi="vue-flow__node-desc",fi="vue-flow__edge-desc",vi=["Enter"," ","Escape"],pi={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};function gi(e){return{...e.computedPosition||{x:0,y:0},width:e.dimensions.width||0,height:e.dimensions.height||0}}function mi(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)}function yi(e){return{width:e.offsetWidth,height:e.offsetHeight}}function wi(e,t=0,n=1){return Math.min(Math.max(e,t),n)}function _i(e,t){return{x:wi(e.x,t[0][0],t[1][0]),y:wi(e.y,t[0][1],t[1][1])}}function bi(e){const t=e.getRootNode();return"elementFromPoint"in t?t:window.document}function xi(e){return e&&"object"==typeof e&&"id"in e&&"source"in e&&"target"in e}function Ei(e){return e&&"object"==typeof e&&"id"in e&&"position"in e&&!xi(e)}function Si(e){return Ei(e)&&"computedPosition"in e}function ki(e){return!Number.isNaN(e)&&Number.isFinite(e)}function Ni(e,t,n){const o={id:e.id.toString(),type:e.type??"default",dimensions:L({width:0,height:0}),computedPosition:L({z:0,...e.position}),
- // todo: shouldn't be defined initially, as we want to use handleBounds to check if a node was actually initialized or not
- handleBounds:{source:[],target:[]},draggable:void 0,selectable:void 0,connectable:void 0,focusable:void 0,selected:!1,dragging:!1,resizing:!1,initialized:!1,isParent:!1,position:{x:0,y:0},data:Cr(e.data)?e.data:{},events:L(Cr(e.events)?e.events:{})};return Object.assign(t??o,e,{id:e.id.toString(),parentNode:n})}function Mi(e,t,n){var o,i;const r={id:e.id.toString(),type:e.type??(null==t?void 0:t.type)??"default",source:e.source.toString(),target:e.target.toString(),sourceHandle:null==(o=e.sourceHandle)?void 0:o.toString(),targetHandle:null==(i=e.targetHandle)?void 0:i.toString(),updatable:e.updatable??(null==n?void 0:n.updatable),selectable:e.selectable??(null==n?void 0:n.selectable),focusable:e.focusable??(null==n?void 0:n.focusable),data:Cr(e.data)?e.data:{},events:L(Cr(e.events)?e.events:{}),label:e.label??"",interactionWidth:e.interactionWidth??(null==n?void 0:n.interactionWidth),...n??{}};return Object.assign(t??r,e,{id:e.id.toString()})}function Ci(e,t,n,o){const i="string"==typeof e?e:e.id,r=new Set,a="source"===o?"target":"source";for(const l of n)l[a]===i&&r.add(l[o]);return t.filter(e=>r.has(e.id))}function Ii({source:e,sourceHandle:t,target:n,targetHandle:o}){return`vueflow__edge-${e}${t??""}-${n}${o??""}`}function $i({x:e,y:t},{x:n,y:o,zoom:i}){return{x:e*i+n,y:t*i+o}}function Ai({x:e,y:t},{x:n,y:o,zoom:i},r=!1,a=[1,1]){const l={x:(e-n)/i,y:(t-o)/i};return r?pr(l,a):l}function Pi(e,t){return{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)}}function Ti({x:e,y:t,width:n,height:o}){return{x:e,y:t,x2:e+n,y2:t+o}}function zi({x:e,y:t,x2:n,y2:o}){return{x:e,y:t,width:n-e,height:o-t}}function Di(e){let t={x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY,x2:Number.NEGATIVE_INFINITY,y2:Number.NEGATIVE_INFINITY};for(let n=0;n<e.length;n++){const o=e[n];t=Pi(t,Ti({...o.computedPosition,...o.dimensions}))}return zi(t)}function Oi(e,t,n={x:0,y:0,zoom:1},o=!1,i=!1){const r={...Ai(t,n),width:t.width/n.zoom,height:t.height/n.zoom},a=[];for(const l of e){const{dimensions:e,selectable:t=!0,hidden:n=!1}=l,u=e.width??l.width??null,s=e.height??l.height??null;if(i&&!t||n)continue;const c=mi(r,gi(l));(null===u||null===s||o&&c>0||c>=(u??0)*(s??0)||l.dragging)&&a.push(l)}return a}function Bi(e,t){const n=new Set;if("string"==typeof e)n.add(e);else if(e.length>=1)for(const o of e)n.add(o.id);return t.filter(e=>n.has(e.source)||n.has(e.target))}function Ri(e,t){if("number"==typeof e)return Math.floor(.5*(t-t/(1+e)));if("string"==typeof e&&e.endsWith("px")){const t=Number.parseFloat(e);if(!Number.isNaN(t))return Math.floor(t)}if("string"==typeof e&&e.endsWith("%")){const n=Number.parseFloat(e);if(!Number.isNaN(n))return Math.floor(t*n*.01)}return Sr(`The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vi(e,t,n,o,i,r=.1){const a=function(e,t,n){if("string"==typeof e||"number"==typeof e){const o=Ri(e,n),i=Ri(e,t);return{top:o,right:i,bottom:o,left:i,x:2*i,y:2*o}}if("object"==typeof e){const o=Ri(e.top??e.y??0,n),i=Ri(e.bottom??e.y??0,n),r=Ri(e.left??e.x??0,t),a=Ri(e.right??e.x??0,t);return{top:o,right:a,bottom:i,left:r,x:r+a,y:o+i}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}(r,t,n),l=(t-a.x)/e.width,u=(n-a.y)/e.height,s=wi(Math.min(l,u),o,i),c=t/2-(e.x+e.width/2)*s,d=n/2-(e.y+e.height/2)*s,h=function(e,t,n,o,i,r){const{x:a,y:l}=$i(e,{x:t,y:n,zoom:o}),{x:u,y:s}=$i({x:e.x+e.width,y:e.y+e.height},{x:t,y:n,zoom:o}),c=i-u,d=r-s;return{left:Math.floor(a),top:Math.floor(l),right:Math.floor(c),bottom:Math.floor(d)}}(e,c,d,s,t,n),f=Math.min(h.left-a.left,0),v=Math.min(h.top-a.top,0);return{x:c-f+Math.min(h.right-a.right,0),y:d-v+Math.min(h.bottom-a.bottom,0),zoom:s}}function Li(e,t){if(!e.parentNode)return!1;const n=t.get(e.parentNode);return!!n&&(!!n.selected||Li(n,t))}function Hi(e,t){if(void 0===e)return"";if("string"==typeof e)return e;return`${t?`${t}__`:""}${Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("&")}`}function Yi(e){const t=e.ctrlKey&&vr()?10:1;return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*t}function Xi(e,t,n){return e<t?wi(Math.abs(e-t),1,t)/t:e>n?-wi(Math.abs(e-n),1,t)/t:0}function Gi(e,t,n=15,o=40){return[Xi(e.x,o,t.width-o)*n,Xi(e.y,o,t.height-o)*n]}function Fi(e,t){if(t){const n=e.position.x+e.dimensions.width-t.dimensions.width,o=e.position.y+e.dimensions.height-t.dimensions.height;if(n>0||o>0||e.position.x<0||e.position.y<0){let i={};if("function"==typeof t.style?i={...t.style(t)}:t.style&&(i={...t.style}),i.width=i.width??`${t.dimensions.width}px`,i.height=i.height??`${t.dimensions.height}px`,n>0)if("string"==typeof i.width){const e=Number(i.width.replace("px",""));i.width=`${e+n}px`}else i.width+=n;if(o>0)if("string"==typeof i.height){const e=Number(i.height.replace("px",""));i.height=`${e+o}px`}else i.height+=o;if(e.position.x<0){const n=Math.abs(e.position.x);if(t.position.x=t.position.x-n,"string"==typeof i.width){const e=Number(i.width.replace("px",""));i.width=`${e+n}px`}else i.width+=n;e.position.x=0}if(e.position.y<0){const n=Math.abs(e.position.y);if(t.position.y=t.position.y-n,"string"==typeof i.height){const e=Number(i.height.replace("px",""));i.height=`${e+n}px`}else i.height+=n;e.position.y=0}t.dimensions.width=Number(i.width.toString().replace("px","")),t.dimensions.height=Number(i.height.toString().replace("px","")),"function"==typeof t.style?t.style=e=>({...(0,t.style)(e),...i}):t.style={...t.style,...i}}}}function Ui(e,t){var n,o;const i=e.filter(e=>"add"===e.type||"remove"===e.type);for(const a of i)if("add"===a.type){-1===t.findIndex(e=>e.id===a.item.id)&&t.push(a.item)}else if("remove"===a.type){const e=t.findIndex(e=>e.id===a.id);-1!==e&&t.splice(e,1)}const r=t.map(e=>e.id);for(const a of t)for(const i of e)if(i.id===a.id)switch(i.type){case"select":a.selected=i.selected;break;case"position":if(Si(a)&&(void 0!==i.position&&(a.position=i.position),void 0!==i.dragging&&(a.dragging=i.dragging),a.expandParent&&a.parentNode)){const e=t[r.indexOf(a.parentNode)];e&&Si(e)&&Fi(a,e)}break;case"dimensions":if(Si(a)&&(void 0!==i.dimensions&&(a.dimensions=i.dimensions),void 0!==i.updateStyle&&i.updateStyle&&(a.style={...a.style||{},width:`${null==(n=i.dimensions)?void 0:n.width}px`,height:`${null==(o=i.dimensions)?void 0:o.height}px`}),void 0!==i.resizing&&(a.resizing=i.resizing),a.expandParent&&a.parentNode)){const e=t[r.indexOf(a.parentNode)];if(e&&Si(e)){!!e.dimensions.width&&!!e.dimensions.height?Fi(a,e):E(()=>{Fi(a,e)})}}}return t}function ji(e,t){return{id:e,type:"select",selected:t}}function Zi(e){return{item:e,type:"add"}}function qi(e){return{id:e,type:"remove"}}function Wi(e,t,n,o,i){return{id:e,source:t,target:n,sourceHandle:o||null,targetHandle:i||null,type:"remove"}}function Ki(e,t=new Set,n=!1){const o=[];for(const[i,r]of e){const e=t.has(i);void 0===r.selected&&!e||r.selected===e||(n&&(r.selected=e),o.push(ji(r.id,e)))}return o}const Ji=()=>{};function Qi(e){const t=new Set;let n=Ji,o=()=>!1;const i=()=>t.size>0||o(),r=e=>{t.delete(e)};return{on:e=>{t.add(e);const n=()=>r(e);return q(n),{off:n}},off:r,trigger:o=>{const r=[n];return i()?r.push(...t):e&&r.push(e),Promise.allSettled(r.map(e=>e(o)))},hasListeners:i,listeners:t,setEmitter:e=>{n=e},removeEmitter:()=>{n=Ji},setHasEmitListeners:e=>{o=e},removeHasEmitListeners:()=>{o=()=>!1}}}function er(e,t,n){let o=e;do{if(o&&o.matches(t))return!0;if(o===n)return!1;o=o.parentElement}while(o);return!1}function tr({id:e,dragItems:t,findNode:n}){const o=[];for(const i of t){const e=n(i.id);e&&o.push(e)}return[e?o.find(t=>t.id===e):o[0],o]}function nr(e){if(Array.isArray(e))switch(e.length){case 1:return[e[0],e[0],e[0],e[0]];case 2:return[e[0],e[1],e[0],e[1]];case 3:return[e[0],e[1],e[2],e[1]];case 4:return e;default:return[0,0,0,0]}return[e,e,e,e]}function or(e,t,n,o){let i=e.extent||n;if("parent"!==i&&(Array.isArray(i)||"parent"!==(null==i?void 0:i.range))||e.expandParent){if(Array.isArray(i)){const e=(null==o?void 0:o.computedPosition.x)||0,t=(null==o?void 0:o.computedPosition.y)||0;i=[[i[0][0]+e,i[0][1]+t],[i[1][0]+e,i[1][1]+t]]}else if("parent"!==i&&(null==i?void 0:i.range)&&Array.isArray(i.range)){const[e,t,n,r]=nr(i.padding),a=(null==o?void 0:o.computedPosition.x)||0,l=(null==o?void 0:o.computedPosition.y)||0;i=[[i.range[0][0]+a+r,i.range[0][1]+l+e],[i.range[1][0]+a-t,i.range[1][1]+l-n]]}}else if(e.parentNode&&o&&e.dimensions.width&&e.dimensions.height){const e=function(e,t,n){const[o,i,r,a]="string"!=typeof e?nr(e.padding):[0,0,0,0];return!(!n||void 0===n.computedPosition.x||void 0===n.computedPosition.y||void 0===n.dimensions.width||void 0===n.dimensions.height)&&[[n.computedPosition.x+a,n.computedPosition.y+o],[n.computedPosition.x+n.dimensions.width-i,n.computedPosition.y+n.dimensions.height-r]]}(i,0,o);e&&(i=e)}else t(new dr(sr.NODE_EXTENT_INVALID,e.id)),i=n;return"parent"===i?[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]]:i}function ir(e,t,n,o,i){const r=_i(t,function({width:e,height:t},n){return[n[0],[n[1][0]-(e||0),n[1][1]-(t||0)]]}(e.dimensions,or(e,n,o,i)));return{position:{x:r.x-((null==i?void 0:i.computedPosition.x)||0),y:r.y-((null==i?void 0:i.computedPosition.y)||0)},computedPosition:r}}function rr(e,t,n=ei.Left,o=!1){const i=((null==t?void 0:t.x)??0)+e.computedPosition.x,r=((null==t?void 0:t.y)??0)+e.computedPosition.y,{width:a,height:l}=t??function(e){var t,n;return{width:(null==(t=e.dimensions)?void 0:t.width)??e.width??0,height:(null==(n=e.dimensions)?void 0:n.height)??e.height??0}}(e);if(o)return{x:i+a/2,y:r+l/2};switch((null==t?void 0:t.position)??n){case ei.Top:return{x:i+a/2,y:r};case ei.Right:return{x:i+a,y:r+l/2};case ei.Bottom:return{x:i+a/2,y:r+l};case ei.Left:return{x:i,y:r+l/2}}}function ar(e,t){return e&&(t?e.find(e=>e.id===t):e[0])||null}function lr({sourcePos:e,targetPos:t,sourceWidth:n,sourceHeight:o,targetWidth:i,targetHeight:r,width:a,height:l,viewport:u}){const s={x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x+n,t.x+i),y2:Math.max(e.y+o,t.y+r)};s.x===s.x2&&(s.x2+=1),s.y===s.y2&&(s.y2+=1);const c=Ti({x:(0-u.x)/u.zoom,y:(0-u.y)/u.zoom,width:a/u.zoom,height:l/u.zoom}),d=Math.max(0,Math.min(c.x2,s.x2)-Math.max(c.x,s.x)),h=Math.max(0,Math.min(c.y2,s.y2)-Math.max(c.y,s.y));return Math.ceil(d*h)>0}function ur(e,t,n=!1){const o="number"==typeof e.zIndex;let i=o?e.zIndex:0;const r=t(e.source),a=t(e.target);return r&&a?(n&&(i=o?e.zIndex:Math.max(r.computedPosition.z||0,a.computedPosition.z||0)),i):0}var sr=(e=>(e.MISSING_STYLES="MISSING_STYLES",e.MISSING_VIEWPORT_DIMENSIONS="MISSING_VIEWPORT_DIMENSIONS",e.NODE_INVALID="NODE_INVALID",e.NODE_NOT_FOUND="NODE_NOT_FOUND",e.NODE_MISSING_PARENT="NODE_MISSING_PARENT",e.NODE_TYPE_MISSING="NODE_TYPE_MISSING",e.NODE_EXTENT_INVALID="NODE_EXTENT_INVALID",e.EDGE_INVALID="EDGE_INVALID",e.EDGE_NOT_FOUND="EDGE_NOT_FOUND",e.EDGE_SOURCE_MISSING="EDGE_SOURCE_MISSING",e.EDGE_TARGET_MISSING="EDGE_TARGET_MISSING",e.EDGE_TYPE_MISSING="EDGE_TYPE_MISSING",e.EDGE_SOURCE_TARGET_SAME="EDGE_SOURCE_TARGET_SAME",e.EDGE_SOURCE_TARGET_MISSING="EDGE_SOURCE_TARGET_MISSING",e.EDGE_ORPHANED="EDGE_ORPHANED",e.USEVUEFLOW_OPTIONS="USEVUEFLOW_OPTIONS",e))(sr||{});const cr={MISSING_STYLES:()=>"It seems that you haven't loaded the necessary styles. Please import '@vue-flow/core/dist/style.css' to ensure that the graph is rendered correctly",MISSING_VIEWPORT_DIMENSIONS:()=>"The Vue Flow parent container needs a width and a height to render the graph",NODE_INVALID:e=>`Node is invalid\nNode: ${e}`,NODE_NOT_FOUND:e=>`Node not found\nNode: ${e}`,NODE_MISSING_PARENT:(e,t)=>`Node is missing a parent\nNode: ${e}\nParent: ${t}`,NODE_TYPE_MISSING:e=>`Node type is missing\nType: ${e}`,NODE_EXTENT_INVALID:e=>`Only child nodes can use a parent extent\nNode: ${e}`,EDGE_INVALID:e=>`An edge needs a source and a target\nEdge: ${e}`,EDGE_SOURCE_MISSING:(e,t)=>`Edge source is missing\nEdge: ${e} \nSource: ${t}`,EDGE_TARGET_MISSING:(e,t)=>`Edge target is missing\nEdge: ${e} \nTarget: ${t}`,EDGE_TYPE_MISSING:e=>`Edge type is missing\nType: ${e}`,EDGE_SOURCE_TARGET_SAME:(e,t,n)=>`Edge source and target are the same\nEdge: ${e} \nSource: ${t} \nTarget: ${n}`,EDGE_SOURCE_TARGET_MISSING:(e,t,n)=>`Edge source or target is missing\nEdge: ${e} \nSource: ${t} \nTarget: ${n}`,EDGE_ORPHANED:e=>`Edge was orphaned (suddenly missing source or target) and has been removed\nEdge: ${e}`,EDGE_NOT_FOUND:e=>`Edge not found\nEdge: ${e}`,
- // deprecation errors
- USEVUEFLOW_OPTIONS:()=>"The options parameter is deprecated and will be removed in the next major version. Please use the id parameter instead"};class dr extends Error{constructor(e,...t){var n;super(null==(n=cr[e])?void 0:n.call(cr,...t)),this.name="VueFlowError",this.code=e,this.args=t}}function hr(e){return"clientX"in e}function fr(e,t){let n,o;return hr(e)?(n=e.clientX,o=e.clientY):"touches"in e&&e.touches.length>0?(n=e.touches[0].clientX,o=e.touches[0].clientY):"changedTouches"in e&&e.changedTouches.length>0?(n=e.changedTouches[0].clientX,o=e.changedTouches[0].clientY):(n=0,o=0),{x:n-((null==t?void 0:t.left)??0),y:o-((null==t?void 0:t.top)??0)}}const vr=()=>{var e;return"undefined"!=typeof navigator&&(null==(e=null==navigator?void 0:navigator.userAgent)?void 0:e.indexOf("Mac"))>=0};function pr(e,t=[1,1]){return{x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}}const gr=()=>!0;function mr(e){null==e||e.classList.remove("valid","connecting","vue-flow__handle-valid","vue-flow__handle-connecting")}function yr(e,t,n,o){var i,r;let a=[],l=Number.POSITIVE_INFINITY;const u=function(e,t,n){const o=[],i={x:e.x-n,y:e.y-n,width:2*n,height:2*n};for(const r of t.values())mi(i,gi(r))>0&&o.push(r);return o}(e,n,t+250);for(const s of u){const n=[...(null==(i=s.handleBounds)?void 0:i.source)??[],...(null==(r=s.handleBounds)?void 0:r.target)??[]];for(const i of n){if(o.nodeId===i.nodeId&&o.type===i.type&&o.id===i.id)continue;const{x:n,y:r}=rr(s,i,i.position,!0),u=Math.sqrt((n-e.x)**2+(r-e.y)**2);u>t||(u<l?(a=[{...i,x:n,y:r}],l=u):u===l&&a.push({...i,x:n,y:r}))}}if(!a.length)return null;if(a.length>1){const e="source"===o.type?"target":"source";return a.find(t=>t.type===e)??a[0]}return a[0]}function wr(e,{handle:t,connectionMode:n,fromNodeId:o,fromHandleId:i,fromType:r,doc:a,lib:l,flowId:u,isValidConnection:s=gr},c,d,h,f){const v="target"===r,p=t?a.querySelector(`.${l}-flow__handle[data-id="${u}-${null==t?void 0:t.nodeId}-${null==t?void 0:t.id}-${null==t?void 0:t.type}"]`):null,{x:g,y:m}=fr(e),y=a.elementFromPoint(g,m),w=(null==y?void 0:y.classList.contains(`${l}-flow__handle`))?y:p,_={handleDomNode:w,isValid:!1,connection:null,toHandle:null};if(w){const e=_r(void 0,w),t=w.getAttribute("data-nodeid"),r=w.getAttribute("data-handleid"),a=w.classList.contains("connectable"),l=w.classList.contains("connectableend");if(!t||!e)return _;const u={source:v?t:o,sourceHandle:v?r:i,target:v?o:t,targetHandle:v?i:r};_.connection=u;const p=a&&l&&(n===oi.Strict?v&&"source"===e||!v&&"target"===e:t!==o||r!==i);_.isValid=p&&s(u,{nodes:d,edges:c,sourceNode:h(u.source),targetNode:h(u.target)}),_.toHandle=br(t,e,r,f,n,!0)}return _}function _r(e,t){return e||((null==t?void 0:t.classList.contains("target"))?"target":(null==t?void 0:t.classList.contains("source"))?"source":null)}function br(e,t,n,o,i,r=!1){var a,l,u;const s=o.get(e);if(!s)return null;const c=i===oi.Strict?null==(a=s.handleBounds)?void 0:a[t]:[...(null==(l=s.handleBounds)?void 0:l.source)??[],...(null==(u=s.handleBounds)?void 0:u.target)??[]],d=(n?null==c?void 0:c.find(e=>e.id===n):null==c?void 0:c[0])??null;return d&&r?{...d,...rr(s,d,d.position,!0)}:d}const xr={[ei.Left]:ei.Right,[ei.Right]:ei.Left,[ei.Top]:ei.Bottom,[ei.Bottom]:ei.Top},Er=["production","prod"];function Sr(e,...t){kr()}function kr(){return!Er.includes("production")}function Nr(e,t,n,o,i){const r=t.querySelectorAll(`.vue-flow__handle.${e}`);return(null==r?void 0:r.length)?Array.from(r).map(t=>{const r=t.getBoundingClientRect();return{id:t.getAttribute("data-handleid"),type:e,nodeId:i,position:t.getAttribute("data-handlepos"),x:(r.left-n.left)/o,y:(r.top-n.top)/o,...yi(t)}}):null}function Mr(e,t,n,o,i,r=!1,a){i.value=!1,e.selected?(r||e.selected&&t)&&(o([e]),E(()=>{a.blur()})):n([e])}function Cr(e){return void 0!==d(e)}function Ir(e,t,n,o){if(!e||!e.source||!e.target)return n(new dr(sr.EDGE_INVALID,(null==e?void 0:e.id)??"[ID UNKNOWN]")),!1;let i;return i=xi(e)?e:{...e,id:Ii(e)},i=Mi(i,void 0,o),!function(e,t){return t.some(t=>xi(t)&&t.source===e.source&&t.target===e.target&&(t.sourceHandle===e.sourceHandle||!t.sourceHandle&&!e.sourceHandle)&&(t.targetHandle===e.targetHandle||!t.targetHandle&&!e.targetHandle))}(i,t)&&i}function $r(e,t,n){const o={},i=[];for(let r=0;r<e.length;++r){const a=e[r];if(!Ei(a)){n(new dr(sr.NODE_INVALID,null==a?void 0:a.id)||`[ID UNKNOWN|INDEX ${r}]`);continue}const l=Ni(a,t(a.id),a.parentNode);a.parentNode&&(o[a.parentNode]=!0),i[r]=l}for(const r of i){const e=t(r.parentNode)||i.find(e=>e.id===r.parentNode);r.parentNode&&!e&&n(new dr(sr.NODE_MISSING_PARENT,r.id,r.parentNode)),(r.parentNode||o[r.id])&&(o[r.id]&&(r.isParent=!0),e&&(e.isParent=!0))}return i}function Ar(e,t,n,o,i,r){let a=i;const l=o.get(a)||new Map;o.set(a,l.set(n,t)),a=`${i}-${e}`;const u=o.get(a)||new Map;if(o.set(a,u.set(n,t)),r){a=`${i}-${e}-${r}`;const l=o.get(a)||new Map;o.set(a,l.set(n,t))}}function Pr(e,t,n){e.clear();for(const o of n){const{source:t,target:n,sourceHandle:i=null,targetHandle:r=null}=o,a={edgeId:o.id,source:t,target:n,sourceHandle:i,targetHandle:r},l=`${t}-${i}--${n}-${r}`;Ar("source",a,`${n}-${r}--${t}-${i}`,e,t,i),Ar("target",a,l,e,n,r)}}function Tr(e,t){if(e.size!==t.size)return!1;for(const n of e)if(!t.has(n))return!1;return!0}function zr(e,t,n,o,i,r,a,l){const u=[];for(const s of e){const e=xi(s)?s:Ir(s,l,i,r);if(!e)continue;const c=n(e.source),d=n(e.target);if(!c||!d){i(new dr(sr.EDGE_SOURCE_TARGET_MISSING,e.id,e.source,e.target));continue}if(!c){i(new dr(sr.EDGE_SOURCE_MISSING,e.id,e.source));continue}if(!d){i(new dr(sr.EDGE_TARGET_MISSING,e.id,e.target));continue}if(t){if(!t(e,{edges:l,nodes:a,sourceNode:c,targetNode:d})){i(new dr(sr.EDGE_INVALID,e.id));continue}}const h=o(e.id);u.push({...Mi(e,h,r),sourceNode:c,targetNode:d})}return u}const Dr=Symbol("vueFlow"),Or=Symbol("nodeId"),Br=Symbol("nodeRef"),Rr=Symbol("edgeId"),Vr=Symbol("edgeRef"),Lr=Symbol("slots");function Hr(e){const{vueFlowRef:t,snapToGrid:o,snapGrid:i,noDragClassName:r,nodeLookup:a,nodeExtent:l,nodeDragThreshold:u,viewport:s,autoPanOnNodeDrag:c,autoPanSpeed:d,nodesDraggable:h,panBy:f,findNode:v,multiSelectionActive:p,nodesSelectionActive:g,selectNodesOnDrag:m,removeSelectedElements:y,addSelectedNodes:w,updateNodePositions:_,emits:b}=Ba(),{onStart:x,onDrag:E,onStop:S,onClick:k,el:N,disabled:M,id:C,selectable:$,dragHandle:A}=e,P=I(!1);let T,z=[],D=null,O={x:void 0,y:void 0},B={x:0,y:0},R=null,L=!1,H=!1,Y=0,X=!1;const G=function(){const{viewport:e,snapGrid:t,snapToGrid:n,vueFlowRef:o}=Ba();return i=>{var r;const a=(null==(r=o.value)?void 0:r.getBoundingClientRect())??{left:0,top:0},l=function(e){return"sourceEvent"in e}(i)?i.sourceEvent:i,{x:u,y:s}=fr(l,a),c=Ai({x:u,y:s},e.value),{x:d,y:h}=n.value?pr(c,t.value):c;return{xSnapped:d,ySnapped:h,...c}}}(),F=({x:e,y:t})=>{O={x:e,y:t};let n=!1;if(z=z.map(r=>{const a={x:e-r.distance.x,y:t-r.distance.y},{computedPosition:u}=ir(r,o.value?pr(a,i.value):a,b.error,l.value,r.parentNode?v(r.parentNode):void 0);return n=n||r.position.x!==u.x||r.position.y!==u.y,r.position=u,r}),H=H||n,n&&(_(z,!0,!0),P.value=!0,R)){const[e,t]=tr({id:C,dragItems:z,findNode:v});E({event:R,node:e,nodes:t})}},U=()=>{if(!D)return;const[e,t]=Gi(B,D,d.value);if(0!==e||0!==t){const n={x:(O.x??0)-e/s.value.zoom,y:(O.y??0)-t/s.value.zoom};f({x:e,y:t})&&F(n)}Y=requestAnimationFrame(U)},j=(e,t)=>{L=!0;const n=v(C);m.value||p.value||!n||n.selected||y(),n&&V($)&&m.value&&Mr(n,p.value,w,y,g,!1,t);const o=G(e.sourceEvent);if(O=o,z=function(e,t,n,o){var i,r;const a=new Map;for(const[l,u]of e)!u.selected&&u.id!==o||u.parentNode&&Li(u,e)||!(u.draggable||t&&void 0===u.draggable)||e.get(l)&&a.set(l,{id:u.id,position:u.position||{x:0,y:0},distance:{x:n.x-(null==(i=u.computedPosition)?void 0:i.x)||0,y:n.y-(null==(r=u.computedPosition)?void 0:r.y)||0},from:{x:u.computedPosition.x,y:u.computedPosition.y},extent:u.extent,parentNode:u.parentNode,dimensions:{...u.dimensions},expandParent:u.expandParent});return Array.from(a.values())}(a.value,h.value,o,C),z.length){const[t,n]=tr({id:C,dragItems:z,findNode:v});x({event:e.sourceEvent,node:t,nodes:n})}};return n([()=>V(M),N],([e,n],o,i)=>{if(n){const o=It(n);e||(T=function(){var e,t,n,o,i=Vt,r=Lt,a=Ht,l=Yt,u={},s=fe("start","drag","end"),c=0,d=0;function h(e){e.on("mousedown.drag",f).filter(l).on("touchstart.drag",g).on("touchmove.drag",m,At).on("touchend.drag touchcancel.drag",y).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(a,l){if(!o&&i.call(this,a,l)){var u=w(this,r.call(this,a,l),a,l,"mouse");u&&(It(a.view).on("mousemove.drag",v,Pt).on("mouseup.drag",p,Pt),Dt(a.view),Tt(a),n=!1,e=a.clientX,t=a.clientY,u("start",a))}}function v(o){if(zt(o),!n){var i=o.clientX-e,r=o.clientY-t;n=i*i+r*r>d}u.mouse("drag",o)}function p(e){It(e.view).on("mousemove.drag mouseup.drag",null),Ot(e.view,n),zt(e),u.mouse("end",e)}function g(e,t){if(i.call(this,e,t)){var n,o,a=e.changedTouches,l=r.call(this,e,t),u=a.length;for(n=0;n<u;++n)(o=w(this,l,e,t,a[n].identifier,a[n]))&&(Tt(e),o("start",e,a[n]))}}function m(e){var t,n,o=e.changedTouches,i=o.length;for(t=0;t<i;++t)(n=u[o[t].identifier])&&(zt(e),n("drag",e,o[t]))}function y(e){var t,n,i=e.changedTouches,r=i.length;for(o&&clearTimeout(o),o=setTimeout(function(){o=null},500),t=0;t<r;++t)(n=u[i[t].identifier])&&(Tt(e),n("end",e,i[t]))}function w(e,t,n,o,i,r){var l,d,f,v=s.copy(),p=$t(r||n,t);if(null!=(f=a.call(e,new Rt("beforestart",{sourceEvent:n,target:h,identifier:i,active:c,x:p[0],y:p[1],dx:0,dy:0,dispatch:v}),o)))return l=f.x-p[0]||0,d=f.y-p[1]||0,function n(r,a,s){var g,m=p;switch(r){case"start":u[i]=n,g=c++;break;case"end":delete u[i],--c;case"drag":p=$t(s||a,t),g=c}v.call(r,e,new Rt(r,{sourceEvent:a,subject:f,target:h,identifier:i,active:g,x:p[0]+l,y:p[1]+d,dx:p[0]-m[0],dy:p[1]-m[1],dispatch:v}),o)}}return h.filter=function(e){return arguments.length?(i="function"==typeof e?e:Bt(!!e),h):i},h.container=function(e){return arguments.length?(r="function"==typeof e?e:Bt(e),h):r},h.subject=function(e){return arguments.length?(a="function"==typeof e?e:Bt(e),h):a},h.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Bt(!!e),h):l},h.on=function(){var e=s.on.apply(s,arguments);return e===s?h:e},h.clickDistance=function(e){return arguments.length?(d=(e=+e)*e,h):Math.sqrt(d)},h}().on("start",e=>((e,n)=>{var o;"touchmove"===e.sourceEvent.type&&e.sourceEvent.touches.length>1||(H=!1,0===u.value&&j(e,n),O=G(e.sourceEvent),D=(null==(o=t.value)?void 0:o.getBoundingClientRect())||null,B=fr(e.sourceEvent,D))})(e,n)).on("drag",e=>((e,t)=>{const n=G(e.sourceEvent);if(!X&&L&&c.value&&(X=!0,U()),!L){const o=n.xSnapped-(O.x??0),i=n.ySnapped-(O.y??0);Math.sqrt(o*o+i*i)>u.value&&j(e,t)}(O.x!==n.xSnapped||O.y!==n.ySnapped)&&z.length&&L&&(R=e.sourceEvent,B=fr(e.sourceEvent,D),F(n))})(e,n)).on("end",e=>(e=>{let t=!1;if(!L&&!P.value&&!p.value){const n=e.sourceEvent,o=G(n),i=o.xSnapped-(O.x??0),r=o.ySnapped-(O.y??0),a=Math.sqrt(i*i+r*r);0!==a&&a<=u.value&&(null==k||k(n),t=!0)}if(z.length&&!t){H&&(_(z,!1,!1),H=!1);const[t,n]=tr({id:C,dragItems:z,findNode:v});S({event:e.sourceEvent,node:t,nodes:n})}z=[],P.value=!1,X=!1,L=!1,O={x:void 0,y:void 0},cancelAnimationFrame(Y)})(e)).filter(e=>{const t=e.target,o=V(A);return!e.button&&(!r.value||!er(t,`.${r.value}`,n)&&(!o||er(t,o,n)))}),o.call(T)),i(()=>{o.on(".drag",null),T&&(T.on("start",null),T.on("drag",null),T.on("end",null))})}}),P}function Yr(e,t){const n={doubleClick:Qi(),click:Qi(),mouseEnter:Qi(),mouseMove:Qi(),mouseLeave:Qi(),contextMenu:Qi(),updateStart:Qi(),update:Qi(),updateEnd:Qi()};return n.doubleClick.on(n=>{var o,i;t.edgeDoubleClick(n),null==(i=null==(o=e.events)?void 0:o.doubleClick)||i.call(o,n)}),n.click.on(n=>{var o,i;t.edgeClick(n),null==(i=null==(o=e.events)?void 0:o.click)||i.call(o,n)}),n.mouseEnter.on(n=>{var o,i;t.edgeMouseEnter(n),null==(i=null==(o=e.events)?void 0:o.mouseEnter)||i.call(o,n)}),n.mouseMove.on(n=>{var o,i;t.edgeMouseMove(n),null==(i=null==(o=e.events)?void 0:o.mouseMove)||i.call(o,n)}),n.mouseLeave.on(n=>{var o,i;t.edgeMouseLeave(n),null==(i=null==(o=e.events)?void 0:o.mouseLeave)||i.call(o,n)}),n.contextMenu.on(n=>{var o,i;t.edgeContextMenu(n),null==(i=null==(o=e.events)?void 0:o.contextMenu)||i.call(o,n)}),n.updateStart.on(n=>{var o,i;t.edgeUpdateStart(n),null==(i=null==(o=e.events)?void 0:o.updateStart)||i.call(o,n)}),n.update.on(n=>{var o,i;t.edgeUpdate(n),null==(i=null==(o=e.events)?void 0:o.update)||i.call(o,n)}),n.updateEnd.on(n=>{var o,i;t.edgeUpdateEnd(n),null==(i=null==(o=e.events)?void 0:o.updateEnd)||i.call(o,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function Xr(){return!0}function Gr({handleId:e,nodeId:t,type:n,isValidConnection:o,edgeUpdaterType:i,onEdgeUpdate:r,onEdgeUpdateEnd:a}){const{id:l,vueFlowRef:u,connectionMode:s,connectionRadius:c,connectOnClick:d,connectionClickStartHandle:h,nodesConnectable:f,autoPanOnConnect:v,autoPanSpeed:p,findNode:g,panBy:m,startConnection:y,updateConnection:w,endConnection:_,emits:b,viewport:x,edges:E,nodes:S,isValidConnection:k,nodeLookup:N}=Ba();let M=null,C=!1,I=null;return{handlePointerDown:function(d){var h;const f="target"===V(n),$=hr(d),A=bi(d.target),P=d.currentTarget;if(P&&($&&0===d.button||!$)){let n=function(n){G=fr(n,H),z=yr(Ai(G,x.value,!1,[1,1]),c.value,N.value,j),F||(U(),F=!0);const o=wr(n,{handle:z,connectionMode:s.value,fromNodeId:V(t),fromHandleId:V(e),fromType:f?"target":"source",isValidConnection:D,doc:A,lib:"vue",flowId:l,nodeLookup:N.value},E.value,S.value,g,N.value);I=o.handleDomNode,M=o.connection,C=function(e,t){let n=null;return t?n=!0:e&&!t&&(n=!1),n}(!!z,o.isValid);const i={
- // from stays the same
- ...W,isValid:C,to:o.toHandle&&C?$i({x:o.toHandle.x,y:o.toHandle.y},x.value):G,toHandle:o.toHandle,toPosition:C&&o.toHandle?o.toHandle.position:xr[j.position],toNode:o.toHandle?N.value.get(o.toHandle.nodeId):null};if(C&&z&&(null==W?void 0:W.toHandle)&&i.toHandle&&W.toHandle.type===i.toHandle.type&&W.toHandle.nodeId===i.toHandle.nodeId&&W.toHandle.id===i.toHandle.id&&W.to.x===i.to.x&&W.to.y===i.to.y)return;const r=z??o.toHandle;if(w(r&&C?$i({x:r.x,y:r.y},x.value):G,r,function(e,t){let n=null;return t?n="valid":e&&!t&&(n="invalid"),n}(!!r,C)),W=i,!z&&!C&&!I)return mr(X);M&&M.source!==M.target&&I&&(mr(X),X=I,I.classList.add("connecting","vue-flow__handle-connecting"),I.classList.toggle("valid",!!C),I.classList.toggle("vue-flow__handle-valid",!!C))},$=function(e){"touches"in e&&e.touches.length>0||((z||I)&&M&&C&&(r?r(e,M):b.connect(M)),b.connectEnd(e),i&&(null==a||a(e)),mr(X),cancelAnimationFrame(O),_(e),F=!1,C=!1,M=null,I=null,A.removeEventListener("mousemove",n),A.removeEventListener("mouseup",$),A.removeEventListener("touchmove",n),A.removeEventListener("touchend",$))};const T=g(V(t));let z,D=V(o)||k.value||Xr;!D&&T&&(D=(f?T.isValidSourcePos:T.isValidTargetPos)||Xr);let O=0;const{x:B,y:R}=fr(d),L=_r(V(i),P),H=null==(h=u.value)?void 0:h.getBoundingClientRect();if(!H||!L)return;const Y=br(V(t),L,V(e),N.value,s.value);if(!Y)return;let X,G=fr(d,H),F=!1;const U=()=>{if(!v.value)return;const[e,t]=Gi(G,H,p.value);m({x:e,y:t}),O=requestAnimationFrame(U)},j={...Y,nodeId:V(t),type:L,position:Y.position},Z=N.value.get(V(t)),q={inProgress:!0,isValid:null,from:rr(Z,j,ei.Left,!0),fromHandle:j,fromPosition:j.position,fromNode:Z,to:G,toHandle:null,toPosition:xr[j.position],toNode:null};y({nodeId:V(t),id:V(e),type:L,position:(null==P?void 0:P.getAttribute("data-handlepos"))||ei.Top,...G},{x:B-H.left,y:R-H.top}),b.connectStart({event:d,nodeId:V(t),handleId:V(e),handleType:L});let W=q;A.addEventListener("mousemove",n),A.addEventListener("mouseup",$),A.addEventListener("touchmove",n),A.addEventListener("touchend",$)}},handleClick:function(i){var r,a;if(!d.value)return;const u="target"===V(n);if(!h.value)return b.clickConnectStart({event:i,nodeId:V(t),handleId:V(e)}),void y({nodeId:V(t),type:V(n),id:V(e),position:ei.Top,...fr(i)},void 0,!0);let c=V(o)||k.value||Xr;const v=g(V(t));if(!c&&v&&(c=(u?v.isValidSourcePos:v.isValidTargetPos)||Xr),v&&!1===(void 0===v.connectable?f.value:v.connectable))return;const p=bi(i.target),m=wr(i,{handle:{nodeId:V(t),id:V(e),type:V(n),position:ei.Top,...fr(i)},connectionMode:s.value,fromNodeId:h.value.nodeId,fromHandleId:h.value.id??null,fromType:h.value.type,isValidConnection:c,doc:p,lib:"vue",flowId:l,nodeLookup:N.value},E.value,S.value,g,N.value),w=(null==(r=m.connection)?void 0:r.source)===(null==(a=m.connection)?void 0:a.target);m.isValid&&m.connection&&!w&&b.connect(m.connection),b.clickConnectEnd(i),_(i,!0)}}}function Fr(t){const n=t??e(Or,"")??"",o=e(Br,C(null)),{findNode:i,edges:r,emits:a}=Ba(),l=i(n);return l||a.error(new dr(sr.NODE_NOT_FOUND,n)),{id:n,nodeEl:o,node:l,parentNode:v(()=>i(l.parentNode)),connectedEdges:v(()=>Bi([l],r.value))}}function Ur(e,t){const n={doubleClick:Qi(),click:Qi(),mouseEnter:Qi(),mouseMove:Qi(),mouseLeave:Qi(),contextMenu:Qi(),dragStart:Qi(),drag:Qi(),dragStop:Qi()};return n.doubleClick.on(n=>{var o,i;t.nodeDoubleClick(n),null==(i=null==(o=e.events)?void 0:o.doubleClick)||i.call(o,n)}),n.click.on(n=>{var o,i;t.nodeClick(n),null==(i=null==(o=e.events)?void 0:o.click)||i.call(o,n)}),n.mouseEnter.on(n=>{var o,i;t.nodeMouseEnter(n),null==(i=null==(o=e.events)?void 0:o.mouseEnter)||i.call(o,n)}),n.mouseMove.on(n=>{var o,i;t.nodeMouseMove(n),null==(i=null==(o=e.events)?void 0:o.mouseMove)||i.call(o,n)}),n.mouseLeave.on(n=>{var o,i;t.nodeMouseLeave(n),null==(i=null==(o=e.events)?void 0:o.mouseLeave)||i.call(o,n)}),n.contextMenu.on(n=>{var o,i;t.nodeContextMenu(n),null==(i=null==(o=e.events)?void 0:o.contextMenu)||i.call(o,n)}),n.dragStart.on(n=>{var o,i;t.nodeDragStart(n),null==(i=null==(o=e.events)?void 0:o.dragStart)||i.call(o,n)}),n.drag.on(n=>{var o,i;t.nodeDrag(n),null==(i=null==(o=e.events)?void 0:o.drag)||i.call(o,n)}),n.dragStop.on(n=>{var o,i;t.nodeDragStop(n),null==(i=null==(o=e.events)?void 0:o.dragStop)||i.call(o,n)}),Object.entries(n).reduce((e,[t,n])=>(e.emit[t]=n.trigger,e.on[t]=n.on,e),{emit:{},on:{}})}function jr(){const{getSelectedNodes:e,nodeExtent:t,updateNodePositions:n,findNode:o,snapGrid:i,snapToGrid:r,nodesDraggable:a,emits:l}=Ba();return(u,s=!1)=>{const c=r.value?i.value[0]:5,d=r.value?i.value[1]:5,h=s?4:1,f=u.x*c*h,v=u.y*d*h,p=[];for(const n of e.value)if(n.draggable||a&&void 0===n.draggable){const e={x:n.computedPosition.x+f,y:n.computedPosition.y+v},{position:i}=ir(n,e,l.error,t.value,n.parentNode?o(n.parentNode):void 0);p.push({id:n.id,position:i,from:n.position,distance:{x:u.x,y:u.y},dimensions:n.dimensions})}n(p,!0,!1)}}const Zr=.1,qr=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2;function Wr(){return Sr(),Promise.resolve(!1)}const Kr={zoomIn:Wr,zoomOut:Wr,zoomTo:Wr,fitView:Wr,setCenter:Wr,fitBounds:Wr,project:e=>e,screenToFlowCoordinate:e=>e,flowToScreenCoordinate:e=>e,setViewport:Wr,setTransform:Wr,getViewport:()=>({x:0,y:0,zoom:1}),getTransform:()=>({x:0,y:0,zoom:1}),viewportInitialized:!1};function Jr(e,t=0,n=qr,o=()=>{}){const i="number"==typeof t&&t>0;return i||o(),i?e.transition().duration(t).ease(n).on("end",o):e}function Qr(e,o,i){const r=t(!0);return r.run(()=>{r.run(()=>{let t,n,o=!(!i.nodes.value.length&&!i.edges.value.length);t=oe([e.modelValue,()=>{var t,n;return null==(n=null==(t=e.modelValue)?void 0:t.value)?void 0:n.length}],([e])=>{e&&Array.isArray(e)&&(null==n||n.pause(),i.setElements(e),n||o||!e.length?null==n||n.resume():o=!0)}),n=oe([i.nodes,i.edges,()=>i.edges.value.length,()=>i.nodes.value.length],([n,o])=>{var i;(null==(i=e.modelValue)?void 0:i.value)&&Array.isArray(e.modelValue.value)&&(null==t||t.pause(),e.modelValue.value=[...n,...o],E(()=>{null==t||t.resume()}))},{immediate:o}),m(()=>{null==t||t.stop(),null==n||n.stop()})}),r.run(()=>{let t,n,o=!!i.nodes.value.length;t=oe([e.nodes,()=>{var t,n;return null==(n=null==(t=e.nodes)?void 0:t.value)?void 0:n.length}],([e])=>{e&&Array.isArray(e)&&(null==n||n.pause(),i.setNodes(e),n||o||!e.length?null==n||n.resume():o=!0)}),n=oe([i.nodes,()=>i.nodes.value.length],([n])=>{var o;(null==(o=e.nodes)?void 0:o.value)&&Array.isArray(e.nodes.value)&&(null==t||t.pause(),e.nodes.value=[...n],E(()=>{null==t||t.resume()}))},{immediate:o}),m(()=>{null==t||t.stop(),null==n||n.stop()})}),r.run(()=>{let t,n,o=!!i.edges.value.length;t=oe([e.edges,()=>{var t,n;return null==(n=null==(t=e.edges)?void 0:t.value)?void 0:n.length}],([e])=>{e&&Array.isArray(e)&&(null==n||n.pause(),i.setEdges(e),n||o||!e.length?null==n||n.resume():o=!0)}),n=oe([i.edges,()=>i.edges.value.length],([n])=>{var o;(null==(o=e.edges)?void 0:o.value)&&Array.isArray(e.edges.value)&&(null==t||t.pause(),e.edges.value=[...n],E(()=>{null==t||t.resume()}))},{immediate:o}),m(()=>{null==t||t.stop(),null==n||n.stop()})}),r.run(()=>{n(()=>o.minZoom,()=>{o.minZoom&&Cr(o.minZoom)&&i.setMinZoom(o.minZoom)},{immediate:!0})}),r.run(()=>{n(()=>o.maxZoom,()=>{o.maxZoom&&Cr(o.maxZoom)&&i.setMaxZoom(o.maxZoom)},{immediate:!0})}),r.run(()=>{n(()=>o.translateExtent,()=>{o.translateExtent&&Cr(o.translateExtent)&&i.setTranslateExtent(o.translateExtent)},{immediate:!0})}),r.run(()=>{n(()=>o.nodeExtent,()=>{o.nodeExtent&&Cr(o.nodeExtent)&&i.setNodeExtent(o.nodeExtent)},{immediate:!0})}),r.run(()=>{n(()=>o.applyDefault,()=>{Cr(o.applyDefault)&&(i.applyDefault.value=o.applyDefault)},{immediate:!0})}),r.run(()=>{const e=async e=>{let t=e;"function"==typeof o.autoConnect&&(t=await o.autoConnect(e)),!1!==t&&i.addEdges([t])};n(()=>o.autoConnect,()=>{Cr(o.autoConnect)&&(i.autoConnect.value=o.autoConnect)},{immediate:!0}),n(i.autoConnect,(t,n,o)=>{t?i.onConnect(e):i.hooks.value.connect.off(e),o(()=>{i.hooks.value.connect.off(e)})},{immediate:!0})}),(()=>{const e=["id","modelValue","translateExtent","nodeExtent","edges","nodes","maxZoom","minZoom","applyDefault","autoConnect"];for(const t of Object.keys(o)){const a=t;if(!e.includes(a)){const e=$(()=>o[a]),t=i[a];z(t)&&r.run(()=>{n(e,e=>{Cr(e)&&(t.value=e)},{immediate:!0})})}}})()}),()=>r.stop()}function ea(){return{vueFlowRef:null,viewportRef:null,nodes:[],edges:[],connectionLookup:new Map,nodeTypes:{},edgeTypes:{},initialized:!1,dimensions:{width:0,height:0},viewport:{x:0,y:0,zoom:1},d3Zoom:null,d3Selection:null,d3ZoomHandler:null,minZoom:.5,maxZoom:2,translateExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],nodeExtent:[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],selectionMode:ti.Full,paneDragging:!1,preventScrolling:!0,zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!0,panOnScroll:!1,panOnScrollSpeed:.5,panOnScrollMode:ri.Free,paneClickDistance:0,panOnDrag:!0,edgeUpdaterRadius:10,onlyRenderVisibleElements:!1,defaultViewport:{x:0,y:0,zoom:1},nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,defaultMarkerColor:"#b1b1b7",connectionLineStyle:{},connectionLineType:null,connectionLineOptions:{type:ni.Bezier,style:{}},connectionMode:oi.Loose,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectionPosition:{x:Number.NaN,y:Number.NaN},connectionRadius:20,connectOnClick:!0,connectionStatus:null,isValidConnection:null,snapGrid:[15,15],snapToGrid:!1,edgesUpdatable:!1,edgesFocusable:!0,nodesFocusable:!0,nodesConnectable:!0,nodesDraggable:!0,nodeDragThreshold:1,elementsSelectable:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,selectionKeyCode:"Shift",multiSelectionKeyCode:vr()?"Meta":"Control",zoomActivationKeyCode:vr()?"Meta":"Control",deleteKeyCode:"Backspace",panActivationKeyCode:"Space",hooks:{edgesChange:Qi(),nodesChange:Qi(),nodeDoubleClick:Qi(),nodeClick:Qi(),nodeMouseEnter:Qi(),nodeMouseMove:Qi(),nodeMouseLeave:Qi(),nodeContextMenu:Qi(),nodeDragStart:Qi(),nodeDrag:Qi(),nodeDragStop:Qi(),nodesInitialized:Qi(),miniMapNodeClick:Qi(),miniMapNodeDoubleClick:Qi(),miniMapNodeMouseEnter:Qi(),miniMapNodeMouseMove:Qi(),miniMapNodeMouseLeave:Qi(),connect:Qi(),connectStart:Qi(),connectEnd:Qi(),clickConnectStart:Qi(),clickConnectEnd:Qi(),paneReady:Qi(),init:Qi(),move:Qi(),moveStart:Qi(),moveEnd:Qi(),selectionDragStart:Qi(),selectionDrag:Qi(),selectionDragStop:Qi(),selectionContextMenu:Qi(),selectionStart:Qi(),selectionEnd:Qi(),viewportChangeStart:Qi(),viewportChange:Qi(),viewportChangeEnd:Qi(),paneScroll:Qi(),paneClick:Qi(),paneContextMenu:Qi(),paneMouseEnter:Qi(),paneMouseMove:Qi(),paneMouseLeave:Qi(),edgeContextMenu:Qi(),edgeMouseEnter:Qi(),edgeMouseMove:Qi(),edgeMouseLeave:Qi(),edgeDoubleClick:Qi(),edgeClick:Qi(),edgeUpdateStart:Qi(),edgeUpdate:Qi(),edgeUpdateEnd:Qi(),updateNodeInternals:Qi(),error:Qi(e=>Sr(e.message))},applyDefault:!0,autoConnect:!1,fitViewOnInit:!1,fitViewOnInitDone:!1,noDragClassName:"nodrag",noWheelClassName:"nowheel",noPanClassName:"nopan",defaultEdgeOptions:void 0,elevateEdgesOnSelect:!1,elevateNodesOnSelect:!0,autoPanOnNodeDrag:!0,autoPanOnConnect:!0,autoPanSpeed:15,disableKeyboardA11y:!1,ariaLiveMessage:""}}const ta=["id","vueFlowRef","viewportRef","initialized","modelValue","nodes","edges","maxZoom","minZoom","translateExtent","hooks","defaultEdgeOptions"];function na(e,t,n){const o=function(e){function t(t,n){return new Promise(o=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate("linear"===(null==n?void 0:n.interpolate)?On:Fn).scaleBy(Jr(e.d3Selection,null==n?void 0:n.duration,null==n?void 0:n.ease,()=>{o(!0)}),t):o(!1)})}function n(t,n,o,i){return new Promise(r=>{var a;const{x:l,y:u}=_i({x:-t,y:-n},e.translateExtent),s=Fo.translate(-l,-u).scale(o);e.d3Selection&&e.d3Zoom?null==(a=e.d3Zoom)||a.interpolate("linear"===(null==i?void 0:i.interpolate)?On:Fn).transform(Jr(e.d3Selection,null==i?void 0:i.duration,null==i?void 0:i.ease,()=>{r(!0)}),s):r(!1)})}return v(()=>e.d3Zoom&&e.d3Selection&&e.dimensions.width&&e.dimensions.height?{viewportInitialized:!0,
- // todo: allow passing scale as option
- zoomIn:e=>t(1.2,e),zoomOut:e=>t(1/1.2,e),zoomTo:(t,n)=>new Promise(o=>{e.d3Selection&&e.d3Zoom?e.d3Zoom.interpolate("linear"===(null==n?void 0:n.interpolate)?On:Fn).scaleTo(Jr(e.d3Selection,null==n?void 0:n.duration,null==n?void 0:n.ease,()=>{o(!0)}),t):o(!1)}),setViewport:(e,t)=>n(e.x,e.y,e.zoom,t),setTransform:(e,t)=>n(e.x,e.y,e.zoom,t),getViewport:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),getTransform:()=>({x:e.viewport.x,y:e.viewport.y,zoom:e.viewport.zoom}),fitView:(t={padding:Zr,includeHiddenNodes:!1,duration:0})=>{var o,i;const r=[];for(const n of e.nodes)n.dimensions.width&&n.dimensions.height&&((null==t?void 0:t.includeHiddenNodes)||!n.hidden)&&(!(null==(o=t.nodes)?void 0:o.length)||(null==(i=t.nodes)?void 0:i.length)&&t.nodes.includes(n.id))&&r.push(n);if(!r.length)return Promise.resolve(!1);const a=Di(r),{x:l,y:u,zoom:s}=Vi(a,e.dimensions.width,e.dimensions.height,t.minZoom??e.minZoom,t.maxZoom??e.maxZoom,t.padding??Zr);return n(l,u,s,t)},setCenter:(t,o,i)=>{const r=void 0!==(null==i?void 0:i.zoom)?i.zoom:e.maxZoom;return n(e.dimensions.width/2-t*r,e.dimensions.height/2-o*r,r,i)},fitBounds:(t,o={padding:Zr})=>{const{x:i,y:r,zoom:a}=Vi(t,e.dimensions.width,e.dimensions.height,e.minZoom,e.maxZoom,o.padding??Zr);return n(i,r,a,o)},project:t=>Ai(t,e.viewport,e.snapToGrid,e.snapGrid),screenToFlowCoordinate:t=>{if(e.vueFlowRef){const{x:n,y:o}=e.vueFlowRef.getBoundingClientRect();return Ai({x:t.x-n,y:t.y-o},e.viewport,e.snapToGrid,e.snapGrid)}return{x:0,y:0}},flowToScreenCoordinate:t=>{if(e.vueFlowRef){const{x:n,y:o}=e.vueFlowRef.getBoundingClientRect();return $i({x:t.x+n,y:t.y+o},e.viewport)}return{x:0,y:0}}}:Kr)}(e),i=t=>{const n=t??[];e.hooks.updateNodeInternals.trigger(n)},r=t=>Bi(t,e.edges),a=e=>{if(e)return t.value.get(e)},l=e=>{if(e)return n.value.get(e)},u=(o,i)=>{const r=new Set,a=new Set;for(const e of o)Ei(e)?r.add(e.id):xi(e)&&a.add(e.id);const l=Ki(t.value,r,!0),u=Ki(n.value,a);if(e.multiSelectionActive){for(const e of r)l.push(ji(e,i));for(const e of a)u.push(ji(e,i))}l.length&&e.hooks.nodesChange.trigger(l),u.length&&e.hooks.edgesChange.trigger(u)},s=t=>{var n;null==(n=e.d3Zoom)||n.scaleExtent([t,e.maxZoom]),e.minZoom=t},c=t=>{var n;null==(n=e.d3Zoom)||n.scaleExtent([e.minZoom,t]),e.maxZoom=t},d=t=>{var n;null==(n=e.d3Zoom)||n.translateExtent(t),e.translateExtent=t},h=t=>{const n=t instanceof Function?t(e.nodes):t;(e.initialized||n.length)&&(e.nodes=$r(n,a,e.hooks.error.trigger))},f=t=>{const o=t instanceof Function?t(e.edges):t;if(!e.initialized&&!o.length)return;const i=zr(o,e.isValidConnection,a,l,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);Pr(e.connectionLookup,n.value,i),e.edges=i},p=t=>{const n=t instanceof Function?t([...e.nodes,...e.edges]):t;(e.initialized||n.length)&&(h(n.filter(Ei)),f(n.filter(xi)))},g=e=>{const t=ki((n=e).width)&&ki(n.height)&&ki(n.x)&&ki(n.y);var n;const o=t?null:Si(e)?e:a(e.id);if(!t&&!o)return[null,null,t];return[t?e:gi(o),o,t]},m=t=>{const n=t instanceof Function?t(e):t,o=["d3Zoom","d3Selection","d3ZoomHandler","viewportRef","vueFlowRef","dimensions","hooks"];Cr(n.defaultEdgeOptions)&&(e.defaultEdgeOptions=n.defaultEdgeOptions);const i=n.modelValue||n.nodes||n.edges?[]:void 0;i&&(n.modelValue&&i.push(...n.modelValue),n.nodes&&i.push(...n.nodes),n.edges&&i.push(...n.edges),p(i));for(const r of Object.keys(n)){const t=r,i=n[t];![...ta,...o].includes(t)&&Cr(i)&&(e[t]=i)}ae(()=>e.d3Zoom).not.toBeNull().then(()=>{Cr(n.maxZoom)&&c(n.maxZoom),Cr(n.minZoom)&&s(n.minZoom),Cr(n.translateExtent)&&d(n.translateExtent)}),e.initialized||(e.initialized=!0)};return{updateNodePositions:(t,n,o)=>{var i,r;const l=[];for(const e of t){const t={id:e.id,type:"position",dragging:o,from:e.from};if(n&&(t.position=e.position,e.parentNode)){const n=a(e.parentNode);t.position={x:t.position.x-((null==(i=null==n?void 0:n.computedPosition)?void 0:i.x)??0),y:t.position.y-((null==(r=null==n?void 0:n.computedPosition)?void 0:r.y)??0)}}l.push(t)}(null==l?void 0:l.length)&&e.hooks.nodesChange.trigger(l)},updateNodeDimensions:t=>{if(!e.vueFlowRef)return;const n=e.vueFlowRef.querySelector(".vue-flow__transformationpane");if(!n)return;const i=window.getComputedStyle(n),{m22:r}=new window.DOMMatrixReadOnly(i.transform),l=[];for(const e of t){const t=e,n=a(t.id);if(n){const e=yi(t.nodeElement);if(!(!e.width||!e.height||n.dimensions.width===e.width&&n.dimensions.height===e.height&&!t.forceUpdate)){const o=t.nodeElement.getBoundingClientRect();n.dimensions=e,n.handleBounds.source=Nr("source",t.nodeElement,o,r,n.id),n.handleBounds.target=Nr("target",t.nodeElement,o,r,n.id),l.push({id:n.id,type:"dimensions",dimensions:e})}}}!e.fitViewOnInitDone&&e.fitViewOnInit&&o.value.fitView().then(()=>{e.fitViewOnInitDone=!0}),l.length&&e.hooks.nodesChange.trigger(l)},setElements:p,setNodes:h,setEdges:f,addNodes:t=>{let n=t instanceof Function?t(e.nodes):t;n=Array.isArray(n)?n:[n];const o=$r(n,a,e.hooks.error.trigger),i=[];for(const e of o)i.push(Zi(e));i.length&&e.hooks.nodesChange.trigger(i)},addEdges:t=>{let n=t instanceof Function?t(e.edges):t;n=Array.isArray(n)?n:[n];const o=zr(n,e.isValidConnection,a,l,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges),i=[];for(const e of o)i.push(Zi(e));i.length&&e.hooks.edgesChange.trigger(i)},removeNodes:(t,n=!0,o=!1)=>{const i=t instanceof Function?t(e.nodes):t,l=Array.isArray(i)?i:[i],u=[],s=[];function c(e){const t=r(e);for(const n of t)Cr(n.deletable)&&!n.deletable||s.push(Wi(n.id,n.source,n.target,n.sourceHandle,n.targetHandle))}function d(t){const o=[];for(const n of e.nodes)n.parentNode===t&&o.push(n);if(o.length){for(const e of o)u.push(qi(e.id));n&&c(o);for(const e of o)d(e.id)}}for(const e of l){const t="string"==typeof e?a(e):e;t&&(Cr(t.deletable)&&!t.deletable||(u.push(qi(t.id)),n&&c([t]),o&&d(t.id)))}s.length&&e.hooks.edgesChange.trigger(s),u.length&&e.hooks.nodesChange.trigger(u)},removeEdges:t=>{const n=t instanceof Function?t(e.edges):t,o=Array.isArray(n)?n:[n],i=[];for(const e of o){const t="string"==typeof e?l(e):e;t&&(Cr(t.deletable)&&!t.deletable||i.push(Wi("string"==typeof e?e:e.id,t.source,t.target,t.sourceHandle,t.targetHandle)))}e.hooks.edgesChange.trigger(i)},findNode:a,findEdge:l,updateEdge:(t,o,i=!0)=>{const r=l(t.id);if(!r)return!1;const u=e.edges.indexOf(r),s=function(e,t,n,o,i){if(!t.source||!t.target)return i(new dr(sr.EDGE_INVALID,e.id)),!1;if(!n)return i(new dr(sr.EDGE_NOT_FOUND,e.id)),!1;const{id:r,...a}=e;return{...a,id:o?Ii(t):r,source:t.source,target:t.target,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle}}(t,o,r,i,e.hooks.error.trigger);if(s){const[t]=zr([s],e.isValidConnection,a,l,e.hooks.error.trigger,e.defaultEdgeOptions,e.nodes,e.edges);return e.edges=e.edges.map((e,n)=>n===u?t:e),Pr(e.connectionLookup,n.value,[t]),t}return!1},updateEdgeData:(e,t,n={replace:!1})=>{const o=l(e);if(!o)return;const i="function"==typeof t?t(o):t;o.data=n.replace?i:{...o.data,...i}},updateNode:(t,n,o={replace:!1})=>{const i=a(t);if(!i)return;const r="function"==typeof n?n(i):n;o.replace?e.nodes.splice(e.nodes.indexOf(i),1,r):Object.assign(i,r)},updateNodeData:(e,t,n={replace:!1})=>{const o=a(e);if(!o)return;const i="function"==typeof t?t(o):t;o.data=n.replace?i:{...o.data,...i}},applyEdgeChanges:t=>{const o=Ui(t,e.edges);return Pr(e.connectionLookup,n.value,o),o},applyNodeChanges:t=>Ui(t,e.nodes),addSelectedElements:e=>{u(e,!0)},addSelectedNodes:o=>{if(e.multiSelectionActive){const t=o.map(e=>ji(e.id,!0));return void e.hooks.nodesChange.trigger(t)}e.hooks.nodesChange.trigger(Ki(t.value,new Set(o.map(e=>e.id)),!0)),e.hooks.edgesChange.trigger(Ki(n.value))},addSelectedEdges:o=>{if(e.multiSelectionActive){const t=o.map(e=>ji(e.id,!0));return void e.hooks.edgesChange.trigger(t)}e.hooks.edgesChange.trigger(Ki(n.value,new Set(o.map(e=>e.id)))),e.hooks.nodesChange.trigger(Ki(t.value,new Set,!0))},setMinZoom:s,setMaxZoom:c,setTranslateExtent:d,setNodeExtent:t=>{e.nodeExtent=t,i()},setPaneClickDistance:t=>{var n;null==(n=e.d3Zoom)||n.clickDistance(t)},removeSelectedElements:t=>{if(!t||!t.length)return u([],!1);const n=t.reduce((e,t)=>{const n=ji(t.id,!1);return Ei(t)?e.nodes.push(n):e.edges.push(n),e},{nodes:[],edges:[]});n.nodes.length&&e.hooks.nodesChange.trigger(n.nodes),n.edges.length&&e.hooks.edgesChange.trigger(n.edges)},removeSelectedNodes:t=>{const n=(t||e.nodes).map(e=>(e.selected=!1,ji(e.id,!1)));e.hooks.nodesChange.trigger(n)},removeSelectedEdges:t=>{const n=(t||e.edges).map(e=>(e.selected=!1,ji(e.id,!1)));e.hooks.edgesChange.trigger(n)},startConnection:(t,n,o=!1)=>{o?e.connectionClickStartHandle=t:e.connectionStartHandle=t,e.connectionEndHandle=null,e.connectionStatus=null,n&&(e.connectionPosition=n)},updateConnection:(t,n=null,o=null)=>{e.connectionStartHandle&&(e.connectionPosition=t,e.connectionEndHandle=n,e.connectionStatus=o)},endConnection:(t,n)=>{e.connectionPosition={x:Number.NaN,y:Number.NaN},e.connectionEndHandle=null,e.connectionStatus=null,n?e.connectionClickStartHandle=null:e.connectionStartHandle=null},setInteractive:t=>{e.nodesDraggable=t,e.nodesConnectable=t,e.elementsSelectable=t},setState:m,getIntersectingNodes:(t,n=!0,o=e.nodes)=>{const[i,r,a]=g(t);if(!i)return[];const l=[];for(const u of o||e.nodes){if(!(a||u.id!==r.id&&u.computedPosition))continue;const e=gi(u),t=mi(e,i);(n&&t>0||t>=e.width*e.height||t>=Number(i.width)*Number(i.height))&&l.push(u)}return l},getIncomers:t=>function(...e){if(3===e.length){const[t,n,o]=e;return Ci(t,n,o,"source")}const[t,n]=e,o="string"==typeof t?t:t.id;return n.filter(e=>xi(e)&&e.target===o).map(e=>n.find(t=>Ei(t)&&t.id===e.source))}(t,e.nodes,e.edges),getOutgoers:t=>function(...e){if(3===e.length){const[t,n,o]=e;return Ci(t,n,o,"target")}const[t,n]=e,o="string"==typeof t?t:t.id;return n.filter(e=>xi(e)&&e.source===o).map(e=>n.find(t=>Ei(t)&&t.id===e.target))}(t,e.nodes,e.edges),getConnectedEdges:r,getHandleConnections:({id:t,type:n,nodeId:o})=>{var i;const r=t?`-${n}-${t}`:`-${n}`;return Array.from((null==(i=e.connectionLookup.get(`${o}${r}`))?void 0:i.values())??[])},isNodeIntersecting:(e,t,n=!0)=>{const[o]=g(e);if(!o)return!1;const i=mi(o,t);return n&&i>0||i>=Number(o.width)*Number(o.height)},panBy:t=>{const{viewport:n,dimensions:o,d3Zoom:i,d3Selection:r,translateExtent:a}=e;if(!i||!r||!t.x&&!t.y)return!1;const l=Fo.translate(n.x+t.x,n.y+t.y).scale(n.zoom),u=[[0,0],[o.width,o.height]],s=i.constrain()(l,u,a),c=e.viewport.x!==s.x||e.viewport.y!==s.y||e.viewport.zoom!==s.k;return i.transform(r,s),c},fitView:e=>o.value.fitView(e),zoomIn:e=>o.value.zoomIn(e),zoomOut:e=>o.value.zoomOut(e),zoomTo:(e,t)=>o.value.zoomTo(e,t),setViewport:(e,t)=>o.value.setViewport(e,t),setTransform:(e,t)=>o.value.setTransform(e,t),getViewport:()=>o.value.getViewport(),getTransform:()=>o.value.getTransform(),setCenter:(e,t,n)=>o.value.setCenter(e,t,n),fitBounds:(e,t)=>o.value.fitBounds(e,t),project:e=>o.value.project(e),screenToFlowCoordinate:e=>o.value.screenToFlowCoordinate(e),flowToScreenCoordinate:e=>o.value.flowToScreenCoordinate(e),toObject:()=>{const t=[],n=[];for(const o of e.nodes){const{computedPosition:e,handleBounds:n,selected:i,dimensions:r,isParent:a,resizing:l,dragging:u,events:s,...c}=o;t.push(c)}for(const o of e.edges){const{selected:e,sourceNode:t,targetNode:i,events:r,...a}=o;n.push(a)}return JSON.parse(JSON.stringify({nodes:t,edges:n,position:[e.viewport.x,e.viewport.y],zoom:e.viewport.zoom,viewport:e.viewport}))},fromObject:t=>new Promise(n=>{const{nodes:i,edges:r,position:a,zoom:l,viewport:u}=t;i&&h(i),r&&f(r);const[s,c]=(null==u?void 0:u.x)&&(null==u?void 0:u.y)?[u.x,u.y]:a??[null,null];if(s&&c){const t=(null==u?void 0:u.zoom)||l||e.viewport.zoom;return ae(()=>o.value.viewportInitialized).toBe(!0).then(()=>{o.value.setViewport({x:s,y:c,zoom:t}).then(()=>{n(!0)})})}n(!0)}),updateNodeInternals:i,viewportHelper:o,$reset:()=>{const t=ea();if(e.edges=[],e.nodes=[],e.d3Zoom&&e.d3Selection){const n=Fo.translate(t.defaultViewport.x??0,t.defaultViewport.y??0).scale(wi(t.defaultViewport.zoom??1,t.minZoom,t.maxZoom)),o=e.viewportRef.getBoundingClientRect(),i=[[0,0],[o.width,o.height]],r=e.d3Zoom.constrain()(n,i,t.translateExtent);e.d3Zoom.transform(e.d3Selection,r)}m(t)},$destroy:()=>{}}}const oa=["data-id","data-handleid","data-nodeid","data-handlepos"],ia=o({name:"Handle",compatConfig:{MODE:3},props:{id:{default:null},type:{},position:{default:()=>ei.Top},isValidConnection:{type:Function},connectable:{type:[Boolean,Number,String,Function],default:void 0},connectableStart:{type:Boolean,default:!0},connectableEnd:{type:Boolean,default:!0}},setup(e,{expose:t}){const n=P(e,["position","connectable","connectableStart","connectableEnd","id"]),o=$(()=>n.type??"source"),i=$(()=>n.isValidConnection??null),{id:r,connectionStartHandle:u,connectionClickStartHandle:s,connectionEndHandle:h,vueFlowRef:p,nodesConnectable:g,noDragClassName:m,noPanClassName:y}=Ba(),{id:_,node:b,nodeEl:x,connectedEdges:E}=Fr(),S=C(),k=$(()=>void 0===e.connectableStart||e.connectableStart),N=$(()=>void 0===e.connectableEnd||e.connectableEnd),M=$(()=>{var t,n,i,r,a,l;return(null==(t=u.value)?void 0:t.nodeId)===_&&(null==(n=u.value)?void 0:n.id)===e.id&&(null==(i=u.value)?void 0:i.type)===o.value||(null==(r=h.value)?void 0:r.nodeId)===_&&(null==(a=h.value)?void 0:a.id)===e.id&&(null==(l=h.value)?void 0:l.type)===o.value}),I=$(()=>{var t,n,i;return(null==(t=s.value)?void 0:t.nodeId)===_&&(null==(n=s.value)?void 0:n.id)===e.id&&(null==(i=s.value)?void 0:i.type)===o.value}),{handlePointerDown:A,handleClick:T}=Gr({nodeId:_,handleId:e.id,isValidConnection:i,type:o}),z=v(()=>"string"==typeof e.connectable&&"single"===e.connectable?!E.value.some(t=>{const n=t[`${o.value}Handle`];return t[o.value]===_&&(!n||n===e.id)}):"number"==typeof e.connectable?E.value.filter(t=>{const n=t[`${o.value}Handle`];return t[o.value]===_&&(!n||n===e.id)}).length<e.connectable:"function"==typeof e.connectable?e.connectable(b,E.value):Cr(e.connectable)?e.connectable:g.value);function D(e){const t=hr(e);z.value&&k.value&&(t&&0===e.button||!t)&&A(e)}function O(e){_&&(s.value||k.value)&&z.value&&T(e)}return w(()=>{var t;if(!b.dimensions.width||!b.dimensions.height)return;const n=null==(t=b.handleBounds[o.value])?void 0:t.find(t=>t.id===e.id);if(!p.value||n)return;const i=p.value.querySelector(".vue-flow__transformationpane");if(!(x.value&&S.value&&i&&e.id))return;const r=x.value.getBoundingClientRect(),a=S.value.getBoundingClientRect(),l=window.getComputedStyle(i),{m22:u}=new window.DOMMatrixReadOnly(l.transform),s={id:e.id,position:e.position,x:(a.left-r.left)/u,y:(a.top-r.top)/u,type:o.value,nodeId:_,...yi(S.value)};b.handleBounds[o.value]=[...b.handleBounds[o.value]??[],s]}),t({handleClick:T,handlePointerDown:A,onClick:O,onPointerDown:D}),(t,n)=>(a(),l("div",{ref_key:"handle",ref:S,"data-id":`${d(r)}-${d(_)}-${e.id}-${o.value}`,"data-handleid":e.id,"data-nodeid":d(_),"data-handlepos":t.position,class:f(["vue-flow__handle",[`vue-flow__handle-${t.position}`,`vue-flow__handle-${e.id}`,d(m),d(y),o.value,{connectable:z.value,connecting:I.value,connectablestart:k.value,connectableend:N.value,connectionindicator:z.value&&(k.value&&!M.value||N.value&&M.value)}]]),onMousedown:D,onTouchstartPassive:D,onClick:O},[c(t.$slots,"default",{id:t.id})],42,oa))}}),ra=function({sourcePosition:e=ei.Bottom,targetPosition:t=ei.Top,label:n,connectable:o=!0,isValidTargetPos:i,isValidSourcePos:r,data:a}){const l=a.label??n;return[R(ia,{type:"target",position:t,connectable:o,isValidConnection:i}),"string"!=typeof l&&l?R(l):R(b,[l]),R(ia,{type:"source",position:e,connectable:o,isValidConnection:r})]};ra.props=["sourcePosition","targetPosition","label","isValidTargetPos","isValidSourcePos","connectable","data"],ra.inheritAttrs=!1,ra.compatConfig={MODE:3};const aa=ra,la=function({targetPosition:e=ei.Top,label:t,connectable:n=!0,isValidTargetPos:o,data:i}){const r=i.label??t;return[R(ia,{type:"target",position:e,connectable:n,isValidConnection:o}),"string"!=typeof r&&r?R(r):R(b,[r])]};la.props=["targetPosition","label","isValidTargetPos","connectable","data"],la.inheritAttrs=!1,la.compatConfig={MODE:3};const ua=la,sa=function({sourcePosition:e=ei.Bottom,label:t,connectable:n=!0,isValidSourcePos:o,data:i}){const r=i.label??t;return["string"!=typeof r&&r?R(r):R(b,[r]),R(ia,{type:"source",position:e,connectable:n,isValidConnection:o})]};sa.props=["sourcePosition","label","isValidSourcePos","connectable","data"],sa.inheritAttrs=!1,sa.compatConfig={MODE:3};const ca=sa,da=["transform"],ha=["width","height","x","y","rx","ry"],fa=["y"],va=o({name:"EdgeText",compatConfig:{MODE:3},props:{x:{},y:{},label:{},labelStyle:{default:()=>({})},labelShowBg:{type:Boolean,default:!0},labelBgStyle:{default:()=>({})},labelBgPadding:{default:()=>[2,4]},labelBgBorderRadius:{default:2}},setup(e){const t=C({x:0,y:0,width:0,height:0}),o=C(null),i=v(()=>`translate(${e.x-t.value.width/2} ${e.y-t.value.height/2})`);function r(){if(!o.value)return;const e=o.value.getBBox();e.width===t.value.width&&e.height===t.value.height||(t.value=e)}return w(r),n([()=>e.x,()=>e.y,o,()=>e.label],r),(e,n)=>(a(),l("g",{transform:i.value,class:"vue-flow__edge-textwrapper"},[e.labelShowBg?(a(),l("rect",{key:0,class:"vue-flow__edge-textbg",width:`${t.value.width+2*e.labelBgPadding[0]}px`,height:`${t.value.height+2*e.labelBgPadding[1]}px`,x:-e.labelBgPadding[0],y:-e.labelBgPadding[1],style:h(e.labelBgStyle),rx:e.labelBgBorderRadius,ry:e.labelBgBorderRadius},null,12,ha)):M("",!0),_("text",G(e.$attrs,{ref_key:"el",ref:o,class:"vue-flow__edge-text",y:t.value.height/2,dy:"0.3em",style:e.labelStyle}),[c(e.$slots,"default",{},()=>["string"!=typeof e.label?(a(),N(F(e.label),{key:0})):(a(),l(b,{key:1},[U(A(e.label),1)],64))])],16,fa)],8,da))}}),pa=["id","d","marker-end","marker-start"],ga=["d","stroke-width"],ma=o({name:"BaseEdge",inheritAttrs:!1,compatConfig:{MODE:3},props:{id:{},labelX:{},labelY:{},path:{},label:{},markerStart:{},markerEnd:{},interactionWidth:{default:20},labelStyle:{},labelShowBg:{type:Boolean},labelBgStyle:{},labelBgPadding:{},labelBgBorderRadius:{}},setup(e,{expose:t}){const n=C(null),o=C(null),i=C(null),r=X();return t({pathEl:n,interactionEl:o,labelEl:i}),(e,t)=>(a(),l(b,null,[_("path",G(d(r),{id:e.id,ref_key:"pathEl",ref:n,d:e.path,class:"vue-flow__edge-path","marker-end":e.markerEnd,"marker-start":e.markerStart}),null,16,pa),e.interactionWidth?(a(),l("path",{key:0,ref_key:"interactionEl",ref:o,fill:"none",d:e.path,"stroke-width":e.interactionWidth,"stroke-opacity":0,class:"vue-flow__edge-interaction"},null,8,ga)):M("",!0),e.label&&e.labelX&&e.labelY?(a(),N(va,{key:1,ref_key:"labelEl",ref:i,x:e.labelX,y:e.labelY,label:e.label,"label-show-bg":e.labelShowBg,"label-bg-style":e.labelBgStyle,"label-bg-padding":e.labelBgPadding,"label-bg-border-radius":e.labelBgBorderRadius,"label-style":e.labelStyle},null,8,["x","y","label","label-show-bg","label-bg-style","label-bg-padding","label-bg-border-radius","label-style"])):M("",!0)],64))}});function ya({sourceX:e,sourceY:t,targetX:n,targetY:o}){const i=Math.abs(n-e)/2,r=n<e?n+i:n-i,a=Math.abs(o-t)/2;return[r,o<t?o+a:o-a,i,a]}function wa({sourceX:e,sourceY:t,targetX:n,targetY:o,sourceControlX:i,sourceControlY:r,targetControlX:a,targetControlY:l}){const u=.125*e+.375*i+.375*a+.125*n,s=.125*t+.375*r+.375*l+.125*o;return[u,s,Math.abs(u-e),Math.abs(s-t)]}function _a(e,t){return e>=0?.5*e:25*t*Math.sqrt(-e)}function ba({pos:e,x1:t,y1:n,x2:o,y2:i,c:r}){let a,l;switch(e){case ei.Left:a=t-_a(t-o,r),l=n;break;case ei.Right:a=t+_a(o-t,r),l=n;break;case ei.Top:a=t,l=n-_a(n-i,r);break;case ei.Bottom:a=t,l=n+_a(i-n,r)}return[a,l]}function xa(e){const{sourceX:t,sourceY:n,sourcePosition:o=ei.Bottom,targetX:i,targetY:r,targetPosition:a=ei.Top,curvature:l=.25}=e,[u,s]=ba({pos:o,x1:t,y1:n,x2:i,y2:r,c:l}),[c,d]=ba({pos:a,x1:i,y1:r,x2:t,y2:n,c:l}),[h,f,v,p]=wa({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:u,sourceControlY:s,targetControlX:c,targetControlY:d});return[`M${t},${n} C${u},${s} ${c},${d} ${i},${r}`,h,f,v,p]}function Ea({pos:e,x1:t,y1:n,x2:o,y2:i}){let r,a;switch(e){case ei.Left:case ei.Right:r=.5*(t+o),a=n;break;case ei.Top:case ei.Bottom:r=t,a=.5*(n+i)}return[r,a]}function Sa(e){const{sourceX:t,sourceY:n,sourcePosition:o=ei.Bottom,targetX:i,targetY:r,targetPosition:a=ei.Top}=e,[l,u]=Ea({pos:o,x1:t,y1:n,x2:i,y2:r}),[s,c]=Ea({pos:a,x1:i,y1:r,x2:t,y2:n}),[d,h,f,v]=wa({sourceX:t,sourceY:n,targetX:i,targetY:r,sourceControlX:l,sourceControlY:u,targetControlX:s,targetControlY:c});return[`M${t},${n} C${l},${u} ${s},${c} ${i},${r}`,d,h,f,v]}const ka={[ei.Left]:{x:-1,y:0},[ei.Right]:{x:1,y:0},[ei.Top]:{x:0,y:-1},[ei.Bottom]:{x:0,y:1}};function Na(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Ma({source:e,sourcePosition:t=ei.Bottom,target:n,targetPosition:o=ei.Top,center:i,offset:r}){const a=ka[t],l=ka[o],u={x:e.x+a.x*r,y:e.y+a.y*r},s={x:n.x+l.x*r,y:n.y+l.y*r},c=function({source:e,sourcePosition:t=ei.Bottom,target:n}){return t===ei.Left||t===ei.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}}({source:u,sourcePosition:t,target:s}),d=0!==c.x?"x":"y",h=c[d];let f,v,p;const g={x:0,y:0},m={x:0,y:0},[y,w,_,b]=ya({sourceX:e.x,sourceY:e.y,targetX:n.x,targetY:n.y});if(a[d]*l[d]===-1){v=i.x??y,p=i.y??w;const e=[{x:v,y:u.y},{x:v,y:s.y}],t=[{x:u.x,y:p},{x:s.x,y:p}];f=a[d]===h?"x"===d?e:t:"x"===d?t:e}else{const i=[{x:u.x,y:s.y}],c=[{x:s.x,y:u.y}];if(f="x"===d?a.x===h?c:i:a.y===h?i:c,t===o){const t=Math.abs(e[d]-n[d]);if(t<=r){const o=Math.min(r-1,r-t);a[d]===h?g[d]=(u[d]>e[d]?-1:1)*o:m[d]=(s[d]>n[d]?-1:1)*o}}if(t!==o){const e="x"===d?"y":"x",t=a[d]===l[e],n=u[e]>s[e],o=u[e]<s[e];(1===a[d]&&(!t&&n||t&&o)||1!==a[d]&&(!t&&o||t&&n))&&(f="x"===d?i:c)}const y={x:u.x+g.x,y:u.y+g.y},w={x:s.x+m.x,y:s.y+m.y};Math.max(Math.abs(y.x-f[0].x),Math.abs(w.x-f[0].x))>=Math.max(Math.abs(y.y-f[0].y),Math.abs(w.y-f[0].y))?(v=(y.x+w.x)/2,p=f[0].y):(v=f[0].x,p=(y.y+w.y)/2)}return[[e,{x:u.x+g.x,y:u.y+g.y},...f,{x:s.x+m.x,y:s.y+m.y},n],v,p,_,b]}function Ca(e){const{sourceX:t,sourceY:n,sourcePosition:o=ei.Bottom,targetX:i,targetY:r,targetPosition:a=ei.Top,borderRadius:l=5,centerX:u,centerY:s,offset:c=20}=e,[d,h,f,v,p]=Ma({source:{x:t,y:n},sourcePosition:o,target:{x:i,y:r},targetPosition:a,center:{x:u,y:s},offset:c});return[d.reduce((e,t,n)=>{let o;return o=n>0&&n<d.length-1?function(e,t,n,o){const i=Math.min(Na(e,t)/2,Na(t,n)/2,o),{x:r,y:a}=t;if(e.x===r&&r===n.x||e.y===a&&a===n.y)return`L${r} ${a}`;if(e.y===a)return`L ${r+i*(e.x<n.x?-1:1)},${a}Q ${r},${a} ${r},${a+i*(e.y<n.y?1:-1)}`;const l=e.x<n.x?1:-1;return`L ${r},${a+i*(e.y<n.y?-1:1)}Q ${r},${a} ${r+i*l},${a}`}(d[n-1],t,d[n+1],l):`${0===n?"M":"L"}${t.x} ${t.y}`,e+=o},""),h,f,v,p]}const Ia=o({name:"StraightEdge",props:["label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,i]=function(e){const{sourceX:t,sourceY:n,targetX:o,targetY:i}=e,[r,a,l,u]=ya({sourceX:t,sourceY:n,targetX:o,targetY:i});return[`M ${t},${n}L ${o},${i}`,r,a,l,u]}(e);return R(ma,{path:n,labelX:o,labelY:i,...t,...e})}}),$a=o({name:"SmoothStepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","borderRadius","markerEnd","markerStart","interactionWidth","offset"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,i]=Ca({...e,sourcePosition:e.sourcePosition??ei.Bottom,targetPosition:e.targetPosition??ei.Top});return R(ma,{path:n,labelX:o,labelY:i,...t,...e})}}),Aa=o({name:"StepEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],setup:(e,{attrs:t})=>()=>R($a,{...e,...t,borderRadius:0})}),Pa=o({name:"BezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","curvature","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,i]=xa({...e,sourcePosition:e.sourcePosition??ei.Bottom,targetPosition:e.targetPosition??ei.Top});return R(ma,{path:n,labelX:o,labelY:i,...t,...e})}}),Ta=o({name:"SimpleBezierEdge",props:["sourcePosition","targetPosition","label","labelStyle","labelShowBg","labelBgStyle","labelBgPadding","labelBgBorderRadius","sourceY","sourceX","targetX","targetY","markerEnd","markerStart","interactionWidth"],compatConfig:{MODE:3},setup:(e,{attrs:t})=>()=>{const[n,o,i]=Sa({...e,sourcePosition:e.sourcePosition??ei.Bottom,targetPosition:e.targetPosition??ei.Top});return R(ma,{path:n,labelX:o,labelY:i,...t,...e})}}),za={input:ca,default:aa,output:ua},Da={default:Pa,straight:Ia,step:Aa,smoothstep:$a,simplebezier:Ta};class Oa{constructor(){this.currentId=0,this.flows=new Map}static getInstance(){var e;const t=null==(e=p())?void 0:e.appContext.app,n=(null==t?void 0:t.config.globalProperties.$vueFlowStorage)??Oa.instance;return Oa.instance=n??new Oa,t&&(t.config.globalProperties.$vueFlowStorage=Oa.instance),Oa.instance}set(e,t){return this.flows.set(e,t)}get(e){return this.flows.get(e)}remove(e){return this.flows.delete(e)}create(e,t){const n=ea(),o=T(n),i={};for(const[d,h]of Object.entries(o.hooks)){i[`on${d.charAt(0).toUpperCase()+d.slice(1)}`]=h.on}const r={};for(const[d,h]of Object.entries(o.hooks))r[d]=h.trigger;const a=v(()=>{const e=new Map;for(const t of o.nodes)e.set(t.id,t);return e}),l=v(()=>{const e=new Map;for(const t of o.edges)e.set(t.id,t);return e}),u=function(e,t,n){const o=v(()=>e=>t.value.get(e)),i=v(()=>e=>n.value.get(e)),r=v(()=>{const t={...Da,...e.edgeTypes},n=Object.keys(t);for(const o of e.edges)o.type&&!n.includes(o.type)&&(t[o.type]=o.type);return t}),a=v(()=>{const t={...za,...e.nodeTypes},n=Object.keys(t);for(const o of e.nodes)o.type&&!n.includes(o.type)&&(t[o.type]=o.type);return t}),l=v(()=>e.onlyRenderVisibleElements?Oi(e.nodes,{x:0,y:0,width:e.dimensions.width,height:e.dimensions.height},e.viewport,!0):e.nodes),u=v(()=>{if(e.onlyRenderVisibleElements){const n=[];for(const o of e.edges){const i=t.value.get(o.source),r=t.value.get(o.target);lr({sourcePos:i.computedPosition||{x:0,y:0},targetPos:r.computedPosition||{x:0,y:0},sourceWidth:i.dimensions.width,sourceHeight:i.dimensions.height,targetWidth:r.dimensions.width,targetHeight:r.dimensions.height,width:e.dimensions.width,height:e.dimensions.height,viewport:e.viewport})&&n.push(o)}return n}return e.edges}),s=v(()=>[...l.value,...u.value]),c=v(()=>{const t=[];for(const n of e.nodes)n.selected&&t.push(n);return t}),d=v(()=>{const t=[];for(const n of e.edges)n.selected&&t.push(n);return t}),h=v(()=>[...c.value,...d.value]),f=v(()=>{const t=[];for(const n of e.nodes)n.dimensions.width&&n.dimensions.height&&void 0!==n.handleBounds&&t.push(n);return t}),p=v(()=>l.value.length>0&&f.value.length===l.value.length);return{getNode:o,getEdge:i,getElements:s,getEdgeTypes:r,getNodeTypes:a,getEdges:u,getNodes:l,getSelectedElements:h,getSelectedNodes:c,getSelectedEdges:d,getNodesInitialized:f,areNodesInitialized:p}}(o,a,l),s=na(o,a,l);s.setState({...o,...t});const c={...i,...u,...s,...ie(o),nodeLookup:a,edgeLookup:l,emits:r,id:e,vueFlowVersion:"1.48.2",$destroy:()=>{this.remove(e)}};return this.set(e,c),c}getId(){return"vue-flow-"+this.currentId++}}function Ba(o){const i=Oa.getInstance(),r=g(),a="object"==typeof o,l=a?o:{id:o},u=l.id,s=u??(null==r?void 0:r.vueFlowId);let c;if(r){const t=e(Dr,null);null==t||s&&t.id!==s||(c=t)}if(c||s&&(c=i.get(s)),!c||s&&c.id!==s){const e=u??i.getId(),o=i.create(e,l);c=o;(r??t(!0)).run(()=>{n(o.applyDefault,(e,t,n)=>{const i=e=>{o.applyNodeChanges(e)},r=e=>{o.applyEdgeChanges(e)};e?(o.onNodesChange(i),o.onEdgesChange(r)):(o.hooks.value.nodesChange.off(i),o.hooks.value.edgesChange.off(r)),n(()=>{o.hooks.value.nodesChange.off(i),o.hooks.value.edgesChange.off(r)})},{immediate:!0}),q(()=>{if(c){const e=i.get(c.id);e?e.$destroy():Sr(c.id)}})})}else a&&c.setState(l);if(r&&(B(Dr,c),r.vueFlowId=c.id),a){const e=p();"VueFlow"!==(null==e?void 0:e.type.name)&&c.emits.error(new dr(sr.USEVUEFLOW_OPTIONS))}return c}const Ra=o({name:"UserSelection",compatConfig:{MODE:3},props:{userSelectionRect:{}},setup:e=>(e,t)=>(a(),l("div",{class:"vue-flow__selection vue-flow__container",style:h({width:`${e.userSelectionRect.width}px`,height:`${e.userSelectionRect.height}px`,transform:`translate(${e.userSelectionRect.x}px, ${e.userSelectionRect.y}px)`})},null,4))}),Va=["tabIndex"],La=o({name:"NodesSelection",compatConfig:{MODE:3},setup(e){const{emits:t,viewport:n,getSelectedNodes:o,noPanClassName:i,disableKeyboardA11y:r,userSelectionActive:u}=Ba(),s=jr(),c=C(null),p=Hr({el:c,onStart(e){t.selectionDragStart(e),t.nodeDragStart(e)},onDrag(e){t.selectionDrag(e),t.nodeDrag(e)},onStop(e){t.selectionDragStop(e),t.nodeDragStop(e)}});w(()=>{var e;r.value||null==(e=c.value)||e.focus({preventScroll:!0})});const g=v(()=>Di(o.value)),m=v(()=>({width:`${g.value.width}px`,height:`${g.value.height}px`,top:`${g.value.y}px`,left:`${g.value.x}px`}));function y(e){t.selectionContextMenu({event:e,nodes:o.value})}function b(e){r.value||pi[e.key]&&(e.preventDefault(),s({x:pi[e.key].x,y:pi[e.key].y},e.shiftKey))}return(e,t)=>!d(u)&&g.value.width&&g.value.height?(a(),l("div",{key:0,class:f(["vue-flow__nodesselection vue-flow__container",d(i)]),style:h({transform:`translate(${d(n).x}px,${d(n).y}px) scale(${d(n).zoom})`})},[_("div",{ref_key:"el",ref:c,class:f([{dragging:d(p)},"vue-flow__nodesselection-rect"]),style:h(m.value),tabIndex:d(r)?void 0:-1,onContextmenu:y,onKeydown:b},null,46,Va)],6)):M("",!0)}});const Ha=o({name:"Pane",compatConfig:{MODE:3},props:{isSelecting:{type:Boolean},selectionKeyPressed:{type:Boolean}},setup(e){const{vueFlowRef:t,nodes:o,viewport:i,emits:r,userSelectionActive:u,removeSelectedElements:s,userSelectionRect:h,elementsSelectable:v,nodesSelectionActive:p,getSelectedEdges:g,getSelectedNodes:m,removeNodes:y,removeEdges:w,selectionMode:_,deleteKeyCode:b,multiSelectionKeyCode:x,multiSelectionActive:E,edgeLookup:S,nodeLookup:k,connectionLookup:C,defaultEdgeOptions:A,connectionStartHandle:P,panOnDrag:T}=Ba(),z=I(null),D=I(new Set),O=I(new Set),B=I(null),R=$(()=>v.value&&(e.isSelecting||u.value)),V=$(()=>null!==P.value);let L=!1,H=!1;const Y=di(b,{actInsideInputWithModifier:!1}),X=di(x);function G(e,t){return n=>{n.target===t&&(null==e||e(n))}}function F(e){L||V.value?L=!1:(r.paneClick(e),s(),p.value=!1)}function U(e){var t;Array.isArray(T.value)&&(null==(t=T.value)?void 0:t.includes(2))?e.preventDefault():r.paneContextMenu(e)}function j(e){r.paneScroll(e)}return n(Y,e=>{e&&(y(m.value),w(g.value),p.value=!1)}),n(X,e=>{E.value=e}),(n,g)=>(a(),l("div",{ref_key:"container",ref:z,class:f(["vue-flow__pane vue-flow__container",{selection:n.isSelecting}]),onClick:g[0]||(g[0]=e=>R.value?void 0:G(F,z.value)(e)),onContextmenu:g[1]||(g[1]=e=>G(U,z.value)(e)),onWheelPassive:g[2]||(g[2]=e=>G(j,z.value)(e)),onPointerenter:g[3]||(g[3]=e=>R.value?void 0:d(r).paneMouseEnter(e)),onPointerdown:g[4]||(g[4]=n=>R.value?function(n){var o,i,a;if(B.value=(null==(o=t.value)?void 0:o.getBoundingClientRect())??null,!v.value||!e.isSelecting||0!==n.button||n.target!==z.value||!B.value)return;null==(a=null==(i=n.target)?void 0:i.setPointerCapture)||a.call(i,n.pointerId);const{x:l,y:u}=function(e,t){return{x:e.clientX-t.left,y:e.clientY-t.top}}(n,B.value);H=!0,L=!1,s(),h.value={width:0,height:0,startX:l,startY:u,x:l,y:u},r.selectionStart(n)}(n):d(r).paneMouseMove(n)),onPointermove:g[5]||(g[5]=e=>R.value?function(e){var t;if(!B.value||!h.value)return;L=!0;const{x:n,y:a}=fr(e,B.value),{startX:l=0,startY:s=0}=h.value,c={startX:l,startY:s,x:n<l?n:l,y:a<s?a:s,width:Math.abs(n-l),height:Math.abs(a-s)},d=D.value,f=O.value;D.value=new Set(Oi(o.value,c,i.value,_.value===ti.Partial,!0).map(e=>e.id)),O.value=new Set;const v=(null==(t=A.value)?void 0:t.selectable)??!0;for(const o of D.value){const e=C.value.get(o);if(e)for(const{edgeId:t}of e.values()){const e=S.value.get(t);e&&(e.selectable??v)&&O.value.add(t)}}if(!Tr(d,D.value)){const e=Ki(k.value,D.value,!0);r.nodesChange(e)}if(!Tr(f,O.value)){const e=Ki(S.value,O.value);r.edgesChange(e)}h.value=c,u.value=!0,p.value=!1}(e):d(r).paneMouseMove(e)),onPointerup:g[6]||(g[6]=t=>R.value?function(t){var n;0===t.button&&H&&(null==(n=t.target)||n.releasePointerCapture(t.pointerId),!u.value&&h.value&&t.target===z.value&&F(t),u.value=!1,h.value=null,p.value=D.value.size>0,r.selectionEnd(t),e.selectionKeyPressed&&(L=!1),H=!1)}(t):void 0),onPointerleave:g[7]||(g[7]=e=>d(r).paneMouseLeave(e))},[c(n.$slots,"default"),d(u)&&d(h)?(a(),N(Ra,{key:0,"user-selection-rect":d(h)},null,8,["user-selection-rect"])):M("",!0),d(p)&&d(m).length?(a(),N(La,{key:1})):M("",!0)],34))}}),Ya=o({name:"Transform",compatConfig:{MODE:3},setup(e){const{viewport:t,fitViewOnInit:n,fitViewOnInitDone:o}=Ba(),i=v(()=>!!n.value&&!o.value),r=v(()=>`translate(${t.value.x}px,${t.value.y}px) scale(${t.value.zoom})`);return(e,t)=>(a(),l("div",{class:"vue-flow__transformationpane vue-flow__container",style:h({transform:r.value,opacity:i.value?0:void 0})},[c(e.$slots,"default")],4))}}),Xa=o({name:"Viewport",compatConfig:{MODE:3},setup(e){const{minZoom:t,maxZoom:o,defaultViewport:i,translateExtent:r,zoomActivationKeyCode:h,selectionKeyCode:v,panActivationKeyCode:p,panOnScroll:g,panOnScrollMode:m,panOnScrollSpeed:y,panOnDrag:_,zoomOnDoubleClick:b,zoomOnPinch:x,zoomOnScroll:E,preventScrolling:k,noWheelClassName:N,noPanClassName:M,emits:C,connectionStartHandle:A,userSelectionActive:P,paneDragging:T,d3Zoom:z,d3Selection:D,d3ZoomHandler:O,viewport:B,viewportRef:R,paneClickDistance:V}=Ba();!function(e){const{emits:t,dimensions:n}=Ba();let o;w(()=>{const i=()=>{var o,i;if(!e.value||!((null==(i=(o=e.value).checkVisibility)?void 0:i.call(o))??1))return;const r=yi(e.value);0!==r.width&&0!==r.height||t.error(new dr(sr.MISSING_VIEWPORT_DIMENSIONS)),n.value={width:r.width||500,height:r.height||500}};i(),window.addEventListener("resize",i),e.value&&(o=new ResizeObserver(()=>i()),o.observe(e.value)),S(()=>{window.removeEventListener("resize",i),o&&e.value&&o.unobserve(e.value)})})}(R);const L=I(!1),H=I(!1);let Y=null,X=!1,G=0,F={x:0,y:0,zoom:0};const U=di(p),j=di(v),Z=di(h),q=$(()=>(!j.value||j.value&&!0===v.value)&&(U.value||_.value)),W=$(()=>U.value||g.value),K=$(()=>!0===v.value&&!0!==q.value),J=$(()=>j.value&&!0!==v.value||P.value||K.value),Q=$(()=>null!==A.value);function ee(e,t){return 2===t&&Array.isArray(e)&&e.includes(2)}function te(e){return{x:e.x,y:e.y,zoom:e.k}}function ne(e,t){return e.target.closest(`.${t}`)}return w(()=>{if(!R.value)return void Sr();const e=R.value,a=e.getBoundingClientRect(),l=function(){var e,t,n,o=Zo,i=qo,r=Qo,a=Ko,l=Jo,u=[0,Infinity],s=[[-Infinity,-Infinity],[Infinity,Infinity]],c=250,d=Fn,h=fe("start","zoom","end"),f=0,v=10;function p(e){e.property("__zoom",Wo).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",S).filter(l).on("touchstart.zoom",k).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(u[0],Math.min(u[1],t)))===e.k?e:new Go(t,e.x,e.y)}function m(e,t,n){var o=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return o===e.x&&i===e.y?e:new Go(e.k,o,i)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){_(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,r=arguments,a=_(e,r).event(o),l=i.apply(e,r),u=null==n?y(l):"function"==typeof n?n.apply(e,r):n,s=Math.max(l[1][0]-l[0][0],l[1][1]-l[0][1]),c=e.__zoom,h="function"==typeof t?t.apply(e,r):t,f=d(c.invert(u).concat(s/c.k),h.invert(u).concat(s/h.k));return function(e){if(1===e)e=h;else{var t=f(e),n=s/t[2];e=new Go(n,u[0]-t[0]*n,u[1]-t[1]*n)}a.zoom(null,e)}})}function _(e,t,n){return!n&&e.__zooming||new b(e,t)}function b(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function x(e,...t){if(o.apply(this,arguments)){var n=_(this,t).event(e),i=this.__zoom,l=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),c=$t(e);if(n.wheel)n.mouse[0][0]===c[0]&&n.mouse[0][1]===c[1]||(n.mouse[1]=i.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(i.k===l)return;n.mouse=[c,i.invert(c)],mo(this),n.start()}jo(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",r(m(g(i,l),n.mouse[0],n.mouse[1]),n.extent,s))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var i=e.currentTarget,a=_(this,t,!0).event(e),l=It(e.view).on("mousemove.zoom",function(e){if(jo(e),!a.moved){var t=e.clientX-c,n=e.clientY-d;a.moved=t*t+n*n>f}a.event(e).zoom("mouse",r(m(a.that.__zoom,a.mouse[0]=$t(e,i),a.mouse[1]),a.extent,s))},!0).on("mouseup.zoom",function(e){l.on("mousemove.zoom mouseup.zoom",null),Ot(e.view,a.moved),jo(e),a.event(e).end()},!0),u=$t(e,i),c=e.clientX,d=e.clientY;Dt(e.view),Uo(e),a.mouse=[u,this.__zoom.invert(u)],mo(this),a.start()}}function S(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=$t(e.changedTouches?e.changedTouches[0]:e,this),l=n.invert(a),u=n.k*(e.shiftKey?.5:2),d=r(m(g(n,u),a,l),i.apply(this,t),s);jo(e),c>0?It(this).transition().duration(c).call(w,d,a,e):It(this).call(p.transform,d,a,e)}}function k(n,...i){if(o.apply(this,arguments)){var r,a,l,u,s=n.touches,c=s.length,d=_(this,i,n.changedTouches.length===c).event(n);for(Uo(n),a=0;a<c;++a)u=[u=$t(l=s[a],this),this.__zoom.invert(u),l.identifier],d.touch0?d.touch1||d.touch0[2]===u[2]||(d.touch1=u,d.taps=0):(d.touch0=u,r=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),r&&(d.taps<2&&(t=u[0],e=setTimeout(function(){e=null},500)),mo(this),d.start())}}function N(e,...t){if(this.__zooming){var n,o,i,a,l=_(this,t).event(e),u=e.changedTouches,c=u.length;for(jo(e),n=0;n<c;++n)i=$t(o=u[n],this),l.touch0&&l.touch0[2]===o.identifier?l.touch0[0]=i:l.touch1&&l.touch1[2]===o.identifier&&(l.touch1[0]=i);if(o=l.that.__zoom,l.touch1){var d=l.touch0[0],h=l.touch0[1],f=l.touch1[0],v=l.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,y=(y=v[0]-h[0])*y+(y=v[1]-h[1])*y;o=g(o,Math.sqrt(p/y)),i=[(d[0]+f[0])/2,(d[1]+f[1])/2],a=[(h[0]+v[0])/2,(h[1]+v[1])/2]}else{if(!l.touch0)return;i=l.touch0[0],a=l.touch0[1]}l.zoom("touch",r(m(o,i,a),l.extent,s))}}function M(e,...o){if(this.__zooming){var i,r,a=_(this,o).event(e),l=e.changedTouches,u=l.length;for(Uo(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<u;++i)r=l[i],a.touch0&&a.touch0[2]===r.identifier?delete a.touch0:a.touch1&&a.touch1[2]===r.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(r=$t(r,this),Math.hypot(t[0]-r[0],t[1]-r[1])<v)){var s=It(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return p.transform=function(e,t,n,o){var i=e.selection?e.selection():e;i.property("__zoom",Wo),e!==i?w(e,t,n,o):i.interrupt().each(function(){_(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},p.scaleBy=function(e,t,n,o){p.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},p.scaleTo=function(e,t,n,o){p.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,a=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n,l=o.invert(a),u="function"==typeof t?t.apply(this,arguments):t;return r(m(g(o,u),a,l),e,s)},n,o)},p.translateBy=function(e,t,n,o){p.transform(e,function(){return r(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),s)},null,o)},p.translateTo=function(e,t,n,o,a){p.transform(e,function(){var e=i.apply(this,arguments),a=this.__zoom,l=null==o?y(e):"function"==typeof o?o.apply(this,arguments):o;return r(Fo.translate(l[0],l[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,s)},o,a)},b.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=It(this.that).datum();h.call(e,this.that,new Xo(e,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Yo(+e),p):a},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:Yo(!!e),p):o},p.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Yo(!!e),p):l},p.extent=function(e){return arguments.length?(i="function"==typeof e?e:Yo([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):i},p.scaleExtent=function(e){return arguments.length?(u[0]=+e[0],u[1]=+e[1],p):[u[0],u[1]]},p.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(e){return arguments.length?(r=e,p):r},p.duration=function(e){return arguments.length?(c=+e,p):c},p.interpolate=function(e){return arguments.length?(d=e,p):d},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,p):Math.sqrt(f)},p.tapDistance=function(e){return arguments.length?(v=+e,p):v},p}().clickDistance(V.value).scaleExtent([t.value,o.value]).translateExtent(r.value),u=It(e).call(l),s=u.on("wheel.zoom"),c=Fo.translate(i.value.x??0,i.value.y??0).scale(wi(i.value.zoom??1,t.value,o.value)),d=[[0,0],[a.width,a.height]],h=l.constrain()(c,d,r.value);l.transform(u,h),l.wheelDelta(Yi),z.value=l,D.value=u,O.value=s,B.value={x:h.x,y:h.y,zoom:h.k},l.on("start",e=>{var t;if(!e.sourceEvent)return null;G=e.sourceEvent.button,L.value=!0;const n=te(e.transform);"mousedown"===(null==(t=e.sourceEvent)?void 0:t.type)&&(T.value=!0),F=n,C.viewportChangeStart(n),C.moveStart({event:e,flowTransform:n})}),l.on("end",e=>{if(!e.sourceEvent)return null;if(L.value=!1,T.value=!1,ee(q.value,G??0)&&!X&&C.paneContextMenu(e.sourceEvent),X=!1,t=F,n=e.transform,t.x!==n.x&&!Number.isNaN(n.x)||t.y!==n.y&&!Number.isNaN(n.y)||t.zoom!==n.k&&!Number.isNaN(n.k)){const t=te(e.transform);F=t,C.viewportChangeEnd(t),C.moveEnd({event:e,flowTransform:t})}var t,n}),l.filter(e=>{var t;const n=Z.value||E.value,o=x.value&&e.ctrlKey,i=e.button,r="wheel"===e.type;if(1===i&&"mousedown"===e.type&&(ne(e,"vue-flow__node")||ne(e,"vue-flow__edge")))return!0;if(!(q.value||n||W.value||b.value||x.value))return!1;if(P.value)return!1;if(Q.value&&!r)return!1;if(!b.value&&"dblclick"===e.type)return!1;if(ne(e,N.value)&&r)return!1;if(ne(e,M.value)&&(!r||W.value&&r&&!Z.value))return!1;if(!x.value&&e.ctrlKey&&r)return!1;if(!n&&!W.value&&!o&&r)return!1;if(!x&&"touchstart"===e.type&&(null==(t=e.touches)?void 0:t.length)>1)return e.preventDefault(),!1;if(!q.value&&("mousedown"===e.type||"touchstart"===e.type))return!1;if(K.value&&Array.isArray(_.value)&&_.value.includes(0)&&0===i)return!1;if(Array.isArray(_.value)&&!_.value.includes(i)&&("mousedown"===e.type||"touchstart"===e.type))return!1;const a=Array.isArray(_.value)&&_.value.includes(i)||!0===v.value&&Array.isArray(_.value)&&!_.value.includes(0)||!i||i<=1;return(!e.ctrlKey||U.value||r)&&a}),n([P,q],()=>{P.value&&!L.value?l.on("zoom",null):P.value||l.on("zoom",e=>{B.value={x:e.transform.x,y:e.transform.y,zoom:e.transform.k};const t=te(e.transform);X=ee(q.value,G??0),C.viewportChange(t),C.move({event:e,flowTransform:t})})},{immediate:!0}),n([P,W,m,Z,x,k,N],()=>{!W.value||Z.value||P.value?void 0!==s&&u.on("wheel.zoom",function(e,t){const n=!k.value&&"wheel"===e.type&&!e.ctrlKey,o=Z.value||E.value,i=x.value&&e.ctrlKey;if(!o&&!g.value&&!i&&"wheel"===e.type||n||ne(e,N.value))return null;e.preventDefault(),s.call(this,e,t)},{passive:!1}):u.on("wheel.zoom",e=>{if(ne(e,N.value))return!1;const t=Z.value||E.value,n=x.value&&e.ctrlKey;if(!(!k.value||W.value||t||n))return!1;e.preventDefault(),e.stopImmediatePropagation();const o=u.property("__zoom").k||1,i=vr();if(!U.value&&e.ctrlKey&&x.value&&i){const t=$t(e),n=o*2**Yi(e);return void l.scaleTo(u,n,t,e)}const r=1===e.deltaMode?20:1;let a=m.value===ri.Vertical?0:e.deltaX*r,s=m.value===ri.Horizontal?0:e.deltaY*r;!i&&e.shiftKey&&m.value!==ri.Vertical&&!a&&s&&(a=s,s=0),l.translateBy(u,-a/o*y.value,-s/o*y.value);const c=te(u.property("__zoom"));Y&&clearTimeout(Y),H.value?(C.move({event:e,flowTransform:c}),C.viewportChange(c),Y=setTimeout(()=>{C.moveEnd({event:e,flowTransform:c}),C.viewportChangeEnd(c),H.value=!1},150)):(H.value=!0,C.moveStart({event:e,flowTransform:c}),C.viewportChangeStart(c))},{passive:!1})},{immediate:!0})}),(e,t)=>(a(),l("div",{ref_key:"viewportRef",ref:R,class:"vue-flow__viewport vue-flow__container"},[u(Ha,{"is-selecting":J.value,"selection-key-pressed":d(j),class:f({connecting:Q.value,dragging:d(T),draggable:!0===d(_)||Array.isArray(d(_))&&d(_).includes(0)})},{default:s(()=>[u(Ya,null,{default:s(()=>[c(e.$slots,"default")]),_:3})]),_:3},8,["is-selecting","selection-key-pressed","class"])],512))}}),Ga=["id"],Fa=["id"],Ua=["id"],ja=o({name:"A11yDescriptions",compatConfig:{MODE:3},setup(e){const{id:t,disableKeyboardA11y:n,ariaLiveMessage:o}=Ba();return(e,i)=>(a(),l(b,null,[_("div",{id:`${d(hi)}-${d(t)}`,style:{display:"none"}}," Press enter or space to select a node. "+A(d(n)?"":"You can then use the arrow keys to move the node around.")+" You can then use the arrow keys to move the node around, press delete to remove it and press escape to cancel. ",9,Ga),_("div",{id:`${d(fi)}-${d(t)}`,style:{display:"none"}}," Press enter or space to select an edge. You can then press delete to remove it or press escape to cancel. ",8,Fa),d(n)?M("",!0):(a(),l("div",{key:0,id:`${d("vue-flow__aria-live")}-${d(t)}`,"aria-live":"assertive","aria-atomic":"true",style:{position:"absolute",width:"1px",height:"1px",margin:"-1px",border:"0",padding:"0",overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)","clip-path":"inset(100%)"}},A(d(o)),9,Ua))],64))}});function Za(e,t,n){return n===ei.Left?e-t:n===ei.Right?e+t:e}function qa(e,t,n){return n===ei.Top?e-t:n===ei.Bottom?e+t:e}const Wa=function({radius:e=10,centerX:t=0,centerY:n=0,position:o=ei.Top,type:i}){return R("circle",{class:`vue-flow__edgeupdater vue-flow__edgeupdater-${i}`,cx:Za(t,e,o),cy:qa(n,e,o),r:e,stroke:"transparent",fill:"transparent"})};Wa.props=["radius","centerX","centerY","position","type"],Wa.compatConfig={MODE:3};const Ka=Wa,Ja=o({name:"Edge",compatConfig:{MODE:3},props:["id"],setup(t){const{id:n,addSelectedEdges:o,connectionMode:i,edgeUpdaterRadius:r,emits:a,nodesSelectionActive:l,noPanClassName:u,getEdgeTypes:s,removeSelectedEdges:c,findEdge:d,findNode:h,isValidConnection:f,multiSelectionActive:g,disableKeyboardA11y:m,elementsSelectable:y,edgesUpdatable:w,edgesFocusable:_,hooks:b}=Ba(),x=v(()=>d(t.id)),{emit:E,on:S}=Yr(x.value,a),k=e(Lr),N=p(),M=C(!1),I=C(!1),A=C(""),P=C(null),T=C("source"),z=C(null),D=$(()=>void 0===x.value.selectable?y.value:x.value.selectable),O=$(()=>void 0===x.value.updatable?w.value:x.value.updatable),V=$(()=>void 0===x.value.focusable?_.value:x.value.focusable);B(Rr,t.id),B(Vr,z);const L=v(()=>x.value.class instanceof Function?x.value.class(x.value):x.value.class),H=v(()=>x.value.style instanceof Function?x.value.style(x.value):x.value.style),X=v(()=>{const e=x.value.type||"default",t=null==k?void 0:k[`edge-${e}`];if(t)return t;let n=x.value.template??s.value[e];if("string"==typeof n&&N){const t=Object.keys(N.appContext.components);t&&t.includes(e)&&(n=Y(e,!1))}return n&&"string"!=typeof n?n:(a.error(new dr(sr.EDGE_TYPE_MISSING,n)),!1)}),{handlePointerDown:G}=Gr({nodeId:A,handleId:P,type:T,isValidConnection:f,edgeUpdaterType:T,onEdgeUpdate:function(e,t){E.update({event:e,edge:x.value,connection:t})},onEdgeUpdateEnd:function(e){E.updateEnd({event:e,edge:x.value}),I.value=!1}});return()=>{const e=h(x.value.source),o=h(x.value.target),l="pathOptions"in x.value?x.value.pathOptions:{};if(!e&&!o)return a.error(new dr(sr.EDGE_SOURCE_TARGET_MISSING,x.value.id,x.value.source,x.value.target)),null;if(!e)return a.error(new dr(sr.EDGE_SOURCE_MISSING,x.value.id,x.value.source)),null;if(!o)return a.error(new dr(sr.EDGE_TARGET_MISSING,x.value.id,x.value.target)),null;if(!x.value||x.value.hidden||e.hidden||o.hidden)return null;let c;c=i.value===oi.Strict?e.handleBounds.source:[...e.handleBounds.source||[],...e.handleBounds.target||[]];const d=ar(c,x.value.sourceHandle);let f;f=i.value===oi.Strict?o.handleBounds.target:[...o.handleBounds.target||[],...o.handleBounds.source||[]];const v=ar(f,x.value.targetHandle),p=(null==d?void 0:d.position)||ei.Bottom,g=(null==v?void 0:v.position)||ei.Top,{x:m,y:y}=rr(e,d,p),{x:w,y:_}=rr(o,v,g);return x.value.sourceX=m,x.value.sourceY=y,x.value.targetX=w,x.value.targetY=_,R("g",{ref:z,key:t.id,"data-id":t.id,class:["vue-flow__edge",`vue-flow__edge-${!1===X.value?"default":x.value.type||"default"}`,u.value,L.value,{updating:M.value,selected:x.value.selected,animated:x.value.animated,inactive:!D.value&&!b.value.edgeClick.hasListeners()}],tabIndex:V.value?0:void 0,"aria-label":null===x.value.ariaLabel?void 0:x.value.ariaLabel??`Edge from ${x.value.source} to ${x.value.target}`,"aria-describedby":V.value?`${fi}-${n}`:void 0,"aria-roledescription":"edge",role:V.value?"group":"img",...x.value.domAttributes,onClick:Z,onContextmenu:q,onDblclick:W,onMouseenter:K,onMousemove:J,onMouseleave:Q,onKeyDown:V.value?ne:void 0},[I.value?null:R(!1===X.value?s.value.default:X.value,{id:t.id,sourceNode:e,targetNode:o,source:x.value.source,target:x.value.target,type:x.value.type,updatable:O.value,selected:x.value.selected,animated:x.value.animated,label:x.value.label,labelStyle:x.value.labelStyle,labelShowBg:x.value.labelShowBg,labelBgStyle:x.value.labelBgStyle,labelBgPadding:x.value.labelBgPadding,labelBgBorderRadius:x.value.labelBgBorderRadius,data:x.value.data,events:{...x.value.events,...S},style:H.value,markerStart:`url('#${Hi(x.value.markerStart,n)}')`,markerEnd:`url('#${Hi(x.value.markerEnd,n)}')`,sourcePosition:p,targetPosition:g,sourceX:m,sourceY:y,targetX:w,targetY:_,sourceHandleId:x.value.sourceHandle,targetHandleId:x.value.targetHandle,interactionWidth:x.value.interactionWidth,...l}),["source"===O.value||!0===O.value?[R("g",{onMousedown:ee,onMouseenter:F,onMouseout:U},R(Ka,{position:p,centerX:m,centerY:y,radius:r.value,type:"source","data-type":"source"}))]:null,"target"===O.value||!0===O.value?[R("g",{onMousedown:te,onMouseenter:F,onMouseout:U},R(Ka,{position:g,centerX:w,centerY:_,radius:r.value,type:"target","data-type":"target"}))]:null]])};function F(){M.value=!0}function U(){M.value=!1}function j(e,t){0===e.button&&(I.value=!0,A.value=t?x.value.target:x.value.source,P.value=(t?x.value.targetHandle:x.value.sourceHandle)??null,T.value=t?"target":"source",E.updateStart({event:e,edge:x.value}),G(e))}function Z(e){var t;const n={event:e,edge:x.value};D.value&&(l.value=!1,x.value.selected&&g.value?(c([x.value]),null==(t=z.value)||t.blur()):o([x.value])),E.click(n)}function q(e){E.contextMenu({event:e,edge:x.value})}function W(e){E.doubleClick({event:e,edge:x.value})}function K(e){E.mouseEnter({event:e,edge:x.value})}function J(e){E.mouseMove({event:e,edge:x.value})}function Q(e){E.mouseLeave({event:e,edge:x.value})}function ee(e){j(e,!0)}function te(e){j(e,!1)}function ne(e){var n;if(!m.value&&vi.includes(e.key)&&D.value){"Escape"===e.key?(null==(n=z.value)||n.blur(),c([d(t.id)])):o([d(t.id)])}}}}),Qa=o({name:"ConnectionLine",compatConfig:{MODE:3},setup(){var t;const{id:n,connectionMode:o,connectionStartHandle:i,connectionEndHandle:r,connectionPosition:a,connectionLineType:l,connectionLineStyle:u,connectionLineOptions:s,connectionStatus:c,viewport:d,findNode:h}=Ba(),f=null==(t=e(Lr))?void 0:t["connection-line"],p=v(()=>{var e;return h(null==(e=i.value)?void 0:e.nodeId)}),g=v(()=>{var e;return h(null==(e=r.value)?void 0:e.nodeId)??null}),m=v(()=>({x:(a.value.x-d.value.x)/d.value.zoom,y:(a.value.y-d.value.y)/d.value.zoom})),y=v(()=>s.value.markerStart?`url(#${Hi(s.value.markerStart,n)})`:""),w=v(()=>s.value.markerEnd?`url(#${Hi(s.value.markerEnd,n)})`:"");return()=>{var e,t,n;if(!p.value||!i.value)return null;const a=i.value.id,d=i.value.type,h=p.value.handleBounds;let v=(null==h?void 0:h[d])??[];if(o.value===oi.Loose){const e=(null==h?void 0:h["source"===d?"target":"source"])??[];v=[...v,...e]}if(!v)return null;const _=(a?v.find(e=>e.id===a):v[0])??null,b=(null==_?void 0:_.position)??ei.Top,{x:x,y:E}=rr(p.value,_,b);let S=null;g.value&&(S=o.value===oi.Strict?(null==(e=g.value.handleBounds["source"===d?"target":"source"])?void 0:e.find(e=>{var t;return e.id===(null==(t=r.value)?void 0:t.id)}))||null:(null==(t=[...g.value.handleBounds.source??[],...g.value.handleBounds.target??[]])?void 0:t.find(e=>{var t;return e.id===(null==(t=r.value)?void 0:t.id)}))||null);const k=(null==(n=r.value)?void 0:n.position)??(b?xr[b]:null);if(!b||!k)return null;const N=l.value??s.value.type??ni.Bezier;let M="";const C={sourceX:x,sourceY:E,sourcePosition:b,targetX:m.value.x,targetY:m.value.y,targetPosition:k};return N===ni.Bezier?[M]=xa(C):N===ni.Step?[M]=Ca({...C,borderRadius:0}):N===ni.SmoothStep?[M]=Ca(C):N===ni.SimpleBezier?[M]=Sa(C):M=`M${x},${E} ${m.value.x},${m.value.y}`,R("svg",{class:"vue-flow__edges vue-flow__connectionline vue-flow__container"},R("g",{class:"vue-flow__connection"},f?R(f,{sourceX:x,sourceY:E,sourcePosition:b,targetX:m.value.x,targetY:m.value.y,targetPosition:k,sourceNode:p.value,sourceHandle:_,targetNode:g.value,targetHandle:S,markerEnd:w.value,markerStart:y.value,connectionStatus:c.value}):R("path",{d:M,class:[s.value.class,c.value,"vue-flow__connection-path"],style:{...u.value,...s.value.style},"marker-end":w.value,"marker-start":y.value})))}}}),el=["id","markerWidth","markerHeight","markerUnits","orient"],tl=o({name:"MarkerType",compatConfig:{MODE:3},props:{id:{},type:{},color:{default:"none"},width:{default:12.5},height:{default:12.5},markerUnits:{default:"strokeWidth"},orient:{default:"auto-start-reverse"},strokeWidth:{default:1}},setup:e=>(e,t)=>(a(),l("marker",{id:e.id,class:"vue-flow__arrowhead",viewBox:"-10 -10 20 20",refX:"0",refY:"0",markerWidth:`${e.width}`,markerHeight:`${e.height}`,markerUnits:e.markerUnits,orient:e.orient},[e.type===d(ii).ArrowClosed?(a(),l("polyline",{key:0,style:h({stroke:e.color,fill:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",points:"-5,-4 0,0 -5,4 -5,-4"},null,4)):M("",!0),e.type===d(ii).Arrow?(a(),l("polyline",{key:1,style:h({stroke:e.color,strokeWidth:e.strokeWidth}),"stroke-linecap":"round","stroke-linejoin":"round",fill:"none",points:"-5,-4 0,0 -5,4"},null,4)):M("",!0)],8,el))}),nl={class:"vue-flow__marker vue-flow__container","aria-hidden":"true"},ol=o({name:"MarkerDefinitions",compatConfig:{MODE:3},setup(e){const{id:t,edges:n,connectionLineOptions:o,defaultMarkerColor:i}=Ba(),r=v(()=>{const e=new Set,r=[],a=n=>{if(n){const o=Hi(n,t);e.has(o)||("object"==typeof n?r.push({...n,id:o,color:n.color||i.value}):r.push({id:o,color:i.value,type:n}),e.add(o))}};for(const t of[o.value.markerEnd,o.value.markerStart])a(t);for(const t of n.value)for(const e of[t.markerStart,t.markerEnd])a(e);return r.sort((e,t)=>e.id.localeCompare(t.id))});return(e,t)=>(a(),l("svg",nl,[_("defs",null,[(a(!0),l(b,null,x(r.value,e=>(a(),N(tl,{id:e.id,key:e.id,type:e.type,color:e.color,width:e.width,height:e.height,markerUnits:e.markerUnits,"stroke-width":e.strokeWidth,orient:e.orient},null,8,["id","type","color","width","height","markerUnits","stroke-width","orient"]))),128))])]))}}),il=o({name:"Edges",compatConfig:{MODE:3},setup(e){const{findNode:t,getEdges:n,elevateEdgesOnSelect:o}=Ba();return(e,i)=>(a(),l(b,null,[u(ol),(a(!0),l(b,null,x(d(n),e=>(a(),l("svg",{key:e.id,class:"vue-flow__edges vue-flow__container",style:h({zIndex:d(ur)(e,d(t),d(o))})},[u(d(Ja),{id:e.id},null,8,["id"])],4))),128)),u(d(Qa))],64))}}),rl=o({name:"Node",compatConfig:{MODE:3},props:["id","resizeObserver"],setup(t){const{id:o,noPanClassName:i,selectNodesOnDrag:r,nodesSelectionActive:a,multiSelectionActive:l,emits:u,removeSelectedNodes:s,addSelectedNodes:c,updateNodeDimensions:d,onUpdateNodeInternals:h,getNodeTypes:f,nodeExtent:g,elevateNodesOnSelect:m,disableKeyboardA11y:y,ariaLiveMessage:_,snapToGrid:b,snapGrid:x,nodeDragThreshold:S,nodesDraggable:k,elementsSelectable:N,nodesConnectable:M,nodesFocusable:I,hooks:A}=Ba(),P=C(null);B(Br,P),B(Or,t.id);const T=e(Lr),z=p(),D=jr(),{node:O,parentNode:V}=Fr(t.id),{emit:L,on:H}=Ur(O,u),X=$(()=>void 0===O.draggable?k.value:O.draggable),G=$(()=>void 0===O.selectable?N.value:O.selectable),F=$(()=>void 0===O.connectable?M.value:O.connectable),U=$(()=>void 0===O.focusable?I.value:O.focusable),j=v(()=>G.value||X.value||A.value.nodeClick.hasListeners()||A.value.nodeDoubleClick.hasListeners()||A.value.nodeMouseEnter.hasListeners()||A.value.nodeMouseMove.hasListeners()||A.value.nodeMouseLeave.hasListeners()),Z=$(()=>!!O.dimensions.width&&!!O.dimensions.height),q=v(()=>{const e=O.type||"default",t=null==T?void 0:T[`node-${e}`];if(t)return t;let n=O.template||f.value[e];if("string"==typeof n&&z){const t=Object.keys(z.appContext.components);t&&t.includes(e)&&(n=Y(e,!1))}return n&&"string"!=typeof n?n:(u.error(new dr(sr.NODE_TYPE_MISSING,n)),!1)}),W=Hr({id:t.id,el:P,disabled:()=>!X.value,selectable:G,dragHandle:()=>O.dragHandle,onStart(e){L.dragStart(e)},onDrag(e){L.drag(e)},onStop(e){L.dragStop(e)},onClick(e){ue(e)}}),K=v(()=>O.class instanceof Function?O.class(O):O.class),J=v(()=>{const e=(O.style instanceof Function?O.style(O):O.style)||{},t=O.width instanceof Function?O.width(O):O.width,n=O.height instanceof Function?O.height(O):O.height;return!e.width&&t&&(e.width="string"==typeof t?t:`${t}px`),!e.height&&n&&(e.height="string"==typeof n?n:`${n}px`),e}),Q=$(()=>Number(O.zIndex??J.value.zIndex??0));return h(e=>{!e.includes(t.id)&&e.length||te()}),w(()=>{n(()=>O.hidden,(e=!1,n,o)=>{!e&&P.value&&(t.resizeObserver.observe(P.value),o(()=>{P.value&&t.resizeObserver.unobserve(P.value)}))},{immediate:!0,flush:"post"})}),n([()=>O.type,()=>O.sourcePosition,()=>O.targetPosition],()=>{E(()=>{d([{id:t.id,nodeElement:P.value,forceUpdate:!0}])})}),n([()=>O.position.x,()=>O.position.y,()=>{var e;return null==(e=V.value)?void 0:e.computedPosition.x},()=>{var e;return null==(e=V.value)?void 0:e.computedPosition.y},()=>{var e;return null==(e=V.value)?void 0:e.computedPosition.z},Q,()=>O.selected,()=>O.dimensions.height,()=>O.dimensions.width,()=>{var e;return null==(e=V.value)?void 0:e.dimensions.height},()=>{var e;return null==(e=V.value)?void 0:e.dimensions.width}],([e,t,n,o,i,r])=>{const a={x:e,y:t,z:r+(m.value&&O.selected?1e3:0)};var l,u;O.computedPosition=void 0!==n&&void 0!==o?{x:(u=a).x+(l={x:n,y:o,z:i}).x,y:u.y+l.y,z:(l.z>u.z?l.z:u.z)+1}:a},{flush:"post",immediate:!0}),n([()=>O.extent,g],([e,t],[n,o])=>{e===n&&t===o||ee()}),"parent"===O.extent||"object"==typeof O.extent&&"range"in O.extent&&"parent"===O.extent.range?ae(()=>Z).toBe(!0).then(ee):ee(),()=>O.hidden?null:R("div",{ref:P,"data-id":O.id,class:["vue-flow__node",`vue-flow__node-${!1===q.value?"default":O.type||"default"}`,{[i.value]:X.value,dragging:null==W?void 0:W.value,draggable:X.value,selected:O.selected,selectable:G.value,parent:O.isParent},K.value],style:{visibility:Z.value?"visible":"hidden",zIndex:O.computedPosition.z??Q.value,transform:`translate(${O.computedPosition.x}px,${O.computedPosition.y}px)`,pointerEvents:j.value?"all":"none",...J.value},tabIndex:U.value?0:void 0,role:U.value?"group":void 0,"aria-describedby":y.value?void 0:`${hi}-${o}`,"aria-label":O.ariaLabel,"aria-roledescription":"node",...O.domAttributes,onMouseenter:ne,onMousemove:oe,onMouseleave:ie,onContextmenu:re,onClick:ue,onDblclick:le,onKeydown:se},[R(!1===q.value?f.value.default:q.value,{id:O.id,type:O.type,data:O.data,events:{...O.events,...H},selected:O.selected,resizing:O.resizing,dragging:W.value,connectable:F.value,position:O.computedPosition,dimensions:O.dimensions,isValidTargetPos:O.isValidTargetPos,isValidSourcePos:O.isValidSourcePos,parent:O.parentNode,parentNodeId:O.parentNode,zIndex:O.computedPosition.z??Q.value,targetPosition:O.targetPosition,sourcePosition:O.sourcePosition,label:O.label,dragHandle:O.dragHandle,onUpdateNodeInternals:te})]);function ee(){const e=O.computedPosition,{computedPosition:t,position:n}=ir(O,b.value?pr(e,x.value):e,u.error,g.value,V.value);O.computedPosition.x===t.x&&O.computedPosition.y===t.y||(O.computedPosition={...O.computedPosition,...t}),O.position.x===n.x&&O.position.y===n.y||(O.position=n)}function te(){P.value&&d([{id:t.id,nodeElement:P.value,forceUpdate:!0}])}function ne(e){(null==W?void 0:W.value)||L.mouseEnter({event:e,node:O})}function oe(e){(null==W?void 0:W.value)||L.mouseMove({event:e,node:O})}function ie(e){(null==W?void 0:W.value)||L.mouseLeave({event:e,node:O})}function re(e){return L.contextMenu({event:e,node:O})}function le(e){return L.doubleClick({event:e,node:O})}function ue(e){G.value&&(!r.value||!X.value||S.value>0)&&Mr(O,l.value,c,s,a,!1,P.value),L.click({event:e,node:O})}function se(e){if(!si(e)&&!y.value)if(vi.includes(e.key)&&G.value){const t="Escape"===e.key;Mr(O,l.value,c,s,a,t,P.value)}else X.value&&O.selected&&pi[e.key]&&(e.preventDefault(),_.value=`Moved selected node ${e.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~O.position.x}, y: ${~~O.position.y}`,D({x:pi[e.key].x,y:pi[e.key].y},e.shiftKey))}}});const al={class:"vue-flow__nodes vue-flow__container"},ll=o({name:"Nodes",compatConfig:{MODE:3},setup(e){const{getNodes:t,updateNodeDimensions:o,emits:i}=Ba(),r=function(e={includeHiddenNodes:!1}){const{nodes:t}=Ba();return v(()=>{if(0===t.value.length)return!1;for(const n of t.value)if((e.includeHiddenNodes||!n.hidden)&&(void 0===(null==n?void 0:n.handleBounds)||0===n.dimensions.width||0===n.dimensions.height))return!1;return!0})}(),u=C();return n(r,e=>{e&&E(()=>{i.nodesInitialized(t.value)})},{immediate:!0}),w(()=>{u.value=new ResizeObserver(e=>{const t=e.map(e=>({id:e.target.getAttribute("data-id"),nodeElement:e.target,forceUpdate:!0}));E(()=>o(t))})}),S(()=>{var e;return null==(e=u.value)?void 0:e.disconnect()}),(e,n)=>(a(),l("div",al,[u.value?(a(!0),l(b,{key:0},x(d(t),(e,t,n,o)=>{const i=[e.id];if(o&&o.key===e.id&&k(o,i))return o;const r=(a(),N(d(rl),{id:e.id,key:e.id,"resize-observer":u.value},null,8,["id","resize-observer"]));return r.memo=i,r},n,0),128)):M("",!0)]))}});const ul=_("div",{class:"vue-flow__edge-labels"},null,-1),sl=o({name:"VueFlow",compatConfig:{MODE:3},props:{id:{},modelValue:{},nodes:{},edges:{},edgeTypes:{},nodeTypes:{},connectionMode:{},connectionLineType:{},connectionLineStyle:{default:void 0},connectionLineOptions:{default:void 0},connectionRadius:{},isValidConnection:{type:[Function,null],default:void 0},deleteKeyCode:{default:void 0},selectionKeyCode:{type:[Boolean,null],default:void 0},multiSelectionKeyCode:{default:void 0},zoomActivationKeyCode:{default:void 0},panActivationKeyCode:{default:void 0},snapToGrid:{type:Boolean,default:void 0},snapGrid:{},onlyRenderVisibleElements:{type:Boolean,default:void 0},edgesUpdatable:{type:[Boolean,String],default:void 0},nodesDraggable:{type:Boolean,default:void 0},nodesConnectable:{type:Boolean,default:void 0},nodeDragThreshold:{},elementsSelectable:{type:Boolean,default:void 0},selectNodesOnDrag:{type:Boolean,default:void 0},panOnDrag:{type:[Boolean,Array],default:void 0},minZoom:{},maxZoom:{},defaultViewport:{},translateExtent:{},nodeExtent:{},defaultMarkerColor:{},zoomOnScroll:{type:Boolean,default:void 0},zoomOnPinch:{type:Boolean,default:void 0},panOnScroll:{type:Boolean,default:void 0},panOnScrollSpeed:{},panOnScrollMode:{},paneClickDistance:{},zoomOnDoubleClick:{type:Boolean,default:void 0},preventScrolling:{type:Boolean,default:void 0},selectionMode:{},edgeUpdaterRadius:{},fitViewOnInit:{type:Boolean,default:void 0},connectOnClick:{type:Boolean,default:void 0},applyDefault:{type:Boolean,default:void 0},autoConnect:{type:[Boolean,Function],default:void 0},noDragClassName:{},noWheelClassName:{},noPanClassName:{},defaultEdgeOptions:{},elevateEdgesOnSelect:{type:Boolean,default:void 0},elevateNodesOnSelect:{type:Boolean,default:void 0},disableKeyboardA11y:{type:Boolean,default:void 0},edgesFocusable:{type:Boolean,default:void 0},nodesFocusable:{type:Boolean,default:void 0},autoPanOnConnect:{type:Boolean,default:void 0},autoPanOnNodeDrag:{type:Boolean,default:void 0},autoPanSpeed:{}},emits:["nodesChange","edgesChange","nodesInitialized","paneReady","init","updateNodeInternals","error","connect","connectStart","connectEnd","clickConnectStart","clickConnectEnd","moveStart","move","moveEnd","selectionDragStart","selectionDrag","selectionDragStop","selectionContextMenu","selectionStart","selectionEnd","viewportChangeStart","viewportChange","viewportChangeEnd","paneScroll","paneClick","paneContextMenu","paneMouseEnter","paneMouseMove","paneMouseLeave","edgeUpdate","edgeContextMenu","edgeMouseEnter","edgeMouseMove","edgeMouseLeave","edgeDoubleClick","edgeClick","edgeUpdateStart","edgeUpdateEnd","nodeContextMenu","nodeMouseEnter","nodeMouseMove","nodeMouseLeave","nodeDoubleClick","nodeClick","nodeDragStart","nodeDrag","nodeDragStop","miniMapNodeClick","miniMapNodeDoubleClick","miniMapNodeMouseEnter","miniMapNodeMouseMove","miniMapNodeMouseLeave","update:modelValue","update:nodes","update:edges"],setup(e,{expose:t,emit:o}){const h=e,f=i(),v=de(h,"modelValue",o),g=de(h,"nodes",o),m=de(h,"edges",o),_=Ba(h),b=Qr({modelValue:v,nodes:g,edges:m},h,_);return function(e,t){const n=p();function o(e){var t;const o=function(e){const[t,...n]=e.split(":");return`on${t.replace(/(?:^|-)(\w)/g,(e,t)=>t.toUpperCase())}${n.length?`:${n.join(":")}`:""}`}(e);return!!(null==(t=null==n?void 0:n.vnode.props)?void 0:t[o])}y(()=>{for(const[n,i]of Object.entries(t.value)){const t=t=>{e(n,t)};i.setEmitter(t),q(i.removeEmitter),i.setHasEmitListeners(()=>o(n)),q(i.removeHasEmitListeners)}})}(o,_.hooks),function(){const e=Ba();n(()=>e.viewportHelper.value.viewportInitialized,t=>{t&&setTimeout(()=>{e.emits.init(e),e.emits.paneReady(e)},1)})}(),function(){const{emits:e}=Ba();w(()=>{if(kr()){const t=document.querySelector(".vue-flow__pane");t&&"1"!==window.getComputedStyle(t).zIndex&&e.error(new dr(sr.MISSING_STYLES))}})}(),B(Lr,f),r(b),t(_),(e,t)=>(a(),l("div",{ref:d(_).vueFlowRef,class:"vue-flow"},[u(Xa,null,{default:s(()=>[u(il),ul,u(ll),c(e.$slots,"zoom-pane")]),_:3}),c(e.$slots,"default"),u(ja)],512))}}),cl=o({name:"Panel",compatConfig:{MODE:3},props:{position:{}},setup(e){const t=e,{userSelectionActive:n}=Ba(),o=v(()=>`${t.position}`.split("-"));return(e,t)=>(a(),l("div",{class:f(["vue-flow__panel",o.value]),style:h({pointerEvents:d(n)?"none":"all"})},[c(e.$slots,"default")],6))}});var dl=(e=>(e.Lines="lines",e.Dots="dots",e))(dl||{});const hl=function({dimensions:e,size:t,color:n}){return R("path",{stroke:n,"stroke-width":t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`})},fl=function({radius:e,color:t}){return R("circle",{cx:e,cy:e,r:e,fill:t})};dl.Lines,dl.Dots;const vl={[dl.Dots]:"#81818a",[dl.Lines]:"#eee"},pl=["id","x","y","width","height","patternTransform"],gl={key:2,height:"100",width:"100"},ml=["fill"],yl=["x","y","fill"],wl=o({name:"Background",compatConfig:{MODE:3},props:{id:{},variant:{default:()=>dl.Dots},gap:{default:20},size:{default:1},lineWidth:{default:1},patternColor:{},color:{},bgColor:{},height:{default:100},width:{default:100},x:{default:0},y:{default:0},offset:{default:0}},setup(e){const{id:t,viewport:n}=Ba(),o=v(()=>{const t=n.value.zoom,[o,i]=Array.isArray(e.gap)?e.gap:[e.gap,e.gap],r=[o*t||1,i*t||1],a=e.size*t,[l,u]=Array.isArray(e.offset)?e.offset:[e.offset,e.offset];return{scaledGap:r,offset:[l*t||1+r[0]/2,u*t||1+r[1]/2],size:a}}),i=$(()=>`pattern-${t}${e.id?`-${e.id}`:""}`),r=$(()=>e.color||e.patternColor||vl[e.variant||dl.Dots]);return(e,t)=>(a(),l("svg",{class:"vue-flow__background vue-flow__container",style:h({height:`${e.height>100?100:e.height}%`,width:`${e.width>100?100:e.width}%`})},[c(e.$slots,"pattern-container",{id:i.value},()=>[_("pattern",{id:i.value,x:d(n).x%o.value.scaledGap[0],y:d(n).y%o.value.scaledGap[1],width:o.value.scaledGap[0],height:o.value.scaledGap[1],patternTransform:`translate(-${o.value.offset[0]},-${o.value.offset[1]})`,patternUnits:"userSpaceOnUse"},[c(e.$slots,"pattern",{},()=>[e.variant===d(dl).Lines?(a(),N(d(hl),{key:0,size:e.lineWidth,color:r.value,dimensions:o.value.scaledGap},null,8,["size","color","dimensions"])):e.variant===d(dl).Dots?(a(),N(d(fl),{key:1,color:r.value,radius:o.value.size/2},null,8,["color","radius"])):M("",!0),e.bgColor?(a(),l("svg",gl,[_("rect",{width:"100%",height:"100%",fill:e.bgColor},null,8,ml)])):M("",!0)])],8,pl)]),_("rect",{x:e.x,y:e.y,width:"100%",height:"100%",fill:`url(#${i.value})`},null,8,yl),c(e.$slots,"default",{id:i.value})],4))}});var _l={value:()=>{}};function bl(){for(var e,t=0,n=arguments.length,o={};t<n;++t){if(!(e=arguments[t]+"")||e in o||/[\s.]/.test(e))throw new Error("illegal type: "+e);o[e]=[]}return new xl(o)}function xl(e){this._=e}function El(e,t){for(var n,o=0,i=e.length;o<i;++o)if((n=e[o]).name===t)return n.value}function Sl(e,t,n){for(var o=0,i=e.length;o<i;++o)if(e[o].name===t){e[o]=_l,e=e.slice(0,o).concat(e.slice(o+1));break}return null!=n&&e.push({name:t,value:n}),e}xl.prototype=bl.prototype={constructor:xl,on:function(e,t){var n,o,i=this._,r=(o=i,(e+"").trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");if(n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),e&&!o.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:t}})),a=-1,l=r.length;if(!(arguments.length<2)){if(null!=t&&"function"!=typeof t)throw new Error("invalid callback: "+t);for(;++a<l;)if(n=(e=r[a]).type)i[n]=Sl(i[n],e.name,t);else if(null==t)for(n in i)i[n]=Sl(i[n],e.name,null);return this}for(;++a<l;)if((n=(e=r[a]).type)&&(n=El(i[n],e.name)))return n},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new xl(e)},call:function(e,t){if((n=arguments.length-2)>0)for(var n,o,i=new Array(n),r=0;r<n;++r)i[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(r=0,n=(o=this._[e]).length;r<n;++r)o[r].value.apply(t,i)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var o=this._[e],i=0,r=o.length;i<r;++i)o[i].value.apply(t,n)}};var kl="http://www.w3.org/1999/xhtml";const Nl={svg:"http://www.w3.org/2000/svg",xhtml:kl,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ml(e){var t=e+="",n=t.indexOf(":");return n>=0&&"xmlns"!==(t=e.slice(0,n))&&(e=e.slice(n+1)),Nl.hasOwnProperty(t)?{space:Nl[t],local:e}:e}function Cl(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===kl&&t.documentElement.namespaceURI===kl?t.createElement(e):t.createElementNS(n,e)}}function Il(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function $l(e){var t=Ml(e);return(t.local?Il:Cl)(t)}function Al(){}function Pl(e){return null==e?Al:function(){return this.querySelector(e)}}function Tl(){return[]}function zl(e){return null==e?Tl:function(){return this.querySelectorAll(e)}}function Dl(e){return function(){return null==(t=e.apply(this,arguments))?[]:Array.isArray(t)?t:Array.from(t);var t}}function Ol(e){return function(){return this.matches(e)}}function Bl(e){return function(t){return t.matches(e)}}var Rl=Array.prototype.find;function Vl(){return this.firstElementChild}var Ll=Array.prototype.filter;function Hl(){return Array.from(this.children)}function Yl(e){return new Array(e.length)}function Xl(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}function Gl(e,t,n,o,i,r){for(var a,l=0,u=t.length,s=r.length;l<s;++l)(a=t[l])?(a.__data__=r[l],o[l]=a):n[l]=new Xl(e,r[l]);for(;l<u;++l)(a=t[l])&&(i[l]=a)}function Fl(e,t,n,o,i,r,a){var l,u,s,c=new Map,d=t.length,h=r.length,f=new Array(d);for(l=0;l<d;++l)(u=t[l])&&(f[l]=s=a.call(u,u.__data__,l,t)+"",c.has(s)?i[l]=u:c.set(s,u));for(l=0;l<h;++l)s=a.call(e,r[l],l,r)+"",(u=c.get(s))?(o[l]=u,u.__data__=r[l],c.delete(s)):n[l]=new Xl(e,r[l]);for(l=0;l<d;++l)(u=t[l])&&c.get(f[l])===u&&(i[l]=u)}function Ul(e){return e.__data__}function jl(e){return"object"==typeof e&&"length"in e?e:Array.from(e)}function Zl(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function ql(e){return function(){this.removeAttribute(e)}}function Wl(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Kl(e,t){return function(){this.setAttribute(e,t)}}function Jl(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Ql(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttribute(e):this.setAttribute(e,n)}}function eu(e,t){return function(){var n=t.apply(this,arguments);null==n?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function tu(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function nu(e){return function(){this.style.removeProperty(e)}}function ou(e,t,n){return function(){this.style.setProperty(e,t,n)}}function iu(e,t,n){return function(){var o=t.apply(this,arguments);null==o?this.style.removeProperty(e):this.style.setProperty(e,o,n)}}function ru(e,t){return e.style.getPropertyValue(t)||tu(e).getComputedStyle(e,null).getPropertyValue(t)}function au(e){return function(){delete this[e]}}function lu(e,t){return function(){this[e]=t}}function uu(e,t){return function(){var n=t.apply(this,arguments);null==n?delete this[e]:this[e]=n}}function su(e){return e.trim().split(/^|\s+/)}function cu(e){return e.classList||new du(e)}function du(e){this._node=e,this._names=su(e.getAttribute("class")||"")}function hu(e,t){for(var n=cu(e),o=-1,i=t.length;++o<i;)n.add(t[o])}function fu(e,t){for(var n=cu(e),o=-1,i=t.length;++o<i;)n.remove(t[o])}function vu(e){return function(){hu(this,e)}}function pu(e){return function(){fu(this,e)}}function gu(e,t){return function(){(t.apply(this,arguments)?hu:fu)(this,e)}}function mu(){this.textContent=""}function yu(e){return function(){this.textContent=e}}function wu(e){return function(){var t=e.apply(this,arguments);this.textContent=null==t?"":t}}function _u(){this.innerHTML=""}function bu(e){return function(){this.innerHTML=e}}function xu(e){return function(){var t=e.apply(this,arguments);this.innerHTML=null==t?"":t}}function Eu(){this.nextSibling&&this.parentNode.appendChild(this)}function Su(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function ku(){return null}function Nu(){var e=this.parentNode;e&&e.removeChild(this)}function Mu(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Cu(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Iu(e){return function(){var t=this.__on;if(t){for(var n,o=0,i=-1,r=t.length;o<r;++o)n=t[o],e.type&&n.type!==e.type||n.name!==e.name?t[++i]=n:this.removeEventListener(n.type,n.listener,n.options);++i?t.length=i:delete this.__on}}}function $u(e,t,n){return function(){var o,i=this.__on,r=function(e){return function(t){e.call(this,t,this.__data__)}}(t);if(i)for(var a=0,l=i.length;a<l;++a)if((o=i[a]).type===e.type&&o.name===e.name)return this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=r,o.options=n),void(o.value=t);this.addEventListener(e.type,r,n),o={type:e.type,name:e.name,value:t,listener:r,options:n},i?i.push(o):this.__on=[o]}}function Au(e,t,n){var o=tu(e),i=o.CustomEvent;"function"==typeof i?i=new i(t,n):(i=o.document.createEvent("Event"),n?(i.initEvent(t,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(t,!1,!1)),e.dispatchEvent(i)}function Pu(e,t){return function(){return Au(this,e,t)}}function Tu(e,t){return function(){return Au(this,e,t.apply(this,arguments))}}Xl.prototype={constructor:Xl,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)}},du.prototype={add:function(e){this._names.indexOf(e)<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}};var zu=[null];function Du(e,t){this._groups=e,this._parents=t}function Ou(){return new Du([[document.documentElement]],zu)}function Bu(e){return"string"==typeof e?new Du([[document.querySelector(e)]],[document.documentElement]):new Du([[e]],zu)}function Ru(e,t){if(e=function(e){let t;for(;t=e.sourceEvent;)e=t;return e}(e),void 0===t&&(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())).x,o.y]}if(t.getBoundingClientRect){var i=t.getBoundingClientRect();return[e.clientX-i.left-t.clientLeft,e.clientY-i.top-t.clientTop]}}return[e.pageX,e.pageY]}Du.prototype=Ou.prototype={constructor:Du,select:function(e){"function"!=typeof e&&(e=Pl(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a,l=t[i],u=l.length,s=o[i]=new Array(u),c=0;c<u;++c)(r=l[c])&&(a=e.call(r,r.__data__,c,l))&&("__data__"in r&&(a.__data__=r.__data__),s[c]=a);return new Du(o,this._parents)},selectAll:function(e){e="function"==typeof e?Dl(e):zl(e);for(var t=this._groups,n=t.length,o=[],i=[],r=0;r<n;++r)for(var a,l=t[r],u=l.length,s=0;s<u;++s)(a=l[s])&&(o.push(e.call(a,a.__data__,s,l)),i.push(a));return new Du(o,i)},selectChild:function(e){return this.select(null==e?Vl:function(e){return function(){return Rl.call(this.children,e)}}("function"==typeof e?e:Bl(e)))},selectChildren:function(e){return this.selectAll(null==e?Hl:function(e){return function(){return Ll.call(this.children,e)}}("function"==typeof e?e:Bl(e)))},filter:function(e){"function"!=typeof e&&(e=Ol(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a=t[i],l=a.length,u=o[i]=[],s=0;s<l;++s)(r=a[s])&&e.call(r,r.__data__,s,a)&&u.push(r);return new Du(o,this._parents)},data:function(e,t){if(!arguments.length)return Array.from(this,Ul);var n,o=t?Fl:Gl,i=this._parents,r=this._groups;"function"!=typeof e&&(n=e,e=function(){return n});for(var a=r.length,l=new Array(a),u=new Array(a),s=new Array(a),c=0;c<a;++c){var d=i[c],h=r[c],f=h.length,v=jl(e.call(d,d&&d.__data__,c,i)),p=v.length,g=u[c]=new Array(p),m=l[c]=new Array(p);o(d,h,g,m,s[c]=new Array(f),v,t);for(var y,w,_=0,b=0;_<p;++_)if(y=g[_]){for(_>=b&&(b=_+1);!(w=m[b])&&++b<p;);y._next=w||null}}return(l=new Du(l,i))._enter=u,l._exit=s,l},enter:function(){return new Du(this._enter||this._groups.map(Yl),this._parents)},exit:function(){return new Du(this._exit||this._groups.map(Yl),this._parents)},join:function(e,t,n){var o=this.enter(),i=this,r=this.exit();return"function"==typeof e?(o=e(o))&&(o=o.selection()):o=o.append(e+""),null!=t&&(i=t(i))&&(i=i.selection()),null==n?r.remove():n(r),o&&i?o.merge(i).order():i},merge:function(e){for(var t=e.selection?e.selection():e,n=this._groups,o=t._groups,i=n.length,r=o.length,a=Math.min(i,r),l=new Array(i),u=0;u<a;++u)for(var s,c=n[u],d=o[u],h=c.length,f=l[u]=new Array(h),v=0;v<h;++v)(s=c[v]||d[v])&&(f[v]=s);for(;u<i;++u)l[u]=n[u];return new Du(l,this._parents)},selection:function(){return this},order:function(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var o,i=e[t],r=i.length-1,a=i[r];--r>=0;)(o=i[r])&&(a&&4^o.compareDocumentPosition(a)&&a.parentNode.insertBefore(o,a),a=o);return this},sort:function(e){function t(t,n){return t&&n?e(t.__data__,n.__data__):!t-!n}e||(e=Zl);for(var n=this._groups,o=n.length,i=new Array(o),r=0;r<o;++r){for(var a,l=n[r],u=l.length,s=i[r]=new Array(u),c=0;c<u;++c)(a=l[c])&&(s[c]=a);s.sort(t)}return new Du(i,this._parents).order()},call:function(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this},nodes:function(){return Array.from(this)},node:function(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o=e[t],i=0,r=o.length;i<r;++i){var a=o[i];if(a)return a}return null},size:function(){let e=0;for(const t of this)++e;return e},empty:function(){return!this.node()},each:function(e){for(var t=this._groups,n=0,o=t.length;n<o;++n)for(var i,r=t[n],a=0,l=r.length;a<l;++a)(i=r[a])&&e.call(i,i.__data__,a,r);return this},attr:function(e,t){var n=Ml(e);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((null==t?n.local?Wl:ql:"function"==typeof t?n.local?eu:Ql:n.local?Jl:Kl)(n,t))},style:function(e,t,n){return arguments.length>1?this.each((null==t?nu:"function"==typeof t?iu:ou)(e,t,null==n?"":n)):ru(this.node(),e)},property:function(e,t){return arguments.length>1?this.each((null==t?au:"function"==typeof t?uu:lu)(e,t)):this.node()[e]},classed:function(e,t){var n=su(e+"");if(arguments.length<2){for(var o=cu(this.node()),i=-1,r=n.length;++i<r;)if(!o.contains(n[i]))return!1;return!0}return this.each(("function"==typeof t?gu:t?vu:pu)(n,t))},text:function(e){return arguments.length?this.each(null==e?mu:("function"==typeof e?wu:yu)(e)):this.node().textContent},html:function(e){return arguments.length?this.each(null==e?_u:("function"==typeof e?xu:bu)(e)):this.node().innerHTML},raise:function(){return this.each(Eu)},lower:function(){return this.each(Su)},append:function(e){var t="function"==typeof e?e:$l(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})},insert:function(e,t){var n="function"==typeof e?e:$l(e),o=null==t?ku:"function"==typeof t?t:Pl(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})},remove:function(){return this.each(Nu)},clone:function(e){return this.select(e?Cu:Mu)},datum:function(e){return arguments.length?this.property("__data__",e):this.node().__data__},on:function(e,t,n){var o,i,r=function(e){return e.trim().split(/^|\s+/).map(function(e){var t="",n=e.indexOf(".");return n>=0&&(t=e.slice(n+1),e=e.slice(0,n)),{type:e,name:t}})}(e+""),a=r.length;if(!(arguments.length<2)){for(l=t?$u:Iu,o=0;o<a;++o)this.each(l(r[o],t,n));return this}var l=this.node().__on;if(l)for(var u,s=0,c=l.length;s<c;++s)for(o=0,u=l[s];o<a;++o)if((i=r[o]).type===u.type&&i.name===u.name)return u.value},dispatch:function(e,t){return this.each(("function"==typeof t?Tu:Pu)(e,t))},[Symbol.iterator]:function*(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var o,i=e[t],r=0,a=i.length;r<a;++r)(o=i[r])&&(yield o)}};const Vu={capture:!0,passive:!1};function Lu(e){e.preventDefault(),e.stopImmediatePropagation()}function Hu(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function Yu(e,t){var n=Object.create(e.prototype);for(var o in t)n[o]=t[o];return n}function Xu(){}var Gu=.7,Fu=1/Gu,Uu="\\s*([+-]?\\d+)\\s*",ju="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Zu="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",qu=/^#([0-9a-f]{3,8})$/,Wu=new RegExp(`^rgb\\(${Uu},${Uu},${Uu}\\)$`),Ku=new RegExp(`^rgb\\(${Zu},${Zu},${Zu}\\)$`),Ju=new RegExp(`^rgba\\(${Uu},${Uu},${Uu},${ju}\\)$`),Qu=new RegExp(`^rgba\\(${Zu},${Zu},${Zu},${ju}\\)$`),es=new RegExp(`^hsl\\(${ju},${Zu},${Zu}\\)$`),ts=new RegExp(`^hsla\\(${ju},${Zu},${Zu},${ju}\\)$`),ns={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};function os(){return this.rgb().formatHex()}function is(){return this.rgb().formatRgb()}function rs(e){var t,n;return e=(e+"").trim().toLowerCase(),(t=qu.exec(e))?(n=t[1].length,t=parseInt(t[1],16),6===n?as(t):3===n?new ss(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ls(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ls(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Wu.exec(e))?new ss(t[1],t[2],t[3],1):(t=Ku.exec(e))?new ss(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Ju.exec(e))?ls(t[1],t[2],t[3],t[4]):(t=Qu.exec(e))?ls(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=es.exec(e))?ps(t[1],t[2]/100,t[3]/100,1):(t=ts.exec(e))?ps(t[1],t[2]/100,t[3]/100,t[4]):ns.hasOwnProperty(e)?as(ns[e]):"transparent"===e?new ss(NaN,NaN,NaN,0):null}function as(e){return new ss(e>>16&255,e>>8&255,255&e,1)}function ls(e,t,n,o){return o<=0&&(e=t=n=NaN),new ss(e,t,n,o)}function us(e,t,n,o){return 1===arguments.length?((i=e)instanceof Xu||(i=rs(i)),i?new ss((i=i.rgb()).r,i.g,i.b,i.opacity):new ss):new ss(e,t,n,null==o?1:o);var i}function ss(e,t,n,o){this.r=+e,this.g=+t,this.b=+n,this.opacity=+o}function cs(){return`#${vs(this.r)}${vs(this.g)}${vs(this.b)}`}function ds(){const e=hs(this.opacity);return`${1===e?"rgb(":"rgba("}${fs(this.r)}, ${fs(this.g)}, ${fs(this.b)}${1===e?")":`, ${e})`}`}function hs(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function fs(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vs(e){return((e=fs(e))<16?"0":"")+e.toString(16)}function ps(e,t,n,o){return o<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ms(e,t,n,o)}function gs(e){if(e instanceof ms)return new ms(e.h,e.s,e.l,e.opacity);if(e instanceof Xu||(e=rs(e)),!e)return new ms;if(e instanceof ms)return e;var t=(e=e.rgb()).r/255,n=e.g/255,o=e.b/255,i=Math.min(t,n,o),r=Math.max(t,n,o),a=NaN,l=r-i,u=(r+i)/2;return l?(a=t===r?(n-o)/l+6*(n<o):n===r?(o-t)/l+2:(t-n)/l+4,l/=u<.5?r+i:2-r-i,a*=60):l=u>0&&u<1?0:a,new ms(a,l,u,e.opacity)}function ms(e,t,n,o){this.h=+e,this.s=+t,this.l=+n,this.opacity=+o}function ys(e){return(e=(e||0)%360)<0?e+360:e}function ws(e){return Math.max(0,Math.min(1,e||0))}function _s(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Hu(Xu,rs,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:os,
- // Deprecated! Use color.formatHex.
- formatHex:os,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return gs(this).formatHsl()},formatRgb:is,toString:is}),Hu(ss,us,Yu(Xu,{brighter(e){return e=null==e?Fu:Math.pow(Fu,e),new ss(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?Gu:Math.pow(Gu,e),new ss(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ss(fs(this.r),fs(this.g),fs(this.b),hs(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:cs,
- // Deprecated! Use color.formatHex.
- formatHex:cs,formatHex8:function(){return`#${vs(this.r)}${vs(this.g)}${vs(this.b)}${vs(255*(isNaN(this.opacity)?1:this.opacity))}`},formatRgb:ds,toString:ds})),Hu(ms,function(e,t,n,o){return 1===arguments.length?gs(e):new ms(e,t,n,null==o?1:o)},Yu(Xu,{brighter(e){return e=null==e?Fu:Math.pow(Fu,e),new ms(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?Gu:Math.pow(Gu,e),new ms(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*t,i=2*n-o;return new ss(_s(e>=240?e-240:e+120,i,o),_s(e,i,o),_s(e<120?e+240:e-120,i,o),this.opacity)},clamp(){return new ms(ys(this.h),ws(this.s),ws(this.l),hs(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=hs(this.opacity);return`${1===e?"hsl(":"hsla("}${ys(this.h)}, ${100*ws(this.s)}%, ${100*ws(this.l)}%${1===e?")":`, ${e})`}`}}));const bs=e=>()=>e;function xs(e){return 1===(e=+e)?Es:function(t,n){return n-t?function(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)}}(t,n,e):bs(isNaN(t)?n:t)}}function Es(e,t){var n=t-e;return n?function(e,t){return function(n){return e+n*t}}(e,n):bs(isNaN(e)?t:e)}const Ss=function e(t){var n=xs(t);function o(e,t){var o=n((e=us(e)).r,(t=us(t)).r),i=n(e.g,t.g),r=n(e.b,t.b),a=Es(e.opacity,t.opacity);return function(t){return e.r=o(t),e.g=i(t),e.b=r(t),e.opacity=a(t),e+""}}return o.gamma=e,o}(1);function ks(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}var Ns=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Ms=new RegExp(Ns.source,"g");function Cs(e,t){var n,o,i,r=Ns.lastIndex=Ms.lastIndex=0,a=-1,l=[],u=[];for(e+="",t+="";(n=Ns.exec(e))&&(o=Ms.exec(t));)(i=o.index)>r&&(i=t.slice(r,i),l[a]?l[a]+=i:l[++a]=i),(n=n[0])===(o=o[0])?l[a]?l[a]+=o:l[++a]=o:(l[++a]=null,u.push({i:a,x:ks(n,o)})),r=Ms.lastIndex;return r<t.length&&(i=t.slice(r),l[a]?l[a]+=i:l[++a]=i),l.length<2?u[0]?function(e){return function(t){return e(t)+""}}(u[0].x):function(e){return function(){return e}}(t):(t=u.length,function(e){for(var n,o=0;o<t;++o)l[(n=u[o]).i]=n.x(e);return l.join("")})}var Is,$s=180/Math.PI,As={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Ps(e,t,n,o,i,r){var a,l,u;return(a=Math.sqrt(e*e+t*t))&&(e/=a,t/=a),(u=e*n+t*o)&&(n-=e*u,o-=t*u),(l=Math.sqrt(n*n+o*o))&&(n/=l,o/=l,u/=l),e*o<t*n&&(e=-e,t=-t,u=-u,a=-a),{translateX:i,translateY:r,rotate:Math.atan2(t,e)*$s,skewX:Math.atan(u)*$s,scaleX:a,scaleY:l}}function Ts(e,t,n,o){function i(e){return e.length?e.pop()+" ":""}return function(r,a){var l=[],u=[];return r=e(r),a=e(a),function(e,o,i,r,a,l){if(e!==i||o!==r){var u=a.push("translate(",null,t,null,n);l.push({i:u-4,x:ks(e,i)},{i:u-2,x:ks(o,r)})}else(i||r)&&a.push("translate("+i+t+r+n)}(r.translateX,r.translateY,a.translateX,a.translateY,l,u),function(e,t,n,r){e!==t?(e-t>180?t+=360:t-e>180&&(e+=360),r.push({i:n.push(i(n)+"rotate(",null,o)-2,x:ks(e,t)})):t&&n.push(i(n)+"rotate("+t+o)}(r.rotate,a.rotate,l,u),function(e,t,n,r){e!==t?r.push({i:n.push(i(n)+"skewX(",null,o)-2,x:ks(e,t)}):t&&n.push(i(n)+"skewX("+t+o)}(r.skewX,a.skewX,l,u),function(e,t,n,o,r,a){if(e!==n||t!==o){var l=r.push(i(r)+"scale(",null,",",null,")");a.push({i:l-4,x:ks(e,n)},{i:l-2,x:ks(t,o)})}else 1===n&&1===o||r.push(i(r)+"scale("+n+","+o+")")}(r.scaleX,r.scaleY,a.scaleX,a.scaleY,l,u),r=a=null,function(e){for(var t,n=-1,o=u.length;++n<o;)l[(t=u[n]).i]=t.x(e);return l.join("")}}}var zs=Ts(function(e){const t=new("function"==typeof DOMMatrix?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?As:Ps(t.a,t.b,t.c,t.d,t.e,t.f)},"px, ","px)","deg)"),Ds=Ts(function(e){return null==e?As:(Is||(Is=document.createElementNS("http://www.w3.org/2000/svg","g")),Is.setAttribute("transform",e),(e=Is.transform.baseVal.consolidate())?Ps((e=e.matrix).a,e.b,e.c,e.d,e.e,e.f):As)},", ",")",")");function Os(e){return((e=Math.exp(e))+1/e)/2}const Bs=function e(t,n,o){function i(e,i){var r,a,l=e[0],u=e[1],s=e[2],c=i[0],d=i[1],h=i[2],f=c-l,v=d-u,p=f*f+v*v;if(p<1e-12)a=Math.log(h/s)/t,r=function(e){return[l+e*f,u+e*v,s*Math.exp(t*e*a)]};else{var g=Math.sqrt(p),m=(h*h-s*s+o*p)/(2*s*n*g),y=(h*h-s*s-o*p)/(2*h*n*g),w=Math.log(Math.sqrt(m*m+1)-m),_=Math.log(Math.sqrt(y*y+1)-y);a=(_-w)/t,r=function(e){var o,i=e*a,r=Os(w),c=s/(n*g)*(r*(o=t*i+w,((o=Math.exp(2*o))-1)/(o+1))-function(e){return((e=Math.exp(e))-1/e)/2}(w));return[l+c*f,u+c*v,s*r/Os(t*i+w)]}}return r.duration=1e3*a*t/Math.SQRT2,r}return i.rho=function(t){var n=Math.max(.001,+t),o=n*n;return e(n,o,o*o)},i}(Math.SQRT2,2,4);var Rs,Vs,Ls=0,Hs=0,Ys=0,Xs=0,Gs=0,Fs=0,Us="object"==typeof performance&&performance.now?performance:Date,js="object"==typeof window&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function Zs(){return Gs||(js(qs),Gs=Us.now()+Fs)}function qs(){Gs=0}function Ws(){this._call=this._time=this._next=null}function Ks(e,t,n){var o=new Ws;return o.restart(e,t,n),o}function Js(){Gs=(Xs=Us.now())+Fs,Ls=Hs=0;try{!function(){Zs(),++Ls;for(var e,t=Rs;t;)(e=Gs-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Ls}()}finally{Ls=0,function(){var e,t,n=Rs,o=Infinity;for(;n;)n._call?(o>n._time&&(o=n._time),e=n,n=n._next):(t=n._next,n._next=null,n=e?e._next=t:Rs=t);Vs=e,ec(o)}(),Gs=0}}function Qs(){var e=Us.now(),t=e-Xs;t>1e3&&(Fs-=t,Xs=e)}function ec(e){Ls||(Hs&&(Hs=clearTimeout(Hs)),e-Gs>24?(e<Infinity&&(Hs=setTimeout(Js,e-Us.now()-Fs)),Ys&&(Ys=clearInterval(Ys))):(Ys||(Xs=Us.now(),Ys=setInterval(Qs,1e3)),Ls=1,js(Js)))}function tc(e,t,n){var o=new Ws;return t=null==t?0:+t,o.restart(n=>{o.stop(),e(n+t)},t,n),o}Ws.prototype=Ks.prototype={constructor:Ws,restart:function(e,t,n){if("function"!=typeof e)throw new TypeError("callback is not a function");n=(null==n?Zs():+n)+(null==t?0:+t),this._next||Vs===this||(Vs?Vs._next=this:Rs=this,Vs=this),this._call=e,this._time=n,ec()},stop:function(){this._call&&(this._call=null,this._time=Infinity,ec())}};var nc=bl("start","end","cancel","interrupt"),oc=[];function ic(e,t,n,o,i,r){var a=e.__transition;if(a){if(n in a)return}else e.__transition={};!function(e,t,n){var o,i=e.__transition;function r(e){n.state=1,n.timer.restart(a,n.delay,n.time),n.delay<=e&&a(e-n.delay)}function a(r){var s,c,d,h;if(1!==n.state)return u();for(s in i)if((h=i[s]).name===n.name){if(3===h.state)return tc(a);4===h.state?(h.state=6,h.timer.stop(),h.on.call("interrupt",e,e.__data__,h.index,h.group),delete i[s]):+s<t&&(h.state=6,h.timer.stop(),h.on.call("cancel",e,e.__data__,h.index,h.group),delete i[s])}if(tc(function(){3===n.state&&(n.state=4,n.timer.restart(l,n.delay,n.time),l(r))}),n.state=2,n.on.call("start",e,e.__data__,n.index,n.group),2===n.state){for(n.state=3,o=new Array(d=n.tween.length),s=0,c=-1;s<d;++s)(h=n.tween[s].value.call(e,e.__data__,n.index,n.group))&&(o[++c]=h);o.length=c+1}}function l(t){for(var i=t<n.duration?n.ease.call(null,t/n.duration):(n.timer.restart(u),n.state=5,1),r=-1,a=o.length;++r<a;)o[r].call(e,i);5===n.state&&(n.on.call("end",e,e.__data__,n.index,n.group),u())}function u(){for(var o in n.state=6,n.timer.stop(),delete i[t],i)return;delete e.__transition}i[t]=n,n.timer=Ks(r,0,n.time)}(e,n,{name:t,index:o,
- // For context during callback.
- group:i,
- // For context during callback.
- on:nc,tween:oc,time:r.time,delay:r.delay,duration:r.duration,ease:r.ease,timer:null,state:0})}function rc(e,t){var n=lc(e,t);if(n.state>0)throw new Error("too late; already scheduled");return n}function ac(e,t){var n=lc(e,t);if(n.state>3)throw new Error("too late; already running");return n}function lc(e,t){var n=e.__transition;if(!n||!(n=n[t]))throw new Error("transition not found");return n}function uc(e,t){var n,o,i,r=e.__transition,a=!0;if(r){for(i in t=null==t?null:t+"",r)(n=r[i]).name===t?(o=n.state>2&&n.state<5,n.state=6,n.timer.stop(),n.on.call(o?"interrupt":"cancel",e,e.__data__,n.index,n.group),delete r[i]):a=!1;a&&delete e.__transition}}function sc(e,t){var n,o;return function(){var i=ac(this,e),r=i.tween;if(r!==n)for(var a=0,l=(o=n=r).length;a<l;++a)if(o[a].name===t){(o=o.slice()).splice(a,1);break}i.tween=o}}function cc(e,t,n){var o,i;if("function"!=typeof n)throw new Error;return function(){var r=ac(this,e),a=r.tween;if(a!==o){i=(o=a).slice();for(var l={name:t,value:n},u=0,s=i.length;u<s;++u)if(i[u].name===t){i[u]=l;break}u===s&&i.push(l)}r.tween=i}}function dc(e,t,n){var o=e._id;return e.each(function(){var e=ac(this,o);(e.value||(e.value={}))[t]=n.apply(this,arguments)}),function(e){return lc(e,o).value[t]}}function hc(e,t){var n;return("number"==typeof t?ks:t instanceof rs?Ss:(n=rs(t))?(t=n,Ss):Cs)(e,t)}function fc(e){return function(){this.removeAttribute(e)}}function vc(e){return function(){this.removeAttributeNS(e.space,e.local)}}function pc(e,t,n){var o,i,r=n+"";return function(){var a=this.getAttribute(e);return a===r?null:a===o?i:i=t(o=a,n)}}function gc(e,t,n){var o,i,r=n+"";return function(){var a=this.getAttributeNS(e.space,e.local);return a===r?null:a===o?i:i=t(o=a,n)}}function mc(e,t,n){var o,i,r;return function(){var a,l,u=n(this);if(null!=u)return(a=this.getAttribute(e))===(l=u+"")?null:a===o&&l===i?r:(i=l,r=t(o=a,u));this.removeAttribute(e)}}function yc(e,t,n){var o,i,r;return function(){var a,l,u=n(this);if(null!=u)return(a=this.getAttributeNS(e.space,e.local))===(l=u+"")?null:a===o&&l===i?r:(i=l,r=t(o=a,u));this.removeAttributeNS(e.space,e.local)}}function wc(e,t){var n,o;function i(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&function(e,t){return function(n){this.setAttributeNS(e.space,e.local,t.call(this,n))}}(e,i)),n}return i._value=t,i}function _c(e,t){var n,o;function i(){var i=t.apply(this,arguments);return i!==o&&(n=(o=i)&&function(e,t){return function(n){this.setAttribute(e,t.call(this,n))}}(e,i)),n}return i._value=t,i}function bc(e,t){return function(){rc(this,e).delay=+t.apply(this,arguments)}}function xc(e,t){return t=+t,function(){rc(this,e).delay=t}}function Ec(e,t){return function(){ac(this,e).duration=+t.apply(this,arguments)}}function Sc(e,t){return t=+t,function(){ac(this,e).duration=t}}var kc=Ou.prototype.constructor;function Nc(e){return function(){this.style.removeProperty(e)}}var Mc=0;function Cc(e,t,n,o){this._groups=e,this._parents=t,this._name=n,this._id=o}function Ic(){return++Mc}var $c=Ou.prototype;Cc.prototype={constructor:Cc,select:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=Pl(e));for(var o=this._groups,i=o.length,r=new Array(i),a=0;a<i;++a)for(var l,u,s=o[a],c=s.length,d=r[a]=new Array(c),h=0;h<c;++h)(l=s[h])&&(u=e.call(l,l.__data__,h,s))&&("__data__"in l&&(u.__data__=l.__data__),d[h]=u,ic(d[h],t,n,h,d,lc(l,n)));return new Cc(r,this._parents,t,n)},selectAll:function(e){var t=this._name,n=this._id;"function"!=typeof e&&(e=zl(e));for(var o=this._groups,i=o.length,r=[],a=[],l=0;l<i;++l)for(var u,s=o[l],c=s.length,d=0;d<c;++d)if(u=s[d]){for(var h,f=e.call(u,u.__data__,d,s),v=lc(u,n),p=0,g=f.length;p<g;++p)(h=f[p])&&ic(h,t,n,p,f,v);r.push(f),a.push(u)}return new Cc(r,a,t,n)},selectChild:$c.selectChild,selectChildren:$c.selectChildren,filter:function(e){"function"!=typeof e&&(e=Ol(e));for(var t=this._groups,n=t.length,o=new Array(n),i=0;i<n;++i)for(var r,a=t[i],l=a.length,u=o[i]=[],s=0;s<l;++s)(r=a[s])&&e.call(r,r.__data__,s,a)&&u.push(r);return new Cc(o,this._parents,this._name,this._id)},merge:function(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,n=e._groups,o=t.length,i=n.length,r=Math.min(o,i),a=new Array(o),l=0;l<r;++l)for(var u,s=t[l],c=n[l],d=s.length,h=a[l]=new Array(d),f=0;f<d;++f)(u=s[f]||c[f])&&(h[f]=u);for(;l<o;++l)a[l]=t[l];return new Cc(a,this._parents,this._name,this._id)},selection:function(){return new kc(this._groups,this._parents)},transition:function(){for(var e=this._name,t=this._id,n=Ic(),o=this._groups,i=o.length,r=0;r<i;++r)for(var a,l=o[r],u=l.length,s=0;s<u;++s)if(a=l[s]){var c=lc(a,t);ic(a,e,n,s,l,{time:c.time+c.delay+c.duration,delay:0,duration:c.duration,ease:c.ease})}return new Cc(o,this._parents,e,n)},call:$c.call,nodes:$c.nodes,node:$c.node,size:$c.size,empty:$c.empty,each:$c.each,on:function(e,t){var n=this._id;return arguments.length<2?lc(this.node(),n).on.on(e):this.each(function(e,t,n){var o,i,r=function(e){return(e+"").trim().split(/^|\s+/).every(function(e){var t=e.indexOf(".");return t>=0&&(e=e.slice(0,t)),!e||"start"===e})}(t)?rc:ac;return function(){var a=r(this,e),l=a.on;l!==o&&(i=(o=l).copy()).on(t,n),a.on=i}}(n,e,t))},attr:function(e,t){var n=Ml(e),o="transform"===n?Ds:hc;return this.attrTween(e,"function"==typeof t?(n.local?yc:mc)(n,o,dc(this,"attr."+e,t)):null==t?(n.local?vc:fc)(n):(n.local?gc:pc)(n,o,t))},attrTween:function(e,t){var n="attr."+e;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(null==t)return this.tween(n,null);if("function"!=typeof t)throw new Error;var o=Ml(e);return this.tween(n,(o.local?wc:_c)(o,t))},style:function(e,t,n){var o="transform"==(e+="")?zs:hc;return null==t?this.styleTween(e,function(e,t){var n,o,i;return function(){var r=ru(this,e),a=(this.style.removeProperty(e),ru(this,e));return r===a?null:r===n&&a===o?i:i=t(n=r,o=a)}}(e,o)).on("end.style."+e,Nc(e)):"function"==typeof t?this.styleTween(e,function(e,t,n){var o,i,r;return function(){var a=ru(this,e),l=n(this),u=l+"";return null==l&&(this.style.removeProperty(e),u=l=ru(this,e)),a===u?null:a===o&&u===i?r:(i=u,r=t(o=a,l))}}(e,o,dc(this,"style."+e,t))).each(function(e,t){var n,o,i,r,a="style."+t,l="end."+a;return function(){var u=ac(this,e),s=u.on,c=null==u.value[a]?r||(r=Nc(t)):void 0;s===n&&i===c||(o=(n=s).copy()).on(l,i=c),u.on=o}}(this._id,e)):this.styleTween(e,function(e,t,n){var o,i,r=n+"";return function(){var a=ru(this,e);return a===r?null:a===o?i:i=t(o=a,n)}}(e,o,t),n).on("end.style."+e,null)},styleTween:function(e,t,n){var o="style."+(e+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(null==t)return this.tween(o,null);if("function"!=typeof t)throw new Error;return this.tween(o,function(e,t,n){var o,i;function r(){var r=t.apply(this,arguments);return r!==i&&(o=(i=r)&&function(e,t,n){return function(o){this.style.setProperty(e,t.call(this,o),n)}}(e,r,n)),o}return r._value=t,r}(e,t,null==n?"":n))},text:function(e){return this.tween("text","function"==typeof e?function(e){return function(){var t=e(this);this.textContent=null==t?"":t}}(dc(this,"text",e)):function(e){return function(){this.textContent=e}}(null==e?"":e+""))},textTween:function(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(null==e)return this.tween(t,null);if("function"!=typeof e)throw new Error;return this.tween(t,function(e){var t,n;function o(){var o=e.apply(this,arguments);return o!==n&&(t=(n=o)&&function(e){return function(t){this.textContent=e.call(this,t)}}(o)),t}return o._value=e,o}(e))},remove:function(){return this.on("end.remove",(e=this._id,function(){var t=this.parentNode;for(var n in this.__transition)if(+n!==e)return;t&&t.removeChild(this)}));var e},tween:function(e,t){var n=this._id;if(e+="",arguments.length<2){for(var o,i=lc(this.node(),n).tween,r=0,a=i.length;r<a;++r)if((o=i[r]).name===e)return o.value;return null}return this.each((null==t?sc:cc)(n,e,t))},delay:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?bc:xc)(t,e)):lc(this.node(),t).delay},duration:function(e){var t=this._id;return arguments.length?this.each(("function"==typeof e?Ec:Sc)(t,e)):lc(this.node(),t).duration},ease:function(e){var t=this._id;return arguments.length?this.each(function(e,t){if("function"!=typeof t)throw new Error;return function(){ac(this,e).ease=t}}(t,e)):lc(this.node(),t).ease},easeVarying:function(e){if("function"!=typeof e)throw new Error;return this.each(function(e,t){return function(){var n=t.apply(this,arguments);if("function"!=typeof n)throw new Error;ac(this,e).ease=n}}(this._id,e))},end:function(){var e,t,n=this,o=n._id,i=n.size();return new Promise(function(r,a){var l={value:a},u={value:function(){0===--i&&r()}};n.each(function(){var n=ac(this,o),i=n.on;i!==e&&((t=(e=i).copy())._.cancel.push(l),t._.interrupt.push(l),t._.end.push(u)),n.on=t}),0===i&&r()})},[Symbol.iterator]:$c[Symbol.iterator]};var Ac={time:null,
- // Set on use.
- delay:0,duration:250,ease:function(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}};function Pc(e,t){for(var n;!(n=e.__transition)||!(n=n[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return n}Ou.prototype.interrupt=function(e){return this.each(function(){uc(this,e)})},Ou.prototype.transition=function(e){var t,n;e instanceof Cc?(t=e._id,e=e._name):(t=Ic(),(n=Ac).time=Zs(),e=null==e?null:e+"");for(var o=this._groups,i=o.length,r=0;r<i;++r)for(var a,l=o[r],u=l.length,s=0;s<u;++s)(a=l[s])&&ic(a,e,t,s,l,n||Pc(a,t));return new Cc(o,this._parents,e,t)};const Tc=e=>()=>e;function zc(e,{sourceEvent:t,target:n,transform:o,dispatch:i}){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:i}})}function Dc(e,t,n){this.k=e,this.x=t,this.y=n}Dc.prototype={constructor:Dc,scale:function(e){return 1===e?this:new Dc(this.k*e,this.x,this.y)},translate:function(e,t){return 0===e&0===t?this:new Dc(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 Oc=new Dc(1,0,0);function Bc(e){e.stopImmediatePropagation()}function Rc(e){e.preventDefault(),e.stopImmediatePropagation()}function Vc(e){return!(e.ctrlKey&&"wheel"!==e.type||e.button)}function Lc(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e).hasAttribute("viewBox")?[[(e=e.viewBox.baseVal).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 Hc(){return this.__zoom||Oc}function Yc(e){return-e.deltaY*(1===e.deltaMode?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function Xc(){return navigator.maxTouchPoints||"ontouchstart"in this}function Gc(e,t,n){var o=e.invertX(t[0][0])-n[0][0],i=e.invertX(t[1][0])-n[1][0],r=e.invertY(t[0][1])-n[0][1],a=e.invertY(t[1][1])-n[1][1];return e.translate(i>o?(o+i)/2:Math.min(0,o)||Math.max(0,i),a>r?(r+a)/2:Math.min(0,r)||Math.max(0,a))}function Fc(){var e,t,n,o=Vc,i=Lc,r=Gc,a=Yc,l=Xc,u=[0,Infinity],s=[[-Infinity,-Infinity],[Infinity,Infinity]],c=250,d=Bs,h=bl("start","zoom","end"),f=0,v=10;function p(e){e.property("__zoom",Hc).on("wheel.zoom",x,{passive:!1}).on("mousedown.zoom",E).on("dblclick.zoom",S).filter(l).on("touchstart.zoom",k).on("touchmove.zoom",N).on("touchend.zoom touchcancel.zoom",M).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function g(e,t){return(t=Math.max(u[0],Math.min(u[1],t)))===e.k?e:new Dc(t,e.x,e.y)}function m(e,t,n){var o=t[0]-n[0]*e.k,i=t[1]-n[1]*e.k;return o===e.x&&i===e.y?e:new Dc(e.k,o,i)}function y(e){return[(+e[0][0]+ +e[1][0])/2,(+e[0][1]+ +e[1][1])/2]}function w(e,t,n,o){e.on("start.zoom",function(){_(this,arguments).event(o).start()}).on("interrupt.zoom end.zoom",function(){_(this,arguments).event(o).end()}).tween("zoom",function(){var e=this,r=arguments,a=_(e,r).event(o),l=i.apply(e,r),u=null==n?y(l):"function"==typeof n?n.apply(e,r):n,s=Math.max(l[1][0]-l[0][0],l[1][1]-l[0][1]),c=e.__zoom,h="function"==typeof t?t.apply(e,r):t,f=d(c.invert(u).concat(s/c.k),h.invert(u).concat(s/h.k));return function(e){if(1===e)e=h;else{var t=f(e),n=s/t[2];e=new Dc(n,u[0]-t[0]*n,u[1]-t[1]*n)}a.zoom(null,e)}})}function _(e,t,n){return!n&&e.__zooming||new b(e,t)}function b(e,t){this.that=e,this.args=t,this.active=0,this.sourceEvent=null,this.extent=i.apply(e,t),this.taps=0}function x(e,...t){if(o.apply(this,arguments)){var n=_(this,t).event(e),i=this.__zoom,l=Math.max(u[0],Math.min(u[1],i.k*Math.pow(2,a.apply(this,arguments)))),c=Ru(e);if(n.wheel)n.mouse[0][0]===c[0]&&n.mouse[0][1]===c[1]||(n.mouse[1]=i.invert(n.mouse[0]=c)),clearTimeout(n.wheel);else{if(i.k===l)return;n.mouse=[c,i.invert(c)],uc(this),n.start()}Rc(e),n.wheel=setTimeout(function(){n.wheel=null,n.end()},150),n.zoom("mouse",r(m(g(i,l),n.mouse[0],n.mouse[1]),n.extent,s))}}function E(e,...t){if(!n&&o.apply(this,arguments)){var i,a,l,u=e.currentTarget,c=_(this,t,!0).event(e),d=Bu(e.view).on("mousemove.zoom",function(e){if(Rc(e),!c.moved){var t=e.clientX-v,n=e.clientY-p;c.moved=t*t+n*n>f}c.event(e).zoom("mouse",r(m(c.that.__zoom,c.mouse[0]=Ru(e,u),c.mouse[1]),c.extent,s))},!0).on("mouseup.zoom",function(e){d.on("mousemove.zoom mouseup.zoom",null),t=e.view,n=c.moved,o=t.document.documentElement,i=Bu(t).on("dragstart.drag",null),n&&(i.on("click.drag",Lu,Vu),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect),Rc(e),c.event(e).end();var t,n,o,i},!0),h=Ru(e,u),v=e.clientX,p=e.clientY;i=e.view,a=i.document.documentElement,l=Bu(i).on("dragstart.drag",Lu,Vu),"onselectstart"in a?l.on("selectstart.drag",Lu,Vu):(a.__noselect=a.style.MozUserSelect,a.style.MozUserSelect="none"),Bc(e),c.mouse=[h,this.__zoom.invert(h)],uc(this),c.start()}}function S(e,...t){if(o.apply(this,arguments)){var n=this.__zoom,a=Ru(e.changedTouches?e.changedTouches[0]:e,this),l=n.invert(a),u=n.k*(e.shiftKey?.5:2),d=r(m(g(n,u),a,l),i.apply(this,t),s);Rc(e),c>0?Bu(this).transition().duration(c).call(w,d,a,e):Bu(this).call(p.transform,d,a,e)}}function k(n,...i){if(o.apply(this,arguments)){var r,a,l,u,s=n.touches,c=s.length,d=_(this,i,n.changedTouches.length===c).event(n);for(Bc(n),a=0;a<c;++a)u=[u=Ru(l=s[a],this),this.__zoom.invert(u),l.identifier],d.touch0?d.touch1||d.touch0[2]===u[2]||(d.touch1=u,d.taps=0):(d.touch0=u,r=!0,d.taps=1+!!e);e&&(e=clearTimeout(e)),r&&(d.taps<2&&(t=u[0],e=setTimeout(function(){e=null},500)),uc(this),d.start())}}function N(e,...t){if(this.__zooming){var n,o,i,a,l=_(this,t).event(e),u=e.changedTouches,c=u.length;for(Rc(e),n=0;n<c;++n)i=Ru(o=u[n],this),l.touch0&&l.touch0[2]===o.identifier?l.touch0[0]=i:l.touch1&&l.touch1[2]===o.identifier&&(l.touch1[0]=i);if(o=l.that.__zoom,l.touch1){var d=l.touch0[0],h=l.touch0[1],f=l.touch1[0],v=l.touch1[1],p=(p=f[0]-d[0])*p+(p=f[1]-d[1])*p,y=(y=v[0]-h[0])*y+(y=v[1]-h[1])*y;o=g(o,Math.sqrt(p/y)),i=[(d[0]+f[0])/2,(d[1]+f[1])/2],a=[(h[0]+v[0])/2,(h[1]+v[1])/2]}else{if(!l.touch0)return;i=l.touch0[0],a=l.touch0[1]}l.zoom("touch",r(m(o,i,a),l.extent,s))}}function M(e,...o){if(this.__zooming){var i,r,a=_(this,o).event(e),l=e.changedTouches,u=l.length;for(Bc(e),n&&clearTimeout(n),n=setTimeout(function(){n=null},500),i=0;i<u;++i)r=l[i],a.touch0&&a.touch0[2]===r.identifier?delete a.touch0:a.touch1&&a.touch1[2]===r.identifier&&delete a.touch1;if(a.touch1&&!a.touch0&&(a.touch0=a.touch1,delete a.touch1),a.touch0)a.touch0[1]=this.__zoom.invert(a.touch0[0]);else if(a.end(),2===a.taps&&(r=Ru(r,this),Math.hypot(t[0]-r[0],t[1]-r[1])<v)){var s=Bu(this).on("dblclick.zoom");s&&s.apply(this,arguments)}}}return p.transform=function(e,t,n,o){var i=e.selection?e.selection():e;i.property("__zoom",Hc),e!==i?w(e,t,n,o):i.interrupt().each(function(){_(this,arguments).event(o).start().zoom(null,"function"==typeof t?t.apply(this,arguments):t).end()})},p.scaleBy=function(e,t,n,o){p.scaleTo(e,function(){return this.__zoom.k*("function"==typeof t?t.apply(this,arguments):t)},n,o)},p.scaleTo=function(e,t,n,o){p.transform(e,function(){var e=i.apply(this,arguments),o=this.__zoom,a=null==n?y(e):"function"==typeof n?n.apply(this,arguments):n,l=o.invert(a),u="function"==typeof t?t.apply(this,arguments):t;return r(m(g(o,u),a,l),e,s)},n,o)},p.translateBy=function(e,t,n,o){p.transform(e,function(){return r(this.__zoom.translate("function"==typeof t?t.apply(this,arguments):t,"function"==typeof n?n.apply(this,arguments):n),i.apply(this,arguments),s)},null,o)},p.translateTo=function(e,t,n,o,a){p.transform(e,function(){var e=i.apply(this,arguments),a=this.__zoom,l=null==o?y(e):"function"==typeof o?o.apply(this,arguments):o;return r(Oc.translate(l[0],l[1]).scale(a.k).translate("function"==typeof t?-t.apply(this,arguments):-t,"function"==typeof n?-n.apply(this,arguments):-n),e,s)},o,a)},b.prototype={event:function(e){return e&&(this.sourceEvent=e),this},start:function(){return 1===++this.active&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(e,t){return this.mouse&&"mouse"!==e&&(this.mouse[1]=t.invert(this.mouse[0])),this.touch0&&"touch"!==e&&(this.touch0[1]=t.invert(this.touch0[0])),this.touch1&&"touch"!==e&&(this.touch1[1]=t.invert(this.touch1[0])),this.that.__zoom=t,this.emit("zoom"),this},end:function(){return 0===--this.active&&(delete this.that.__zooming,this.emit("end")),this},emit:function(e){var t=Bu(this.that).datum();h.call(e,this.that,new zc(e,{sourceEvent:this.sourceEvent,target:p,transform:this.that.__zoom,dispatch:h}),t)}},p.wheelDelta=function(e){return arguments.length?(a="function"==typeof e?e:Tc(+e),p):a},p.filter=function(e){return arguments.length?(o="function"==typeof e?e:Tc(!!e),p):o},p.touchable=function(e){return arguments.length?(l="function"==typeof e?e:Tc(!!e),p):l},p.extent=function(e){return arguments.length?(i="function"==typeof e?e:Tc([[+e[0][0],+e[0][1]],[+e[1][0],+e[1][1]]]),p):i},p.scaleExtent=function(e){return arguments.length?(u[0]=+e[0],u[1]=+e[1],p):[u[0],u[1]]},p.translateExtent=function(e){return arguments.length?(s[0][0]=+e[0][0],s[1][0]=+e[1][0],s[0][1]=+e[0][1],s[1][1]=+e[1][1],p):[[s[0][0],s[0][1]],[s[1][0],s[1][1]]]},p.constrain=function(e){return arguments.length?(r=e,p):r},p.duration=function(e){return arguments.length?(c=+e,p):c},p.interpolate=function(e){return arguments.length?(d=e,p):d},p.on=function(){var e=h.on.apply(h,arguments);return e===h?p:e},p.clickDistance=function(e){return arguments.length?(f=(e=+e)*e,p):Math.sqrt(f)},p.tapDistance=function(e){return arguments.length?(v=+e,p):v},p}Dc.prototype;const Uc=Symbol("MiniMapSlots"),jc=["id","x","y","rx","ry","width","height","fill","stroke","stroke-width","shape-rendering"],Zc=o({name:"MiniMapNode",compatConfig:{MODE:3},inheritAttrs:!1,props:{id:{},type:{},selected:{type:Boolean},dragging:{type:Boolean},position:{},dimensions:{},borderRadius:{},color:{},shapeRendering:{},strokeColor:{},strokeWidth:{},hidden:{type:Boolean}},emits:["click","dblclick","mouseenter","mousemove","mouseleave"],setup(t,{emit:n}){const o=t,i=e(Uc),r=X(),u=$(()=>r.style??{});function s(e){n("click",e)}function c(e){n("dblclick",e)}function h(e){n("mouseenter",e)}function f(e){n("mousemove",e)}function v(e){n("mouseleave",e)}return(e,t)=>e.hidden||0===e.dimensions.width||0===e.dimensions.height?M("",!0):(a(),l(b,{key:0},[d(i)[`node-${o.type}`]?(a(),N(F(d(i)[`node-${o.type}`]),Z(G({key:0},{...o,...e.$attrs})),null,16)):(a(),l("rect",G({key:1,id:e.id},e.$attrs,{class:["vue-flow__minimap-node",{selected:e.selected,dragging:e.dragging}],x:e.position.x,y:e.position.y,rx:e.borderRadius,ry:e.borderRadius,width:e.dimensions.width,height:e.dimensions.height,fill:e.color||u.value.background||u.value.backgroundColor,stroke:e.strokeColor,"stroke-width":e.strokeWidth,"shape-rendering":e.shapeRendering,onClick:s,onDblclick:c,onMouseenter:h,onMousemove:f,onMouseleave:v}),null,16,jc))],64))}}),qc=["width","height","viewBox","aria-labelledby"],Wc=["id"],Kc=["d","fill","stroke","stroke-width"],Jc=o({name:"MiniMap",compatConfig:{MODE:3},props:{nodeColor:{type:[String,Function],default:"#e2e2e2"},nodeStrokeColor:{type:[String,Function],default:"transparent"},nodeClassName:{type:[String,Function]},nodeBorderRadius:{default:5},nodeStrokeWidth:{default:2},maskColor:{default:"rgb(240, 240, 240, 0.6)"},maskStrokeColor:{default:"none"},maskStrokeWidth:{default:1},position:{default:"bottom-right"},pannable:{type:Boolean,default:!1},zoomable:{type:Boolean,default:!1},width:{},height:{},ariaLabel:{default:"Vue Flow mini map"},inversePan:{type:Boolean,default:!1},zoomStep:{default:1},offsetScale:{default:5},maskBorderRadius:{default:0}},emits:["click","nodeClick","nodeDblclick","nodeMouseenter","nodeMousemove","nodeMouseleave"],setup(e,{emit:t}){const n=i(),o=X(),{id:r,edges:u,viewport:c,translateExtent:p,dimensions:g,emits:m,d3Selection:y,d3Zoom:w,getNodesInitialized:E}=Ba(),S=C();B(Uc,n);const k=$(()=>{var t;return e.width??(null==(t=o.style)?void 0:t.width)??200}),I=$(()=>{var t;return e.height??(null==(t=o.style)?void 0:t.height)??150}),P="undefined"==typeof window||window.chrome?"crispEdges":"geometricPrecision",T=v(()=>"string"==typeof e.nodeColor?()=>e.nodeColor:e.nodeColor),z=v(()=>"string"==typeof e.nodeStrokeColor?()=>e.nodeStrokeColor:e.nodeStrokeColor),D=v(()=>"string"==typeof e.nodeClassName?()=>e.nodeClassName:"function"==typeof e.nodeClassName?e.nodeClassName:()=>""),O=v(()=>Di(E.value.filter(e=>!e.hidden))),R=v(()=>({x:-c.value.x/c.value.zoom,y:-c.value.y/c.value.zoom,width:g.value.width/c.value.zoom,height:g.value.height/c.value.zoom})),V=v(()=>{return E.value&&E.value.length?(e=O.value,t=R.value,zi(Pi(Ti(e),Ti(t)))):R.value;var e,t}),L=v(()=>{const e=V.value.width/k.value,t=V.value.height/I.value;return Math.max(e,t)}),H=v(()=>{const t=L.value*k.value,n=L.value*I.value,o=e.offsetScale*L.value;return{offset:o,x:V.value.x-(t-V.value.width)/2-o,y:V.value.y-(n-V.value.height)/2-o,width:t+2*o,height:n+2*o}}),Y=v(()=>H.value.x&&H.value.y?`\n M${H.value.x-H.value.offset},${H.value.y-H.value.offset}\n h${H.value.width+2*H.value.offset}\n v${H.value.height+2*H.value.offset}\n h${-H.value.width-2*H.value.offset}z\n M${R.value.x+e.maskBorderRadius},${R.value.y}\n h${R.value.width-2*e.maskBorderRadius}\n a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},${e.maskBorderRadius}\n v${R.value.height-2*e.maskBorderRadius}\n a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},${e.maskBorderRadius}\n h${-(R.value.width-2*e.maskBorderRadius)}\n a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 -${e.maskBorderRadius},-${e.maskBorderRadius}\n v${-(R.value.height-2*e.maskBorderRadius)}\n a${e.maskBorderRadius},${e.maskBorderRadius} 0 0 1 ${e.maskBorderRadius},-${e.maskBorderRadius}z`:"");function G(e){const[n,o]=Ru(e);t("click",{event:e,position:{x:n,y:o}})}return j(t=>{if(S.value){const n=Bu(S.value),o=t=>{if("wheel"!==t.sourceEvent.type||!y.value||!w.value)return;const n=t.sourceEvent.ctrlKey&&vr()?10:1,o=-t.sourceEvent.deltaY*(1===t.sourceEvent.deltaMode?.05:t.sourceEvent.deltaMode?1:.002)*e.zoomStep,i=c.value.zoom*2**(o*n);w.value.scaleTo(y.value,i)},i=t=>{if("mousemove"!==t.sourceEvent.type||!y.value||!w.value)return;const n=L.value*Math.max(1,c.value.zoom)*(e.inversePan?-1:1),o={x:c.value.x-t.sourceEvent.movementX*n,y:c.value.y-t.sourceEvent.movementY*n},i=[[0,0],[g.value.width,g.value.height]],r=Oc.translate(o.x,o.y).scale(c.value.zoom),a=w.value.constrain()(r,i,p.value);w.value.transform(y.value,a)},r=Fc().wheelDelta(t=>Yi(t)*(e.zoomStep/10)).on("zoom",e.pannable?i:()=>{}).on("zoom.wheel",e.zoomable?o:()=>{});n.call(r),t(()=>{n.on("zoom",null)})}},{flush:"post"}),(e,n)=>(a(),N(d(cl),{position:e.position,class:f(["vue-flow__minimap",{pannable:e.pannable,zoomable:e.zoomable}])},{default:s(()=>[(a(),l("svg",{ref_key:"el",ref:S,width:k.value,height:I.value,viewBox:[H.value.x,H.value.y,H.value.width,H.value.height].join(" "),role:"img","aria-labelledby":`vue-flow__minimap-${d(r)}`,onClick:G},[e.ariaLabel?(a(),l("title",{key:0,id:`vue-flow__minimap-${d(r)}`},A(e.ariaLabel),9,Wc)):M("",!0),(a(!0),l(b,null,x(d(E),n=>(a(),N(Zc,{id:n.id,key:n.id,f:"",position:n.computedPosition,dimensions:n.dimensions,selected:n.selected,dragging:n.dragging,style:h(n.style),class:f(D.value(n)),color:T.value(n),"border-radius":e.nodeBorderRadius,"stroke-color":z.value(n),"stroke-width":e.nodeStrokeWidth,"shape-rendering":d(P),type:n.type,hidden:n.hidden,onClick:e=>function(e,n){const o={event:e,node:n,connectedEdges:Bi([n],u.value)};m.miniMapNodeClick(o),t("nodeClick",o)}(e,n),onDblclick:e=>function(e,n){const o={event:e,node:n,connectedEdges:Bi([n],u.value)};m.miniMapNodeDoubleClick(o),t("nodeDblclick",o)}(e,n),onMouseenter:e=>function(e,n){const o={event:e,node:n,connectedEdges:Bi([n],u.value)};m.miniMapNodeMouseEnter(o),t("nodeMouseenter",o)}(e,n),onMousemove:e=>function(e,n){const o={event:e,node:n,connectedEdges:Bi([n],u.value)};m.miniMapNodeMouseMove(o),t("nodeMousemove",o)}(e,n),onMouseleave:e=>function(e,n){const o={event:e,node:n,connectedEdges:Bi([n],u.value)};m.miniMapNodeMouseLeave(o),t("nodeMouseleave",o)}(e,n)},null,8,["id","position","dimensions","selected","dragging","style","class","color","border-radius","stroke-color","stroke-width","shape-rendering","type","hidden","onClick","onDblclick","onMouseenter","onMousemove","onMouseleave"]))),128)),_("path",{class:"vue-flow__minimap-mask",d:Y.value,fill:e.maskColor,stroke:e.maskStrokeColor,"stroke-width":e.maskStrokeWidth,"fill-rule":"evenodd"},null,8,Kc)],8,qc))]),_:1},8,["position","class"]))}}),Qc={type:"button",class:"vue-flow__controls-button"};const ed=((e,t)=>{const n=e.__vccOpts||e;for(const[o,i]of t)n[o]=i;return n})({name:"ControlButton",compatConfig:{MODE:3}},[["render",function(e,t,n,o,i,r){return a(),l("button",Qc,[c(e.$slots,"default")])}]]),td={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},nd=[_("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"},null,-1)];const od={render:function(e,t){return a(),l("svg",td,nd)}},id={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},rd=[_("path",{d:"M0 0h32v4.2H0z"},null,-1)];const ad={render:function(e,t){return a(),l("svg",id,rd)}},ld={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},ud=[_("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 0 0 27.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.94a.919.919 0 0 1-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"},null,-1)];const sd={render:function(e,t){return a(),l("svg",ld,ud)}},cd={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},dd=[_("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 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-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"},null,-1)];const hd={render:function(e,t){return a(),l("svg",cd,dd)}},fd={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},vd=[_("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 0 0 0 13.714v15.238A3.056 3.056 0 0 0 3.048 32h18.285a3.056 3.056 0 0 0 3.048-3.048V13.714a3.056 3.056 0 0 0-3.048-3.047zM12.19 24.533a3.056 3.056 0 0 1-3.047-3.047 3.056 3.056 0 0 1 3.047-3.048 3.056 3.056 0 0 1 3.048 3.048 3.056 3.056 0 0 1-3.048 3.047z"},null,-1)];const pd={render:function(e,t){return a(),l("svg",fd,vd)}},gd=o({name:"Controls",compatConfig:{MODE:3},props:{showZoom:{type:Boolean,default:!0},showFitView:{type:Boolean,default:!0},showInteractive:{type:Boolean,default:!0},fitViewParams:{},position:{default:()=>ai.BottomLeft}},emits:["zoomIn","zoomOut","fitView","interactionChange"],setup(e,{emit:t}){const{nodesDraggable:n,nodesConnectable:o,elementsSelectable:i,setInteractive:r,zoomIn:h,zoomOut:f,fitView:v,viewport:p,minZoom:g,maxZoom:m}=Ba(),y=$(()=>n.value||o.value||i.value),w=$(()=>p.value.zoom<=g.value),_=$(()=>p.value.zoom>=m.value);function x(){h(),t("zoomIn")}function E(){f(),t("zoomOut")}function S(){v(e.fitViewParams),t("fitView")}function k(){r(!y.value),t("interactionChange",!y.value)}return(e,t)=>(a(),N(d(cl),{class:"vue-flow__controls",position:e.position},{default:s(()=>[c(e.$slots,"top"),e.showZoom?(a(),l(b,{key:0},[c(e.$slots,"control-zoom-in",{},()=>[u(ed,{class:"vue-flow__controls-zoomin",disabled:_.value,onClick:x},{default:s(()=>[c(e.$slots,"icon-zoom-in",{},()=>[(a(),N(F(d(od))))])]),_:3},8,["disabled"])]),c(e.$slots,"control-zoom-out",{},()=>[u(ed,{class:"vue-flow__controls-zoomout",disabled:w.value,onClick:E},{default:s(()=>[c(e.$slots,"icon-zoom-out",{},()=>[(a(),N(F(d(ad))))])]),_:3},8,["disabled"])])],64)):M("",!0),e.showFitView?c(e.$slots,"control-fit-view",{key:1},()=>[u(ed,{class:"vue-flow__controls-fitview",onClick:S},{default:s(()=>[c(e.$slots,"icon-fit-view",{},()=>[(a(),N(F(d(sd))))])]),_:3})]):M("",!0),e.showInteractive?c(e.$slots,"control-interactive",{key:2},()=>[e.showInteractive?(a(),N(ed,{key:0,class:"vue-flow__controls-interactive",onClick:k},{default:s(()=>[y.value?c(e.$slots,"icon-unlock",{key:0},()=>[(a(),N(F(d(pd))))]):M("",!0),y.value?M("",!0):c(e.$slots,"icon-lock",{key:1},()=>[(a(),N(F(d(hd))))])]),_:3})):M("",!0)]):M("",!0),c(e.$slots,"default")]),_:3},8,["position"]))}});export{ia as _,sl as a,gd as b,wl as c,cl as d,Jc as e,Ba as u};
|