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