@vue-flow/node-resizer
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),tt=require("@vue-flow/core");var X=(t=>(t.Line="line",t.Handle="handle",t))(X||{}),nt="http://www.w3.org/1999/xhtml";const gt={svg:"http://www.w3.org/2000/svg",xhtml:nt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gt.hasOwnProperty(e)?{space:gt[e],local:t}:t}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===nt&&e.documentElement.namespaceURI===nt?e.createElement(t):e.createElementNS(n,t)}}function Bt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function _t(t){var e=vt(t);return(e.local?Bt:Pt)(e)}function Mt(){}function wt(t){return t==null?Mt:function(){return this.querySelector(t)}}function Lt(t){typeof t!="function"&&(t=wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=new Array(l),a,c,f=0;f<l;++f)(a=o[f])&&(c=t.call(a,a.__data__,f,o))&&("__data__"in a&&(c.__data__=a.__data__),s[f]=c);return new S(r,this._parents)}function Tt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Vt(){return[]}function Ft(t){return t==null?Vt:function(){return this.querySelectorAll(t)}}function Ht(t){return function(){return Tt(t.apply(this,arguments))}}function It(t){typeof t=="function"?t=Ht(t):t=Ft(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var l=e[o],s=l.length,a,c=0;c<s;++c)(a=l[c])&&(r.push(t.call(a,a.__data__,c,l)),i.push(a));return new S(r,i)}function Dt(t){return function(){return this.matches(t)}}function bt(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Yt(t){return function(){return Xt.call(this.children,t)}}function Ot(){return this.firstElementChild}function Wt(t){return this.select(t==null?Ot:Yt(typeof t=="function"?t:bt(t)))}var qt=Array.prototype.filter;function Ut(){return Array.from(this.children)}function $t(t){return function(){return qt.call(this.children,t)}}function Kt(t){return this.selectAll(t==null?Ut:$t(typeof t=="function"?t:bt(t)))}function Gt(t){typeof t!="function"&&(t=Dt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=[],a,c=0;c<l;++c)(a=o[c])&&t.call(a,a.__data__,c,o)&&s.push(a);return new S(r,this._parents)}function xt(t){return new Array(t.length)}function Jt(){return new S(this._enter||this._groups.map(xt),this._parents)}function J(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}J.prototype={constructor:J,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Qt(t){return function(){return t}}function Zt(t,e,n,r,i,o){for(var l=0,s,a=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],r[l]=s):n[l]=new J(t,o[l]);for(;l<a;++l)(s=e[l])&&(i[l]=s)}function jt(t,e,n,r,i,o,l){var s,a,c=new Map,f=e.length,g=o.length,p=new Array(f),v;for(s=0;s<f;++s)(a=e[s])&&(p[s]=v=l.call(a,a.__data__,s,e)+"",c.has(v)?i[s]=a:c.set(v,a));for(s=0;s<g;++s)v=l.call(t,o[s],s,o)+"",(a=c.get(v))?(r[s]=a,a.__data__=o[s],c.delete(v)):n[s]=new J(t,o[s]);for(s=0;s<f;++s)(a=e[s])&&c.get(p[s])===a&&(i[s]=a)}function te(t){return t.__data__}function ee(t,e){if(!arguments.length)return Array.from(this,te);var n=e?jt:Zt,r=this._parents,i=this._groups;typeof t!="function"&&(t=Qt(t));for(var o=i.length,l=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var f=r[c],g=i[c],p=g.length,v=ne(t.call(f,f&&f.__data__,c,r)),w=v.length,x=s[c]=new Array(w),M=l[c]=new Array(w),F=a[c]=new Array(p);n(f,g,x,M,F,v,e);for(var z=0,C=0,u,m;z<w;++z)if(u=x[z]){for(z>=C&&(C=z+1);!(m=M[C])&&++C<w;);u._next=m||null}}return l=new S(l,r),l._enter=s,l._exit=a,l}function ne(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function re(){return new S(this._exit||this._groups.map(xt),this._parents)}function ie(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function oe(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),s=new Array(i),a=0;a<l;++a)for(var c=n[a],f=r[a],g=c.length,p=s[a]=new Array(g),v,w=0;w<g;++w)(v=c[w]||f[w])&&(p[w]=v);for(;a<i;++a)s[a]=n[a];return new S(s,this._parents)}function se(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],l;--i>=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function le(t){t||(t=ue);function e(g,p){return g&&p?t(g.__data__,p.__data__):!g-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var l=n[o],s=l.length,a=i[o]=new Array(s),c,f=0;f<s;++f)(c=l[f])&&(a[f]=c);a.sort(e)}return new S(i,this._parents).order()}function ue(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ce(){return Array.from(this)}function fe(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var l=r[i];if(l)return l}return null}function he(){let t=0;for(const e of this)++t;return t}function de(){return!this.node()}function pe(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,s;o<l;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function ge(t){return function(){this.removeAttribute(t)}}function me(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function ve(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function be(t,e){var n=vt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?me:ge:typeof e=="function"?n.local?we:_e:n.local?ve:ye)(n,e))}function At(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xe(t){return function(){this.style.removeProperty(t)}}function Ae(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Se(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ce(t,e,n){return arguments.length>1?this.each((e==null?xe:typeof e=="function"?Se:Ae)(t,e,n??"")):ze(this.node(),t)}function ze(t,e){return t.style.getPropertyValue(e)||At(t).getComputedStyle(t,null).getPropertyValue(e)}function Ee(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ke(t,e){return arguments.length>1?this.each((e==null?Ee:typeof e=="function"?Ne:Re)(t,e)):this.node()[t]}function St(t){return t.trim().split(/^|\s+/)}function ot(t){return t.classList||new Ct(t)}function Ct(t){this._node=t,this._names=St(t.getAttribute("class")||"")}Ct.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function zt(t,e){for(var n=ot(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Et(t,e){for(var n=ot(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Pe(t){return function(){zt(this,t)}}function Be(t){return function(){Et(this,t)}}function Me(t,e){return function(){(e.apply(this,arguments)?zt:Et)(this,t)}}function Le(t,e){var n=St(t+"");if(arguments.length<2){for(var r=ot(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Me:e?Pe:Be)(n,e))}function Te(){this.textContent=""}function Ve(t){return function(){this.textContent=t}}function Fe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function He(t){return arguments.length?this.each(t==null?Te:(typeof t=="function"?Fe:Ve)(t)):this.node().textContent}function Ie(){this.innerHTML=""}function De(t){return function(){this.innerHTML=t}}function Xe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ye(t){return arguments.length?this.each(t==null?Ie:(typeof t=="function"?Xe:De)(t)):this.node().innerHTML}function Oe(){this.nextSibling&&this.parentNode.appendChild(this)}function We(){return this.each(Oe)}function qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(qe)}function $e(t){var e=typeof t=="function"?t:_t(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ke(){return null}function Ge(t,e){var n=typeof t=="function"?t:_t(t),r=e==null?Ke:typeof e=="function"?e:wt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Je(){var t=this.parentNode;t&&t.removeChild(this)}function Qe(){return this.each(Je)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(t){return this.select(t?je:Ze)}function en(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nn(t){return function(e){t.call(this,e,this.__data__)}}function rn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function on(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function sn(t,e,n){return function(){var r=this.__on,i,o=nn(e);if(r){for(var l=0,s=r.length;l<s;++l)if((i=r[l]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function ln(t,e,n){var r=rn(t+""),i,o=r.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var a=0,c=s.length,f;a<c;++a)for(i=0,f=s[a];i<o;++i)if((l=r[i]).type===f.type&&l.name===f.name)return f.value}return}for(s=e?sn:on,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function Rt(t,e,n){var r=At(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function un(t,e){return function(){return Rt(this,t,e)}}function an(t,e){return function(){return Rt(this,t,e.apply(this,arguments))}}function cn(t,e){return this.each((typeof e=="function"?an:un)(t,e))}function*fn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,l;i<o;++i)(l=r[i])&&(yield l)}var hn=[null];function S(t,e){this._groups=t,this._parents=e}function dn(){return this}S.prototype={constructor:S,select:Lt,selectAll:It,selectChild:Wt,selectChildren:Kt,filter:Gt,data:ee,enter:Jt,exit:re,join:ie,merge:oe,selection:dn,order:se,sort:le,call:ae,nodes:ce,node:fe,size:he,empty:de,each:pe,attr:be,style:Ce,property:ke,classed:Le,text:He,html:Ye,raise:We,lower:Ue,append:$e,insert:Ge,remove:Qe,clone:tn,datum:en,on:ln,dispatch:cn,[Symbol.iterator]:fn};function Y(t){return typeof t=="string"?new S([[document.querySelector(t)]],[document.documentElement]):new S([[t]],hn)}function pn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function mt(t,e){if(t=pn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var gn={value:()=>{}};function Nt(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new G(n)}function G(t){this._=t}function mn(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}G.prototype=Nt.prototype={constructor:G,on:function(t,e){var n=this._,r=mn(t+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((i=(t=r[o]).type)&&(i=yn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(i=(t=r[o]).type)n[i]=yt(n[i],t.name,e);else if(e==null)for(i in n)n[i]=yt(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new G(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function yn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function yt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=gn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}const vn={passive:!1},O={capture:!0,passive:!1};function et(t){t.stopImmediatePropagation()}function V(t){t.preventDefault(),t.stopImmediatePropagation()}function _n(t){var e=t.document.documentElement,n=Y(t).on("dragstart.drag",V,O);"onselectstart"in e?n.on("selectstart.drag",V,O):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function wn(t,e){var n=t.document.documentElement,r=Y(t).on("dragstart.drag",null);e&&(r.on("click.drag",V,O),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const K=t=>()=>t;function rt(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:l,y:s,dx:a,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}rt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function bn(t){return!t.ctrlKey&&!t.button}function xn(){return this.parentNode}function An(t,e){return e??{x:t.x,y:t.y}}function Sn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cn(){var t=bn,e=xn,n=An,r=Sn,i={},o=Nt("start","drag","end"),l=0,s,a,c,f,g=0;function p(u){u.on("mousedown.drag",v).filter(r).on("touchstart.drag",M).on("touchmove.drag",F,vn).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(u,m){if(!(f||!t.call(this,u,m))){var y=C(this,e.call(this,u,m),u,m,"mouse");y&&(Y(u.view).on("mousemove.drag",w,O).on("mouseup.drag",x,O),_n(u.view),et(u),c=!1,s=u.clientX,a=u.clientY,y("start",u))}}function w(u){if(V(u),!c){var m=u.clientX-s,y=u.clientY-a;c=m*m+y*y>g}i.mouse("drag",u)}function x(u){Y(u.view).on("mousemove.drag mouseup.drag",null),wn(u.view,c),V(u),i.mouse("end",u)}function M(u,m){if(t.call(this,u,m)){var y=u.changedTouches,d=e.call(this,u,m),_=y.length,b,E;for(b=0;b<_;++b)(E=C(this,d,u,m,y[b].identifier,y[b]))&&(et(u),E("start",u,y[b]))}}function F(u){var m=u.changedTouches,y=m.length,d,_;for(d=0;d<y;++d)(_=i[m[d].identifier])&&(V(u),_("drag",u,m[d]))}function z(u){var m=u.changedTouches,y=m.length,d,_;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),d=0;d<y;++d)(_=i[m[d].identifier])&&(et(u),_("end",u,m[d]))}function C(u,m,y,d,_,b){var E=o.copy(),A=mt(b||y,m),R,N,k;if((k=n.call(u,new rt("beforestart",{sourceEvent:y,target:p,identifier:_,active:l,x:A[0],y:A[1],dx:0,dy:0,dispatch:E}),d))!=null)return R=k.x-A[0]||0,N=k.y-A[1]||0,function L(H,W,q){var I=A,T;switch(H){case"start":i[_]=L,T=l++;break;case"end":delete i[_],--l;case"drag":A=mt(q||W,m),T=l;break}E.call(H,u,new rt(H,{sourceEvent:W,subject:k,target:p,identifier:_,active:T,x:A[0]+R,y:A[1]+N,dx:A[0]-I[0],dy:A[1]-I[1],dispatch:E}),d)}}return p.filter=function(u){return arguments.length?(t=typeof u=="function"?u:K(!!u),p):t},p.container=function(u){return arguments.length?(e=typeof u=="function"?u:K(u),p):e},p.subject=function(u){return arguments.length?(n=typeof u=="function"?u:K(u),p):n},p.touchable=function(u){return arguments.length?(r=typeof u=="function"?u:K(!!u),p):r},p.on=function(){var u=o.on.apply(o,arguments);return u===o?p:u},p.clickDistance=function(u){return arguments.length?(g=(u=+u)*u,p):Math.sqrt(g)},p}function zn({width:t,prevWidth:e,height:n,prevHeight:r,invertX:i,invertY:o}){const l=t-e,s=n-r,a=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&i&&(a[0]=a[0]*-1),s&&o&&(a[1]=a[1]*-1),a}const En={name:"ResizeControl",compatConfig:{MODE:3}},it=h.defineComponent({...En,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,r={width:0,height:0,x:0,y:0},i={...r,pointerX:0,pointerY:0},o=h.inject(tt.NodeIdInjection,null),l=h.ref(),s=h.computed(()=>typeof n.nodeId=="string"?n.nodeId:o),{findNode:a,emits:c}=tt.useVueFlow(),f=h.ref(i),g=h.ref(r),p=h.computed(()=>{if(n.keepAspectRatio===!0&&f.value.width&&f.value.height)return f.value.width/f.value.height;if(typeof n.keepAspectRatio=="number")return n.keepAspectRatio}),v=tt.useGetPointerPosition(),w=h.computed(()=>n.variant===X.Line?"right":"bottom-right"),x=h.computed(()=>n.position??w.value);h.watchEffect(C=>{if(!l.value||!s.value)return;const u=Y(l.value),m=Cn().on("start",y=>{const d=a(s.value),{xSnapped:_,ySnapped:b}=v(y);g.value={width:(d==null?void 0:d.dimensions.width)??0,height:(d==null?void 0:d.dimensions.height)??0,x:(d==null?void 0:d.position.x)??0,y:(d==null?void 0:d.position.y)??0},f.value={...g.value,pointerX:_,pointerY:b},e("resizeStart",{event:y,params:g.value})}).on("drag",y=>{var k;const{xSnapped:d,ySnapped:_}=v(y),b=a(s.value),E=x.value.includes("right")||x.value.includes("left"),A=x.value.includes("bottom")||x.value.includes("top"),R=x.value.includes("left"),N=x.value.includes("top");if(b){const L=[],{pointerX:H,pointerY:W,width:q,height:I,x:T,y:st}=f.value,{x:lt,y:ut,width:at,height:ct}=g.value,Q=Math.floor(E?d-H:0),Z=Math.floor(A?_-W:0);let P=Math.max(q+(R?-Q:Q),n.minWidth),B=Math.max(I+(N?-Z:Z),n.minHeight);if(p.value&&P/B!==p.value){const U=B*p.value,$=P/p.value;Q>Z?B=Math.max($,n.minHeight):P=Math.max(U,n.minWidth)}const ft=P!==at,ht=B!==ct;if(R||N){const D=R?T-(P-q):T,U=N?st-(B-I):st,$=D!==lt&&ft,pt=U!==ut&&ht;if($||pt){const j={id:b.id,type:"position",from:b.position,position:{x:$?D:lt,y:pt?U:ut}};L.push(j),g.value.x=j.position.x,g.value.y=j.position.y}}if(ft||ht){const D={id:s.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:P,height:B}};L.push(D),g.value.width=P,g.value.height=B}if(L.length===0)return;const kt=zn({width:g.value.width,prevWidth:at,height:g.value.height,prevHeight:ct,invertX:R,invertY:N}),dt={...g.value,direction:kt};if(((k=n.shouldResize)==null?void 0:k.call(n,y,dt))===!1)return;e("resize",{event:y,params:dt}),c.nodesChange(L)}}).on("end",y=>{const d={id:s.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:y,params:g.value}),c.nodesChange([d])});u.call(m),C(()=>{u.on(".drag",null)})});const M=h.computed(()=>x.value.split("-")),F=h.computed(()=>n.variant===X.Line?"borderColor":"backgroundColor"),z=h.computed(()=>n.color?{[F.value]:n.color}:{});return(C,u)=>(h.openBlock(),h.createElementBlock("div",{ref_key:"resizeControlRef",ref:l,class:h.normalizeClass(["vue-flow__resize-control nodrag",[...h.unref(M),t.variant]]),style:h.normalizeStyle(h.unref(z))},[h.renderSlot(C.$slots,"default")],6))}}),Rn={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Nn=h.defineComponent({...Rn,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],r=["top","right","bottom","left"];return(i,o)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(r,l=>h.createVNode(it,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:h.unref(X).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","should-resize"])),64)),(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(n,l=>h.createVNode(it,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","should-resize","keep-aspect-ratio"])),64))],64))}});exports.NodeResizeControl=it;exports.NodeResizer=Nn;exports.ResizeControlVariant=X; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),O=require("@vue-flow/core");var q=(t=>(t.Line="line",t.Handle="handle",t))(q||{}),et="http://www.w3.org/1999/xhtml";const mt={svg:"http://www.w3.org/2000/svg",xhtml:et,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),mt.hasOwnProperty(e)?{space:mt[e],local:t}:t}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===et&&e.documentElement.namespaceURI===et?e.createElement(t):e.createElementNS(n,t)}}function Ht(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function vt(t){var e=yt(t);return(e.local?Ht:Pt)(e)}function Vt(){}function _t(t){return t==null?Vt:function(){return this.querySelector(t)}}function Lt(t){typeof t!="function"&&(t=_t(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=new Array(l),a,c,h=0;h<l;++h)(a=o[h])&&(c=t.call(a,a.__data__,h,o))&&("__data__"in a&&(c.__data__=a.__data__),s[h]=c);return new E(i,this._parents)}function Bt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Tt(){return[]}function Ft(t){return t==null?Tt:function(){return this.querySelectorAll(t)}}function Mt(t){return function(){return Bt(t.apply(this,arguments))}}function Wt(t){typeof t=="function"?t=Mt(t):t=Ft(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var l=e[o],s=l.length,a,c=0;c<s;++c)(a=l[c])&&(i.push(t.call(a,a.__data__,c,l)),r.push(a));return new E(i,r)}function Xt(t){return function(){return this.matches(t)}}function wt(t){return function(e){return e.matches(t)}}var Dt=Array.prototype.find;function It(t){return function(){return Dt.call(this.children,t)}}function Yt(){return this.firstElementChild}function Ot(t){return this.select(t==null?Yt:It(typeof t=="function"?t:wt(t)))}var qt=Array.prototype.filter;function Ut(){return Array.from(this.children)}function $t(t){return function(){return qt.call(this.children,t)}}function Kt(t){return this.selectAll(t==null?Ut:$t(typeof t=="function"?t:wt(t)))}function Gt(t){typeof t!="function"&&(t=Xt(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=[],a,c=0;c<l;++c)(a=o[c])&&t.call(a,a.__data__,c,o)&&s.push(a);return new E(i,this._parents)}function xt(t){return new Array(t.length)}function Jt(){return new E(this._enter||this._groups.map(xt),this._parents)}function Z(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Z.prototype={constructor:Z,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Qt(t){return function(){return t}}function Zt(t,e,n,i,r,o){for(var l=0,s,a=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],i[l]=s):n[l]=new Z(t,o[l]);for(;l<a;++l)(s=e[l])&&(r[l]=s)}function jt(t,e,n,i,r,o,l){var s,a,c=new Map,h=e.length,m=o.length,d=new Array(h),x;for(s=0;s<h;++s)(a=e[s])&&(d[s]=x=l.call(a,a.__data__,s,e)+"",c.has(x)?r[s]=a:c.set(x,a));for(s=0;s<m;++s)x=l.call(t,o[s],s,o)+"",(a=c.get(x))?(i[s]=a,a.__data__=o[s],c.delete(x)):n[s]=new Z(t,o[s]);for(s=0;s<h;++s)(a=e[s])&&c.get(d[s])===a&&(r[s]=a)}function te(t){return t.__data__}function ee(t,e){if(!arguments.length)return Array.from(this,te);var n=e?jt:Zt,i=this._parents,r=this._groups;typeof t!="function"&&(t=Qt(t));for(var o=r.length,l=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var h=i[c],m=r[c],d=m.length,x=ne(t.call(h,h&&h.__data__,c,i)),_=x.length,V=s[c]=new Array(_),L=l[c]=new Array(_),F=a[c]=new Array(d);n(h,m,V,L,F,x,e);for(var R=0,N=0,u,g;R<_;++R)if(u=V[R]){for(R>=N&&(N=R+1);!(g=L[N])&&++N<_;);u._next=g||null}}return l=new E(l,i),l._enter=s,l._exit=a,l}function ne(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ie(){return new E(this._exit||this._groups.map(xt),this._parents)}function re(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function oe(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,l=Math.min(r,o),s=new Array(r),a=0;a<l;++a)for(var c=n[a],h=i[a],m=c.length,d=s[a]=new Array(m),x,_=0;_<m;++_)(x=c[_]||h[_])&&(d[_]=x);for(;a<r;++a)s[a]=n[a];return new E(s,this._parents)}function se(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],l;--r>=0;)(l=i[r])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function le(t){t||(t=ue);function e(m,d){return m&&d?t(m.__data__,d.__data__):!m-!d}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var l=n[o],s=l.length,a=r[o]=new Array(s),c,h=0;h<s;++h)(c=l[h])&&(a[h]=c);a.sort(e)}return new E(r,this._parents).order()}function ue(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ce(){return Array.from(this)}function fe(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var l=i[r];if(l)return l}return null}function he(){let t=0;for(const e of this)++t;return t}function de(){return!this.node()}function me(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,l=r.length,s;o<l;++o)(s=r[o])&&t.call(s,s.__data__,o,r);return this}function ge(t){return function(){this.removeAttribute(t)}}function pe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function ve(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function xe(t,e){var n=yt(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?pe:ge:typeof e=="function"?n.local?we:_e:n.local?ve:ye)(n,e))}function bt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function be(t){return function(){this.style.removeProperty(t)}}function Ae(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Se(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Ce(t,e,n){return arguments.length>1?this.each((e==null?be:typeof e=="function"?Se:Ae)(t,e,n??"")):ze(this.node(),t)}function ze(t,e){return t.style.getPropertyValue(e)||bt(t).getComputedStyle(t,null).getPropertyValue(e)}function Ee(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ke(t,e){return arguments.length>1?this.each((e==null?Ee:typeof e=="function"?Ne:Re)(t,e)):this.node()[t]}function At(t){return t.trim().split(/^|\s+/)}function rt(t){return t.classList||new St(t)}function St(t){this._node=t,this._names=At(t.getAttribute("class")||"")}St.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ct(t,e){for(var n=rt(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function zt(t,e){for(var n=rt(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Pe(t){return function(){Ct(this,t)}}function He(t){return function(){zt(this,t)}}function Ve(t,e){return function(){(e.apply(this,arguments)?Ct:zt)(this,t)}}function Le(t,e){var n=At(t+"");if(arguments.length<2){for(var i=rt(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ve:e?Pe:He)(n,e))}function Be(){this.textContent=""}function Te(t){return function(){this.textContent=t}}function Fe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Me(t){return arguments.length?this.each(t==null?Be:(typeof t=="function"?Fe:Te)(t)):this.node().textContent}function We(){this.innerHTML=""}function Xe(t){return function(){this.innerHTML=t}}function De(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ie(t){return arguments.length?this.each(t==null?We:(typeof t=="function"?De:Xe)(t)):this.node().innerHTML}function Ye(){this.nextSibling&&this.parentNode.appendChild(this)}function Oe(){return this.each(Ye)}function qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(qe)}function $e(t){var e=typeof t=="function"?t:vt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ke(){return null}function Ge(t,e){var n=typeof t=="function"?t:vt(t),i=e==null?Ke:typeof e=="function"?e:_t(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Je(){var t=this.parentNode;t&&t.removeChild(this)}function Qe(){return this.each(Je)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(t){return this.select(t?je:Ze)}function en(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nn(t){return function(e){t.call(this,e,this.__data__)}}function rn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function on(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function sn(t,e,n){return function(){var i=this.__on,r,o=nn(e);if(i){for(var l=0,s=i.length;l<s;++l)if((r=i[l]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function ln(t,e,n){var i=rn(t+""),r,o=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var a=0,c=s.length,h;a<c;++a)for(r=0,h=s[a];r<o;++r)if((l=i[r]).type===h.type&&l.name===h.name)return h.value}return}for(s=e?sn:on,r=0;r<o;++r)this.each(s(i[r],e,n));return this}function Et(t,e,n){var i=bt(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function un(t,e){return function(){return Et(this,t,e)}}function an(t,e){return function(){return Et(this,t,e.apply(this,arguments))}}function cn(t,e){return this.each((typeof e=="function"?an:un)(t,e))}function*fn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,l;r<o;++r)(l=i[r])&&(yield l)}var hn=[null];function E(t,e){this._groups=t,this._parents=e}function dn(){return this}E.prototype={constructor:E,select:Lt,selectAll:Wt,selectChild:Ot,selectChildren:Kt,filter:Gt,data:ee,enter:Jt,exit:ie,join:re,merge:oe,selection:dn,order:se,sort:le,call:ae,nodes:ce,node:fe,size:he,empty:de,each:me,attr:xe,style:Ce,property:ke,classed:Le,text:Me,html:Ie,raise:Oe,lower:Ue,append:$e,insert:Ge,remove:Qe,clone:tn,datum:en,on:ln,dispatch:cn,[Symbol.iterator]:fn};function U(t){return typeof t=="string"?new E([[document.querySelector(t)]],[document.documentElement]):new E([[t]],hn)}function mn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function gt(t,e){if(t=mn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var gn={value:()=>{}};function Rt(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Q(n)}function Q(t){this._=t}function pn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Q.prototype=Rt.prototype={constructor:Q,on:function(t,e){var n=this._,i=pn(t+"",n),r,o=-1,l=i.length;if(arguments.length<2){for(;++o<l;)if((r=(t=i[o]).type)&&(r=yn(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(r=(t=i[o]).type)n[r]=pt(n[r],t.name,e);else if(e==null)for(r in n)n[r]=pt(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Q(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function yn(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function pt(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=gn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}const vn={passive:!1},$={capture:!0,passive:!1};function tt(t){t.stopImmediatePropagation()}function T(t){t.preventDefault(),t.stopImmediatePropagation()}function _n(t){var e=t.document.documentElement,n=U(t).on("dragstart.drag",T,$);"onselectstart"in e?n.on("selectstart.drag",T,$):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function wn(t,e){var n=t.document.documentElement,i=U(t).on("dragstart.drag",null);e&&(i.on("click.drag",T,$),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const J=t=>()=>t;function nt(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:l,y:s,dx:a,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}nt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function xn(t){return!t.ctrlKey&&!t.button}function bn(){return this.parentNode}function An(t,e){return e??{x:t.x,y:t.y}}function Sn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cn(){var t=xn,e=bn,n=An,i=Sn,r={},o=Rt("start","drag","end"),l=0,s,a,c,h,m=0;function d(u){u.on("mousedown.drag",x).filter(i).on("touchstart.drag",L).on("touchmove.drag",F,vn).on("touchend.drag touchcancel.drag",R).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(u,g){if(!(h||!t.call(this,u,g))){var y=N(this,e.call(this,u,g),u,g,"mouse");y&&(U(u.view).on("mousemove.drag",_,$).on("mouseup.drag",V,$),_n(u.view),tt(u),c=!1,s=u.clientX,a=u.clientY,y("start",u))}}function _(u){if(T(u),!c){var g=u.clientX-s,y=u.clientY-a;c=g*g+y*y>m}r.mouse("drag",u)}function V(u){U(u.view).on("mousemove.drag mouseup.drag",null),wn(u.view,c),T(u),r.mouse("end",u)}function L(u,g){if(t.call(this,u,g)){var y=u.changedTouches,v=e.call(this,u,g),b=y.length,w,p;for(w=0;w<b;++w)(p=N(this,v,u,g,y[w].identifier,y[w]))&&(tt(u),p("start",u,y[w]))}}function F(u){var g=u.changedTouches,y=g.length,v,b;for(v=0;v<y;++v)(b=r[g[v].identifier])&&(T(u),b("drag",u,g[v]))}function R(u){var g=u.changedTouches,y=g.length,v,b;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),v=0;v<y;++v)(b=r[g[v].identifier])&&(tt(u),b("end",u,g[v]))}function N(u,g,y,v,b,w){var p=o.copy(),A=gt(w||y,g),P,M,k;if((k=n.call(u,new nt("beforestart",{sourceEvent:y,target:d,identifier:b,active:l,x:A[0],y:A[1],dx:0,dy:0,dispatch:p}),v))!=null)return P=k.x-A[0]||0,M=k.y-A[1]||0,function j(W,X,K){var D=A,B;switch(W){case"start":r[b]=j,B=l++;break;case"end":delete r[b],--l;case"drag":A=gt(K||X,g),B=l;break}p.call(W,u,new nt(W,{sourceEvent:X,subject:k,target:d,identifier:b,active:B,x:A[0]+P,y:A[1]+M,dx:A[0]-D[0],dy:A[1]-D[1],dispatch:p}),v)}}return d.filter=function(u){return arguments.length?(t=typeof u=="function"?u:J(!!u),d):t},d.container=function(u){return arguments.length?(e=typeof u=="function"?u:J(u),d):e},d.subject=function(u){return arguments.length?(n=typeof u=="function"?u:J(u),d):n},d.touchable=function(u){return arguments.length?(i=typeof u=="function"?u:J(!!u),d):i},d.on=function(){var u=o.on.apply(o,arguments);return u===o?d:u},d.clickDistance=function(u){return arguments.length?(m=(u=+u)*u,d):Math.sqrt(m)},d}function zn({width:t,prevWidth:e,height:n,prevHeight:i,invertX:r,invertY:o}){const l=t-e,s=n-i,a=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&r&&(a[0]=a[0]*-1),s&&o&&(a[1]=a[1]*-1),a}const En={name:"ResizeControl",compatConfig:{MODE:3}},it=f.defineComponent({...En,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},maxWidth:{default:Number.MAX_VALUE},maxHeight:{default:Number.MAX_VALUE},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number],default:!1}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,i={width:0,height:0,x:0,y:0},r={...i,pointerX:0,pointerY:0,aspectRatio:1},{findNode:o,emits:l}=O.useVueFlow(),s=O.useGetPointerPosition(),a=f.inject(O.NodeIdInjection,null),c=f.ref(),h=f.ref(r),m=f.ref(i),d=f.computed(()=>typeof n.nodeId=="string"?n.nodeId:a),x=f.computed(()=>n.variant===q.Line?"right":"bottom-right"),_=f.computed(()=>n.position??x.value);f.watchEffect(R=>{if(!c.value||!d.value)return;const N=U(c.value),u=_.value.includes("right")||_.value.includes("left"),g=_.value.includes("bottom")||_.value.includes("top"),y=_.value.includes("left"),v=_.value.includes("top"),b=Cn().on("start",w=>{const p=o(d.value),{xSnapped:A,ySnapped:P}=s(w);m.value={width:(p==null?void 0:p.dimensions.width)??0,height:(p==null?void 0:p.dimensions.height)??0,x:(p==null?void 0:p.position.x)??0,y:(p==null?void 0:p.position.y)??0},h.value={...m.value,pointerX:A,pointerY:P,aspectRatio:m.value.width/m.value.height},e("resizeStart",{event:w,params:m.value})}).on("drag",w=>{var M;const{xSnapped:p,ySnapped:A}=s(w),P=o(d.value);if(P){const k=[],{pointerX:j,pointerY:W,width:X,height:K,x:D,y:B,aspectRatio:Nt}=h.value,{x:ot,y:st,width:lt,height:ut}=m.value,at=Math.floor(u?p-j:0),ct=Math.floor(g?A-W:0);let S=O.clamp(X+(y?-at:at),n.minWidth,n.maxWidth),C=O.clamp(K+(v?-ct:ct),n.minHeight,n.maxHeight);if(n.keepAspectRatio){const H=S/C;let z=Nt;typeof n.keepAspectRatio=="number"&&H!==n.keepAspectRatio&&(z=n.keepAspectRatio);const I=u&&g,G=u&&!g,Y=g&&!u;S=H<=z&&I||Y?C*z:S,C=H>z&&I||G?S/z:C,S>=n.maxWidth?(S=n.maxWidth,C=n.maxWidth/z):S<=n.minWidth&&(S=n.minWidth,C=n.minWidth/z),C>=n.maxHeight?(C=n.maxHeight,S=n.maxHeight*z):C<=n.minHeight&&(C=n.minHeight,S=n.minHeight*z)}const ft=S!==lt,ht=C!==ut;if(y||v){const H=y?D-(S-X):D,z=v?B-(C-K):B,I=H!==ot&&ft,G=z!==st&&ht;if(I||G){const Y={id:P.id,type:"position",from:P.position,position:{x:I?H:ot,y:G?z:st}};k.push(Y),m.value.x=Y.position.x,m.value.y=Y.position.y}}if(ft||ht){const H={id:d.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:S,height:C}};k.push(H),m.value.width=S,m.value.height=C}if(k.length===0)return;const kt=zn({width:m.value.width,prevWidth:lt,height:m.value.height,prevHeight:ut,invertX:y,invertY:v}),dt={...m.value,direction:kt};if(((M=n.shouldResize)==null?void 0:M.call(n,w,dt))===!1)return;e("resize",{event:w,params:dt}),l.nodesChange(k)}}).on("end",w=>{const p={id:d.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:w,params:m.value}),l.nodesChange([p])});N.call(b),R(()=>{N.on(".drag",null)})});const V=f.computed(()=>_.value.split("-")),L=f.computed(()=>n.variant===q.Line?"borderColor":"backgroundColor"),F=f.computed(()=>n.color?{[L.value]:n.color}:{});return(R,N)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"resizeControlRef",ref:c,class:f.normalizeClass(["vue-flow__resize-control nodrag",[...f.unref(V),t.variant]]),style:f.normalizeStyle(f.unref(F))},[f.renderSlot(R.$slots,"default")],6))}}),Rn={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Nn=f.defineComponent({...Rn,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],i=["top","right","bottom","left"];return(r,o)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(i,l=>f.createVNode(it,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:f.unref(q).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","max-width","max-height","should-resize"])),64)),(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(n,l=>f.createVNode(it,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","max-width","max-height","should-resize","keep-aspect-ratio"])),64))],64))}});exports.NodeResizeControl=it;exports.NodeResizer=Nn;exports.ResizeControlVariant=q; |
@@ -11,2 +11,5 @@ import type { OnResize, OnResizeStart, ResizeControlProps } from './types' | ||
minHeight: number | ||
maxWidth: number | ||
maxHeight: number | ||
keepAspectRatio: boolean | ||
} | ||
@@ -37,2 +40,5 @@ >, | ||
minHeight: number | ||
maxWidth: number | ||
maxHeight: number | ||
keepAspectRatio: boolean | ||
} | ||
@@ -49,3 +55,6 @@ > | ||
minHeight: number | ||
maxWidth: number | ||
maxHeight: number | ||
variant: ResizeControlVariant | ||
keepAspectRatio: number | boolean | ||
} | ||
@@ -52,0 +61,0 @@ >, |
@@ -36,2 +36,4 @@ import type { D3DragEvent, SubjectPosition } from 'd3-drag' | ||
minHeight?: number | ||
maxWidth?: number | ||
maxHeight?: number | ||
shouldResize?: ShouldResize | ||
@@ -56,2 +58,4 @@ keepAspectRatio?: boolean | number | ||
minHeight?: number | ||
maxWidth?: number | ||
maxHeight?: number | ||
position?: ControlPosition | ||
@@ -62,3 +66,3 @@ variant?: ResizeControlVariant | ||
} | ||
export interface ResizeControlLineProps { | ||
export interface ResizeControlLineProps extends ResizeControlProps { | ||
nodeId?: string | ||
@@ -68,2 +72,4 @@ color?: string | ||
minHeight?: number | ||
maxWidth?: number | ||
maxHeight?: number | ||
variant?: ResizeControlVariant | ||
@@ -70,0 +76,0 @@ position?: ControlLinePosition |
@@ -1,1 +0,1 @@ | ||
var VueFlowNodeResizer=function(T,h,Z){"use strict";const Pn="";var H=(t=>(t.Line="line",t.Handle="handle",t))(H||{}),j="http://www.w3.org/1999/xhtml";const lt={svg:"http://www.w3.org/2000/svg",xhtml:j,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ut(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),lt.hasOwnProperty(e)?{space:lt[e],local:t}:t}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===j&&e.documentElement.namespaceURI===j?e.createElement(t):e.createElementNS(n,t)}}function Vt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function at(t){var e=ut(t);return(e.local?Vt:Pt)(e)}function Bt(){}function ct(t){return t==null?Bt:function(){return this.querySelector(t)}}function Ft(t){typeof t!="function"&&(t=ct(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=new Array(l),a,c,f=0;f<l;++f)(a=o[f])&&(c=t.call(a,a.__data__,f,o))&&("__data__"in a&&(c.__data__=a.__data__),s[f]=c);return new A(r,this._parents)}function Mt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Lt(){return[]}function Tt(t){return t==null?Lt:function(){return this.querySelectorAll(t)}}function Ht(t){return function(){return Mt(t.apply(this,arguments))}}function It(t){typeof t=="function"?t=Ht(t):t=Tt(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var l=e[o],s=l.length,a,c=0;c<s;++c)(a=l[c])&&(r.push(t.call(a,a.__data__,c,l)),i.push(a));return new A(r,i)}function Dt(t){return function(){return this.matches(t)}}function ft(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Yt(t){return function(){return Xt.call(this.children,t)}}function Ot(){return this.firstElementChild}function Wt(t){return this.select(t==null?Ot:Yt(typeof t=="function"?t:ft(t)))}var qt=Array.prototype.filter;function Ut(){return Array.from(this.children)}function $t(t){return function(){return qt.call(this.children,t)}}function Kt(t){return this.selectAll(t==null?Ut:$t(typeof t=="function"?t:ft(t)))}function Gt(t){typeof t!="function"&&(t=Dt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=[],a,c=0;c<l;++c)(a=o[c])&&t.call(a,a.__data__,c,o)&&s.push(a);return new A(r,this._parents)}function ht(t){return new Array(t.length)}function Jt(){return new A(this._enter||this._groups.map(ht),this._parents)}function q(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}q.prototype={constructor:q,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Qt(t){return function(){return t}}function Zt(t,e,n,r,i,o){for(var l=0,s,a=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],r[l]=s):n[l]=new q(t,o[l]);for(;l<a;++l)(s=e[l])&&(i[l]=s)}function jt(t,e,n,r,i,o,l){var s,a,c=new Map,f=e.length,g=o.length,p=new Array(f),_;for(s=0;s<f;++s)(a=e[s])&&(p[s]=_=l.call(a,a.__data__,s,e)+"",c.has(_)?i[s]=a:c.set(_,a));for(s=0;s<g;++s)_=l.call(t,o[s],s,o)+"",(a=c.get(_))?(r[s]=a,a.__data__=o[s],c.delete(_)):n[s]=new q(t,o[s]);for(s=0;s<f;++s)(a=e[s])&&c.get(p[s])===a&&(i[s]=a)}function te(t){return t.__data__}function ee(t,e){if(!arguments.length)return Array.from(this,te);var n=e?jt:Zt,r=this._parents,i=this._groups;typeof t!="function"&&(t=Qt(t));for(var o=i.length,l=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var f=r[c],g=i[c],p=g.length,_=ne(t.call(f,f&&f.__data__,c,r)),w=_.length,C=s[c]=new Array(w),F=l[c]=new Array(w),X=a[c]=new Array(p);n(f,g,C,F,X,_,e);for(var z=0,x=0,u,m;z<w;++z)if(u=C[z]){for(z>=x&&(x=z+1);!(m=F[x])&&++x<w;);u._next=m||null}}return l=new A(l,r),l._enter=s,l._exit=a,l}function ne(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function re(){return new A(this._exit||this._groups.map(ht),this._parents)}function ie(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function oe(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),s=new Array(i),a=0;a<l;++a)for(var c=n[a],f=r[a],g=c.length,p=s[a]=new Array(g),_,w=0;w<g;++w)(_=c[w]||f[w])&&(p[w]=_);for(;a<i;++a)s[a]=n[a];return new A(s,this._parents)}function se(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],l;--i>=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function le(t){t||(t=ue);function e(g,p){return g&&p?t(g.__data__,p.__data__):!g-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var l=n[o],s=l.length,a=i[o]=new Array(s),c,f=0;f<s;++f)(c=l[f])&&(a[f]=c);a.sort(e)}return new A(i,this._parents).order()}function ue(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ce(){return Array.from(this)}function fe(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var l=r[i];if(l)return l}return null}function he(){let t=0;for(const e of this)++t;return t}function de(){return!this.node()}function pe(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,s;o<l;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function ge(t){return function(){this.removeAttribute(t)}}function me(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function _e(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function ve(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function be(t,e){var n=ut(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?me:ge:typeof e=="function"?n.local?we:ve:n.local?_e:ye)(n,e))}function dt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function Ae(t){return function(){this.style.removeProperty(t)}}function Ce(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Se(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function xe(t,e,n){return arguments.length>1?this.each((e==null?Ae:typeof e=="function"?Se:Ce)(t,e,n??"")):ze(this.node(),t)}function ze(t,e){return t.style.getPropertyValue(e)||dt(t).getComputedStyle(t,null).getPropertyValue(e)}function Ee(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ke(t,e){return arguments.length>1?this.each((e==null?Ee:typeof e=="function"?Ne:Re)(t,e)):this.node()[t]}function pt(t){return t.trim().split(/^|\s+/)}function tt(t){return t.classList||new gt(t)}function gt(t){this._node=t,this._names=pt(t.getAttribute("class")||"")}gt.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function mt(t,e){for(var n=tt(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function yt(t,e){for(var n=tt(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Pe(t){return function(){mt(this,t)}}function Ve(t){return function(){yt(this,t)}}function Be(t,e){return function(){(e.apply(this,arguments)?mt:yt)(this,t)}}function Fe(t,e){var n=pt(t+"");if(arguments.length<2){for(var r=tt(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Be:e?Pe:Ve)(n,e))}function Me(){this.textContent=""}function Le(t){return function(){this.textContent=t}}function Te(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function He(t){return arguments.length?this.each(t==null?Me:(typeof t=="function"?Te:Le)(t)):this.node().textContent}function Ie(){this.innerHTML=""}function De(t){return function(){this.innerHTML=t}}function Xe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ye(t){return arguments.length?this.each(t==null?Ie:(typeof t=="function"?Xe:De)(t)):this.node().innerHTML}function Oe(){this.nextSibling&&this.parentNode.appendChild(this)}function We(){return this.each(Oe)}function qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(qe)}function $e(t){var e=typeof t=="function"?t:at(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ke(){return null}function Ge(t,e){var n=typeof t=="function"?t:at(t),r=e==null?Ke:typeof e=="function"?e:ct(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Je(){var t=this.parentNode;t&&t.removeChild(this)}function Qe(){return this.each(Je)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(t){return this.select(t?je:Ze)}function en(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nn(t){return function(e){t.call(this,e,this.__data__)}}function rn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function on(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function sn(t,e,n){return function(){var r=this.__on,i,o=nn(e);if(r){for(var l=0,s=r.length;l<s;++l)if((i=r[l]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function ln(t,e,n){var r=rn(t+""),i,o=r.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var a=0,c=s.length,f;a<c;++a)for(i=0,f=s[a];i<o;++i)if((l=r[i]).type===f.type&&l.name===f.name)return f.value}return}for(s=e?sn:on,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function _t(t,e,n){var r=dt(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function un(t,e){return function(){return _t(this,t,e)}}function an(t,e){return function(){return _t(this,t,e.apply(this,arguments))}}function cn(t,e){return this.each((typeof e=="function"?an:un)(t,e))}function*fn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,l;i<o;++i)(l=r[i])&&(yield l)}var hn=[null];function A(t,e){this._groups=t,this._parents=e}function dn(){return this}A.prototype={constructor:A,select:Ft,selectAll:It,selectChild:Wt,selectChildren:Kt,filter:Gt,data:ee,enter:Jt,exit:re,join:ie,merge:oe,selection:dn,order:se,sort:le,call:ae,nodes:ce,node:fe,size:he,empty:de,each:pe,attr:be,style:xe,property:ke,classed:Fe,text:He,html:Ye,raise:We,lower:Ue,append:$e,insert:Ge,remove:Qe,clone:tn,datum:en,on:ln,dispatch:cn,[Symbol.iterator]:fn};function I(t){return typeof t=="string"?new A([[document.querySelector(t)]],[document.documentElement]):new A([[t]],hn)}function pn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function vt(t,e){if(t=pn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var gn={value:()=>{}};function wt(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new U(n)}function U(t){this._=t}function mn(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}U.prototype=wt.prototype={constructor:U,on:function(t,e){var n=this._,r=mn(t+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((i=(t=r[o]).type)&&(i=yn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(i=(t=r[o]).type)n[i]=bt(n[i],t.name,e);else if(e==null)for(i in n)n[i]=bt(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new U(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function yn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function bt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=gn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}const _n={passive:!1},D={capture:!0,passive:!1};function et(t){t.stopImmediatePropagation()}function B(t){t.preventDefault(),t.stopImmediatePropagation()}function vn(t){var e=t.document.documentElement,n=I(t).on("dragstart.drag",B,D);"onselectstart"in e?n.on("selectstart.drag",B,D):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function wn(t,e){var n=t.document.documentElement,r=I(t).on("dragstart.drag",null);e&&(r.on("click.drag",B,D),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const $=t=>()=>t;function nt(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:l,y:s,dx:a,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}nt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function bn(t){return!t.ctrlKey&&!t.button}function An(){return this.parentNode}function Cn(t,e){return e??{x:t.x,y:t.y}}function Sn(){return navigator.maxTouchPoints||"ontouchstart"in this}function xn(){var t=bn,e=An,n=Cn,r=Sn,i={},o=wt("start","drag","end"),l=0,s,a,c,f,g=0;function p(u){u.on("mousedown.drag",_).filter(r).on("touchstart.drag",F).on("touchmove.drag",X,_n).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function _(u,m){if(!(f||!t.call(this,u,m))){var y=x(this,e.call(this,u,m),u,m,"mouse");y&&(I(u.view).on("mousemove.drag",w,D).on("mouseup.drag",C,D),vn(u.view),et(u),c=!1,s=u.clientX,a=u.clientY,y("start",u))}}function w(u){if(B(u),!c){var m=u.clientX-s,y=u.clientY-a;c=m*m+y*y>g}i.mouse("drag",u)}function C(u){I(u.view).on("mousemove.drag mouseup.drag",null),wn(u.view,c),B(u),i.mouse("end",u)}function F(u,m){if(t.call(this,u,m)){var y=u.changedTouches,d=e.call(this,u,m),v=y.length,b,E;for(b=0;b<v;++b)(E=x(this,d,u,m,y[b].identifier,y[b]))&&(et(u),E("start",u,y[b]))}}function X(u){var m=u.changedTouches,y=m.length,d,v;for(d=0;d<y;++d)(v=i[m[d].identifier])&&(B(u),v("drag",u,m[d]))}function z(u){var m=u.changedTouches,y=m.length,d,v;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),d=0;d<y;++d)(v=i[m[d].identifier])&&(et(u),v("end",u,m[d]))}function x(u,m,y,d,v,b){var E=o.copy(),S=vt(b||y,m),R,N,k;if((k=n.call(u,new nt("beforestart",{sourceEvent:y,target:p,identifier:v,active:l,x:S[0],y:S[1],dx:0,dy:0,dispatch:E}),d))!=null)return R=k.x-S[0]||0,N=k.y-S[1]||0,function M(Y,K,G){var O=S,L;switch(Y){case"start":i[v]=M,L=l++;break;case"end":delete i[v],--l;case"drag":S=vt(G||K,m),L=l;break}E.call(Y,u,new nt(Y,{sourceEvent:K,subject:k,target:p,identifier:v,active:L,x:S[0]+R,y:S[1]+N,dx:S[0]-O[0],dy:S[1]-O[1],dispatch:E}),d)}}return p.filter=function(u){return arguments.length?(t=typeof u=="function"?u:$(!!u),p):t},p.container=function(u){return arguments.length?(e=typeof u=="function"?u:$(u),p):e},p.subject=function(u){return arguments.length?(n=typeof u=="function"?u:$(u),p):n},p.touchable=function(u){return arguments.length?(r=typeof u=="function"?u:$(!!u),p):r},p.on=function(){var u=o.on.apply(o,arguments);return u===o?p:u},p.clickDistance=function(u){return arguments.length?(g=(u=+u)*u,p):Math.sqrt(g)},p}function zn({width:t,prevWidth:e,height:n,prevHeight:r,invertX:i,invertY:o}){const l=t-e,s=n-r,a=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&i&&(a[0]=a[0]*-1),s&&o&&(a[1]=a[1]*-1),a}const En={name:"ResizeControl",compatConfig:{MODE:3}},rt=h.defineComponent({...En,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,r={width:0,height:0,x:0,y:0},i={...r,pointerX:0,pointerY:0},o=h.inject(Z.NodeIdInjection,null),l=h.ref(),s=h.computed(()=>typeof n.nodeId=="string"?n.nodeId:o),{findNode:a,emits:c}=Z.useVueFlow(),f=h.ref(i),g=h.ref(r),p=h.computed(()=>{if(n.keepAspectRatio===!0&&f.value.width&&f.value.height)return f.value.width/f.value.height;if(typeof n.keepAspectRatio=="number")return n.keepAspectRatio}),_=Z.useGetPointerPosition(),w=h.computed(()=>n.variant===H.Line?"right":"bottom-right"),C=h.computed(()=>n.position??w.value);h.watchEffect(x=>{if(!l.value||!s.value)return;const u=I(l.value),m=xn().on("start",y=>{const d=a(s.value),{xSnapped:v,ySnapped:b}=_(y);g.value={width:(d==null?void 0:d.dimensions.width)??0,height:(d==null?void 0:d.dimensions.height)??0,x:(d==null?void 0:d.position.x)??0,y:(d==null?void 0:d.position.y)??0},f.value={...g.value,pointerX:v,pointerY:b},e("resizeStart",{event:y,params:g.value})}).on("drag",y=>{var k;const{xSnapped:d,ySnapped:v}=_(y),b=a(s.value),E=C.value.includes("right")||C.value.includes("left"),S=C.value.includes("bottom")||C.value.includes("top"),R=C.value.includes("left"),N=C.value.includes("top");if(b){const M=[],{pointerX:Y,pointerY:K,width:G,height:O,x:L,y:At}=f.value,{x:Ct,y:St,width:xt,height:zt}=g.value,it=Math.floor(E?d-Y:0),ot=Math.floor(S?v-K:0);let P=Math.max(G+(R?-it:it),n.minWidth),V=Math.max(O+(N?-ot:ot),n.minHeight);if(p.value&&P/V!==p.value){const J=V*p.value,Q=P/p.value;it>ot?V=Math.max(Q,n.minHeight):P=Math.max(J,n.minWidth)}const Et=P!==xt,Rt=V!==zt;if(R||N){const W=R?L-(P-G):L,J=N?At-(V-O):At,Q=W!==Ct&&Et,kt=J!==St&&Rt;if(Q||kt){const st={id:b.id,type:"position",from:b.position,position:{x:Q?W:Ct,y:kt?J:St}};M.push(st),g.value.x=st.position.x,g.value.y=st.position.y}}if(Et||Rt){const W={id:s.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:P,height:V}};M.push(W),g.value.width=P,g.value.height=V}if(M.length===0)return;const kn=zn({width:g.value.width,prevWidth:xt,height:g.value.height,prevHeight:zt,invertX:R,invertY:N}),Nt={...g.value,direction:kn};if(((k=n.shouldResize)==null?void 0:k.call(n,y,Nt))===!1)return;e("resize",{event:y,params:Nt}),c.nodesChange(M)}}).on("end",y=>{const d={id:s.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:y,params:g.value}),c.nodesChange([d])});u.call(m),x(()=>{u.on(".drag",null)})});const F=h.computed(()=>C.value.split("-")),X=h.computed(()=>n.variant===H.Line?"borderColor":"backgroundColor"),z=h.computed(()=>n.color?{[X.value]:n.color}:{});return(x,u)=>(h.openBlock(),h.createElementBlock("div",{ref_key:"resizeControlRef",ref:l,class:h.normalizeClass(["vue-flow__resize-control nodrag",[...h.unref(F),t.variant]]),style:h.normalizeStyle(h.unref(z))},[h.renderSlot(x.$slots,"default")],6))}}),Rn={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Nn=h.defineComponent({...Rn,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],r=["top","right","bottom","left"];return(i,o)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(r,l=>h.createVNode(rt,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:h.unref(H).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","should-resize"])),64)),(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(n,l=>h.createVNode(rt,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","should-resize","keep-aspect-ratio"])),64))],64))}});return T.NodeResizeControl=rt,T.NodeResizer=Nn,T.ResizeControlVariant=H,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),T}({},Vue,VueFlowCore); | ||
var VueFlowNodeResizer=function(T,f,M){"use strict";const Pn="";var W=(t=>(t.Line="line",t.Handle="handle",t))(W||{}),tt="http://www.w3.org/1999/xhtml";const st={svg:"http://www.w3.org/2000/svg",xhtml:tt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function lt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),st.hasOwnProperty(e)?{space:st[e],local:t}:t}function kt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===tt&&e.documentElement.namespaceURI===tt?e.createElement(t):e.createElementNS(n,t)}}function Pt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function at(t){var e=lt(t);return(e.local?Pt:kt)(e)}function Ht(){}function ut(t){return t==null?Ht:function(){return this.querySelector(t)}}function Vt(t){typeof t!="function"&&(t=ut(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=new Array(l),u,c,h=0;h<l;++h)(u=o[h])&&(c=t.call(u,u.__data__,h,o))&&("__data__"in u&&(c.__data__=u.__data__),s[h]=c);return new z(i,this._parents)}function Lt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Bt(){return[]}function Ft(t){return t==null?Bt:function(){return this.querySelectorAll(t)}}function Tt(t){return function(){return Lt(t.apply(this,arguments))}}function Mt(t){typeof t=="function"?t=Tt(t):t=Ft(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var l=e[o],s=l.length,u,c=0;c<s;++c)(u=l[c])&&(i.push(t.call(u,u.__data__,c,l)),r.push(u));return new z(i,r)}function Wt(t){return function(){return this.matches(t)}}function ct(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Dt(t){return function(){return Xt.call(this.children,t)}}function It(){return this.firstElementChild}function Yt(t){return this.select(t==null?It:Dt(typeof t=="function"?t:ct(t)))}var Ot=Array.prototype.filter;function Ut(){return Array.from(this.children)}function qt(t){return function(){return Ot.call(this.children,t)}}function $t(t){return this.selectAll(t==null?Ut:qt(typeof t=="function"?t:ct(t)))}function Kt(t){typeof t!="function"&&(t=Wt(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=[],u,c=0;c<l;++c)(u=o[c])&&t.call(u,u.__data__,c,o)&&s.push(u);return new z(i,this._parents)}function ft(t){return new Array(t.length)}function Gt(){return new z(this._enter||this._groups.map(ft),this._parents)}function G(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}G.prototype={constructor:G,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Jt(t){return function(){return t}}function Qt(t,e,n,i,r,o){for(var l=0,s,u=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],i[l]=s):n[l]=new G(t,o[l]);for(;l<u;++l)(s=e[l])&&(r[l]=s)}function Zt(t,e,n,i,r,o,l){var s,u,c=new Map,h=e.length,m=o.length,d=new Array(h),x;for(s=0;s<h;++s)(u=e[s])&&(d[s]=x=l.call(u,u.__data__,s,e)+"",c.has(x)?r[s]=u:c.set(x,u));for(s=0;s<m;++s)x=l.call(t,o[s],s,o)+"",(u=c.get(x))?(i[s]=u,u.__data__=o[s],c.delete(x)):n[s]=new G(t,o[s]);for(s=0;s<h;++s)(u=e[s])&&c.get(d[s])===u&&(r[s]=u)}function jt(t){return t.__data__}function te(t,e){if(!arguments.length)return Array.from(this,jt);var n=e?Zt:Qt,i=this._parents,r=this._groups;typeof t!="function"&&(t=Jt(t));for(var o=r.length,l=new Array(o),s=new Array(o),u=new Array(o),c=0;c<o;++c){var h=i[c],m=r[c],d=m.length,x=ee(t.call(h,h&&h.__data__,c,i)),v=x.length,L=s[c]=new Array(v),B=l[c]=new Array(v),I=u[c]=new Array(d);n(h,m,L,B,I,x,e);for(var R=0,N=0,a,g;R<v;++R)if(a=L[R]){for(R>=N&&(N=R+1);!(g=B[N])&&++N<v;);a._next=g||null}}return l=new z(l,i),l._enter=s,l._exit=u,l}function ee(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ne(){return new z(this._exit||this._groups.map(ft),this._parents)}function ie(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function re(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,l=Math.min(r,o),s=new Array(r),u=0;u<l;++u)for(var c=n[u],h=i[u],m=c.length,d=s[u]=new Array(m),x,v=0;v<m;++v)(x=c[v]||h[v])&&(d[v]=x);for(;u<r;++u)s[u]=n[u];return new z(s,this._parents)}function oe(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],l;--r>=0;)(l=i[r])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function se(t){t||(t=le);function e(m,d){return m&&d?t(m.__data__,d.__data__):!m-!d}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var l=n[o],s=l.length,u=r[o]=new Array(s),c,h=0;h<s;++h)(c=l[h])&&(u[h]=c);u.sort(e)}return new z(r,this._parents).order()}function le(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ue(){return Array.from(this)}function ce(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var l=i[r];if(l)return l}return null}function fe(){let t=0;for(const e of this)++t;return t}function he(){return!this.node()}function de(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,l=r.length,s;o<l;++o)(s=r[o])&&t.call(s,s.__data__,o,r);return this}function me(t){return function(){this.removeAttribute(t)}}function ge(t){return function(){this.removeAttributeNS(t.space,t.local)}}function pe(t,e){return function(){this.setAttribute(t,e)}}function ye(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function ve(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function we(t,e){var n=lt(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?ge:me:typeof e=="function"?n.local?ve:_e:n.local?ye:pe)(n,e))}function ht(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xe(t){return function(){this.style.removeProperty(t)}}function be(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Ae(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Ce(t,e,n){return arguments.length>1?this.each((e==null?xe:typeof e=="function"?Ae:be)(t,e,n??"")):Se(this.node(),t)}function Se(t,e){return t.style.getPropertyValue(e)||ht(t).getComputedStyle(t,null).getPropertyValue(e)}function ze(t){return function(){delete this[t]}}function Ee(t,e){return function(){this[t]=e}}function Re(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ne(t,e){return arguments.length>1?this.each((e==null?ze:typeof e=="function"?Re:Ee)(t,e)):this.node()[t]}function dt(t){return t.trim().split(/^|\s+/)}function et(t){return t.classList||new mt(t)}function mt(t){this._node=t,this._names=dt(t.getAttribute("class")||"")}mt.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function gt(t,e){for(var n=et(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function pt(t,e){for(var n=et(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function ke(t){return function(){gt(this,t)}}function Pe(t){return function(){pt(this,t)}}function He(t,e){return function(){(e.apply(this,arguments)?gt:pt)(this,t)}}function Ve(t,e){var n=dt(t+"");if(arguments.length<2){for(var i=et(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?He:e?ke:Pe)(n,e))}function Le(){this.textContent=""}function Be(t){return function(){this.textContent=t}}function Fe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Te(t){return arguments.length?this.each(t==null?Le:(typeof t=="function"?Fe:Be)(t)):this.node().textContent}function Me(){this.innerHTML=""}function We(t){return function(){this.innerHTML=t}}function Xe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function De(t){return arguments.length?this.each(t==null?Me:(typeof t=="function"?Xe:We)(t)):this.node().innerHTML}function Ie(){this.nextSibling&&this.parentNode.appendChild(this)}function Ye(){return this.each(Ie)}function Oe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(Oe)}function qe(t){var e=typeof t=="function"?t:at(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function $e(){return null}function Ke(t,e){var n=typeof t=="function"?t:at(t),i=e==null?$e:typeof e=="function"?e:ut(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Ge(){var t=this.parentNode;t&&t.removeChild(this)}function Je(){return this.each(Ge)}function Qe(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function Ze(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(t){return this.select(t?Ze:Qe)}function tn(t){return arguments.length?this.property("__data__",t):this.node().__data__}function en(t){return function(e){t.call(this,e,this.__data__)}}function nn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function rn(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function on(t,e,n){return function(){var i=this.__on,r,o=en(e);if(i){for(var l=0,s=i.length;l<s;++l)if((r=i[l]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function sn(t,e,n){var i=nn(t+""),r,o=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var u=0,c=s.length,h;u<c;++u)for(r=0,h=s[u];r<o;++r)if((l=i[r]).type===h.type&&l.name===h.name)return h.value}return}for(s=e?on:rn,r=0;r<o;++r)this.each(s(i[r],e,n));return this}function yt(t,e,n){var i=ht(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function ln(t,e){return function(){return yt(this,t,e)}}function an(t,e){return function(){return yt(this,t,e.apply(this,arguments))}}function un(t,e){return this.each((typeof e=="function"?an:ln)(t,e))}function*cn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,l;r<o;++r)(l=i[r])&&(yield l)}var fn=[null];function z(t,e){this._groups=t,this._parents=e}function hn(){return this}z.prototype={constructor:z,select:Vt,selectAll:Mt,selectChild:Yt,selectChildren:$t,filter:Kt,data:te,enter:Gt,exit:ne,join:ie,merge:re,selection:hn,order:oe,sort:se,call:ae,nodes:ue,node:ce,size:fe,empty:he,each:de,attr:we,style:Ce,property:Ne,classed:Ve,text:Te,html:De,raise:Ye,lower:Ue,append:qe,insert:Ke,remove:Je,clone:je,datum:tn,on:sn,dispatch:un,[Symbol.iterator]:cn};function X(t){return typeof t=="string"?new z([[document.querySelector(t)]],[document.documentElement]):new z([[t]],fn)}function dn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function _t(t,e){if(t=dn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var mn={value:()=>{}};function vt(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new J(n)}function J(t){this._=t}function gn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}J.prototype=vt.prototype={constructor:J,on:function(t,e){var n=this._,i=gn(t+"",n),r,o=-1,l=i.length;if(arguments.length<2){for(;++o<l;)if((r=(t=i[o]).type)&&(r=pn(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(r=(t=i[o]).type)n[r]=wt(n[r],t.name,e);else if(e==null)for(r in n)n[r]=wt(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new J(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function pn(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function wt(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=mn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}const yn={passive:!1},D={capture:!0,passive:!1};function nt(t){t.stopImmediatePropagation()}function V(t){t.preventDefault(),t.stopImmediatePropagation()}function _n(t){var e=t.document.documentElement,n=X(t).on("dragstart.drag",V,D);"onselectstart"in e?n.on("selectstart.drag",V,D):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function vn(t,e){var n=t.document.documentElement,i=X(t).on("dragstart.drag",null);e&&(i.on("click.drag",V,D),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Q=t=>()=>t;function it(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:l,y:s,dx:u,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:u,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}it.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function wn(t){return!t.ctrlKey&&!t.button}function xn(){return this.parentNode}function bn(t,e){return e??{x:t.x,y:t.y}}function An(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cn(){var t=wn,e=xn,n=bn,i=An,r={},o=vt("start","drag","end"),l=0,s,u,c,h,m=0;function d(a){a.on("mousedown.drag",x).filter(i).on("touchstart.drag",B).on("touchmove.drag",I,yn).on("touchend.drag touchcancel.drag",R).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(a,g){if(!(h||!t.call(this,a,g))){var y=N(this,e.call(this,a,g),a,g,"mouse");y&&(X(a.view).on("mousemove.drag",v,D).on("mouseup.drag",L,D),_n(a.view),nt(a),c=!1,s=a.clientX,u=a.clientY,y("start",a))}}function v(a){if(V(a),!c){var g=a.clientX-s,y=a.clientY-u;c=g*g+y*y>m}r.mouse("drag",a)}function L(a){X(a.view).on("mousemove.drag mouseup.drag",null),vn(a.view,c),V(a),r.mouse("end",a)}function B(a,g){if(t.call(this,a,g)){var y=a.changedTouches,_=e.call(this,a,g),b=y.length,w,p;for(w=0;w<b;++w)(p=N(this,_,a,g,y[w].identifier,y[w]))&&(nt(a),p("start",a,y[w]))}}function I(a){var g=a.changedTouches,y=g.length,_,b;for(_=0;_<y;++_)(b=r[g[_].identifier])&&(V(a),b("drag",a,g[_]))}function R(a){var g=a.changedTouches,y=g.length,_,b;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),_=0;_<y;++_)(b=r[g[_].identifier])&&(nt(a),b("end",a,g[_]))}function N(a,g,y,_,b,w){var p=o.copy(),A=_t(w||y,g),P,Y,k;if((k=n.call(a,new it("beforestart",{sourceEvent:y,target:d,identifier:b,active:l,x:A[0],y:A[1],dx:0,dy:0,dispatch:p}),_))!=null)return P=k.x-A[0]||0,Y=k.y-A[1]||0,function ot(O,U,Z){var q=A,F;switch(O){case"start":r[b]=ot,F=l++;break;case"end":delete r[b],--l;case"drag":A=_t(Z||U,g),F=l;break}p.call(O,a,new it(O,{sourceEvent:U,subject:k,target:d,identifier:b,active:F,x:A[0]+P,y:A[1]+Y,dx:A[0]-q[0],dy:A[1]-q[1],dispatch:p}),_)}}return d.filter=function(a){return arguments.length?(t=typeof a=="function"?a:Q(!!a),d):t},d.container=function(a){return arguments.length?(e=typeof a=="function"?a:Q(a),d):e},d.subject=function(a){return arguments.length?(n=typeof a=="function"?a:Q(a),d):n},d.touchable=function(a){return arguments.length?(i=typeof a=="function"?a:Q(!!a),d):i},d.on=function(){var a=o.on.apply(o,arguments);return a===o?d:a},d.clickDistance=function(a){return arguments.length?(m=(a=+a)*a,d):Math.sqrt(m)},d}function Sn({width:t,prevWidth:e,height:n,prevHeight:i,invertX:r,invertY:o}){const l=t-e,s=n-i,u=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&r&&(u[0]=u[0]*-1),s&&o&&(u[1]=u[1]*-1),u}const zn={name:"ResizeControl",compatConfig:{MODE:3}},rt=f.defineComponent({...zn,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},maxWidth:{default:Number.MAX_VALUE},maxHeight:{default:Number.MAX_VALUE},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number],default:!1}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,i={width:0,height:0,x:0,y:0},r={...i,pointerX:0,pointerY:0,aspectRatio:1},{findNode:o,emits:l}=M.useVueFlow(),s=M.useGetPointerPosition(),u=f.inject(M.NodeIdInjection,null),c=f.ref(),h=f.ref(r),m=f.ref(i),d=f.computed(()=>typeof n.nodeId=="string"?n.nodeId:u),x=f.computed(()=>n.variant===W.Line?"right":"bottom-right"),v=f.computed(()=>n.position??x.value);f.watchEffect(R=>{if(!c.value||!d.value)return;const N=X(c.value),a=v.value.includes("right")||v.value.includes("left"),g=v.value.includes("bottom")||v.value.includes("top"),y=v.value.includes("left"),_=v.value.includes("top"),b=Cn().on("start",w=>{const p=o(d.value),{xSnapped:A,ySnapped:P}=s(w);m.value={width:(p==null?void 0:p.dimensions.width)??0,height:(p==null?void 0:p.dimensions.height)??0,x:(p==null?void 0:p.position.x)??0,y:(p==null?void 0:p.position.y)??0},h.value={...m.value,pointerX:A,pointerY:P,aspectRatio:m.value.width/m.value.height},e("resizeStart",{event:w,params:m.value})}).on("drag",w=>{var Y;const{xSnapped:p,ySnapped:A}=s(w),P=o(d.value);if(P){const k=[],{pointerX:ot,pointerY:O,width:U,height:Z,x:q,y:F,aspectRatio:Nn}=h.value,{x:xt,y:bt,width:At,height:Ct}=m.value,St=Math.floor(a?p-ot:0),zt=Math.floor(g?A-O:0);let C=M.clamp(U+(y?-St:St),n.minWidth,n.maxWidth),S=M.clamp(Z+(_?-zt:zt),n.minHeight,n.maxHeight);if(n.keepAspectRatio){const H=C/S;let E=Nn;typeof n.keepAspectRatio=="number"&&H!==n.keepAspectRatio&&(E=n.keepAspectRatio);const $=a&&g,j=a&&!g,K=g&&!a;C=H<=E&&$||K?S*E:C,S=H>E&&$||j?C/E:S,C>=n.maxWidth?(C=n.maxWidth,S=n.maxWidth/E):C<=n.minWidth&&(C=n.minWidth,S=n.minWidth/E),S>=n.maxHeight?(S=n.maxHeight,C=n.maxHeight*E):S<=n.minHeight&&(S=n.minHeight,C=n.minHeight*E)}const Et=C!==At,Rt=S!==Ct;if(y||_){const H=y?q-(C-U):q,E=_?F-(S-Z):F,$=H!==xt&&Et,j=E!==bt&&Rt;if($||j){const K={id:P.id,type:"position",from:P.position,position:{x:$?H:xt,y:j?E:bt}};k.push(K),m.value.x=K.position.x,m.value.y=K.position.y}}if(Et||Rt){const H={id:d.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:C,height:S}};k.push(H),m.value.width=C,m.value.height=S}if(k.length===0)return;const kn=Sn({width:m.value.width,prevWidth:At,height:m.value.height,prevHeight:Ct,invertX:y,invertY:_}),Nt={...m.value,direction:kn};if(((Y=n.shouldResize)==null?void 0:Y.call(n,w,Nt))===!1)return;e("resize",{event:w,params:Nt}),l.nodesChange(k)}}).on("end",w=>{const p={id:d.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:w,params:m.value}),l.nodesChange([p])});N.call(b),R(()=>{N.on(".drag",null)})});const L=f.computed(()=>v.value.split("-")),B=f.computed(()=>n.variant===W.Line?"borderColor":"backgroundColor"),I=f.computed(()=>n.color?{[B.value]:n.color}:{});return(R,N)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"resizeControlRef",ref:c,class:f.normalizeClass(["vue-flow__resize-control nodrag",[...f.unref(L),t.variant]]),style:f.normalizeStyle(f.unref(I))},[f.renderSlot(R.$slots,"default")],6))}}),En={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Rn=f.defineComponent({...En,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],i=["top","right","bottom","left"];return(r,o)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(i,l=>f.createVNode(rt,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:f.unref(W).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","max-width","max-height","should-resize"])),64)),(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(n,l=>f.createVNode(rt,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","max-width","max-height","should-resize","keep-aspect-ratio"])),64))],64))}});return T.NodeResizeControl=rt,T.NodeResizer=Rn,T.ResizeControlVariant=W,Object.defineProperty(T,Symbol.toStringTag,{value:"Module"}),T}({},Vue,VueFlowCore); |
@@ -1,1 +0,1 @@ | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("vue"),tt=require("@vue-flow/core");var X=(t=>(t.Line="line",t.Handle="handle",t))(X||{}),nt="http://www.w3.org/1999/xhtml";const gt={svg:"http://www.w3.org/2000/svg",xhtml:nt,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function vt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),gt.hasOwnProperty(e)?{space:gt[e],local:t}:t}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===nt&&e.documentElement.namespaceURI===nt?e.createElement(t):e.createElementNS(n,t)}}function Bt(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function _t(t){var e=vt(t);return(e.local?Bt:Pt)(e)}function Mt(){}function wt(t){return t==null?Mt:function(){return this.querySelector(t)}}function Lt(t){typeof t!="function"&&(t=wt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=new Array(l),a,c,f=0;f<l;++f)(a=o[f])&&(c=t.call(a,a.__data__,f,o))&&("__data__"in a&&(c.__data__=a.__data__),s[f]=c);return new S(r,this._parents)}function Tt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Vt(){return[]}function Ft(t){return t==null?Vt:function(){return this.querySelectorAll(t)}}function Ht(t){return function(){return Tt(t.apply(this,arguments))}}function It(t){typeof t=="function"?t=Ht(t):t=Ft(t);for(var e=this._groups,n=e.length,r=[],i=[],o=0;o<n;++o)for(var l=e[o],s=l.length,a,c=0;c<s;++c)(a=l[c])&&(r.push(t.call(a,a.__data__,c,l)),i.push(a));return new S(r,i)}function Dt(t){return function(){return this.matches(t)}}function bt(t){return function(e){return e.matches(t)}}var Xt=Array.prototype.find;function Yt(t){return function(){return Xt.call(this.children,t)}}function Ot(){return this.firstElementChild}function Wt(t){return this.select(t==null?Ot:Yt(typeof t=="function"?t:bt(t)))}var qt=Array.prototype.filter;function Ut(){return Array.from(this.children)}function $t(t){return function(){return qt.call(this.children,t)}}function Kt(t){return this.selectAll(t==null?Ut:$t(typeof t=="function"?t:bt(t)))}function Gt(t){typeof t!="function"&&(t=Dt(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i<n;++i)for(var o=e[i],l=o.length,s=r[i]=[],a,c=0;c<l;++c)(a=o[c])&&t.call(a,a.__data__,c,o)&&s.push(a);return new S(r,this._parents)}function xt(t){return new Array(t.length)}function Jt(){return new S(this._enter||this._groups.map(xt),this._parents)}function J(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}J.prototype={constructor:J,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Qt(t){return function(){return t}}function Zt(t,e,n,r,i,o){for(var l=0,s,a=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],r[l]=s):n[l]=new J(t,o[l]);for(;l<a;++l)(s=e[l])&&(i[l]=s)}function jt(t,e,n,r,i,o,l){var s,a,c=new Map,f=e.length,g=o.length,p=new Array(f),v;for(s=0;s<f;++s)(a=e[s])&&(p[s]=v=l.call(a,a.__data__,s,e)+"",c.has(v)?i[s]=a:c.set(v,a));for(s=0;s<g;++s)v=l.call(t,o[s],s,o)+"",(a=c.get(v))?(r[s]=a,a.__data__=o[s],c.delete(v)):n[s]=new J(t,o[s]);for(s=0;s<f;++s)(a=e[s])&&c.get(p[s])===a&&(i[s]=a)}function te(t){return t.__data__}function ee(t,e){if(!arguments.length)return Array.from(this,te);var n=e?jt:Zt,r=this._parents,i=this._groups;typeof t!="function"&&(t=Qt(t));for(var o=i.length,l=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var f=r[c],g=i[c],p=g.length,v=ne(t.call(f,f&&f.__data__,c,r)),w=v.length,x=s[c]=new Array(w),M=l[c]=new Array(w),F=a[c]=new Array(p);n(f,g,x,M,F,v,e);for(var z=0,C=0,u,m;z<w;++z)if(u=x[z]){for(z>=C&&(C=z+1);!(m=M[C])&&++C<w;);u._next=m||null}}return l=new S(l,r),l._enter=s,l._exit=a,l}function ne(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function re(){return new S(this._exit||this._groups.map(xt),this._parents)}function ie(t,e,n){var r=this.enter(),i=this,o=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(i=e(i),i&&(i=i.selection())),n==null?o.remove():n(o),r&&i?r.merge(i).order():i}function oe(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,i=n.length,o=r.length,l=Math.min(i,o),s=new Array(i),a=0;a<l;++a)for(var c=n[a],f=r[a],g=c.length,p=s[a]=new Array(g),v,w=0;w<g;++w)(v=c[w]||f[w])&&(p[w]=v);for(;a<i;++a)s[a]=n[a];return new S(s,this._parents)}function se(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],i=r.length-1,o=r[i],l;--i>=0;)(l=r[i])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function le(t){t||(t=ue);function e(g,p){return g&&p?t(g.__data__,p.__data__):!g-!p}for(var n=this._groups,r=n.length,i=new Array(r),o=0;o<r;++o){for(var l=n[o],s=l.length,a=i[o]=new Array(s),c,f=0;f<s;++f)(c=l[f])&&(a[f]=c);a.sort(e)}return new S(i,this._parents).order()}function ue(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ce(){return Array.from(this)}function fe(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length;i<o;++i){var l=r[i];if(l)return l}return null}function he(){let t=0;for(const e of this)++t;return t}function de(){return!this.node()}function pe(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var i=e[n],o=0,l=i.length,s;o<l;++o)(s=i[o])&&t.call(s,s.__data__,o,i);return this}function ge(t){return function(){this.removeAttribute(t)}}function me(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function ve(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function be(t,e){var n=vt(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?me:ge:typeof e=="function"?n.local?we:_e:n.local?ve:ye)(n,e))}function At(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function xe(t){return function(){this.style.removeProperty(t)}}function Ae(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Se(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Ce(t,e,n){return arguments.length>1?this.each((e==null?xe:typeof e=="function"?Se:Ae)(t,e,n??"")):ze(this.node(),t)}function ze(t,e){return t.style.getPropertyValue(e)||At(t).getComputedStyle(t,null).getPropertyValue(e)}function Ee(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ke(t,e){return arguments.length>1?this.each((e==null?Ee:typeof e=="function"?Ne:Re)(t,e)):this.node()[t]}function St(t){return t.trim().split(/^|\s+/)}function ot(t){return t.classList||new Ct(t)}function Ct(t){this._node=t,this._names=St(t.getAttribute("class")||"")}Ct.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function zt(t,e){for(var n=ot(t),r=-1,i=e.length;++r<i;)n.add(e[r])}function Et(t,e){for(var n=ot(t),r=-1,i=e.length;++r<i;)n.remove(e[r])}function Pe(t){return function(){zt(this,t)}}function Be(t){return function(){Et(this,t)}}function Me(t,e){return function(){(e.apply(this,arguments)?zt:Et)(this,t)}}function Le(t,e){var n=St(t+"");if(arguments.length<2){for(var r=ot(this.node()),i=-1,o=n.length;++i<o;)if(!r.contains(n[i]))return!1;return!0}return this.each((typeof e=="function"?Me:e?Pe:Be)(n,e))}function Te(){this.textContent=""}function Ve(t){return function(){this.textContent=t}}function Fe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function He(t){return arguments.length?this.each(t==null?Te:(typeof t=="function"?Fe:Ve)(t)):this.node().textContent}function Ie(){this.innerHTML=""}function De(t){return function(){this.innerHTML=t}}function Xe(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ye(t){return arguments.length?this.each(t==null?Ie:(typeof t=="function"?Xe:De)(t)):this.node().innerHTML}function Oe(){this.nextSibling&&this.parentNode.appendChild(this)}function We(){return this.each(Oe)}function qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(qe)}function $e(t){var e=typeof t=="function"?t:_t(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ke(){return null}function Ge(t,e){var n=typeof t=="function"?t:_t(t),r=e==null?Ke:typeof e=="function"?e:wt(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Je(){var t=this.parentNode;t&&t.removeChild(this)}function Qe(){return this.each(Je)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(t){return this.select(t?je:Ze)}function en(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nn(t){return function(e){t.call(this,e,this.__data__)}}function rn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function on(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n<i;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++r]=o;++r?e.length=r:delete this.__on}}}function sn(t,e,n){return function(){var r=this.__on,i,o=nn(e);if(r){for(var l=0,s=r.length;l<s;++l)if((i=r[l]).type===t.type&&i.name===t.name){this.removeEventListener(i.type,i.listener,i.options),this.addEventListener(i.type,i.listener=o,i.options=n),i.value=e;return}}this.addEventListener(t.type,o,n),i={type:t.type,name:t.name,value:e,listener:o,options:n},r?r.push(i):this.__on=[i]}}function ln(t,e,n){var r=rn(t+""),i,o=r.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var a=0,c=s.length,f;a<c;++a)for(i=0,f=s[a];i<o;++i)if((l=r[i]).type===f.type&&l.name===f.name)return f.value}return}for(s=e?sn:on,i=0;i<o;++i)this.each(s(r[i],e,n));return this}function Rt(t,e,n){var r=At(t),i=r.CustomEvent;typeof i=="function"?i=new i(e,n):(i=r.document.createEvent("Event"),n?(i.initEvent(e,n.bubbles,n.cancelable),i.detail=n.detail):i.initEvent(e,!1,!1)),t.dispatchEvent(i)}function un(t,e){return function(){return Rt(this,t,e)}}function an(t,e){return function(){return Rt(this,t,e.apply(this,arguments))}}function cn(t,e){return this.each((typeof e=="function"?an:un)(t,e))}function*fn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],i=0,o=r.length,l;i<o;++i)(l=r[i])&&(yield l)}var hn=[null];function S(t,e){this._groups=t,this._parents=e}function dn(){return this}S.prototype={constructor:S,select:Lt,selectAll:It,selectChild:Wt,selectChildren:Kt,filter:Gt,data:ee,enter:Jt,exit:re,join:ie,merge:oe,selection:dn,order:se,sort:le,call:ae,nodes:ce,node:fe,size:he,empty:de,each:pe,attr:be,style:Ce,property:ke,classed:Le,text:He,html:Ye,raise:We,lower:Ue,append:$e,insert:Ge,remove:Qe,clone:tn,datum:en,on:ln,dispatch:cn,[Symbol.iterator]:fn};function Y(t){return typeof t=="string"?new S([[document.querySelector(t)]],[document.documentElement]):new S([[t]],hn)}function pn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function mt(t,e){if(t=pn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var i=e.getBoundingClientRect();return[t.clientX-i.left-e.clientLeft,t.clientY-i.top-e.clientTop]}}return[t.pageX,t.pageY]}var gn={value:()=>{}};function Nt(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new G(n)}function G(t){this._=t}function mn(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",i=n.indexOf(".");if(i>=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}G.prototype=Nt.prototype={constructor:G,on:function(t,e){var n=this._,r=mn(t+"",n),i,o=-1,l=r.length;if(arguments.length<2){for(;++o<l;)if((i=(t=r[o]).type)&&(i=yn(n[i],t.name)))return i;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(i=(t=r[o]).type)n[i]=yt(n[i],t.name,e);else if(e==null)for(i in n)n[i]=yt(n[i],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new G(t)},call:function(t,e){if((i=arguments.length-2)>0)for(var n=new Array(i),r=0,i,o;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],r=0,i=o.length;r<i;++r)o[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}};function yn(t,e){for(var n=0,r=t.length,i;n<r;++n)if((i=t[n]).name===e)return i.value}function yt(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=gn,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}const vn={passive:!1},O={capture:!0,passive:!1};function et(t){t.stopImmediatePropagation()}function V(t){t.preventDefault(),t.stopImmediatePropagation()}function _n(t){var e=t.document.documentElement,n=Y(t).on("dragstart.drag",V,O);"onselectstart"in e?n.on("selectstart.drag",V,O):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function wn(t,e){var n=t.document.documentElement,r=Y(t).on("dragstart.drag",null);e&&(r.on("click.drag",V,O),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const K=t=>()=>t;function rt(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:l,y:s,dx:a,dy:c,dispatch:f}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:f}})}rt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function bn(t){return!t.ctrlKey&&!t.button}function xn(){return this.parentNode}function An(t,e){return e??{x:t.x,y:t.y}}function Sn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cn(){var t=bn,e=xn,n=An,r=Sn,i={},o=Nt("start","drag","end"),l=0,s,a,c,f,g=0;function p(u){u.on("mousedown.drag",v).filter(r).on("touchstart.drag",M).on("touchmove.drag",F,vn).on("touchend.drag touchcancel.drag",z).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function v(u,m){if(!(f||!t.call(this,u,m))){var y=C(this,e.call(this,u,m),u,m,"mouse");y&&(Y(u.view).on("mousemove.drag",w,O).on("mouseup.drag",x,O),_n(u.view),et(u),c=!1,s=u.clientX,a=u.clientY,y("start",u))}}function w(u){if(V(u),!c){var m=u.clientX-s,y=u.clientY-a;c=m*m+y*y>g}i.mouse("drag",u)}function x(u){Y(u.view).on("mousemove.drag mouseup.drag",null),wn(u.view,c),V(u),i.mouse("end",u)}function M(u,m){if(t.call(this,u,m)){var y=u.changedTouches,d=e.call(this,u,m),_=y.length,b,E;for(b=0;b<_;++b)(E=C(this,d,u,m,y[b].identifier,y[b]))&&(et(u),E("start",u,y[b]))}}function F(u){var m=u.changedTouches,y=m.length,d,_;for(d=0;d<y;++d)(_=i[m[d].identifier])&&(V(u),_("drag",u,m[d]))}function z(u){var m=u.changedTouches,y=m.length,d,_;for(f&&clearTimeout(f),f=setTimeout(function(){f=null},500),d=0;d<y;++d)(_=i[m[d].identifier])&&(et(u),_("end",u,m[d]))}function C(u,m,y,d,_,b){var E=o.copy(),A=mt(b||y,m),R,N,k;if((k=n.call(u,new rt("beforestart",{sourceEvent:y,target:p,identifier:_,active:l,x:A[0],y:A[1],dx:0,dy:0,dispatch:E}),d))!=null)return R=k.x-A[0]||0,N=k.y-A[1]||0,function L(H,W,q){var I=A,T;switch(H){case"start":i[_]=L,T=l++;break;case"end":delete i[_],--l;case"drag":A=mt(q||W,m),T=l;break}E.call(H,u,new rt(H,{sourceEvent:W,subject:k,target:p,identifier:_,active:T,x:A[0]+R,y:A[1]+N,dx:A[0]-I[0],dy:A[1]-I[1],dispatch:E}),d)}}return p.filter=function(u){return arguments.length?(t=typeof u=="function"?u:K(!!u),p):t},p.container=function(u){return arguments.length?(e=typeof u=="function"?u:K(u),p):e},p.subject=function(u){return arguments.length?(n=typeof u=="function"?u:K(u),p):n},p.touchable=function(u){return arguments.length?(r=typeof u=="function"?u:K(!!u),p):r},p.on=function(){var u=o.on.apply(o,arguments);return u===o?p:u},p.clickDistance=function(u){return arguments.length?(g=(u=+u)*u,p):Math.sqrt(g)},p}function zn({width:t,prevWidth:e,height:n,prevHeight:r,invertX:i,invertY:o}){const l=t-e,s=n-r,a=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&i&&(a[0]=a[0]*-1),s&&o&&(a[1]=a[1]*-1),a}const En={name:"ResizeControl",compatConfig:{MODE:3}},it=h.defineComponent({...En,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,r={width:0,height:0,x:0,y:0},i={...r,pointerX:0,pointerY:0},o=h.inject(tt.NodeIdInjection,null),l=h.ref(),s=h.computed(()=>typeof n.nodeId=="string"?n.nodeId:o),{findNode:a,emits:c}=tt.useVueFlow(),f=h.ref(i),g=h.ref(r),p=h.computed(()=>{if(n.keepAspectRatio===!0&&f.value.width&&f.value.height)return f.value.width/f.value.height;if(typeof n.keepAspectRatio=="number")return n.keepAspectRatio}),v=tt.useGetPointerPosition(),w=h.computed(()=>n.variant===X.Line?"right":"bottom-right"),x=h.computed(()=>n.position??w.value);h.watchEffect(C=>{if(!l.value||!s.value)return;const u=Y(l.value),m=Cn().on("start",y=>{const d=a(s.value),{xSnapped:_,ySnapped:b}=v(y);g.value={width:(d==null?void 0:d.dimensions.width)??0,height:(d==null?void 0:d.dimensions.height)??0,x:(d==null?void 0:d.position.x)??0,y:(d==null?void 0:d.position.y)??0},f.value={...g.value,pointerX:_,pointerY:b},e("resizeStart",{event:y,params:g.value})}).on("drag",y=>{var k;const{xSnapped:d,ySnapped:_}=v(y),b=a(s.value),E=x.value.includes("right")||x.value.includes("left"),A=x.value.includes("bottom")||x.value.includes("top"),R=x.value.includes("left"),N=x.value.includes("top");if(b){const L=[],{pointerX:H,pointerY:W,width:q,height:I,x:T,y:st}=f.value,{x:lt,y:ut,width:at,height:ct}=g.value,Q=Math.floor(E?d-H:0),Z=Math.floor(A?_-W:0);let P=Math.max(q+(R?-Q:Q),n.minWidth),B=Math.max(I+(N?-Z:Z),n.minHeight);if(p.value&&P/B!==p.value){const U=B*p.value,$=P/p.value;Q>Z?B=Math.max($,n.minHeight):P=Math.max(U,n.minWidth)}const ft=P!==at,ht=B!==ct;if(R||N){const D=R?T-(P-q):T,U=N?st-(B-I):st,$=D!==lt&&ft,pt=U!==ut&&ht;if($||pt){const j={id:b.id,type:"position",from:b.position,position:{x:$?D:lt,y:pt?U:ut}};L.push(j),g.value.x=j.position.x,g.value.y=j.position.y}}if(ft||ht){const D={id:s.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:P,height:B}};L.push(D),g.value.width=P,g.value.height=B}if(L.length===0)return;const kt=zn({width:g.value.width,prevWidth:at,height:g.value.height,prevHeight:ct,invertX:R,invertY:N}),dt={...g.value,direction:kt};if(((k=n.shouldResize)==null?void 0:k.call(n,y,dt))===!1)return;e("resize",{event:y,params:dt}),c.nodesChange(L)}}).on("end",y=>{const d={id:s.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:y,params:g.value}),c.nodesChange([d])});u.call(m),C(()=>{u.on(".drag",null)})});const M=h.computed(()=>x.value.split("-")),F=h.computed(()=>n.variant===X.Line?"borderColor":"backgroundColor"),z=h.computed(()=>n.color?{[F.value]:n.color}:{});return(C,u)=>(h.openBlock(),h.createElementBlock("div",{ref_key:"resizeControlRef",ref:l,class:h.normalizeClass(["vue-flow__resize-control nodrag",[...h.unref(M),t.variant]]),style:h.normalizeStyle(h.unref(z))},[h.renderSlot(C.$slots,"default")],6))}}),Rn={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Nn=h.defineComponent({...Rn,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],r=["top","right","bottom","left"];return(i,o)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(r,l=>h.createVNode(it,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:h.unref(X).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","should-resize"])),64)),(h.openBlock(),h.createElementBlock(h.Fragment,null,h.renderList(n,l=>h.createVNode(it,{key:l,class:h.normalizeClass(t.lineClassName),style:h.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","should-resize","keep-aspect-ratio"])),64))],64))}});exports.NodeResizeControl=it;exports.NodeResizer=Nn;exports.ResizeControlVariant=X; | ||
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("vue"),O=require("@vue-flow/core");var q=(t=>(t.Line="line",t.Handle="handle",t))(q||{}),et="http://www.w3.org/1999/xhtml";const mt={svg:"http://www.w3.org/2000/svg",xhtml:et,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function yt(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),mt.hasOwnProperty(e)?{space:mt[e],local:t}:t}function Pt(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===et&&e.documentElement.namespaceURI===et?e.createElement(t):e.createElementNS(n,t)}}function Ht(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function vt(t){var e=yt(t);return(e.local?Ht:Pt)(e)}function Vt(){}function _t(t){return t==null?Vt:function(){return this.querySelector(t)}}function Lt(t){typeof t!="function"&&(t=_t(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=new Array(l),a,c,h=0;h<l;++h)(a=o[h])&&(c=t.call(a,a.__data__,h,o))&&("__data__"in a&&(c.__data__=a.__data__),s[h]=c);return new E(i,this._parents)}function Bt(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Tt(){return[]}function Ft(t){return t==null?Tt:function(){return this.querySelectorAll(t)}}function Mt(t){return function(){return Bt(t.apply(this,arguments))}}function Wt(t){typeof t=="function"?t=Mt(t):t=Ft(t);for(var e=this._groups,n=e.length,i=[],r=[],o=0;o<n;++o)for(var l=e[o],s=l.length,a,c=0;c<s;++c)(a=l[c])&&(i.push(t.call(a,a.__data__,c,l)),r.push(a));return new E(i,r)}function Xt(t){return function(){return this.matches(t)}}function wt(t){return function(e){return e.matches(t)}}var Dt=Array.prototype.find;function It(t){return function(){return Dt.call(this.children,t)}}function Yt(){return this.firstElementChild}function Ot(t){return this.select(t==null?Yt:It(typeof t=="function"?t:wt(t)))}var qt=Array.prototype.filter;function Ut(){return Array.from(this.children)}function $t(t){return function(){return qt.call(this.children,t)}}function Kt(t){return this.selectAll(t==null?Ut:$t(typeof t=="function"?t:wt(t)))}function Gt(t){typeof t!="function"&&(t=Xt(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var o=e[r],l=o.length,s=i[r]=[],a,c=0;c<l;++c)(a=o[c])&&t.call(a,a.__data__,c,o)&&s.push(a);return new E(i,this._parents)}function xt(t){return new Array(t.length)}function Jt(){return new E(this._enter||this._groups.map(xt),this._parents)}function Z(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Z.prototype={constructor:Z,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function Qt(t){return function(){return t}}function Zt(t,e,n,i,r,o){for(var l=0,s,a=e.length,c=o.length;l<c;++l)(s=e[l])?(s.__data__=o[l],i[l]=s):n[l]=new Z(t,o[l]);for(;l<a;++l)(s=e[l])&&(r[l]=s)}function jt(t,e,n,i,r,o,l){var s,a,c=new Map,h=e.length,m=o.length,d=new Array(h),x;for(s=0;s<h;++s)(a=e[s])&&(d[s]=x=l.call(a,a.__data__,s,e)+"",c.has(x)?r[s]=a:c.set(x,a));for(s=0;s<m;++s)x=l.call(t,o[s],s,o)+"",(a=c.get(x))?(i[s]=a,a.__data__=o[s],c.delete(x)):n[s]=new Z(t,o[s]);for(s=0;s<h;++s)(a=e[s])&&c.get(d[s])===a&&(r[s]=a)}function te(t){return t.__data__}function ee(t,e){if(!arguments.length)return Array.from(this,te);var n=e?jt:Zt,i=this._parents,r=this._groups;typeof t!="function"&&(t=Qt(t));for(var o=r.length,l=new Array(o),s=new Array(o),a=new Array(o),c=0;c<o;++c){var h=i[c],m=r[c],d=m.length,x=ne(t.call(h,h&&h.__data__,c,i)),_=x.length,V=s[c]=new Array(_),L=l[c]=new Array(_),F=a[c]=new Array(d);n(h,m,V,L,F,x,e);for(var R=0,N=0,u,g;R<_;++R)if(u=V[R]){for(R>=N&&(N=R+1);!(g=L[N])&&++N<_;);u._next=g||null}}return l=new E(l,i),l._enter=s,l._exit=a,l}function ne(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ie(){return new E(this._exit||this._groups.map(xt),this._parents)}function re(t,e,n){var i=this.enter(),r=this,o=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(r=e(r),r&&(r=r.selection())),n==null?o.remove():n(o),i&&r?i.merge(r).order():r}function oe(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,r=n.length,o=i.length,l=Math.min(r,o),s=new Array(r),a=0;a<l;++a)for(var c=n[a],h=i[a],m=c.length,d=s[a]=new Array(m),x,_=0;_<m;++_)(x=c[_]||h[_])&&(d[_]=x);for(;a<r;++a)s[a]=n[a];return new E(s,this._parents)}function se(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],r=i.length-1,o=i[r],l;--r>=0;)(l=i[r])&&(o&&l.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(l,o),o=l);return this}function le(t){t||(t=ue);function e(m,d){return m&&d?t(m.__data__,d.__data__):!m-!d}for(var n=this._groups,i=n.length,r=new Array(i),o=0;o<i;++o){for(var l=n[o],s=l.length,a=r[o]=new Array(s),c,h=0;h<s;++h)(c=l[h])&&(a[h]=c);a.sort(e)}return new E(r,this._parents).order()}function ue(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function ae(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ce(){return Array.from(this)}function fe(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length;r<o;++r){var l=i[r];if(l)return l}return null}function he(){let t=0;for(const e of this)++t;return t}function de(){return!this.node()}function me(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r=e[n],o=0,l=r.length,s;o<l;++o)(s=r[o])&&t.call(s,s.__data__,o,r);return this}function ge(t){return function(){this.removeAttribute(t)}}function pe(t){return function(){this.removeAttributeNS(t.space,t.local)}}function ye(t,e){return function(){this.setAttribute(t,e)}}function ve(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function _e(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function we(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function xe(t,e){var n=yt(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?pe:ge:typeof e=="function"?n.local?we:_e:n.local?ve:ye)(n,e))}function bt(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function be(t){return function(){this.style.removeProperty(t)}}function Ae(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Se(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function Ce(t,e,n){return arguments.length>1?this.each((e==null?be:typeof e=="function"?Se:Ae)(t,e,n??"")):ze(this.node(),t)}function ze(t,e){return t.style.getPropertyValue(e)||bt(t).getComputedStyle(t,null).getPropertyValue(e)}function Ee(t){return function(){delete this[t]}}function Re(t,e){return function(){this[t]=e}}function Ne(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function ke(t,e){return arguments.length>1?this.each((e==null?Ee:typeof e=="function"?Ne:Re)(t,e)):this.node()[t]}function At(t){return t.trim().split(/^|\s+/)}function rt(t){return t.classList||new St(t)}function St(t){this._node=t,this._names=At(t.getAttribute("class")||"")}St.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Ct(t,e){for(var n=rt(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function zt(t,e){for(var n=rt(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}function Pe(t){return function(){Ct(this,t)}}function He(t){return function(){zt(this,t)}}function Ve(t,e){return function(){(e.apply(this,arguments)?Ct:zt)(this,t)}}function Le(t,e){var n=At(t+"");if(arguments.length<2){for(var i=rt(this.node()),r=-1,o=n.length;++r<o;)if(!i.contains(n[r]))return!1;return!0}return this.each((typeof e=="function"?Ve:e?Pe:He)(n,e))}function Be(){this.textContent=""}function Te(t){return function(){this.textContent=t}}function Fe(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Me(t){return arguments.length?this.each(t==null?Be:(typeof t=="function"?Fe:Te)(t)):this.node().textContent}function We(){this.innerHTML=""}function Xe(t){return function(){this.innerHTML=t}}function De(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function Ie(t){return arguments.length?this.each(t==null?We:(typeof t=="function"?De:Xe)(t)):this.node().innerHTML}function Ye(){this.nextSibling&&this.parentNode.appendChild(this)}function Oe(){return this.each(Ye)}function qe(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Ue(){return this.each(qe)}function $e(t){var e=typeof t=="function"?t:vt(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Ke(){return null}function Ge(t,e){var n=typeof t=="function"?t:vt(t),i=e==null?Ke:typeof e=="function"?e:_t(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function Je(){var t=this.parentNode;t&&t.removeChild(this)}function Qe(){return this.each(Je)}function Ze(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function je(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tn(t){return this.select(t?je:Ze)}function en(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nn(t){return function(e){t.call(this,e,this.__data__)}}function rn(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function on(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,r=e.length,o;n<r;++n)o=e[n],(!t.type||o.type===t.type)&&o.name===t.name?this.removeEventListener(o.type,o.listener,o.options):e[++i]=o;++i?e.length=i:delete this.__on}}}function sn(t,e,n){return function(){var i=this.__on,r,o=nn(e);if(i){for(var l=0,s=i.length;l<s;++l)if((r=i[l]).type===t.type&&r.name===t.name){this.removeEventListener(r.type,r.listener,r.options),this.addEventListener(r.type,r.listener=o,r.options=n),r.value=e;return}}this.addEventListener(t.type,o,n),r={type:t.type,name:t.name,value:e,listener:o,options:n},i?i.push(r):this.__on=[r]}}function ln(t,e,n){var i=rn(t+""),r,o=i.length,l;if(arguments.length<2){var s=this.node().__on;if(s){for(var a=0,c=s.length,h;a<c;++a)for(r=0,h=s[a];r<o;++r)if((l=i[r]).type===h.type&&l.name===h.name)return h.value}return}for(s=e?sn:on,r=0;r<o;++r)this.each(s(i[r],e,n));return this}function Et(t,e,n){var i=bt(t),r=i.CustomEvent;typeof r=="function"?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}function un(t,e){return function(){return Et(this,t,e)}}function an(t,e){return function(){return Et(this,t,e.apply(this,arguments))}}function cn(t,e){return this.each((typeof e=="function"?an:un)(t,e))}function*fn(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,o=i.length,l;r<o;++r)(l=i[r])&&(yield l)}var hn=[null];function E(t,e){this._groups=t,this._parents=e}function dn(){return this}E.prototype={constructor:E,select:Lt,selectAll:Wt,selectChild:Ot,selectChildren:Kt,filter:Gt,data:ee,enter:Jt,exit:ie,join:re,merge:oe,selection:dn,order:se,sort:le,call:ae,nodes:ce,node:fe,size:he,empty:de,each:me,attr:xe,style:Ce,property:ke,classed:Le,text:Me,html:Ie,raise:Oe,lower:Ue,append:$e,insert:Ge,remove:Qe,clone:tn,datum:en,on:ln,dispatch:cn,[Symbol.iterator]:fn};function U(t){return typeof t=="string"?new E([[document.querySelector(t)]],[document.documentElement]):new E([[t]],hn)}function mn(t){let e;for(;e=t.sourceEvent;)t=e;return t}function gt(t,e){if(t=mn(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var r=e.getBoundingClientRect();return[t.clientX-r.left-e.clientLeft,t.clientY-r.top-e.clientTop]}}return[t.pageX,t.pageY]}var gn={value:()=>{}};function Rt(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new Q(n)}function Q(t){this._=t}function pn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}Q.prototype=Rt.prototype={constructor:Q,on:function(t,e){var n=this._,i=pn(t+"",n),r,o=-1,l=i.length;if(arguments.length<2){for(;++o<l;)if((r=(t=i[o]).type)&&(r=yn(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++o<l;)if(r=(t=i[o]).type)n[r]=pt(n[r],t.name,e);else if(e==null)for(r in n)n[r]=pt(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Q(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,o;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(o=this._[t],i=0,r=o.length;i<r;++i)o[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,o=i.length;r<o;++r)i[r].value.apply(e,n)}};function yn(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function pt(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=gn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}const vn={passive:!1},$={capture:!0,passive:!1};function tt(t){t.stopImmediatePropagation()}function T(t){t.preventDefault(),t.stopImmediatePropagation()}function _n(t){var e=t.document.documentElement,n=U(t).on("dragstart.drag",T,$);"onselectstart"in e?n.on("selectstart.drag",T,$):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function wn(t,e){var n=t.document.documentElement,i=U(t).on("dragstart.drag",null);e&&(i.on("click.drag",T,$),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const J=t=>()=>t;function nt(t,{sourceEvent:e,subject:n,target:i,identifier:r,active:o,x:l,y:s,dx:a,dy:c,dispatch:h}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:r,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:a,enumerable:!0,configurable:!0},dy:{value:c,enumerable:!0,configurable:!0},_:{value:h}})}nt.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function xn(t){return!t.ctrlKey&&!t.button}function bn(){return this.parentNode}function An(t,e){return e??{x:t.x,y:t.y}}function Sn(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cn(){var t=xn,e=bn,n=An,i=Sn,r={},o=Rt("start","drag","end"),l=0,s,a,c,h,m=0;function d(u){u.on("mousedown.drag",x).filter(i).on("touchstart.drag",L).on("touchmove.drag",F,vn).on("touchend.drag touchcancel.drag",R).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(u,g){if(!(h||!t.call(this,u,g))){var y=N(this,e.call(this,u,g),u,g,"mouse");y&&(U(u.view).on("mousemove.drag",_,$).on("mouseup.drag",V,$),_n(u.view),tt(u),c=!1,s=u.clientX,a=u.clientY,y("start",u))}}function _(u){if(T(u),!c){var g=u.clientX-s,y=u.clientY-a;c=g*g+y*y>m}r.mouse("drag",u)}function V(u){U(u.view).on("mousemove.drag mouseup.drag",null),wn(u.view,c),T(u),r.mouse("end",u)}function L(u,g){if(t.call(this,u,g)){var y=u.changedTouches,v=e.call(this,u,g),b=y.length,w,p;for(w=0;w<b;++w)(p=N(this,v,u,g,y[w].identifier,y[w]))&&(tt(u),p("start",u,y[w]))}}function F(u){var g=u.changedTouches,y=g.length,v,b;for(v=0;v<y;++v)(b=r[g[v].identifier])&&(T(u),b("drag",u,g[v]))}function R(u){var g=u.changedTouches,y=g.length,v,b;for(h&&clearTimeout(h),h=setTimeout(function(){h=null},500),v=0;v<y;++v)(b=r[g[v].identifier])&&(tt(u),b("end",u,g[v]))}function N(u,g,y,v,b,w){var p=o.copy(),A=gt(w||y,g),P,M,k;if((k=n.call(u,new nt("beforestart",{sourceEvent:y,target:d,identifier:b,active:l,x:A[0],y:A[1],dx:0,dy:0,dispatch:p}),v))!=null)return P=k.x-A[0]||0,M=k.y-A[1]||0,function j(W,X,K){var D=A,B;switch(W){case"start":r[b]=j,B=l++;break;case"end":delete r[b],--l;case"drag":A=gt(K||X,g),B=l;break}p.call(W,u,new nt(W,{sourceEvent:X,subject:k,target:d,identifier:b,active:B,x:A[0]+P,y:A[1]+M,dx:A[0]-D[0],dy:A[1]-D[1],dispatch:p}),v)}}return d.filter=function(u){return arguments.length?(t=typeof u=="function"?u:J(!!u),d):t},d.container=function(u){return arguments.length?(e=typeof u=="function"?u:J(u),d):e},d.subject=function(u){return arguments.length?(n=typeof u=="function"?u:J(u),d):n},d.touchable=function(u){return arguments.length?(i=typeof u=="function"?u:J(!!u),d):i},d.on=function(){var u=o.on.apply(o,arguments);return u===o?d:u},d.clickDistance=function(u){return arguments.length?(m=(u=+u)*u,d):Math.sqrt(m)},d}function zn({width:t,prevWidth:e,height:n,prevHeight:i,invertX:r,invertY:o}){const l=t-e,s=n-i,a=[l>0?1:l<0?-1:0,s>0?1:s<0?-1:0];return l&&r&&(a[0]=a[0]*-1),s&&o&&(a[1]=a[1]*-1),a}const En={name:"ResizeControl",compatConfig:{MODE:3}},it=f.defineComponent({...En,props:{nodeId:null,color:null,minWidth:{default:10},minHeight:{default:10},maxWidth:{default:Number.MAX_VALUE},maxHeight:{default:Number.MAX_VALUE},position:null,variant:{default:"handle"},shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number],default:!1}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=t,i={width:0,height:0,x:0,y:0},r={...i,pointerX:0,pointerY:0,aspectRatio:1},{findNode:o,emits:l}=O.useVueFlow(),s=O.useGetPointerPosition(),a=f.inject(O.NodeIdInjection,null),c=f.ref(),h=f.ref(r),m=f.ref(i),d=f.computed(()=>typeof n.nodeId=="string"?n.nodeId:a),x=f.computed(()=>n.variant===q.Line?"right":"bottom-right"),_=f.computed(()=>n.position??x.value);f.watchEffect(R=>{if(!c.value||!d.value)return;const N=U(c.value),u=_.value.includes("right")||_.value.includes("left"),g=_.value.includes("bottom")||_.value.includes("top"),y=_.value.includes("left"),v=_.value.includes("top"),b=Cn().on("start",w=>{const p=o(d.value),{xSnapped:A,ySnapped:P}=s(w);m.value={width:(p==null?void 0:p.dimensions.width)??0,height:(p==null?void 0:p.dimensions.height)??0,x:(p==null?void 0:p.position.x)??0,y:(p==null?void 0:p.position.y)??0},h.value={...m.value,pointerX:A,pointerY:P,aspectRatio:m.value.width/m.value.height},e("resizeStart",{event:w,params:m.value})}).on("drag",w=>{var M;const{xSnapped:p,ySnapped:A}=s(w),P=o(d.value);if(P){const k=[],{pointerX:j,pointerY:W,width:X,height:K,x:D,y:B,aspectRatio:Nt}=h.value,{x:ot,y:st,width:lt,height:ut}=m.value,at=Math.floor(u?p-j:0),ct=Math.floor(g?A-W:0);let S=O.clamp(X+(y?-at:at),n.minWidth,n.maxWidth),C=O.clamp(K+(v?-ct:ct),n.minHeight,n.maxHeight);if(n.keepAspectRatio){const H=S/C;let z=Nt;typeof n.keepAspectRatio=="number"&&H!==n.keepAspectRatio&&(z=n.keepAspectRatio);const I=u&&g,G=u&&!g,Y=g&&!u;S=H<=z&&I||Y?C*z:S,C=H>z&&I||G?S/z:C,S>=n.maxWidth?(S=n.maxWidth,C=n.maxWidth/z):S<=n.minWidth&&(S=n.minWidth,C=n.minWidth/z),C>=n.maxHeight?(C=n.maxHeight,S=n.maxHeight*z):C<=n.minHeight&&(C=n.minHeight,S=n.minHeight*z)}const ft=S!==lt,ht=C!==ut;if(y||v){const H=y?D-(S-X):D,z=v?B-(C-K):B,I=H!==ot&&ft,G=z!==st&&ht;if(I||G){const Y={id:P.id,type:"position",from:P.position,position:{x:I?H:ot,y:G?z:st}};k.push(Y),m.value.x=Y.position.x,m.value.y=Y.position.y}}if(ft||ht){const H={id:d.value,type:"dimensions",updateStyle:!0,resizing:!0,dimensions:{width:S,height:C}};k.push(H),m.value.width=S,m.value.height=C}if(k.length===0)return;const kt=zn({width:m.value.width,prevWidth:lt,height:m.value.height,prevHeight:ut,invertX:y,invertY:v}),dt={...m.value,direction:kt};if(((M=n.shouldResize)==null?void 0:M.call(n,w,dt))===!1)return;e("resize",{event:w,params:dt}),l.nodesChange(k)}}).on("end",w=>{const p={id:d.value,type:"dimensions",resizing:!1};e("resizeEnd",{event:w,params:m.value}),l.nodesChange([p])});N.call(b),R(()=>{N.on(".drag",null)})});const V=f.computed(()=>_.value.split("-")),L=f.computed(()=>n.variant===q.Line?"borderColor":"backgroundColor"),F=f.computed(()=>n.color?{[L.value]:n.color}:{});return(R,N)=>(f.openBlock(),f.createElementBlock("div",{ref_key:"resizeControlRef",ref:c,class:f.normalizeClass(["vue-flow__resize-control nodrag",[...f.unref(V),t.variant]]),style:f.normalizeStyle(f.unref(F))},[f.renderSlot(R.$slots,"default")],6))}}),Rn={name:"NodeResizer",compatConfig:{MODE:3},inheritAttrs:!1},Nn=f.defineComponent({...Rn,props:{nodeId:null,color:null,handleClassName:null,handleStyle:null,lineClassName:null,lineStyle:null,isVisible:{type:Boolean,default:!0},minWidth:null,minHeight:null,maxWidth:null,maxHeight:null,shouldResize:{type:Function},keepAspectRatio:{type:[Boolean,Number]}},emits:["resizeStart","resize","resizeEnd"],setup(t,{emit:e}){const n=["top-left","top-right","bottom-left","bottom-right"],i=["top","right","bottom","left"];return(r,o)=>(f.openBlock(),f.createElementBlock(f.Fragment,null,[(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(i,l=>f.createVNode(it,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,variant:f.unref(q).Line,"keep-aspect-ratio":t.keepAspectRatio,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,onResizeStart:o[0]||(o[0]=s=>e("resizeStart",s)),onResize:o[1]||(o[1]=s=>e("resize",s)),onResizeEnd:o[2]||(o[2]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","variant","keep-aspect-ratio","color","min-width","min-height","max-width","max-height","should-resize"])),64)),(f.openBlock(),f.createElementBlock(f.Fragment,null,f.renderList(n,l=>f.createVNode(it,{key:l,class:f.normalizeClass(t.lineClassName),style:f.normalizeStyle(t.lineStyle),"node-id":t.nodeId,position:l,color:t.color,"min-width":t.minWidth,"min-height":t.minHeight,"max-width":t.maxWidth,"max-height":t.maxHeight,"should-resize":t.shouldResize,"keep-aspect-ratio":t.keepAspectRatio,onResizeStart:o[3]||(o[3]=s=>e("resizeStart",s)),onResize:o[4]||(o[4]=s=>e("resize",s)),onResizeEnd:o[5]||(o[5]=s=>e("resizeEnd",s))},null,8,["class","style","node-id","position","color","min-width","min-height","max-width","max-height","should-resize","keep-aspect-ratio"])),64))],64))}});exports.NodeResizeControl=it;exports.NodeResizer=Nn;exports.ResizeControlVariant=q; |
{ | ||
"name": "@vue-flow/node-resizer", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"private": false, | ||
@@ -33,12 +33,12 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/d3-drag": "^3.0.1", | ||
"@types/d3-selection": "^3.0.3", | ||
"@types/d3-drag": "^3.0.2", | ||
"@types/d3-selection": "^3.0.4", | ||
"vite-plugin-vue-type-imports": "^0.2.4", | ||
"vite": "^4.1.4", | ||
"vue": "^3.2.25", | ||
"vue-tsc": "^1.1.5", | ||
"vue-tsc": "^1.2.0", | ||
"@tooling/eslint-config": "0.0.0", | ||
"@vue-flow/core": "1.15.2", | ||
"@tooling/tsconfig": "0.0.0", | ||
"@tooling/vite-config": "0.0.0", | ||
"@tooling/tsconfig": "0.0.0" | ||
"@vue-flow/core": "1.16.0" | ||
}, | ||
@@ -45,0 +45,0 @@ "publishConfig": { |
Sorry, the diff of this file is not supported yet
115301
1584