import{a as m}from"./chunk-Q7NEU37N.js";import{f}from"./chunk-QO3I7KTG.js";import{e as h,s as d}from"./chunk-VA2ZAQUO.js";import{G as l,ea as u,ja as s,p as o,t as c,u as a}from"./chunk-F5OOQG77.js";import{i as n}from"./chunk-2AVGQ2MQ.js";var C=(()=>{class r{constructor(e,t,i,g){this.http=e,this.router=t,this.cookieService=i,this.configService=g,this.envUrl="",this.envDetails={},this.inclusionLicenses=[],this.exclusionLicenses=[],this.envUrl=this.configService.protocol+this.configService.baseFolder+"/paralite/cloud/"+this.configService.cloudName+"/envDetails/"}checkLicense(){let e=this.http.get(this.envUrl,{observe:"response"}).pipe(a(t=>(this.storeHeaders(t.headers),{status:t.status,headers:t.headers,body:t.body})),l(t=>(this.storeHeaders(t.headers),o({status:t.status,headers:t.headers,error:t.error}))));return this.API_promise=e,e}storeHeaders(e){let t={};this.inclusionLicenses=[],this.exclusionLicenses=[],e?.keys().forEach(i=>{t[i.toLowerCase()]=e.get(i)||"",e.get(i)==="true"?this.inclusionLicenses.push(i):e.get(i)==="false"&&this.exclusionLicenses.push(i)}),this.envDetails=t}getEnvDetails(){return this.envDetails}getInclusionLicenses(){return this.inclusionLicenses}getInclusionLicensesNew(){return n(this,null,function*(){if(this.inclusionLicenses.length===0&&this.API_promise==null)try{yield c(this.checkLicense())}catch(e){return console.error("Error fetching license info",e),[]}else this.inclusionLicenses.length===0&&this.API_promise!==void 0&&(yield this.API_promise.toPromise());return this.inclusionLicenses})}getExclusionLicenses(){return this.exclusionLicenses}handleErrorByStatus(e){switch(e.status){case 0:return this.router.navigate(["/503"]),{errorMessage:"A specific error occurred. Please try again later."};case 416:return{licenseExpired:!0};case 434:case 450:return{errorMessage:"A specific error occurred. Please try again later."};case 435:return{clientId:e.error.AADCredentialsElement.clientId,tenentId:e.error.AADCredentialsElement.tenentId,portalRedirectURI:e.error.AADCredentialsElement.portalRedirectURI,loginMode:e.error.AADCredentialsElement.loginMode,errorMessage:"A specific error occurred. Please try again later."};case 503:return this.router.navigate(["/503"]),{errorMessage:"A specific error occurred. Please try again later."};default:return{clientId:e.error?.AADCredentialsElement?.clientId,tenentId:e.error?.AADCredentialsElement?.tenentId,portalRedirectURI:e.error?.AADCredentialsElement?.portalRedirectURI,loginMode:e.error?.AADCredentialsElement?.loginMode,errorMessage:"An error occurred. Please try again later."}}}static{this.\u0275fac=function(t){return new(t||r)(s(h),s(d),s(m),s(f))}}static{this.\u0275prov=u({token:r,factory:r.\u0275fac,providedIn:"root"})}}return r})();export{C as a};
