import{a6 as e,aU as a,aW as o,a as t,Q as s,a8 as n,g as l,aJ as i,aK as r,ag as u,aL as c,h as d,aM as f,aN as v,aO as p,aP as g,aQ as h,w as m,b2 as b,b3 as q,b4 as y,b5 as x,ai as B,T as S,f as k,b6 as E,b7 as O,b8 as T,b9 as w,aT as C}from"./index.9313841a.js";import{f as P,v as R,a as D,b as Q,c as F,r as H,s as M,p as W,e as j}from"./position-engine.57eefbc7.js";const K=["ul","ol"];var L=e({name:"QList",props:{...a,bordered:Boolean,dense:Boolean,separator:Boolean,padding:Boolean,tag:{type:String,default:"div"}},setup(e,{slots:a}){const i=l(),r=o(e,i.proxy.$q),u=t((()=>K.includes(e.tag)?null:"list")),c=t((()=>"q-list"+(!0===e.bordered?" q-list--bordered":"")+(!0===e.dense?" q-list--dense":"")+(!0===e.separator?" q-list--separator":"")+(!0===r.value?" q-list--dark":"")+(!0===e.padding?" q-list--padding":"")));return()=>s(e.tag,{class:c.value,role:u.value},n(a.default))}}),A=e({name:"QMenu",inheritAttrs:!1,props:{...P,...i,...a,...r,persistent:Boolean,autoClose:Boolean,separateClosePopup:Boolean,noEscDismiss:Boolean,noRouteDismiss:Boolean,noRefocus:Boolean,noFocus:Boolean,fit:Boolean,cover:Boolean,square:Boolean,anchor:{type:String,validator:R},self:{type:String,validator:R},offset:{type:Array,validator:D},scrollTarget:u,touchPosition:Boolean,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null}},emits:[...c,"click","escapeKey"],setup(e,{slots:a,emit:i,attrs:r}){let u,c,P,R=null;const D=l(),{proxy:K}=D,{$q:L}=K,A=d(null),$=d(!1),_=t((()=>!0!==e.persistent&&!0!==e.noRouteDismiss)),J=o(e,L),{registerTick:N,removeTick:U}=f(),{registerTimeout:z}=v(),{transitionProps:G,transitionStyle:I}=p(e),{localScrollTarget:V,changeScrollEvent:X,unconfigureScrollTarget:Y}=Q(e,ve),{anchorEl:Z,canShow:ee}=F({showing:$}),{hide:ae}=g({showing:$,canShow:ee,handleShow:function(a){if(R=!1===e.noRefocus?document.activeElement:null,b(ge),oe(),ve(),u=void 0,void 0!==a&&(e.touchPosition||e.contextMenu)){const e=q(a);if(void 0!==e.left){const{top:a,left:o}=Z.value.getBoundingClientRect();u={left:e.left-o,top:e.top-a}}}void 0===c&&(c=m((()=>L.screen.width+"|"+L.screen.height+"|"+e.self+"|"+e.anchor+"|"+L.lang.rtl),me));!0!==e.noFocus&&document.activeElement.blur();N((()=>{me(),!0!==e.noFocus&&de()})),z((()=>{!0===L.platform.is.ios&&(P=e.autoClose,A.value.click()),me(),oe(!0),i("show",a)}),e.transitionDuration)},handleHide:function(a){U(),te(),fe(!0),null===R||void 0!==a&&!0===a.qClickOutside||(((0===(null==a?void 0:a.type.indexOf("key"))?R.closest('[tabindex]:not([tabindex^="-"])'):void 0)||R).focus(),R=null);z((()=>{te(!0),i("hide",a)}),e.transitionDuration)},hideOnRouteChange:_,processOnMount:!0}),{showPortal:oe,hidePortal:te,renderPortal:se}=h(D,A,(function(){return s(S,G.value,(()=>!0===$.value?s("div",{role:"menu",...r,ref:A,tabindex:-1,class:["q-menu q-position-engine scroll"+re.value,r.class],style:[r.style,I.value],...ue.value},n(a.default)):null))}),"menu"),ne={anchorEl:Z,innerRef:A,onClickOutside(a){if(!0!==e.persistent&&!0===$.value)return ae(a),("touchstart"===a.type||a.target.classList.contains("q-dialog__backdrop"))&&C(a),!0}},le=t((()=>W(e.anchor||(!0===e.cover?"center middle":"bottom start"),L.lang.rtl))),ie=t((()=>!0===e.cover?le.value:W(e.self||"top start",L.lang.rtl))),re=t((()=>(!0===e.square?" q-menu--square":"")+(!0===J.value?" q-menu--dark q-dark":""))),ue=t((()=>!0===e.autoClose?{onClick:pe}:{})),ce=t((()=>!0===$.value&&!0!==e.persistent));function de(){E((()=>{let e=A.value;e&&!0!==e.contains(document.activeElement)&&(e=e.querySelector("[autofocus][tabindex], [data-autofocus][tabindex]")||e.querySelector("[autofocus] [tabindex], [data-autofocus] [tabindex]")||e.querySelector("[autofocus], [data-autofocus]")||e,e.focus({preventScroll:!0}))}))}function fe(e){u=void 0,void 0!==c&&(c(),c=void 0),!0!==e&&!0!==$.value||(y(ge),Y(),H(ne),x(he)),!0!==e&&(R=null)}function ve(){null===Z.value&&void 0===e.scrollTarget||(V.value=B(Z.value,e.scrollTarget),X(V.value,me))}function pe(e){!0!==P?(O(K,e),i("click",e)):P=!1}function ge(a){!0===ce.value&&!0!==e.noFocus&&!0!==w(A.value,a.target)&&de()}function he(a){!0!==e.noEscDismiss&&(i("escapeKey"),ae(a))}function me(){M({targetEl:A.value,offset:e.offset,anchorEl:Z.value,anchorOrigin:le.value,selfOrigin:ie.value,absoluteOffset:u,fit:e.fit,cover:e.cover,maxHeight:e.maxHeight,maxWidth:e.maxWidth})}return m(ce,(e=>{!0===e?(T(he),j(ne)):(x(he),H(ne))})),k(fe),Object.assign(K,{focus:de,updatePosition:me}),se}});export{L as Q,A as a};
