import{b as p,a as r,e as u,$ as c,h as w,i as v,j as g,y as h,A as x,l as M,u as _,T as y}from"./vue-y3KLWBaS.js";import{M as C}from"./MkMenu-6Et8UIBq.js";import{c as k}from"./contains-sEkIgjp4.js";import{aS as $,n as b}from"./app-JmgyQoR0.js";const B=["onContextmenu"],E=p({__name:"MkContextMenu",props:{items:{},ev:{}},emits:["closed"],setup(d,{emit:f}){const s=d,l=f,o=r(),m=r($("high"));u(()=>{let e=s.ev.pageX+1,t=s.ev.pageY+1;const n=o.value.offsetWidth,i=o.value.offsetHeight;e+n-window.pageXOffset>window.innerWidth&&(e=window.innerWidth-n+window.pageXOffset),t+i-window.pageYOffset>window.innerHeight&&(t=window.innerHeight-i+window.pageYOffset),t<0&&(t=0),e<0&&(e=0),o.value.style.top=`${t}px`,o.value.style.left=`${e}px`,document.body.addEventListener("mousedown",a)}),c(()=>{document.body.removeEventListener("mousedown",a)});function a(e){!k(o.value,e.target)&&o.value!==e.target&&l("closed")}return(e,t)=>(w(),v(y,{name:e.$store.state.animation?"fade":"",appear:""},{default:g(()=>[_("div",{ref_key:"rootEl",ref:o,class:"nvlagfpb",style:h({zIndex:m.value}),onContextmenu:x(()=>{},["prevent","stop"])},[M(C,{items:e.items,align:"left",onClose:t[0]||(t[0]=n=>e.$emit("closed"))},null,8,["items"])],44,B)]),_:1},8,["name"]))}}),W=b(E,[["__scopeId","data-v-922ff539"]]);export{W as default};
