import{n as e}from"./create-CGAkPJkS.js";import{a as t,i as n,n as r,p as i,u as a}from"./dom-BXiDqs7-.js";var o=!1;function s(e){o=e.isComposing===!0}function c(e){return o||e!==Object(e)||e.isComposing||e.qKeyEvent}function l(e,t){return!c(e)&&[t].flat().includes(e.keyCode)}function u(e,t=250){let n=!1,r;return function(...i){return n||(n=!0,setTimeout(()=>{n=!1},t),r=e.apply(this,i)),r}}function d(e,t,n,o){n.modifiers.stop&&i(e);let s=n.modifiers.color,c=n.modifiers.center||o===!0,l=document.createElement(`span`),u=document.createElement(`span`),d=a(e),{left:f,top:p,width:m,height:h}=t.getBoundingClientRect(),g=Math.hypot(m,h),_=g/2,v=`${(m-g)/2}px`,y=c?v:`${d.left-f-_}px`,b=`${(h-g)/2}px`,x=c?b:`${d.top-p-_}px`;u.className=`q-ripple__inner`,r(u,{height:`${g}px`,width:`${g}px`,transform:`translate3d(${y},${x},0) scale3d(.2,.2,1)`,opacity:0}),l.className=`q-ripple${s?` text-`+s:``}`,l.setAttribute(`dir`,`ltr`),l.append(u),t.append(l);let S=()=>{l.remove(),clearTimeout(C)};n.abort.push(S);let C=setTimeout(()=>{u.classList.add(`q-ripple__inner--enter`),u.style.transform=`translate3d(${v},${b},0) scale3d(1,1,1)`,u.style.opacity=.2,C=setTimeout(()=>{u.classList.remove(`q-ripple__inner--enter`),u.classList.add(`q-ripple__inner--leave`),u.style.opacity=0,C=setTimeout(()=>{l.remove(),n.abort.splice(n.abort.indexOf(S),1)},275)},250)},50)}function f(e,{modifiers:t,value:n,arg:r}){let i={...e.cfg.ripple,...t,...n};e.modifiers={early:i.early===!0,stop:i.stop===!0,center:i.center===!0,color:i.color||r,keyCodes:[i.keyCodes||13].flat()}}var p=e({name:`ripple`,beforeMount(e,t){let r=t.instance.$.appContext.config.globalProperties.$q.config||{};if(r.ripple===!1)return;let i={cfg:r,enabled:t.value!==!1,modifiers:{},abort:[],start(t){i.enabled&&!t.qSkipRipple&&t.type===(i.modifiers.early?`pointerdown`:`click`)&&d(t,e,i,t.qKeyEvent===!0)},keystart:u(t=>{i.enabled&&!t.qSkipRipple&&l(t,i.modifiers.keyCodes)&&t.type===`key${i.modifiers.early?`down`:`up`}`&&d(t,e,i,!0)},300)};f(i,t),e.__qripple=i,n(i,`main`,[[e,`pointerdown`,`start`,`passive`],[e,`click`,`start`,`passive`],[e,`keydown`,`keystart`,`passive`],[e,`keyup`,`keystart`,`passive`]])},updated(e,t){if(t.oldValue!==t.value){let n=e.__qripple;n!==void 0&&(n.enabled=t.value!==!1,n.enabled&&Object(t.value)===t.value&&f(n,t))}},beforeUnmount(e){let n=e.__qripple;n!==void 0&&(n.abort.forEach(e=>{e()}),t(n,`main`),delete e.__qripple)}});export{c as i,l as n,s as r,p as t};