"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("vue"),R=require("./useSizes.js"),T=(_,y,P,j,M,q)=>{const u=r.unref(_).map(e=>[e.min,e.max]),v=r.computed(()=>r.unref(j)||0),O=e=>e*v.value;function f(e,l){return typeof e=="string"?O(R.getPtg(e)):e??l}const I=r.ref([]),b=[],S=r.ref(null),E=()=>r.unref(P).map(O);return[e=>{I.value=E(),S.value={index:e,confirmed:!1}},(e,l)=>{let n=null;const z=r.unref(S),i=r.unref(I),a=r.unref(v);if((!z||!z.confirmed)&&l!==0){if(l>0)n=e,S.value={index:e,confirmed:!0};else for(let d=e;d>=0;d-=1)if(i[d]>0&&r.unref(y)[d].resizable){n=d,S.value={index:d,confirmed:!0};break}}const s=n??z?.index??e,t=[...i],c=s+1,m=f(u[s][0],0),g=f(u[c][0],0),p=f(u[s][1],a),h=f(u[c][1],a);let o=l;return t[s]+o<m&&(o=m-t[s]),t[c]-o<g&&(o=t[c]-g),t[s]+o>p&&(o=p-t[s]),t[c]-o>h&&(o=t[c]-h),t[s]+=o,t[c]-=o,M(t),t},()=>{S.value=null},(e,l)=>{const n=E(),z=q?l==="start"?"end":"start":l,i=z==="start"?e:e+1,a=z==="start"?e+1:e,s=n[i],t=n[a];if(s!==0&&t!==0)n[i]=0,n[a]+=s,b[e]=s;else{const c=r.unref(v),m=s+t,g=f(u[i][0],0),p=f(u[i][1],c),h=f(u[a][0],0),o=f(u[a][1],c),d=Math.max(g,m-o),U=(Math.min(p,m-h)-d)/2,C=b[e],x=m-C;C&&C<=o&&C>=h&&x<=p&&x>=g?(n[a]=C,n[i]=x):(n[i]-=U,n[a]+=U)}return M(n),n},r.computed(()=>S.value?.index)]};exports.useResize=T;
