import{H as v,I as M,j as l,k as T}from"./chunk-JE2X3YFA.js";import{Wj as f,Xj as C,s as u,t as k,u as p,v as A}from"./chunk-GDJMZZ4C.js";import{a,b as j,g as h,h as D}from"./chunk-V3J5YJ3L.js";import{La as E,za as d}from"./chunk-2XIOYYFS.js";import{b as m,c as I}from"./chunk-YTY7HHO3.js";import{Rd as y,ha as n,ma as g,na as b,r as s,sa as c,x as o,xa as t}from"./chunk-4HFZZ7HS.js";import{e as R}from"./chunk-SZAW6ZBW.js";var H,U=R(()=>{b();g();A();k();j();T();y();C();E();M();I();D();H=(()=>{class i extends u{constructor(e,r,w,S,P){super(S,P),this.assetService=e,this.confirmationService=r,this.pwnedDialogService=w}changePassword(e){return this.assetService.ChangePassword(e).pipe(n(r=>this.handleResponse(r)))}validatePassword(e){return this.assetService.ValidateLoginPassword(e).pipe(o(r=>r.isValid))}resetPassword(e){return this.assetService.ResetPassword(e).pipe(n(r=>this.handleResponse(r)))}handleResponse(e){if(e.result===a.InvalidData){if(e.passwordResult){let r={details:e.details,result:e.result,passwordResult:e.passwordResult};return this.handleInvalidPassword(r)}return this.displayError(e),s(null)}return e.result===a.Success?s(e):(this.handleApiResult(e,this.translatorService.translate(a.getEnumKey(e.result))),s(null))}handleInvalidPassword(e){let r;switch(e.passwordResult){case l.InvalidTemplate:this.confirmationService.confirm({key:"error-confirmation",header:this.translatorService.translate("lblError"),message:`${this.translatorService.translate("ThePasswordDoesNotMeetThePasswordPolicyRequirements")}
          ${e.details}`}),r=s(null);break;case l.PwnedInvalid:r=this.pwnedDialogService.showPwnedDialog(p.Required);break;default:r=this.pwnedDialogService.handleError(e.result);break}return r.pipe(o(()=>null))}displayError(e){this.confirmationService.confirm({key:"error-confirmation",header:this.translatorService.translate("lblError"),message:`${this.translatorService.translate(e.errorMessage)}`})}static{this.\u0275fac=function(r){return new(r||i)(t(f),t(d),t(v),t(m),t(h))}}static{this.\u0275prov=c({token:i,factory:i.\u0275fac,providedIn:"root"})}}return i})()});export{H as a,U as b};
