import{d as L,bH as k,r as l,co as A,E as $,G as B,aL as I,aO as N,e as p,a as _,p as f,H as v,b as s,n as g,ac as M,f as h,c as S,cp as T,bN as W,o as r,cq as c,cr as C,ab as D}from"./BvNnk7SS.js";const H={key:1,"of-hidden":"","max-h-screen":""},R=L({__name:"PanelFloating",props:{isOpen:{type:Boolean},isFixed:{type:Boolean},storageKey:{}},setup(b){const t=b,a=W(),u=k(),d=l(!1),m=l(0),w=l(0),F=l(0),n=l(A),y=$(()=>`${a.value.position}: ${n.value}px`);function O(e){d.value=!0,m.value=e.clientX,w.value=n.value,F.value=a.value.width||0,document.addEventListener("mousemove",x),document.addEventListener("mouseup",z)}function x(e){if(d.value){const i=e.clientX-m.value;if(a.value.position!=="right"){const o=Math.max(c,F.value+i);a.value.width=o,a.value.defaultFrameSize=o,n.value=Math.max(c,w.value+i)}else{const o=Math.max(c,window.innerWidth-i);a.value.width=o,a.value.defaultFrameSize=o,n.value=Math.max(c,window.innerWidth-m.value-i-50)}}}function z(){d.value&&(d.value=!1,document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",z))}function E(){t.isOpen?(!a.value.panelOpen||a.value.panelOpen?.length===0)&&(n.value=t.isFixed?0:a.value.width||C,a.value.panelOpen=t.storageKey):a.value.panelOpen=void 0}return B(()=>[t.isOpen,t.isFixed],()=>{E()},{immediate:!0}),I(()=>{E()}),N(()=>{a.value.panelOpen=void 0}),(e,i)=>(r(),p("div",{relative:"","h-full":"",grid:"",class:g([s(a).position==="right"&&"flex-row-reverse",e.isOpen&&s(u)&&!e.isFixed?"grid-cols-[auto_1fr]":"w-full"])},[_("div",{style:v(e.isOpen&&s(u)&&`width: ${s(n)}px`),class:g(["of-auto!",e.isFixed&&"hidden"])},[f(e.$slots,"default",{},void 0,!0)],6),e.isOpen&&!e.isFixed&&s(u)?(r(),p("div",{key:0,class:"unpress-resize-handle unpress-resize-handle-vertical",style:v(s(y)),onMousedown:M(O,["prevent"])},null,36)):h("",!0),e.isOpen||e.isFixed?(r(),p("div",H,[s(u)?f(e.$slots,"panel",{key:0},void 0,!0):(r(),S(T,{key:1,to:"#floating-panel"},[_("div",{style:v(`width: ${s(n)}px`),"h-screen":"","border-base":"","bg-base":"","border-r":"",class:"translate-x-[-1px]"},[f(e.$slots,"panel",{},void 0,!0)],4),e.isOpen&&!e.isFixed?(r(),p("div",{key:0,class:"unpress-resize-handle unpress-resize-handle-vertical translate-x-[-1px]",style:v(s(y)),onMousedown:M(O,["prevent"])},null,36)):h("",!0)]))])):h("",!0)],2))}}),P=D(R,[["__scopeId","data-v-41cca711"]]);export{P as _};
