import{At as e,P as t,Q as ee,T as n,U as r,bt as i,ct as a,et as o,h as s,m as c,s as te,w as l}from"./dom-CdSnbvZ6.js";import{l as u,u as d}from"./private.use-form-BL2f1xto.js";import{Z as f,ct as p,dt as m,et as h,ft as g,lt as _,rt as ne,ut as v}from"./index-_dGt2VRU.js";import{a as y,c as b,d as x,f as S,h as C,l as w,m as T,o as E,s as D,u as O}from"./QMenu-CrOVdCP-.js";var k=n({name:`QTooltip`,inheritAttrs:!1,props:{...T,...v,...d,maxHeight:{type:String,default:null},maxWidth:{type:String,default:null},transitionShow:{...d.transitionShow,default:`jump-down`},transitionHide:{...d.transitionHide,default:`jump-up`},anchor:{type:String,default:`bottom middle`,validator:b},self:{type:String,default:`top middle`,validator:b},offset:{type:Array,default:()=>[14,14],validator:D},scrollTarget:h,delay:{type:Number,default:0},hideDelay:{type:Number,default:0},persistent:Boolean},emits:[..._],setup(n,{slots:d,emit:h,attrs:_}){let v,b,T=ee(),{proxy:{$q:D}}=T,k=e(null),A=e(!1),j=r(()=>y(n.anchor,D.lang.rtl)),M=r(()=>y(n.self,D.lang.rtl)),N=r(()=>n.persistent!==!0),{registerTick:P,removeTick:F}=m(),{registerTimeout:I}=g(),{transitionProps:L,transitionStyle:R}=u(n),{localScrollTarget:z,changeScrollEvent:B,unconfigureScrollTarget:V}=x(n,$),{anchorEl:H,canShow:U,anchorEvents:W}=S({showing:A,configureAnchorEl:oe}),{show:G,hide:K}=p({showing:A,canShow:U,handleShow:X,handleHide:re,hideOnRouteChange:N,processOnMount:!0});Object.assign(W,{delayShow:ie,delayHide:ae});let{showPortal:q,hidePortal:J,renderPortal:Y}=ne(T,k,ce,`tooltip`);if(D.platform.is.mobile===!0){let e={anchorEl:H,innerRef:k,onClickOutside(e){return K(e),e.target.classList.contains(`q-dialog__backdrop`)&&l(e),!0}};i(r(()=>n.modelValue===null&&n.persistent!==!0&&A.value===!0),t=>{(t===!0?w:O)(e)}),a(()=>{O(e)})}function X(e){q(),P(()=>{b=new MutationObserver(()=>Q()),b.observe(k.value,{attributes:!1,childList:!0,characterData:!0,subtree:!0}),Q(),$()}),v===void 0&&(v=i(()=>D.screen.width+`|`+D.screen.height+`|`+n.self+`|`+n.anchor+`|`+D.lang.rtl,Q)),I(()=>{q(!0),h(`show`,e)},n.transitionDuration)}function re(e){F(),J(),Z(),I(()=>{J(!0),h(`hide`,e)},n.transitionDuration)}function Z(){b!==void 0&&(b.disconnect(),b=void 0),v!==void 0&&(v(),v=void 0),V(),s(W,`tooltipTemp`)}function Q(){E({targetEl:k.value,offset:n.offset,anchorEl:H.value,anchorOrigin:j.value,selfOrigin:M.value,maxHeight:n.maxHeight,maxWidth:n.maxWidth})}function ie(e){if(D.platform.is.mobile===!0){C(),document.body.classList.add(`non-selectable`);let e=H.value;c(W,`tooltipTemp`,[`touchmove`,`touchcancel`,`touchend`,`click`].map(t=>[e,t,`delayHide`,`passiveCapture`]))}I(()=>{G(e)},n.delay)}function ae(e){D.platform.is.mobile===!0&&(s(W,`tooltipTemp`),C(),setTimeout(()=>{document.body.classList.remove(`non-selectable`)},10)),I(()=>{K(e)},n.hideDelay)}function oe(){n.noParentEvent===!0||H.value===null||c(W,`anchor`,D.platform.is.mobile===!0?[[H.value,`touchstart`,`delayShow`,`passive`]]:[[H.value,`mouseenter`,`delayShow`,`passive`],[H.value,`mouseleave`,`delayHide`,`passive`]])}function $(){if(H.value!==null||n.scrollTarget!==void 0){z.value=f(H.value,n.scrollTarget);let e=n.noParentEvent===!0?Q:K;B(z.value,e)}}function se(){return A.value===!0?o(`div`,{..._,ref:k,class:[`q-tooltip q-tooltip--style q-position-engine no-pointer-events`,_.class],style:[_.style,R.value],role:`tooltip`},te(d.default)):null}function ce(){return o(t,L.value,se)}return a(Z),Object.assign(T.proxy,{updatePosition:Q}),Y}});export{k as t};