vue3-draggable-resizable-temp
Version:
[Vue3 Component] 拖拽缩放并具有自动吸附对齐、参考线等功能
14 lines (13 loc) • 34.1 kB
JavaScript
/**
* @vue/shared v3.5.22
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function an(t){const e=Object.create(null);for(const n of t.split(","))e[n]=1;return n=>n in e}const he={},jt=()=>{},on=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),Nt=Object.assign,cn=Object.prototype.hasOwnProperty,ee=(t,e)=>cn.call(t,e),x=Array.isArray,Rt=t=>$t(t)==="[object Map]",un=t=>$t(t)==="[object Set]",P=t=>typeof t=="function",ct=t=>typeof t=="string",Wt=t=>typeof t=="symbol",F=t=>t!==null&&typeof t=="object",fn=t=>(F(t)||P(t))&&P(t.then)&&P(t.catch),hn=Object.prototype.toString,$t=t=>hn.call(t),dn=t=>$t(t).slice(8,-1),gn=t=>$t(t)==="[object Object]",de=t=>ct(t)&&t!=="NaN"&&t[0]!=="-"&&""+parseInt(t,10)===t,ot=(t,e)=>!Object.is(t,e);let Ie;const ge=()=>Ie||(Ie=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{});function pe(t){if(x(t)){const e={};for(let n=0;n<t.length;n++){const i=t[n],s=ct(i)?_n(i):pe(i);if(s)for(const r in s)e[r]=s[r]}return e}else if(ct(t)||F(t))return t}const pn=/;(?![^(]*\))/g,vn=/:([^]+)/,mn=/\/\*[^]*?\*\//g;function _n(t){const e={};return t.replace(mn,"").split(pn).forEach(n=>{if(n){const i=n.split(vn);i.length>1&&(e[i[0].trim()]=i[1].trim())}}),e}function ve(t){let e="";if(ct(t))e=t;else if(x(t))for(let n=0;n<t.length;n++){const i=ve(t[n]);i&&(e+=i+" ")}else if(F(t))for(const n in t)t[n]&&(e+=n+" ");return e.trim()}/**
* @vue/reactivity v3.5.22
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/let m;const Gt=new WeakSet;class bn{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,Gt.has(this)&&(Gt.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||ze(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,Te(this),Ce(this);const e=m,n=$;m=this,$=!0;try{return this.fn()}finally{Pe(this),m=e,$=n,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)be(e);this.deps=this.depsTail=void 0,Te(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?Gt.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){ne(this)&&this.run()}get dirty(){return ne(this)}}let De=0,Mt,Ht;function ze(t,e=!1){if(t.flags|=8,e){t.next=Ht,Ht=t;return}t.next=Mt,Mt=t}function me(){De++}function _e(){if(--De>0)return;if(Ht){let e=Ht;for(Ht=void 0;e;){const n=e.next;e.next=void 0,e.flags&=-9,e=n}}let t;for(;Mt;){let e=Mt;for(Mt=void 0;e;){const n=e.next;if(e.next=void 0,e.flags&=-9,e.flags&1)try{e.trigger()}catch(i){t||(t=i)}e=n}}if(t)throw t}function Ce(t){for(let e=t.deps;e;e=e.nextDep)e.version=-1,e.prevActiveLink=e.dep.activeLink,e.dep.activeLink=e}function Pe(t){let e,n=t.depsTail,i=n;for(;i;){const s=i.prevDep;i.version===-1?(i===n&&(n=s),be(i),yn(i)):e=i,i.dep.activeLink=i.prevActiveLink,i.prevActiveLink=void 0,i=s}t.deps=e,t.depsTail=n}function ne(t){for(let e=t.deps;e;e=e.nextDep)if(e.dep.version!==e.version||e.dep.computed&&(Ne(e.dep.computed)||e.dep.version!==e.version))return!0;return!!t._dirty}function Ne(t){if(t.flags&4&&!(t.flags&16)||(t.flags&=-17,t.globalVersion===Et)||(t.globalVersion=Et,!t.isSSR&&t.flags&128&&(!t.deps&&!t._dirty||!ne(t))))return;t.flags|=2;const e=t.dep,n=m,i=$;m=t,$=!0;try{Ce(t);const s=t.fn(t._value);(e.version===0||ot(s,t._value))&&(t.flags|=128,t._value=s,e.version++)}catch(s){throw e.version++,s}finally{m=n,$=i,Pe(t),t.flags&=-3}}function be(t,e=!1){const{dep:n,prevSub:i,nextSub:s}=t;if(i&&(i.nextSub=s,t.prevSub=void 0),s&&(s.prevSub=i,t.nextSub=void 0),n.subs===t&&(n.subs=i,!i&&n.computed)){n.computed.flags&=-5;for(let r=n.computed.deps;r;r=r.nextDep)be(r,!0)}!e&&!--n.sc&&n.map&&n.map.delete(n.key)}function yn(t){const{prevDep:e,nextDep:n}=t;e&&(e.nextDep=n,t.prevDep=void 0),n&&(n.prevDep=e,t.nextDep=void 0)}let $=!0;const We=[];function Ut(){We.push($),$=!1}function Jt(){const t=We.pop();$=t===void 0?!0:t}function Te(t){const{cleanup:e}=t;if(t.cleanup=void 0,e){const n=m;m=void 0;try{e()}finally{m=n}}}let Et=0;class wn{constructor(e,n){this.sub=e,this.dep=n,this.version=n.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}}class ye{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!m||!$||m===this.computed)return;let n=this.activeLink;if(n===void 0||n.sub!==m)n=this.activeLink=new wn(m,this),m.deps?(n.prevDep=m.depsTail,m.depsTail.nextDep=n,m.depsTail=n):m.deps=m.depsTail=n,Ae(n);else if(n.version===-1&&(n.version=this.version,n.nextDep)){const i=n.nextDep;i.prevDep=n.prevDep,n.prevDep&&(n.prevDep.nextDep=i),n.prevDep=m.depsTail,n.nextDep=void 0,m.depsTail.nextDep=n,m.depsTail=n,m.deps===n&&(m.deps=i)}return n}trigger(e){this.version++,Et++,this.notify(e)}notify(e){me();try{for(let n=this.subs;n;n=n.prevSub)n.sub.notify()&&n.sub.dep.notify()}finally{_e()}}}function Ae(t){if(t.dep.sc++,t.sub.flags&4){const e=t.dep.computed;if(e&&!t.dep.subs){e.flags|=20;for(let i=e.deps;i;i=i.nextDep)Ae(i)}const n=t.dep.subs;n!==t&&(t.prevSub=n,n&&(n.nextSub=t)),t.dep.subs=t}}const Yt=new WeakMap,gt=Symbol(""),se=Symbol(""),Lt=Symbol("");function C(t,e,n){if($&&m){let i=Yt.get(t);i||Yt.set(t,i=new Map);let s=i.get(n);s||(i.set(n,s=new ye),s.map=i,s.key=n),s.track()}}function lt(t,e,n,i,s,r){const l=Yt.get(t);if(!l){Et++;return}const a=o=>{o&&o.trigger()};if(me(),e==="clear")l.forEach(a);else{const o=x(t),c=o&&de(n);if(o&&n==="length"){const u=Number(i);l.forEach((f,p)=>{(p==="length"||p===Lt||!Wt(p)&&p>=u)&&a(f)})}else switch((n!==void 0||l.has(void 0))&&a(l.get(n)),c&&a(l.get(Lt)),e){case"add":o?c&&a(l.get("length")):(a(l.get(gt)),Rt(t)&&a(l.get(se)));break;case"delete":o||(a(l.get(gt)),Rt(t)&&a(l.get(se)));break;case"set":Rt(t)&&a(l.get(gt));break}}_e()}function Sn(t,e){const n=Yt.get(t);return n&&n.get(e)}function vt(t){const e=v(t);return e===t?e:(C(e,"iterate",Lt),U(t)?e:e.map(T))}function we(t){return C(t=v(t),"iterate",Lt),t}const xn={__proto__:null,[Symbol.iterator](){return Qt(this,Symbol.iterator,T)},concat(...t){return vt(this).concat(...t.map(e=>x(e)?vt(e):e))},entries(){return Qt(this,"entries",t=>(t[1]=T(t[1]),t))},every(t,e){return Z(this,"every",t,e,void 0,arguments)},filter(t,e){return Z(this,"filter",t,e,n=>n.map(T),arguments)},find(t,e){return Z(this,"find",t,e,T,arguments)},findIndex(t,e){return Z(this,"findIndex",t,e,void 0,arguments)},findLast(t,e){return Z(this,"findLast",t,e,T,arguments)},findLastIndex(t,e){return Z(this,"findLastIndex",t,e,void 0,arguments)},forEach(t,e){return Z(this,"forEach",t,e,void 0,arguments)},includes(...t){return Zt(this,"includes",t)},indexOf(...t){return Zt(this,"indexOf",t)},join(t){return vt(this).join(t)},lastIndexOf(...t){return Zt(this,"lastIndexOf",t)},map(t,e){return Z(this,"map",t,e,void 0,arguments)},pop(){return St(this,"pop")},push(...t){return St(this,"push",t)},reduce(t,...e){return Ee(this,"reduce",t,e)},reduceRight(t,...e){return Ee(this,"reduceRight",t,e)},shift(){return St(this,"shift")},some(t,e){return Z(this,"some",t,e,void 0,arguments)},splice(...t){return St(this,"splice",t)},toReversed(){return vt(this).toReversed()},toSorted(t){return vt(this).toSorted(t)},toSpliced(...t){return vt(this).toSpliced(...t)},unshift(...t){return St(this,"unshift",t)},values(){return Qt(this,"values",T)}};function Qt(t,e,n){const i=we(t),s=i[e]();return i!==t&&!U(t)&&(s._next=s.next,s.next=()=>{const r=s._next();return r.done||(r.value=n(r.value)),r}),s}const Rn=Array.prototype;function Z(t,e,n,i,s,r){const l=we(t),a=l!==t&&!U(t),o=l[e];if(o!==Rn[e]){const f=o.apply(t,r);return a?T(f):f}let c=n;l!==t&&(a?c=function(f,p){return n.call(this,T(f),p,t)}:n.length>2&&(c=function(f,p){return n.call(this,f,p,t)}));const u=o.call(l,c,i);return a&&s?s(u):u}function Ee(t,e,n,i){const s=we(t);let r=n;return s!==t&&(U(t)?n.length>3&&(r=function(l,a,o){return n.call(this,l,a,o,t)}):r=function(l,a,o){return n.call(this,l,T(a),o,t)}),s[e](r,...i)}function Zt(t,e,n){const i=v(t);C(i,"iterate",Lt);const s=i[e](...n);return(s===-1||s===!1)&&Se(n[0])?(n[0]=v(n[0]),i[e](...n)):s}function St(t,e,n=[]){Ut(),me();const i=v(t)[e].apply(t,n);return _e(),Jt(),i}const Mn=an("__proto__,__v_isRef,__isVue"),Oe=new Set(Object.getOwnPropertyNames(Symbol).filter(t=>t!=="arguments"&&t!=="caller").map(t=>Symbol[t]).filter(Wt));function Hn(t){Wt(t)||(t=String(t));const e=v(this);return C(e,"has",t),e.hasOwnProperty(t)}class Fe{constructor(e=!1,n=!1){this._isReadonly=e,this._isShallow=n}get(e,n,i){if(n==="__v_skip")return e.__v_skip;const s=this._isReadonly,r=this._isShallow;if(n==="__v_isReactive")return!s;if(n==="__v_isReadonly")return s;if(n==="__v_isShallow")return r;if(n==="__v_raw")return i===(s?r?Wn:Be:r?Nn:Ve).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(i)?e:void 0;const l=x(e);if(!s){let o;if(l&&(o=xn[n]))return o;if(n==="hasOwnProperty")return Hn}const a=Reflect.get(e,n,K(e)?e:i);if((Wt(n)?Oe.has(n):Mn(n))||(s||C(e,"get",n),r))return a;if(K(a)){const o=l&&de(n)?a:a.value;return s&&F(o)?re(o):o}return F(a)?s?re(a):Kt(a):a}}class In extends Fe{constructor(e=!1){super(!1,e)}set(e,n,i,s){let r=e[n];if(!this._isShallow){const o=pt(r);if(!U(i)&&!pt(i)&&(r=v(r),i=v(i)),!x(e)&&K(r)&&!K(i))return o||(r.value=i),!0}const l=x(e)&&de(n)?Number(n)<e.length:ee(e,n),a=Reflect.set(e,n,i,K(e)?e:s);return e===v(s)&&(l?ot(i,r)&<(e,"set",n,i):lt(e,"add",n,i)),a}deleteProperty(e,n){const i=ee(e,n);e[n];const s=Reflect.deleteProperty(e,n);return s&&i&<(e,"delete",n,void 0),s}has(e,n){const i=Reflect.has(e,n);return(!Wt(n)||!Oe.has(n))&&C(e,"has",n),i}ownKeys(e){return C(e,"iterate",x(e)?"length":gt),Reflect.ownKeys(e)}}class Tn extends Fe{constructor(e=!1){super(!0,e)}set(e,n){return!0}deleteProperty(e,n){return!0}}const En=new In,Ln=new Tn,ie=t=>t,At=t=>Reflect.getPrototypeOf(t);function Dn(t,e,n){return function(...i){const s=this.__v_raw,r=v(s),l=Rt(r),a=t==="entries"||t===Symbol.iterator&&l,o=t==="keys"&&l,c=s[t](...i),u=n?ie:e?le:T;return!e&&C(r,"iterate",o?se:gt),{next(){const{value:f,done:p}=c.next();return p?{value:f,done:p}:{value:a?[u(f[0]),u(f[1])]:u(f),done:p}},[Symbol.iterator](){return this}}}}function Ot(t){return function(...e){return t==="delete"?!1:t==="clear"?void 0:this}}function zn(t,e){const n={get(s){const r=this.__v_raw,l=v(r),a=v(s);t||(ot(s,a)&&C(l,"get",s),C(l,"get",a));const{has:o}=At(l),c=e?ie:t?le:T;if(o.call(l,s))return c(r.get(s));if(o.call(l,a))return c(r.get(a));r!==l&&r.get(s)},get size(){const s=this.__v_raw;return!t&&C(v(s),"iterate",gt),s.size},has(s){const r=this.__v_raw,l=v(r),a=v(s);return t||(ot(s,a)&&C(l,"has",s),C(l,"has",a)),s===a?r.has(s):r.has(s)||r.has(a)},forEach(s,r){const l=this,a=l.__v_raw,o=v(a),c=e?ie:t?le:T;return!t&&C(o,"iterate",gt),a.forEach((u,f)=>s.call(r,c(u),c(f),l))}};return Nt(n,t?{add:Ot("add"),set:Ot("set"),delete:Ot("delete"),clear:Ot("clear")}:{add(s){!e&&!U(s)&&!pt(s)&&(s=v(s));const r=v(this);return At(r).has.call(r,s)||(r.add(s),lt(r,"add",s,s)),this},set(s,r){!e&&!U(r)&&!pt(r)&&(r=v(r));const l=v(this),{has:a,get:o}=At(l);let c=a.call(l,s);c||(s=v(s),c=a.call(l,s));const u=o.call(l,s);return l.set(s,r),c?ot(r,u)&<(l,"set",s,r):lt(l,"add",s,r),this},delete(s){const r=v(this),{has:l,get:a}=At(r);let o=l.call(r,s);o||(s=v(s),o=l.call(r,s)),a&&a.call(r,s);const c=r.delete(s);return o&<(r,"delete",s,void 0),c},clear(){const s=v(this),r=s.size!==0,l=s.clear();return r&<(s,"clear",void 0,void 0),l}}),["keys","values","entries",Symbol.iterator].forEach(s=>{n[s]=Dn(s,t,e)}),n}function je(t,e){const n=zn(t,e);return(i,s,r)=>s==="__v_isReactive"?!t:s==="__v_isReadonly"?t:s==="__v_raw"?i:Reflect.get(ee(n,s)&&s in i?n:i,s,r)}const Cn={get:je(!1,!1)},Pn={get:je(!0,!1)},Ve=new WeakMap,Nn=new WeakMap,Be=new WeakMap,Wn=new WeakMap;function An(t){switch(t){case"Object":case"Array":return 1;case"Map":case"Set":case"WeakMap":case"WeakSet":return 2;default:return 0}}function On(t){return t.__v_skip||!Object.isExtensible(t)?0:An(dn(t))}function Kt(t){return pt(t)?t:Ye(t,!1,En,Cn,Ve)}function re(t){return Ye(t,!0,Ln,Pn,Be)}function Ye(t,e,n,i,s){if(!F(t)||t.__v_raw&&!(e&&t.__v_isReactive))return t;const r=On(t);if(r===0)return t;const l=s.get(t);if(l)return l;const a=new Proxy(t,r===2?i:n);return s.set(t,a),a}function Vt(t){return pt(t)?Vt(t.__v_raw):!!(t&&t.__v_isReactive)}function pt(t){return!!(t&&t.__v_isReadonly)}function U(t){return!!(t&&t.__v_isShallow)}function Se(t){return t?!!t.__v_raw:!1}function v(t){const e=t&&t.__v_raw;return e?v(e):t}const T=t=>F(t)?Kt(t):t,le=t=>F(t)?re(t):t;function K(t){return t?t.__v_isRef===!0:!1}function Dt(t){return Fn(t,!1)}function Fn(t,e){return K(t)?t:new jn(t,e)}class jn{constructor(e,n){this.dep=new ye,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=n?e:v(e),this._value=n?e:T(e),this.__v_isShallow=n}get value(){return this.dep.track(),this._value}set value(e){const n=this._rawValue,i=this.__v_isShallow||U(e)||pt(e);e=i?e:v(e),ot(e,n)&&(this._rawValue=e,this._value=i?e:T(e),this.dep.trigger())}}class Vn{constructor(e,n,i){this._object=e,this._key=n,this._defaultValue=i,this.__v_isRef=!0,this._value=void 0}get value(){const e=this._object[this._key];return this._value=e===void 0?this._defaultValue:e}set value(e){this._object[this._key]=e}get dep(){return Sn(v(this._object),this._key)}}class Bn{constructor(e){this._getter=e,this.__v_isRef=!0,this.__v_isReadonly=!0,this._value=void 0}get value(){return this._value=this._getter()}}function ae(t,e,n){return K(t)?t:P(t)?new Bn(t):F(t)&&arguments.length>1?Yn(t,e,n):Dt(t)}function Yn(t,e,n){const i=t[e];return K(i)?i:new Vn(t,e,n)}class Kn{constructor(e,n,i){this.fn=e,this.setter=n,this._value=void 0,this.dep=new ye(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=Et-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!n,this.isSSR=i}notify(){if(this.flags|=16,!(this.flags&8)&&m!==this)return ze(this,!0),!0}get value(){const e=this.dep.track();return Ne(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}}function Xn(t,e,n=!1){let i,s;return P(t)?i=t:(i=t.get,s=t.set),new Kn(i,s,n)}const Ft={},Xt=new WeakMap;let dt;function $n(t,e=!1,n=dt){if(n){let i=Xt.get(n);i||Xt.set(n,i=[]),i.push(t)}}function Un(t,e,n=he){const{immediate:i,deep:s,once:r,scheduler:l,augmentJob:a,call:o}=n,c=h=>s?h:U(h)||s===!1||s===0?at(h,1):at(h);let u,f,p,g,R=!1,w=!1;if(K(t)?(f=()=>t.value,R=U(t)):Vt(t)?(f=()=>c(t),R=!0):x(t)?(w=!0,R=t.some(h=>Vt(h)||U(h)),f=()=>t.map(h=>{if(K(h))return h.value;if(Vt(h))return c(h);if(P(h))return o?o(h,2):h()})):P(t)?e?f=o?()=>o(t,2):t:f=()=>{if(p){Ut();try{p()}finally{Jt()}}const h=dt;dt=u;try{return o?o(t,3,[g]):t(g)}finally{dt=h}}:f=jt,e&&s){const h=f,H=s===!0?1/0:s;f=()=>at(h(),H)}const S=()=>{u.stop()};if(r&&e){const h=e;e=(...H)=>{h(...H),S()}}let _=w?new Array(t.length).fill(Ft):Ft;const N=h=>{if(!(!(u.flags&1)||!u.dirty&&!h))if(e){const H=u.run();if(s||R||(w?H.some((J,E)=>ot(J,_[E])):ot(H,_))){p&&p();const J=dt;dt=u;try{const E=[H,_===Ft?void 0:w&&_[0]===Ft?[]:_,g];_=H,o?o(e,3,E):e(...E)}finally{dt=J}}}else u.run()};return a&&a(N),u=new bn(f),u.scheduler=l?()=>l(N,!1):N,g=h=>$n(h,!1,u),p=u.onStop=()=>{const h=Xt.get(u);if(h){if(o)o(h,4);else for(const H of h)H();Xt.delete(u)}},e?i?N(!0):_=u.run():l?l(N.bind(null,!0),!0):u.run(),S.pause=u.pause.bind(u),S.resume=u.resume.bind(u),S.stop=S,S}function at(t,e=1/0,n){if(e<=0||!F(t)||t.__v_skip||(n=n||new Map,(n.get(t)||0)>=e))return t;if(n.set(t,e),e--,K(t))at(t.value,e,n);else if(x(t))for(let i=0;i<t.length;i++)at(t[i],e,n);else if(un(t)||Rt(t))t.forEach(i=>{at(i,e,n)});else if(gn(t)){for(const i in t)at(t[i],e,n);for(const i of Object.getOwnPropertySymbols(t))Object.prototype.propertyIsEnumerable.call(t,i)&&at(t[i],e,n)}return t}/**
* @vue/runtime-core v3.5.22
* (c) 2018-present Yuxi (Evan) You and Vue contributors
* @license MIT
**/function xe(t,e,n,i){try{return i?t(...i):t()}catch(s){Ke(s,e,n)}}function Re(t,e,n,i){if(P(t)){const s=xe(t,e,n,i);return s&&fn(s)&&s.catch(r=>{Ke(r,e,n)}),s}if(x(t)){const s=[];for(let r=0;r<t.length;r++)s.push(Re(t[r],e,n,i));return s}}function Ke(t,e,n,i=!0){const s=e?e.vnode:null,{errorHandler:r,throwUnhandledErrorInProduction:l}=e&&e.appContext.config||he;if(e){let a=e.parent;const o=e.proxy,c=`https://vuejs.org/error-reference/#runtime-${n}`;for(;a;){const u=a.ec;if(u){for(let f=0;f<u.length;f++)if(u[f](t,o,c)===!1)return}a=a.parent}if(r){Ut(),xe(r,null,10,[t,o,c]),Jt();return}}Jn(t,n,s,i,l)}function Jn(t,e,n,i=!0,s=!1){if(s)throw t;console.error(t)}const Y=[];let k=-1;const bt=[];let rt=null,mt=0;const qn=Promise.resolve();let oe=null;function Gn(t){let e=k+1,n=Y.length;for(;e<n;){const i=e+n>>>1,s=Y[i],r=zt(s);r<t||r===t&&s.flags&2?e=i+1:n=i}return e}function Qn(t){if(!(t.flags&1)){const e=zt(t),n=Y[Y.length-1];!n||!(t.flags&2)&&e>=zt(n)?Y.push(t):Y.splice(Gn(e),0,t),t.flags|=1,Xe()}}function Xe(){oe||(oe=qn.then($e))}function Zn(t){x(t)?bt.push(...t):rt&&t.id===-1?rt.splice(mt+1,0,t):t.flags&1||(bt.push(t),t.flags|=1),Xe()}function kn(t){if(bt.length){const e=[...new Set(bt)].sort((n,i)=>zt(n)-zt(i));if(bt.length=0,rt){rt.push(...e);return}for(rt=e,mt=0;mt<rt.length;mt++){const n=rt[mt];n.flags&4&&(n.flags&=-2),n.flags&8||n(),n.flags&=-2}rt=null,mt=0}}const zt=t=>t.id==null?t.flags&2?-1:1/0:t.id;function $e(t){try{for(k=0;k<Y.length;k++){const e=Y[k];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),xe(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;k<Y.length;k++){const e=Y[k];e&&(e.flags&=-2)}k=-1,Y.length=0,kn(),oe=null,(Y.length||bt.length)&&$e()}}let Ct=null,ts=null;const es=t=>t.__isTeleport;function Ue(t,e){t.shapeFlag&6&&t.component?(t.transition=e,Ue(t.component.subTree,e)):t.shapeFlag&128?(t.ssContent.transition=e.clone(t.ssContent),t.ssFallback.transition=e.clone(t.ssFallback)):t.transition=e}function Je(t,e){return P(t)?Nt({name:t.name},e,{setup:t}):t}ge().requestIdleCallback;ge().cancelIdleCallback;function ns(t,e,n=X,i=!1){if(n){const s=n[t]||(n[t]=[]),r=e.__weh||(e.__weh=(...l)=>{Ut();const a=ys(n),o=Re(e,n,t,l);return a(),Jt(),o});return i?s.unshift(r):s.push(r),r}}const qe=t=>(e,n=X)=>{(!Pt||t==="sp")&&ns(t,(...i)=>e(...i),n)},Ge=qe("m"),Qe=qe("um"),ss=Symbol.for("v-ndc");let is=null;function it(t,e){if(X){let n=X.provides;const i=X.parent&&X.parent.provides;i===n&&(n=X.provides=Object.create(i)),n[t]=e}}function tt(t,e,n=!1){const i=bs();if(i||is){let s=i?i.parent==null||i.ce?i.vnode.appContext&&i.vnode.appContext.provides:i.parent.provides:void 0;if(s&&t in s)return s[t];if(arguments.length>1)return n&&P(e)?e.call(i&&i.proxy):e}}const rs={},Ze=t=>Object.getPrototypeOf(t)===rs,ls=fs,as=Symbol.for("v-scx"),os=()=>tt(as);function B(t,e,n){return cs(t,e,n)}function cs(t,e,n=he){const{immediate:i,deep:s,flush:r,once:l}=n,a=Nt({},n),o=e&&i||!e&&r!=="post";let c;if(Pt){if(r==="sync"){const g=os();c=g.__watcherHandles||(g.__watcherHandles=[])}else if(!o){const g=()=>{};return g.stop=jt,g.resume=jt,g.pause=jt,g}}const u=X;a.call=(g,R,w)=>Re(g,u,R,w);let f=!1;r==="post"?a.scheduler=g=>{ls(g,u&&u.suspense)}:r!=="sync"&&(f=!0,a.scheduler=(g,R)=>{R?g():Qn(g)}),a.augmentJob=g=>{e&&(g.flags|=4),f&&(g.flags|=2,u&&(g.id=u.uid,g.i=u))};const p=Un(t,e,a);return Pt&&(c?c.push(p):o&&p()),p}const us=t=>t.__isSuspense;function fs(t,e){e&&e.pendingBranch?x(t)?e.effects.push(...t):e.effects.push(t):Zn(t)}const ke=Symbol.for("v-fgt"),hs=Symbol.for("v-txt"),ds=Symbol.for("v-cmt");function ce(t){return t?t.__v_isVNode===!0:!1}const tn=({key:t})=>t??null,Bt=({ref:t,ref_key:e,ref_for:n})=>(typeof t=="number"&&(t=""+t),t!=null?ct(t)||K(t)||P(t)?{i:Ct,r:t,k:e,f:!!n}:t:null);function gs(t,e=null,n=null,i=0,s=null,r=t===ke?0:1,l=!1,a=!1){const o={__v_isVNode:!0,__v_skip:!0,type:t,props:e,key:e&&tn(e),ref:e&&Bt(e),scopeId:ts,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:r,patchFlag:i,dynamicProps:s,dynamicChildren:null,appContext:null,ctx:Ct};return a?(Me(o,n),r&128&&t.normalize(o)):n&&(o.shapeFlag|=ct(n)?8:16),o}const xt=ps;function ps(t,e=null,n=null,i=0,s=null,r=!1){if((!t||t===ss)&&(t=ds),ce(t)){const a=ue(t,e,!0);return n&&Me(a,n),a.patchFlag=-2,a}if(ws(t)&&(t=t.__vccOpts),e){e=vs(e);let{class:a,style:o}=e;a&&!ct(a)&&(e.class=ve(a)),F(o)&&(Se(o)&&!x(o)&&(o=Nt({},o)),e.style=pe(o))}const l=ct(t)?1:us(t)?128:es(t)?64:F(t)?4:P(t)?2:0;return gs(t,e,n,i,s,l,r,!0)}function vs(t){return t?Se(t)||Ze(t)?Nt({},t):t:null}function ue(t,e,n=!1,i=!1){const{props:s,ref:r,patchFlag:l,children:a,transition:o}=t,c=e?_s(s||{},e):s,u={__v_isVNode:!0,__v_skip:!0,type:t.type,props:c,key:c&&tn(c),ref:e&&e.ref?n&&r?x(r)?r.concat(Bt(e)):[r,Bt(e)]:Bt(e):r,scopeId:t.scopeId,slotScopeIds:t.slotScopeIds,children:a,target:t.target,targetStart:t.targetStart,targetAnchor:t.targetAnchor,staticCount:t.staticCount,shapeFlag:t.shapeFlag,patchFlag:e&&t.type!==ke?l===-1?16:l|16:l,dynamicProps:t.dynamicProps,dynamicChildren:t.dynamicChildren,appContext:t.appContext,dirs:t.dirs,transition:o,component:t.component,suspense:t.suspense,ssContent:t.ssContent&&ue(t.ssContent),ssFallback:t.ssFallback&&ue(t.ssFallback),placeholder:t.placeholder,el:t.el,anchor:t.anchor,ctx:t.ctx,ce:t.ce};return o&&i&&Ue(u,o.clone(u)),u}function ms(t=" ",e=0){return xt(hs,null,t,e)}function Me(t,e){let n=0;const{shapeFlag:i}=t;if(e==null)e=null;else if(x(e))n=16;else if(typeof e=="object")if(i&65){const s=e.default;s&&(s._c&&(s._d=!1),Me(t,s()),s._c&&(s._d=!0));return}else n=32,!e._&&!Ze(e)&&(e._ctx=Ct);else P(e)?(e={default:e,_ctx:Ct},n=32):(e=String(e),i&64?(n=16,e=[ms(e)]):n=8);t.children=e,t.shapeFlag|=n}function _s(...t){const e={};for(let n=0;n<t.length;n++){const i=t[n];for(const s in i)if(s==="class")e.class!==i.class&&(e.class=ve([e.class,i.class]));else if(s==="style")e.style=pe([e.style,i.style]);else if(on(s)){const r=e[s],l=i[s];l&&r!==l&&!(x(r)&&r.includes(l))&&(e[s]=r?[].concat(r,l):l)}else s!==""&&(e[s]=i[s])}return e}let X=null;const bs=()=>X||Ct;let fe;{const t=ge(),e=(n,i)=>{let s;return(s=t[n])||(s=t[n]=[]),s.push(i),r=>{s.length>1?s.forEach(l=>l(r)):s[0](r)}};fe=e("__VUE_INSTANCE_SETTERS__",n=>X=n),e("__VUE_SSR_SETTERS__",n=>Pt=n)}const ys=t=>{const e=X;return fe(t),t.scope.on(),()=>{t.scope.off(),fe(e)}};let Pt=!1;function ws(t){return P(t)&&"__vccOpts"in t}const V=(t,e)=>Xn(t,e,Pt);function It(t,e,n){try{const i=arguments.length;return i===2?F(e)&&!x(e)?ce(e)?xt(t,null,[e]):xt(t,e):xt(t,null,e):(i>3?n=Array.prototype.slice.call(arguments,2):i===3&&ce(n)&&(n=[n]),xt(t,e,n))}finally{}}const en=Symbol("Vue3DraggableResizable");function nn(t){const e=window.getComputedStyle(t);return{width:parseFloat(e.getPropertyValue("width")),height:parseFloat(e.getPropertyValue("height"))}}function sn(t){return(e,n,i,s=!1)=>{e&&(typeof n=="string"&&(n=[n]),n.forEach(r=>e[t](r,i,{capture:s,passive:!1})))}}const _t=sn("addEventListener"),et=sn("removeEventListener");function rn(t){if(t&&t.length>0){const e=[];return t.forEach(n=>{ln.includes(n)&&!e.includes(n)&&e.push(n)}),e}else return[]}function Ss(){return String(Math.random()).substr(2)+String(Date.now())}function xs(t,e,n){if(t.disabled.value)return null;const i={row:[],col:[]},{parentWidth:s,parentHeight:r}=e;i.row.push(...t.adsorbRows),i.col.push(...t.adsorbCols),t.adsorbParent.value&&(i.row.push(0,r.value,r.value/2),i.col.push(0,s.value,s.value/2));const l=t.getPositionStore(n);return Object.values(l).forEach(({x:o,y:c,w:u,h:f})=>{i.row.push(c,c+f,c+f/2),i.col.push(o,o+u,o+u/2)}),{row:i.row.reduce((o,c)=>({...o,[c]:{min:c-5,max:c+5,value:c}}),{}),col:i.col.reduce((o,c)=>({...o,[c]:{min:c-5,max:c+5,value:c}}),{})}}function Rs(t,e){for(;t!==null;){if(t.matches(e))return t;t=t.parentElement}return null}function z(t){const e=Dt(t);return[e,i=>(e.value=i,i)]}function Ms(t,e){const[n,i]=z(t.initW),[s,r]=z(t.initH),[l,a]=z(t.x),[o,c]=z(t.y),[u,f]=z(t.active),[p,g]=z(t.focus),[R,w]=z(t.blur),[S,_]=z(!1),[N,h]=z(!1),[H,J]=z(""),[E,G]=z(1/0),[ut,q]=z(1/0),[W,ft]=z(t.minW),[nt,A]=z(t.minH),j=V(()=>s.value/n.value);return B(n,d=>{e("update:w",d)},{immediate:!0}),B(s,d=>{e("update:h",d)},{immediate:!0}),B(o,d=>{e("update:y",d)}),B(l,d=>{e("update:x",d)}),B(u,(d,L)=>{e("update:active",d),console.log(d,L),!L&&d?e("activated"):L&&!d&&e("deactivated")}),B(()=>t.active,d=>{f(d)}),B(()=>t.blur,d=>w(d)),{id:Ss(),width:n,height:s,top:o,left:l,blur:R,focus:p,enable:u,dragging:S,resizing:N,resizingHandle:H,resizingMaxHeight:ut,resizingMaxWidth:E,resizingMinWidth:W,resizingMinHeight:nt,aspectRatio:j,classNameOperation:t.classNameOperation,setFocus:g,setEnable:f,setDragging:_,setResizing:h,setResizingHandle:J,setResizingMaxHeight:q,setResizingMaxWidth:G,setResizingMinWidth:ft,setResizingMinHeight:A,setWidth:d=>i(Math.floor(d)),setHeight:d=>r(Math.floor(d)),setTop:d=>c(Math.floor(d)),setLeft:d=>a(Math.floor(d))}}function Hs(t){const e=Dt(0),n=Dt(0);return Ge(()=>{if(t.value&&t.value.parentElement){const{width:i,height:s}=nn(t.value.parentElement);e.value=i,n.value=s}}),{parentWidth:e,parentHeight:n}}function Is(t,e,n){const{width:i,height:s,left:r,top:l,resizingMaxWidth:a,resizingMaxHeight:o,resizingMinWidth:c,resizingMinHeight:u}=n,{setWidth:f,setHeight:p,setTop:g,setLeft:R}=n,{parentWidth:w,parentHeight:S}=e,_={minWidth:V(()=>c.value),minHeight:V(()=>u.value),maxWidth:V(()=>{let h=1/0;return t.parent&&(h=Math.min(w.value,a.value)),h}),maxHeight:V(()=>{let h=1/0;return t.parent&&(h=Math.min(S.value,o.value)),h}),minLeft:V(()=>t.parent?0:-1/0),minTop:V(()=>t.parent?0:-1/0),maxLeft:V(()=>t.parent?w.value-i.value:1/0),maxTop:V(()=>t.parent?S.value-s.value:1/0)};return{..._,...{setWidth(h){return t.disabledW?i.value:f(Math.min(_.maxWidth.value,Math.max(_.minWidth.value,h)))},setHeight(h){return t.disabledH?s.value:p(Math.min(_.maxHeight.value,Math.max(_.minHeight.value,h)))},setTop(h){return t.disabledY?l.value:g(Math.min(_.maxTop.value,Math.max(_.minTop.value,h)))},setLeft(h){return t.disabledX?r.value:R(Math.min(_.maxLeft.value,Math.max(_.minLeft.value,h)))}}}}const kt=["mousedown","touchstart"],yt=["mouseup","touchend"],wt=["mousemove","touchmove"];function Tt(t){return"touches"in t?[t.touches[0]?.pageX,t.touches[0]?.pageY]:[t.pageX,t.pageY]}function Ts(t,e,n,i,s,r,l){const{left:a,top:o,width:c,height:u,dragging:f,id:p,blur:g,focus:R}=e,{setDragging:w,setEnable:S,setResizing:_,setResizingHandle:N}=e,{setTop:h,setLeft:H}=n;let J=0,E=0,G=0,ut=0,q=null;const W=document.documentElement,ft=d=>{const L=d.target;if(!t.value?.contains(L)){let st=!1;if(e.classNameOperation&&(st=!!Rs(L,e.classNameOperation)),!g.value||st)return;S(!1),w(!1),_(!1),N("")}},nt=()=>{w(!1),et(W,yt,nt),et(W,wt,A),q=null,r&&(r.updatePosition(p,{x:a.value,y:o.value,w:c.value,h:u.value}),r.setMatchedLine(null))},A=d=>{if(d.preventDefault(),!(f.value&&t.value))return;const[L=0,st=0]=Tt(d),qt=L-G,He=st-ut;let O=J+qt,D=E+He;if(q!==null){const Q={col:[O,O+c.value/2,O+c.value],row:[D,D+u.value/2,D+u.value]},M={row:Q.row.map((b,I)=>{let y=null;return Object.values(q.row).forEach(ht=>{b>=ht.min&&b<=ht.max&&(y=ht.value)}),y!==null&&(I===0?D=y:I===1?D=Math.floor(y-u.value/2):I===2&&(D=Math.floor(y-u.value))),y}).filter(b=>b!==null),col:Q.col.map((b,I)=>{let y=null;return Object.values(q.col).forEach(ht=>{b>=ht.min&&b<=ht.max&&(y=ht.value)}),y!==null&&(I===0?O=y:I===1?O=Math.floor(y-c.value/2):I===2&&(O=Math.floor(y-c.value))),y}).filter(b=>b!==null)};r.setMatchedLine(M)}s("dragging",{x:H(O),y:h(D)})},j=d=>{i.value?(w(!0),J=a.value,E=o.value,G=Tt(d)[0]??0,ut=Tt(d)[1]??0,_t(W,wt,A),_t(W,yt,nt),r&&!r.disabled.value&&(q=xs(r,l,p))):R.value&&S(!0)};return B(f,(d,L)=>{!L&&d?(s("drag-start",{x:a.value,y:o.value}),S(!0),w(!0)):(s("drag-end",{x:a.value,y:o.value}),w(!1))}),Ge(()=>{const d=t.value;d&&(d.style.left=a+"px",d.style.top=o+"px",_t(d,kt,j),_t(W,kt,ft,!0))}),Qe(()=>{t.value&&(et(W,kt,ft),et(W,yt,nt),et(W,wt,A))}),{containerRef:t}}function Es(t,e,n,i,s){const{setWidth:r,setHeight:l,setLeft:a,setTop:o}=e,{width:c,height:u,left:f,top:p,aspectRatio:g}=t,{setResizing:R,setResizingHandle:w,setResizingMaxWidth:S,setResizingMaxHeight:_,setResizingMinWidth:N,setResizingMinHeight:h}=t,{parentWidth:H,parentHeight:J}=n;let E=0,G=0,ut=0,q=0,W=0,ft=0,nt=1,A="",j="";const d=document.documentElement,L=O=>{O.preventDefault();let[D=0,Q=0]=Tt(O),M=D-W,b=Q-ft,I=M,y=b;i.lockAspectRatio&&(M=Math.abs(M),b=M*nt,(I<0||j==="m"&&y<0)&&(M=-M,b=-b)),A==="t"?(l(G-b),o(q-(u.value-G))):A==="b"&&l(G+b),j==="l"?(r(E-M),a(ut-(c.value-E))):j==="r"&&r(E+M),s("resizing",{x:f.value,y:p.value,w:c.value,h:u.value})},st=()=>{s("resize-end",{x:f.value,y:p.value,w:c.value,h:u.value}),w(""),R(!1),S(1/0),_(1/0),N(i.minW),h(i.minH),et(d,wt,L),et(d,yt,st)},qt=(O,D)=>{if(!i.resizable)return;O.stopPropagation(),w(D),R(!0),A=D[0]??"",j=D[1]??"",g.value&&(["tl","tm","ml","bl"].includes(D)?(A="t",j="l"):(A="b",j="r"));let Q=i.minH,M=i.minW;if(Q/M>g.value?M=Q/g.value:Q=M*g.value,N(M),h(Q),parent){let I=A==="t"?p.value+u.value:J.value-p.value,y=j==="l"?f.value+c.value:H.value-f.value;i.lockAspectRatio&&(I/y<g.value?y=I/g.value:I=y*g.value),_(I),S(y)}E=c.value,G=u.value,ut=f.value,q=p.value;const b=Tt(O);W=b[0]??0,ft=b[1]??0,nt=g.value,s("resize-start",{x:f.value,y:p.value,w:c.value,h:u.value}),_t(d,wt,L),_t(d,yt,st)};return Qe(()=>{et(d,yt,st),et(d,wt,L)}),{handlesFiltered:V(()=>i.resizable?rn(i.handles):[]),resizeHandleDown:qt}}function Ls(t,e){const{setWidth:n,setHeight:i,setLeft:s,setTop:r}=e;B(()=>t.w,l=>{n(l)}),B(()=>t.h,l=>{i(l)}),B(()=>t.x,l=>{s(l)}),B(()=>t.y,l=>{r(l)})}const ln=["tl","tm","tr","ml","mr","bl","bm","br"],Ds={initW:{type:Number,default:null},initH:{type:Number,default:null},w:{type:Number,default:0},h:{type:Number,default:0},x:{type:Number,default:0},y:{type:Number,default:0},draggable:{type:Boolean,default:!0},resizable:{type:Boolean,default:!0},disabledX:{type:Boolean,default:!1},disabledY:{type:Boolean,default:!1},disabledW:{type:Boolean,default:!1},disabledH:{type:Boolean,default:!1},minW:{type:Number,default:20},minH:{type:Number,default:20},active:{type:Boolean,default:!1},blur:{type:Boolean,default:!0},focus:{type:Boolean,default:!1},parent:{type:Boolean,default:!1},handles:{type:Array,default:ln,validator:t=>rn(t).length===t.length},classNameDraggable:{type:String,default:"draggable"},classNameResizable:{type:String,default:"resizable"},classNameDragging:{type:String,default:"dragging"},classNameResizing:{type:String,default:"resizing"},classNameActive:{type:String,default:"active"},classNameHandle:{type:String,default:"handle"},lockAspectRatio:{type:Boolean,default:!1},classNameOperation:{type:String,default:""}},zs=["activated","deactivated","drag-start","resize-start","dragging","resizing","drag-end","resize-end","update:w","update:h","update:x","update:y","update:active"],te=Je({name:"Vue3DraggableResizable",props:Ds,emits:zs,setup(t,{emit:e}){const n=Ms(t,e),i=tt("identity");let s=null;i===en&&(s={updatePosition:tt("updatePosition"),getPositionStore:tt("getPositionStore"),disabled:tt("disabled"),adsorbParent:tt("adsorbParent"),adsorbCols:tt("adsorbCols"),adsorbRows:tt("adsorbRows"),setMatchedLine:tt("setMatchedLine")});const r=Dt(),l=Hs(r),a=Is(t,l,n);Ts(r,n,a,ae(t,"draggable"),e,s,l);const o=Es(n,a,l,t,e);return Ls(t,a),t.active&&e("activated"),{containerRef:r,containerProvider:s,...n,...l,...a,...o}},computed:{style(){return{width:this.width+"px",height:this.height+"px",top:this.top+"px",left:this.left+"px"}},klass(){return{[this.classNameActive]:this.enable,[this.classNameDragging]:this.dragging,[this.classNameResizing]:this.resizing,[this.classNameDraggable]:this.draggable,[this.classNameResizable]:this.resizable}}},mounted(){if(!this.containerRef)return;this.containerRef.ondragstart=()=>!1;const{width:t,height:e}=nn(this.containerRef);this.setWidth(this.initW===null?this.w||t:this.initW),this.setHeight(this.initH===null?this.h||e:this.initH),this.containerProvider&&this.containerProvider.updatePosition(this.id,{x:this.left,y:this.top,w:this.width,h:this.height})},render(){return It("div",{ref:"containerRef",class:["vdr-container",this.klass],style:this.style},[this.$slots.default&&this.$slots.default(),...this.handlesFiltered.map(t=>It("div",{class:["vdr-handle","vdr-handle-"+t,this.classNameHandle,`${this.classNameHandle}-${t}`],style:{display:this.enable?"block":"none"},onMousedown:e=>this.resizeHandleDown(e,t),onTouchstart:e=>this.resizeHandleDown(e,t)}))])}}),Le=Je({name:"DraggableContainer",props:{disabled:{type:Boolean,default:!1},adsorbParent:{type:Boolean,default:!0},adsorbCols:{type:Array,default:null},adsorbRows:{type:Array,default:null},referenceLineVisible:{type:Boolean,default:!0},referenceLineColor:{type:String,default:"#f00"}},setup(t){const e=Kt({}),n=(o,c)=>{e[o]=c},i=o=>{const c=Object.assign({},e);return o&&delete c[o],c},s=Kt({matchedLine:null}),r=V(()=>s.matchedLine&&s.matchedLine.row||[]),l=V(()=>s.matchedLine&&s.matchedLine.col||[]),a=o=>{s.matchedLine=o};return it("identity",en),it("updatePosition",n),it("getPositionStore",i),it("setMatchedLine",a),it("disabled",ae(t,"disabled")),it("adsorbParent",ae(t,"adsorbParent")),it("adsorbCols",t.adsorbCols||[]),it("adsorbRows",t.adsorbRows||[]),{matchedRows:r,matchedCols:l}},methods:{renderReferenceLine(){return this.referenceLineVisible?[...this.matchedCols.map(t=>It("div",{style:{width:"0",height:"100%",top:"0",left:t+"px",borderLeft:`1px dashed ${this.referenceLineColor}`,position:"absolute"}})),...this.matchedRows.map(t=>It("div",{style:{width:"100%",height:"0",left:"0",top:t+"px",borderTop:`1px dashed ${this.referenceLineColor}`,position:"absolute"}}))]:[]}},render(){return It("div",{style:{width:"100%",height:"100%",position:"relative"}},[this.$slots.default&&this.$slots.default(),...this.renderReferenceLine()])}});te.install=t=>(t.component(te.name,te),t.component(Le.name,Le),t);