import{ao as g,a0 as B,a1 as C,a2 as H,a4 as O,h as W,ab as L,bK as X,e as I,bL as D,a6 as N,m as $,G as j,aO as A,y as K,aV as U}from"./index-25eb6331.js";import{P as E}from"./vnode-761469ca.js";import{I as x,t as V,W as k,Z as F,Q as G,$ as Q}from"./index-3bef6acb.js";import{a as Z}from"./scroll-044a6ede.js";const q=e=>{if(!e)return{onClick:g,onMousedown:g,onMouseup:g};let n=!1,s=!1;return{onClick:t=>{n&&s&&e(t),n=s=!1},onMousedown:t=>{n=t.target===t.currentTarget},onMouseup:t=>{s=t.target===t.currentTarget}}},J=B({mask:{type:Boolean,default:!0},customMaskEvent:Boolean,overlayClass:{type:C([String,Array,Object])},zIndex:{type:C([String,Number])}}),_={click:e=>e instanceof MouseEvent},R="overlay";var ee=H({name:"ElOverlay",props:J,emits:_,setup(e,{slots:n,emit:s}){const a=O(R),o=d=>{s("click",d)},{onClick:c,onMousedown:t,onMouseup:i}=q(e.customMaskEvent?void 0:o);return()=>e.mask?W("div",{class:[a.b(),e.overlayClass],style:{zIndex:e.zIndex},onClick:c,onMousedown:t,onMouseup:i},[L(n,"default")],E.STYLE|E.CLASS|E.PROPS,["onClick","onMouseup","onMousedown"]):X("div",{class:e.overlayClass,style:{zIndex:e.zIndex,position:"fixed",top:"0px",right:"0px",bottom:"0px",left:"0px"}},[L(n,"default")])}});const ae=ee,ce=(e,n,s,a)=>{const o={offsetX:0,offsetY:0},c=(u,l)=>{if(e.value){const{offsetX:p,offsetY:y}=o,r=e.value.getBoundingClientRect(),f=r.left,v=r.top,h=r.width,w=r.height,M=document.documentElement.clientWidth,P=document.documentElement.clientHeight,S=-f+p,T=-v+y,Y=M-f-h+p,z=P-v-w+y;a!=null&&a.value||(u=Math.min(Math.max(u,S),Y),l=Math.min(Math.max(l,T),z)),o.offsetX=u,o.offsetY=l,e.value.style.transform="translate(".concat(x(u),", ").concat(x(l),")")}},t=u=>{const l=u.clientX,p=u.clientY,{offsetX:y,offsetY:r}=o,f=h=>{const w=y+h.clientX-l,M=r+h.clientY-p;c(w,M)},v=()=>{document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",v)};document.addEventListener("mousemove",f),document.addEventListener("mouseup",v)},i=()=>{n.value&&e.value&&(n.value.addEventListener("mousedown",t),window.addEventListener("resize",m))},d=()=>{n.value&&e.value&&(n.value.removeEventListener("mousedown",t),window.removeEventListener("resize",m))},b=()=>{o.offsetX=0,o.offsetY=0,e.value&&(e.value.style.transform="")},m=()=>{const{offsetX:u,offsetY:l}=o;c(u,l)};return I(()=>{D(()=>{s.value?i():d()})}),N(()=>{d()}),{resetPosition:b,updatePosition:m}},ue=(e,n={})=>{$(e)||V("[useLockscreen]","You need to pass a ref param to this function");const s=n.ns||O("popup"),a=j(()=>s.bm("parent","hidden"));if(!A||k(document.body,a.value))return;let o=0,c=!1,t="0";const i=()=>{setTimeout(()=>{typeof document>"u"||c&&document&&(document.body.style.width=t,Q(document.body,a.value))},200)};K(e,d=>{if(!d){i();return}c=!k(document.body,a.value),c&&(t=document.body.style.width,F(document.body,a.value)),o=Z(s.namespace.value);const b=document.documentElement.clientHeight<document.body.scrollHeight,m=G(document.body,"overflowY");o>0&&(b||m==="scroll")&&c&&(document.body.style.width="calc(100% - ".concat(o,"px)"))}),U(()=>i())};export{ae as E,q as a,ue as b,ce as u};
