import{Q as P}from"./chunk-CUANlmUG.js";import{a as x}from"./chunk-X_78B3t_.js";import{e as y,c as b}from"./chunk-CCQf9h9p.js";import{B as Q,X as C}from"./app-CPb3bToC.js";import{m as j,g as p,a as h,w as k,l as M}from"./chunk-DhYw-kuD.js";const q=Q({name:"QPopupProxy",props:{...y,breakpoint:{type:[String,Number],default:450}},emits:["show","hide"],setup(a,{slots:m,emit:c,attrs:f}){const{proxy:r}=j(),{$q:l}=r,n=p(!1),t=p(null),i=h(()=>parseInt(a.breakpoint,10)),{canShow:g}=b({showing:n});function u(){return l.screen.width<i.value||l.screen.height<i.value?"dialog":"menu"}const o=p(u()),v=h(()=>o.value==="menu"?{maxHeight:"99vh"}:{});k(()=>u(),e=>{n.value!==!0&&(o.value=e)});function d(e){n.value=!0,c("show",e)}function w(e){n.value=!1,o.value=u(),c("hide",e)}return Object.assign(r,{show(e){g(e)===!0&&t.value.show(e)},hide(e){t.value.hide(e)},toggle(e){t.value.toggle(e)}}),C(r,"currentComponent",()=>({type:o.value,ref:t.value})),()=>{const e={ref:t,...v.value,...f,onShow:d,onHide:w};let s;return o.value==="dialog"?s=P:(s=x,Object.assign(e,{target:a.target,contextMenu:a.contextMenu,noParentEvent:!0,separateClosePopup:!0})),M(s,e,m.default)}}});export{q as Q};
