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