import{_ as m}from"./index-M_JNBppB.js";/* empty css                  *//* empty css                   */import{y as u,z as d,F as a,D as n,B as w,I as h,V as f,H as z,W as b,x as g,C as p}from"./vue-BJk78QHK.js";import{V as D}from"./element-3_pOinej.js";const y={name:"DraggableDrawer",props:{size:{type:[String,Number],default:"30%"},direction:{type:String,default:"btt"}},data(){return{dragging:!1,drawerSize:this.size}},watch:{size(t){this.drawerSize=t}},mounted(){window.addEventListener("mousemove",this.onDragging),window.addEventListener("mouseup",this.stopDragging)},beforeUnmount(){window.removeEventListener("mousemove",this.onDragging),window.removeEventListener("mouseup",this.stopDragging)},methods:{startDragging(t){this.dragging=!0,document.body.style.userSelect="none",document.body.style.cursor=this.direction==="btt"||this.direction==="ttb"?"ns-resize":"ew-resize"},onDragging(t){if(!this.dragging)return;let e=0;this.direction==="btt"?e=window.innerHeight-t.clientY:this.direction==="ttb"?e=t.clientY:this.direction==="ltr"?e=t.clientX:this.direction==="rtl"&&(e=window.innerWidth-t.clientX);const i=100,s=this.direction==="btt"||this.direction==="ttb"?window.innerHeight-50:window.innerWidth-50;e>=i&&e<=s&&(this.drawerSize=`${e}px`)},stopDragging(){this.dragging&&(this.dragging=!1,document.body.style.userSelect="",document.body.style.cursor="")}}},v={class:"drawer-content"};function S(t,e,i,s,r,o){const l=D;return d(),u(l,p(t.$attrs,{direction:i.direction,size:r.drawerSize,class:["draggable-drawer",[r.dragging?"is-dragging":""]]}),{header:a(()=>[g(t.$slots,"header",{},void 0,!0)]),default:a(()=>[n("div",{class:z(["resize-handle",`handle-${i.direction}`]),onMousedown:e[0]||(e[0]=f((...c)=>o.startDragging&&o.startDragging(...c),["stop"]))},e[1]||(e[1]=[n("div",{class:"handle-line"},null,-1)]),34),r.dragging?(d(),w("div",{key:0,class:"dragging-mask",style:b({cursor:i.direction==="btt"||i.direction==="ttb"?"ns-resize":"ew-resize"})},null,4)):h("",!0),n("div",v,[g(t.$slots,"default",{},void 0,!0)])]),_:3},16,["direction","size","class"])}const C=m(y,[["render",S],["__scopeId","data-v-3c559f29"]]);export{C as D};
