1import{Fa as q}from"./chunk-CSKO464Y.js";import"./chunk-RFZ65DFT.js";import"./chunk-ZAELU3GP.js";import"./chunk-KCBWTIVH.js";import"./chunk-Q7LOV5U2.js";import"./chunk-DIZWDXBB.js";import"./chunk-Q4MTVQC2.js";import{b as B}from"./chunk-RRAYDVNW.js";import{Ab as h,Ea as j,Ga as S,Na as R,a as N,cc as E,dc as U,ic as H,lc as V}from"./chunk-WGWIBZ2L.js";import{$c as v,B as $,C as A,D as C,Gd as x,Hd as p,Ib as w,La as M,T as O,Va as g,Vb as F,d as b,e as I,fd as _,n as T,r as z,s as D,tb as k,ua as L,vd as u,w as c,ya as r}from"./chunk-6LP6WHZQ.js";import"./chunk-5KTCK5IS.js";z();function K(i,P={}){let{selector:e}=P,t=T(P,["selector"]);return new b(o=>{let a=new AbortController,{signal:d}=a,f=!0,{signal:m}=t;if(m)if(m.aborted)a.abort();else{let s=()=>{d.aborted||a.abort()};m.addEventListener("abort",s),o.add(()=>m.removeEventListener("abort",s))}let l=Object.assign(Object.assign({},t),{signal:d}),n=s=>{f=!1,o.error(s)};return fetch(i,l).then(s=>{e?D(e(s)).subscribe(I(o,void 0,()=>{f=!1,o.complete()},n)):(f=!1,o.next(s),o.complete())}).catch(n),()=>{f&&a.abort()}})}var y=(()=>{class i{constructor(){this.configManagerService=r(U),this.logger=r(E),this.environmentService=r(H),this.currentSiteState=r(V),this.platformId=r(g),this.serverResponse=r(h,{optional:!0})}static{this.DEFAULT_TIMEOUT=2e3}tryDoRedirect(e){if(!u(this.platformId)||!this.serverResponse)return this.logger.info("[PathRedirectsService] skipping path redirect, not on the server"),c(!1);if(this.serverResponse.writableEnded)return this.logger.info(`[PathRedirectsService] skipping path "${e}" redirect, response already sent to client`),c(!1);if(!this.environmentService.getEnvironmentVariable(S.PATH_REDIRECTS_ENABLED))return this.logger.info(`[PathRedirectsService] skipping path "${e}" redirect, disabled in env variable`),c(!1);if(e.charAt(0)==="/"&&(e=e.substring(1)),!e)return this.logger.info("[PathRedirectsService] skipping path redirect, received empty path"),c(!1);let t=this.currentSiteState.currentSite();if(!t)return this.logger.info(`[PathRedirectsService] skipping path "${e}" redirect, site not recognized`),c(!1);let o=this.configManagerService.getSiteSettingValueByKey(t,j.EasyredirRedirectAliasDomain);if(!o)return this.logger.info(`[PathRedirectsService] skipping path "${e}" redirect, redirect alias domain not configured for site: ${t.id} (${t.name})`),c(!1);let a=e,d=e.indexOf("?");if(d>-1&&(a=e.substring(0,d)),this.configManagerService.isActiveSiteRootName(a))return this.logger.info(`[PathRedirectsService] skipping path "${e}" redirect, subSite recognized`),c(!1);let f=this.environmentService.getEnvironmentVariable(S.EASYREDIR_TIMEOUT),m=f?Number(f):i.DEFAULT_TIMEOUT,l=`https://${o}/${e}`;return this.logger.info(`[PathRedirectsService] Initiating redirect check for path "${e}" via "${l}"`),K(l,{method:"HEAD",redirect:"manual"}).pipe(A(m),C(n=>{if(n.status!=p.MovedPermanently)return this.logger.warn(`[PathRedirectsService] Request to redirect ${e} returned status ${n.status}`),!1;let s=n.headers.get("location");return s?(this.logger.info(`[PathRedirectsService] Redirecting user from ${e} to ${s}`),this.serverResponse?.redirect(p.MovedPermanently,s),!0):(this.logger.warn(`[PathRedirectsService] Location header was empty for ${e}`),!1)}),O(n=>n instanceof x&&n.status===p.NotFound?(this.logger.warn(`[PathRedirectsService] Redirect is not found for ${e}`),c(!1)):n instanceof $?(this.logger.warn(`[PathRedirectsService] Request to redirect ${l} timed out after ${m} ms`),c(!1)):(this.logger.warn(`[PathRedirectsService] Error occurred while checking redirect from ${e}: ${n.message}`),c(!1))))}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275prov=L({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})();var Oe=(()=>{class i{constructor(){this.pageTitle=v(()=>this.resourceService.getResourceByKey(R.PAGE_404_TITLE)),this.pageDescription=v(()=>this.resourceService.getResourceByKey(R.PAGE_404_DESCRIPTION)),this.pathRedirectsService=r(y),this.platformId=r(g),this.serverResponse=r(h,{optional:!0}),this.location=r(_),this.destroyRef=r(M),this.resourceService=r(B)}ngOnInit(){u(this.platformId)&&this.pathRedirectsService.tryDoRedirect(this.location.path()).pipe(N(this.destroyRef)).subscribe(e=>{!e&&!this.serverResponse?.writableEnded&&this.serverResponse?.status(p.NotFound)})}static{this.\u0275fac=function(t){return new(t||i)}}static{this.\u0275cmp=k({type:i,selectors:[["ppg-notfound"]],decls:1,vars:2,consts:[[3,"pageTitle","pageDescription"]],template:function(t,o){t&1&&F(0,"ppg-error-base",0),t&2&&w("pageTitle",o.pageTitle())("pageDescription",o.pageDescription())},dependencies:[q],styles:["[_nghost-%COMP%]{flex:1;display:flex;flex-direction:column;justify-content:center;align-items:center}"],changeDetection:0})}}return i})();export{Oe as NotfoundComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.