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