import{e as h,f as x,g as f,h as k}from"./chunk-AIHAZUSZ.js";import{f as l,s as g}from"./chunk-KADRYNDC.js";import{b as d,c as T}from"./chunk-IOINCEV4.js";import{Gd as v,ma as E,r as c,sa as t,xa as s}from"./chunk-JSJB5BKT.js";import{e as n}from"./chunk-SZAW6ZBW.js";var i,M,y=n(()=>{E();x();v();g();k();T();i=function(e){return e[e.success=200]="success",e[e.badRequest=400]="badRequest",e[e.notFound=404]="notFound",e[e.serverError=500]="serverError",e[e.forbidden=403]="forbidden",e}(i||{}),M=(()=>{class e{constructor(r,o,a){this.confirmationService=r,this.applicationErrorService=o,this.translatorService=a}handleError(r,o){switch(console.error(r),r.status){case i.serverError:this.handleServerError(r);break;case i.forbidden:this.handleForbiddenError(r.error);break;case i.badRequest:this.handleBadRequest(r.error,o);break;case i.notFound:this.handleBadRequest(r.error,o,"Item not found");break;default:this.handleGenericError(r)}return c()}handleBadRequest(r,o=this.translatorService.translate("AnErrorOccured"),a=this.translatorService.translate("AnErrorOccured")){typeof r=="string"&&(r={message:`${r}`}),this.confirmationService.confirm({key:"globalInfos",acceptLabel:"lblClose",header:`${o}`,message:r?.Message||r?.message||a})}handleForbiddenError(r,o=this.translatorService.translate("ShowAccessDenied")){let a=r.translationKey?this.translatorService.translate(r.translationKey):r.Message||r.message;this.confirmationService.confirm({key:"globalInfos",acceptLabel:"lblClose",header:`${o}`,message:a})}handleGenericError(r){this.sendToApplicationError(r.message,r.statusText)}handleServerError(r){r.error&&(r.error.exceptionMessage||r.error.message)?this.sendToApplicationError(r.error.message,r.statusText,r.error.exceptionMessage,r.error.exceptionType,r.error.stackTrace):this.handleGenericError(r)}sendToApplicationError(r,o,a,p,b){this.applicationErrorService.pushError(new h({message:r,statusText:o,exceptionMessage:a,exceptionType:p,stackTrace:b,fatal:!1}))}static{this.\u0275fac=function(o){return new(o||e)(s(l),s(f),s(d))}}static{this.\u0275prov=t({token:e,factory:e.\u0275fac,providedIn:"root"})}}return e})()});var m,A=n(()=>{m=class{}});export{M as a,y as b,m as c,A as d};
