import{ref as h,computed as _,watch as b,createBlock as E,openBlock as s,Transition as L,withCtx as z,createElementBlock as B,createCommentVNode as x,normalizeStyle as k,unref as c,createElementVNode as u,renderSlot as M,withModifiers as i}from"/vue.js";const S={class:"nc-drawer-inner"},$=270,C={__name:"nc-drawer",props:{show:{type:Boolean,default:!1}},emits:["update:width"],setup(m,{emit:l}){const f=l,e=h(300),p=_(()=>({width:`${e.value}px`}));b(e,()=>{document.body.style.setProperty("--nc-drawer-width",`${e.value}px`)},{immediate:!0});function r(o){document.body.style.cursor="ew-resize";const n=o.clientX;n>$&&(e.value=n),f("update:width",e.value)}function w(){document.addEventListener("mousemove",r,!1),document.addEventListener("mouseup",t,!1)}function t(){document.body.style.cursor="",document.removeEventListener("mousemove",r,!1),document.removeEventListener("mouseup",t,!1)}function a(){document.body.dataset.drawer_appear=!0}function d(){delete document.body.dataset.drawer_appear}function v(){document.body.dataset.drawer_mode=!0}function y(){delete document.body.dataset.drawer_mode}return(o,n)=>(s(),E(L,{name:"expand-nc-drawer",appear:"",onBeforeEnter:a,onBeforeLeave:a,onEnter:v,onLeave:y,onAfterEnter:d,onAfterLeave:d},{default:z(()=>[m.show?(s(),B("aside",{key:0,class:"nc-drawer",style:k(c(p))},[u("div",S,[M(o.$slots,"default",{width:c(e)})]),u("div",{ref:"border",class:"nc-drawer-border",onMousedown:i(w,["prevent"]),onMouseup:i(t,["prevent"])},null,544)],4)):x("",!0)]),_:3}))}};export{C as default};
