import{r as P,S as M,b3 as y,k as m,c1 as D,b4 as b}from"./index-D92x6h1h.js";function S(e){return typeof e=="number"&&Number.isFinite(e)}function g(e){return y(e,S)}function X(e,n){b(e,n)}function K(e){D(e)}function W(e){const n=P(g(e.storageKey)),s=m(()=>n.value??e.defaultPx),L=m(()=>n.value===null),E=M(),p=m(()=>E.value?{width:"100vw"}:{width:`min(${s.value}px, 95vw)`});function d(o){const u=Math.max(e.minPx,Math.min(e.maxPx,Math.round(o)));n.value=u,X(e.storageKey,u)}function x(){n.value=null,K(e.storageKey)}function w(o){let u=0,c=0;function l(t){d(c+(u-t))}function i(t){l(t.clientX)}function a(){document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",a)}function h(t){t.preventDefault(),u=t.clientX,c=s.value,document.addEventListener("mousemove",i),document.addEventListener("mouseup",a)}function v(t){t.touches.length!==0&&(t.preventDefault(),l(t.touches[0].clientX))}function r(){document.removeEventListener("touchmove",v),document.removeEventListener("touchend",r),document.removeEventListener("touchcancel",r)}function f(t){t.touches.length!==0&&(t.preventDefault(),u=t.touches[0].clientX,c=s.value,document.addEventListener("touchmove",v,{passive:!1}),document.addEventListener("touchend",r),document.addEventListener("touchcancel",r))}return o.addEventListener("mousedown",h),o.addEventListener("touchstart",f,{passive:!1}),()=>{o.removeEventListener("mousedown",h),o.removeEventListener("touchstart",f),document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",a),document.removeEventListener("touchmove",v),document.removeEventListener("touchend",r),document.removeEventListener("touchcancel",r)}}return{widthPx:s,widthStyle:p,isAtDefault:L,setWidth:d,reset:x,attachHandle:w}}export{W as u};
