1import {o}from'./chunk-SDcs1xql.js';import {G}from'./chunk-CWBrHG4i.js';import {s}from'./chunk-D1g3129g.js';import {D,w as we,eM as Sf,j as Sa,n as hI,b6 as K,d as E,eR as oR,cT as Ve,bI as Qe,bm as br,da as lo,cV as B,P as qT,bM as Ys,F as we$1,br as Te,bB as X9,bz as Nf,c_ as fu,d4 as vI,d2 as sI,d1 as on,cX as X3,f0 as M$1,cF as eR,cH as co,cI as Ch,d_ as ea,cM as j,cN as u,bi as dn,cY as uo,cZ as Nl,eS as Cr,eo as QI,c$ as Pa,d0 as gu,bh as _e,fR as BI,d5 as No,c8 as H8,ca as Pf,A as D$1,hU as X6,bu as mn,a2 as ye,bW as a,a3 as Ms,aM as N_,a6 as mC,cO as nd,a5 as rd,a8 as Ry,bv as R_,aa as mb,ab as gC,bp as f6,bq as m6,bs as p6,bt as iN,ad as c_,t as de,X,e as ep,v as vM,p as pi,$ as $N,b as $n,h as he,W,be as na,aw as F,c5 as Be,J as da,N as N$1,E as E$1,V,aS as V$1,c1 as CC,a4 as ky,d6 as tT,c2 as qy,c6 as yh,aL as RC,c7 as vh,c3 as HC,b_,d7 as nT}from'./chunk-hxK0xzc4.js';import {S,N}from'./main-UKM7BIED.js';import'./chunk-DROiOONM.js';vM();pi();$N();$n();he();W();na();F();var w=N(ep());Be();vM();var O=class m{customDatesValidator(){return e=>{let t=e.get("fromDate"),n=e.get("toDate"),r=Qe(),p={};this.resetControls([t,n]),p=this.checkDatesValidation(p,t,n,r),this.setValidations(p,e);}}checkDatesValidation(e,t,n,r){return (0, w.isDate)(t.value)||(e.fromDate="invalidDate"),(0, w.isDate)(n.value)||(e.toDate="invalidDate"),Qe(t.value)>r&&(e.fromDate="invalidFutureDate"),Qe(n.value).startOf("day")<r.startOf("day")&&(e.toDate="invalidPastDate"),Qe(t.value).isAfter(Qe(n.value))&&t.dirty&&(e.fromDate="fromDateAfterToDate"),Qe(n.value).isBefore(Qe(t.value))&&n.dirty&&(e.toDate="toDateBeforeFromDate"),e}setValidations(e,t){let n=Object.entries(e);if(n.length>0){let r=n[0][0],p=n[0][1];t.get(r).setErrors({[p]:true}),t.get(r).markAsTouched(),t.get(r).markAsDirty();}}resetControls(e){e.forEach(t=>t.setErrors(null));}static{this.\u0275fac=function(t){return new(t||m)};}static{this.\u0275prov=X({token:m,factory:m.\u0275fac,providedIn:"any"});}};da();Be();vM();he();na();var ee=()=>["displayName","id","primaryBalance"];
1function ne(m,e){if(m&1&&(Ms(0,"div",23),ky(1,"ebank-template-prominent",24),N_(2,"translate"),N_(3,"amountFormat"),ky(4,"ebank-template-prominent",24),N_(5,"translate"),N_(6,"amountFormat"),rd()),m&2){let t=RC(2);mb(),Ry("supportText",R_(2,4,"PAGE.INTEREST_RATE_SIMULATION.SIMULATE.RESULT.LABEL"))("text","kr "+R_(3,6,t.interest)+" NOK"),mb(3),Ry("supportText",R_(5,8,"PAGE.INTEREST_RATE_SIMULATION.SIMULATE.RESULT_WITH_AMOUNT.LABEL"))("text","kr "+R_(6,10,t.Number(t.interest)+t.Number(t.lastSimulatedInterestRate))+" NOK");}}function ie(m,e){if(m&1){let t=CC();Ms(0,"form",4)(1,"ebank-form-field")(2,"ebank-label",5),c_(3,"PAGE.INTEREST_RATE_SIMULATION.ACCOUNT"),rd(),Ms(4,"ebank-simple-selector",6),N_(5,"translate"),ky(6,"ebank-option-template",7),rd(),tT(),rd(),Ms(7,"ebank-form-field")(8,"ebank-label",5),c_(9,"PAGE.INTEREST_RATE_SIMULATION.AMOUNT.HEADER"),rd(),ky(10,"ebank-amount-field",8,0),tT(),Ms(12,"ebank-form-error-wrapper")(13,"ebank-form-error",9)(14,"span",5),c_(15,"PAGE.INTEREST_RATE_SIMULATION.AMOUNT.ERROR"),rd()(),Ms(16,"ebank-form-error",10)(17,"span",5),c_(18,"PAGE.INTEREST_RATE_SIMULATION.AMOUNT.REQUIRED"),rd()(),Ms(19,"ebank-form-error",11)(20,"span",5),c_(21,"PAGE.INTEREST_RATE_SIMULATION.AMOUNT.ERROR"),rd()(),Ms(22,"ebank-form-error",12)(23,"span",5),c_(24,"PAGE.INTEREST_RATE_SIMULATION.AMOUNT.INVALID_RANGE"),rd()()()(),Ms(25,"div",13)(26,"ebank-form-field")(27,"ebank-label",5),c_(28,"PAGE.INTEREST_RATE_SIMULATION.FROM_DATE"),rd(),Ms(29,"ebank-sub-label",5),c_(30,"PAGE.INTEREST_RATE_SIMULATION.DATE.SUBLABEL"),rd(),ky(31,"ebank-date-picker",14,1),N_(33,"translate"),tT(),Ms(34,"ebank-form-error-wrapper")(35,"ebank-form-error",15)(36,"span",5),c_(37,"PAGE.INTEREST_RATE_SIMULATION.INVALID_DATE"),rd()(),Ms(38,"ebank-form-error",16)(39,"span",5),c_(40,"PAGE.INTEREST_RATE_SIMULATION.INVALID_FUTURE_DATE"),rd()(),Ms(41,"ebank-form-error",17)(42,"span",5),c_(43,"PAGE.INTEREST_RATE_SIMULATION.INVALID_FROM_DATE_GREATER"),rd()()()(),Ms(44,"ebank-form-field")(45,"ebank-label",5),c_(46,"PAGE.INTEREST_RATE_SIMULATION.TO_DATE"),rd(),Ms(47,"ebank-sub-label",5),c_(48,"PAGE.INTEREST_RATE_SIMULATION.DATE.SUBLABEL"),rd(),ky(49,"ebank-date-picker",18,2),N_(51,"translate"),tT(),Ms(52,"ebank-form-error-wrapper")(53,"ebank-form-error",15)(54,"span",5),c_(55,"PAGE.INTEREST_RATE_SIMULATION.INVALID_DATE"),rd()(),Ms(56,"ebank-form-error",19)(57,"span",5),c_(58,"PAGE.INTEREST_RATE_SIMULATION.INVALID_PAST_DATE"),rd()(),Ms(59,"ebank-form-error",20)(60,"span",5),c_(61,"PAGE.INTEREST_RATE_SIMULATION.INVALID_TO_DATE_EARLIER"),rd()()()()(),Ms(62,"ebank-information-area",21)(63,"ebank-information-area-custom-template")(64,"span",5),c_(65,"PAGE.INTEREST_RATE_SIMULATION.SIMULATE.INFORMATION.TEXT"),rd()()(),Ms(66,"ebank-button",22),qy("buttonClick",function(){yh(t);let r=RC();return vh(r.simulate())}),Ms(67,"span",5),c_(68,"PAGE.INTEREST_RATE_SIMULATION.SIMULATE.BUTTON"),rd()()(),mC(69,ne,7,12,"div",23);}if(m&2){let t=HC(11),n=HC(32),r=HC(50),p=RC();Ry("formGroup",p.interestRateSimulationForm),mb(4),Ry("options",p.accounts)("searchAttributes",b_(29,ee))("titleOnMobile",R_(5,23,"PAGE.INTEREST_RATE_SIMULATION.ACCOUNT")),nT(),mb(2),Ry("labelMap",p.labelMap),mb(4),Ry("maxlength",19),nT(),mb(3),Ry("control",t),mb(3),Ry("control",t),mb(3),Ry("control",t),mb(3),Ry("control",t),mb(9),Ry("min",p.minFromDate)("max",p.maxFromDate)("titleOnMobile",R_(33,25,"PAGE.INTEREST_RATE_SIMULATION.FROM_DATE")),nT(),mb(4),Ry("control",n),mb(3),Ry("control",n),mb(3),Ry("control",n),mb(8),Ry("min",p.minToDate)("titleOnMobile",R_(51,27,"PAGE.INTEREST_RATE_SIMULATION.TO_DATE")),nT(),mb(4),Ry("control",r),mb(3),Ry("control",r),mb(3),Ry("control",r),mb(7),Ry("disabled",p.interestRateSimulationForm.invalid),mb(3),gC(p.showSimulationResult?69:-1);}}function ae(m,e){m&1&&(Ms(0,"ebank-empty-state")(1,"ebank-empty-state-description",5),c_(2,"PAGE.INTEREST_RATE_SIMULATION.NO_ACCOUNTS"),rd()());}var M=class m{constructor(){this.route=D(K);this.dataAccounts=D(G);this.logService=D(E);this.formBuilder=D(oR);this.destroyRef=D(Ve);this.validator=D(O);this.today=Qe().startOf("day").toDate();this.Number=Number;this.showNoAccountsEmptyState$=new br(false);this.showSpinner$=new br(false);this.accounts=[];this.showSimulationResult=false;this.lastSimulatedInterestRate=0;this.interestRateSimulationForm=this.formBuilder.group({account:null,amount:["0",lo.compose([lo.required,lo.pattern(/^[0-9.,\s]+$/),s()])],minMaxDates:this.formBuilder.group({fromDate:this.today,toDate:this.today},{validators:this.validator.customDatesValidator()})});this.maxFromDate=this.today;this.minFromDate=null;this.minToDate=this.today;this.labelMap={upLeft:"displayName",downLeft:"accountNumber",right:"primaryBalance"};}ngOnInit(){this.initialDataLoading(),this.interestRateSimulationForm.valueChanges.subscribe(()=>{this.updateMinFromDateDueToAccountCreationDate(this.interestRateSimulationForm.value.account);});}initialDataLoading(){this.showSpinner(true),this.dataAccounts.get().pipe(Sf(e=>{!e||e.length===0?(this.showNoAccountsEmptyState(true),this.showSpinner(false)):this.handleAccounts(e);}),B(this.destroyRef)).subscribe({next:()=>{this.showSpinner(false);},error:e=>{this.logService.error(e);}});}preselectAccount(e){let t=this.accounts.find(n=>n.accountId===e);t&&(this.interestRateSimulationForm.patchValue({account:t}),this.updateMinFromDateDueToAccountCreationDate(t));}handleAccounts(e){this.accounts=e.filter(t=>t.type==="client-account"),this.accounts.length?(this.updateMinFromDateDueToAccountCreationDate(e[0]),this.preselectAccountOnQueryParam()):this.showNoAccountsEmptyState(true);}preselectAccountOnQueryParam(){this.route.queryParams.pipe(we(e=>e?.accountId),B(this.destroyRef)).subscribe(e=>{e&&this.preselectAccount(e);});}showNoAccountsEmptyState(e){this.showNoAccountsEmptyState$.next(e);}showSpinner(e){this.showSpinner$.next(e);}simulate(){return S(this,null,function*(){let e=t=>Qe(t).format("YYYY-MM-DD");if(this.interestRateSimulationForm.valid){let t=this.accounts.find(r=>r===this.interestRateSimulationForm.value.account),{interest:n}=yield t.interestSimulation({fromDate:e(this.interestRateSimulationForm.value.minMaxDates.fromDate),toDate:e(this.interestRateSimulationForm.value.minMaxDates.toDate),amount:this.interestRateSimulationForm.value.amount});this.interest=n,this.lastSimulatedInterestRate=this.interestRateSimulationForm.value.amount,this.showSimulationResult=true;}})}updateMinFromDateDueToAccountCreationDate(e){this.minFromDate=Qe(e?.properties?.accountCreateDate)?.toDate()||this.minFromDate;}static{this.\u0275fac=function(t){return new(t||m)};}
1static{this.\u0275cmp=qT({type:m,selectors:[["interest-rate-simulation"]],decls:6,vars:9,consts:[["amountControl","ebankControl"],["fromDateEbankControl","ebankControl"],["toDateEbankControl","ebankControl"],[3,"loading","loadAnnouncement"],["id","interestRateSimulationForm",1,"ebank-form","ebank-form-input",3,"formGroup"],["translate",""],["formControlName","account","id","account",3,"options","searchAttributes","titleOnMobile"],["selectTemplate","2left1right",3,"labelMap"],["id","amount","formControlName","amount",3,"maxlength"],["validation","number",3,"control"],["validation","required",3,"control"],["validation","pattern",3,"control"],["validation","maxlength",3,"control"],["formGroupName","minMaxDates"],["id","fromDate","formControlName","fromDate",3,"min","max","titleOnMobile"],["validation","invalidDate",3,"control"],["validation","invalidFutureDate",3,"control"],["validation","fromDateAfterToDate",3,"control"],["id","toDate","formControlName","toDate",3,"min","titleOnMobile"],["validation","invalidPastDate",3,"control"],["validation","toDateBeforeFromDate",3,"control"],["level","general"],[3,"buttonClick","disabled"],[1,"ebank-template-prominent-group"],[3,"supportText","text"]],template:function(t,n){t&1&&(Ms(0,"ebank-spinner",3),N_(1,"async"),N_(2,"translate"),mC(3,ie,70,30),N_(4,"async"),nd(5,ae,3,0,"ebank-empty-state"),rd()),t&2&&(Ry("loading",R_(1,3,n.showSpinner$))("loadAnnouncement",R_(2,5,"PAGE.INTEREST_RATE_SIMULATION.LOADING")),mb(3),gC(R_(4,7,n.showNoAccountsEmptyState$)===false?3:5));},dependencies:[Ys,we$1,Te,X9,Nf,fu,vI,sI,on,X3,M$1,eR,co,Ch,ea,j,u,dn,uo,Nl,Cr,QI,Pa,gu,_e,BI,No,H8,Pf,D$1,X6,mn,ye,a],encapsulation:2,changeDetection:1});}};vM();pi();vM();W();N$1();he();da();var L=class m{constructor(e,t,n,r){this.log=e;this.alert=t;this.translateService=n;this.router=r;}error(e,t,n){n&&this.alert.error(this.translateService.instant(n)),this.log.error(`${e}: ${t}`);}handleBackendError(e,t){this.error(e,JSON.stringify(t)),this.navigateToErrorPage();}navigateToErrorPage(){this.router.navigate(["/page/interest-rate-simulation/error"]);}static{this.\u0275fac=function(t){return new(t||m)(de(E),de(E$1),de(V),de(V$1))};}static{this.\u0275prov=X({token:m,factory:m.\u0275fac,providedIn:"any"});}};var Wt=(m,e)=>{let t=D(L);return D(o).get().pipe(we(r=>r.administrator),Sf(r=>{r||t.navigateToErrorPage();}),Sa(r=>(t.handleBackendError("Error while getting access rights",r),hI(false))))};$N();he();vM();he();var x=class m{static{this.\u0275fac=function(t){return new(t||m)};}
1static{this.\u0275cmp=qT({type:m,selectors:[["interest-rate-simulation-error"]],decls:6,vars:0,consts:[["level","error"],["translate",""]],template:function(t,n){t&1&&(Ms(0,"ebank-page-alert",0)(1,"ebank-page-alert-header",1),c_(2,"PAGE.INTEREST_RATE_SIMULATION.ERROR.HEADER"),rd(),Ms(3,"ebank-page-alert-content")(4,"ebank-page-alert-text",1),c_(5,"PAGE.INTEREST_RATE_SIMULATION.ERROR.DESC"),rd()()());},dependencies:[f6,m6,p6,iN,we$1,Te],encapsulation:2,changeDetection:1});}};var We=[{path:"",component:M,data:{name:"interest-rate-simulation",title:"PAGE.INTEREST_RATE_SIMULATION.HEADER",ebankuiPage:"half",breadcrumbLabel:"PAGE.CLIENT_ACCOUNT_OVERVIEW.HEADER",breadcrumbPath:"client-account-overview"},canActivate:[Wt]},{path:"error",component:x,data:{ebankuiPage:"medium ebankui-alert-page",name:"interest-rate-simulation-error",title:"PAGE.INTEREST_RATE_SIMULATION.HEADER"}}];export{We as INTEREST_RATE_SIMULATION_ROUTES};
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.