import{b as p,c as E,d as O}from"./chunk-TRLYPWTD.js";import{a as h,ha as v,ia as R,ja as A}from"./chunk-OGMMZFJL.js";import{Ba as _,Ha as f,Ta as g,fa as d,la as n,sb as b}from"./chunk-QVZULMP5.js";var T={capture:!0},N=["focus","mousedown","mouseenter","touchstart"],l="mat-ripple-loader-uninitialized",c="mat-ripple-loader-class-name",D="mat-ripple-loader-centered",o="mat-ripple-loader-disabled",S=(()=>{class r{_document=n(h);_animationMode=n(g,{optional:!0});_globalRippleOptions=n(O,{optional:!0});_platform=n(A);_ngZone=n(f);_injector=n(_);_eventCleanups;_hosts=new Map;constructor(){let e=n(b).createRenderer(null,null);this._eventCleanups=this._ngZone.runOutsideAngular(()=>N.map(t=>R(e,this._document,t,this._onInteraction,T)))}ngOnDestroy(){let e=this._hosts.keys();for(let t of e)this.destroyRipple(t);this._eventCleanups.forEach(t=>t())}configureRipple(e,t){e.setAttribute(l,this._globalRippleOptions?.namespace??""),(t.className||!e.hasAttribute(c))&&e.setAttribute(c,t.className||""),t.centered&&e.setAttribute(D,""),t.disabled&&e.setAttribute(o,"")}setDisabled(e,t){let i=this._hosts.get(e);i?(i.target.rippleDisabled=t,!t&&!i.hasSetUpEvents&&(i.hasSetUpEvents=!0,i.renderer.setupTriggerEvents(e))):t?e.setAttribute(o,""):e.removeAttribute(o)}_onInteraction=e=>{let t=v(e);if(t instanceof HTMLElement){let i=t.closest(`[${l}="${this._globalRippleOptions?.namespace??""}"]`);i&&this._createRipple(i)}};_createRipple(e){if(!this._document||this._hosts.has(e))return;e.querySelector(".mat-ripple")?.remove();let t=this._document.createElement("span");t.classList.add("mat-ripple",e.getAttribute(c)),e.append(t);let i=this._animationMode==="NoopAnimations",s=this._globalRippleOptions,I=i?0:s?.animation?.enterDuration??p.enterDuration,M=i?0:s?.animation?.exitDuration??p.exitDuration,a={rippleDisabled:i||s?.disabled||e.hasAttribute(o),rippleConfig:{centered:e.hasAttribute(D),terminateOnPointerUp:s?.terminateOnPointerUp,animation:{enterDuration:I,exitDuration:M}}},m=new E(a,this._ngZone,t,this._platform,this._injector),u=!a.rippleDisabled;u&&m.setupTriggerEvents(e),this._hosts.set(e,{target:a,renderer:m,hasSetUpEvents:u}),e.removeAttribute(l)}destroyRipple(e){let t=this._hosts.get(e);t&&(t.renderer._removeTriggerEvents(),this._hosts.delete(e))}static \u0275fac=function(t){return new(t||r)};static \u0275prov=d({token:r,factory:r.\u0275fac,providedIn:"root"})}return r})();export{S as a};
