1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1011],{11599:(e,a,t)=>{t.r(a),t.d(a,{Flow:()=>aN,default:()=>aS});var n,i,o,s,r,c,l,u,d,p,m,f,A,g,h,b=t(54568),y=t(7620),C=t(82676),v=t(7152),I=t(16531),x=t(2456),N=t(93830),S=t(50039),w=t(99015),D=t(41867),R=t(65939),k=t(16069),j=t(41055),L=t(54558),M=t(64513),T=t(70126),P=t(69836),q=((n={}).IfNoneMatch="if-none-match",n.ETag="etag",n.Country="x-country",n.SubscriptionKey="ocp-apim-subscription-key",n.ApiVersion="x-api-version",n),E=((i={}).AuthRequiredNo="AuthRequiredNo",i.CustomerConsentRequiredNo="CustomerConsentRequiredNo",i.StudyLoanInfoRequiredNo="StudyLoanInfoRequiredNo",i.SblManualHandlingInfoRequiredNo="SblManualHandlingInfoRequiredNo",i.SblInfoPendingNo="SblInfoPendingNo",i),U=((o={}).Active="Active",o.Inactive="Inactive",o.Completed="Completed",o),B=((s={}).MainApplicant="MainApplicant",s.CoApplicant="CoApplicant",s),F=((r={}).CreateApplicationNo="CreateApplicationNo",r),$=((c={}).UpdateMarketingConsentsNo="UpdateMarketingConsentsNo",c.OtherInformationNo="OtherInformationNo",c.InsuranceNo="InsuranceNo",c.GenerateDocumentPackageNo="GenerateDocumentPackageNo",c.UpdateConsentsNo="UpdateConsentsNo",c.UpdateCalculationNo="UpdateCalculationNo",c.RegisterRefinanceDetailsNo="RegisterRefinanceDetailsNo",c.RegisterPaymentServiceNo="RegisterPaymentServiceNo",c.ResetApplicationContextNo="ResetApplicationContextNo",c.SkipAvtaleGiroNo="SkipAvtaleGiroNo",c.RemoveAmlDocumentNo="RemoveAmlDocumentNo",c),O=((l={}).none="none",l.partial="partial",l.full="full",l),V=((u={}).SigningRequiredDataNo="SigningRequiredDataNo",u.AmlRequiredDataNo="AmlRequiredDataNo",u.InsuranceStatementRequiredDataNo="InsuranceStatementRequiredDataNo",u.DocumentsRequiredDataNo="DocumentsRequiredDataNo",u.DocumentPackageRequiredDataNo="DocumentPackageRequiredDataNo",u.RefinanceDetailsRequiredDataNo="RefinanceDetailsRequiredDataNo",u.PayoutAccountRequiredDataNo="PayoutAccountRequiredDataNo",u.MisalignedConsentsUpdateRequiredDataNo="MisalignedConsentsUpdateRequiredDataNo",u.MisalignedCalculationUpdateRequiredDataNo="MisalignedCalculationUpdateRequiredDataNo",u.SblManualHandlingInfoRequiredNo="SblManualHandlingInfoRequiredNo",u.AmlDocumentRemovalRequiredDataNo="AmlDocumentRemovalRequiredDataNo",u),H=((d={}).Pending="Pending",d.Declined="Declined",d.Cancelled="Cancelled",d.Investigation="Investigation",d.Approved="Approved",d.Signed="Signed",d.CaseBeenHandled="CaseBeenHandled",d),Z=t(31746),z=t(66845),W=t(4692),Y=t(64203),G=t(80013),K=t(43190),_=t(26283),J=t(79344),Q=t(42493),X=t(94062),ee=t(45135),ea=t(10207),et=t(57454),en=t(76721),ei=t(16681),eo=t(1490),es=t(35729),er=t(43031),ec=t(7787),el=t(5902),eu=t(58737),ed=t(94236),ep=t(75233),em=t(31868),ef=((p={}).TotalAmountMinValue="totalAmountMinValue",p.TotalAmountMaxValue="totalAmountMaxValue",p.ExceedAmount="exceedAmount",p),eA=t(48442),eg=t(21524),eh=t(31645),eb=t(10891),ey=t(38208),eC=t(58423),ev=t(66343),eI=t(79900),ex=t(70260),eN=t(22628),eS=t(5697),ew=t(74917);let eD=(e,a=!1)=>({...e,accounts:e?.accounts?.map(e=>e.subAccounts?[...e.subAccounts.map(a=>({...e,customerId:a.customerId})),...a&&e.subAccounts.draft?[{...e,customerId:e.subAccounts.draft.customerId}]:[]]:[e]).flat()});var eR=t(3584),ek=t(74503),ej=((m={}).Balance="balance",m.InterestRate="interestRate",m.CreditLimit="creditLimit",m.RemainingTerms="remainingTerms",m.CurrentAmount="currentAmount",m.SubAccountsTotalAmount="subAccountsTotalAmount",m.SubAccountsCount="subAccountsCount",m),eL=((f={}).Selected="selected",f.Name="name",f.RefinanceAmount="amount",f.SubAccounts="subAccounts",f.Id="id",f.BankName="bankName",f),eM=((A={}).Loan="Loan",A.CreditCard="CreditCard",A),eT=((g={}).Main="Main",g.Co="Co",g.Joint="Joint",g),eP=t(39818),eq=t(23629),eE=t(96108),eU=t(94786),eB=t(57232),eF=t(15866),e$=t(10218),eO=t(74952),eV=t(55896),eH=t(79320),eZ=t(47780),ez=t(36626),eW=t(63204),eY=t(32528),eG=t(95969);let{element:eK}=(0,eA.T)("sn-debt-registry-account"),e_=({accountId:e,currentAmount:a,subAccounts:t,prefix:n,texts:i,formats:o,onRemove:s,onAdd:r,kidValidator:c,amountValidator:l})=>{let[u,d]=(0,y.useState)(t.draft?.amount),[p,m]=(0,y.useState)(t.draft?.customerId),[f,A]=(0,y.useState)(0===t.length),g=(0,eU.fY)(`${n}.${eL.SubAccounts}`),h=(0,eU.fY)(`${n}.${eL.SubAccounts}.draft.${eL.RefinanceAmount}`),C=(0,eU.fY)(`${n}.${eL.SubAccounts}.draft.${eG.L.KIDNumber}`);(0,y.useEffect)(()=>(g.register({validate:{saved:({draft:e})=>e?.amount===void 0||e?.customerId===void 0||i.draftSubAccountNotSavedMessage}}),()=>g.unregister()),[]),(0,y.useEffect)(()=>{g.setValue(t)},[t]);let v=(0,y.useMemo)(()=>({min:l.validate.min,max:(t,n)=>{let o=n?.accounts?.find(a=>a.id===e),s=o?.amount??a;return!s||!t||t<=s-(o?.subAccounts?.reduce((e,a)=>e+(a.amount??0),0)??0)||(i?.subRefinanceAmount?.errors?.max??!1)}}),[e,l.validate.min,a,i?.subRefinanceAmount?.errors?.max]),I=(0,y.useCallback)(async()=>{!(await Promise.all([h.validate(),C.validate()])).some(e=>!e)&&u&&p&&(r({amount:u,customerId:p}),d(void 0),m(void 0),A(!1),setTimeout(()=>{g.validate()},100))},[u,p,r,g,h,C]),x=(0,y.useMemo)(()=>({...i.subRefinanceAmount,format:{...o.money,...i.subRefinanceAmount.format}}),[i.subRefinanceAmount,o.money]),N=(0,y.useCallback)(e=>{s(e),1===t.length&&(A(!0),setTimeout(()=>{d(a)},100))},[s,t.length,a]),S=(0,y.useCallback)((e,a)=>{a&&(a.validate=!0),d(e??void 0)},[]),w=(0,y.useCallback)(e=>{m(e)},[]),D=(0,y.useCallback)(()=>{g.validate()},[g]),R=(0,y.useCallback)(()=>{A(!1)},[]),k=(0,y.useCallback)(()=>{A(!0),setTimeout(()=>d(Math.max(0,a-t.reduce((e,a)=>
1e+a.amount,0))),0)},[a,t]);return(0,b.jsxs)(b.Fragment,{children:[t.map((e,a)=>{let t=(i.subAccountHeader?.label??"Purchase {index}").replace("{index}",String(a+1));return(0,b.jsxs)(eg.A,{className:eK("sub-account"),color:"white",rounded:!0,children:[(0,b.jsxs)("div",{className:eK("sub-account-header"),children:[(0,b.jsx)("span",{className:eK("sub-account-header-label"),children:t}),i.subAccountHeader?.help&&(0,b.jsx)(eN.A,{title:i.subAccountHeader.help.title,className:eK("tooltip"),direction:"left",children:(0,b.jsx)(ex.A,{children:i.subAccountHeader.help.content})})]}),(0,b.jsxs)("div",{className:eK("sub-account-card-row"),children:[(0,b.jsx)("span",{className:eK("sub-account-card-label"),children:i.subRefinanceAmount?.label}),(0,b.jsx)("span",{className:eK("sub-account-card-value"),children:eS.sH.format(e.amount,o.money)})]}),(0,b.jsxs)("div",{className:eK("sub-account-card-row"),children:[(0,b.jsx)("span",{className:eK("sub-account-card-label"),children:i.subKidNumber?.label}),(0,b.jsx)("span",{className:eK("sub-account-card-value"),children:e.customerId})]}),(0,b.jsx)("button",{type:"button","data-id":`${n}.${eL.SubAccounts}.${a}.remove`,"data-component":"Button",className:eK("sub-account-remove"),onClick:()=>N(a),disabled:f,children:(0,b.jsx)("span",{children:(0,b.jsx)(eV.h,{})})})]},e.customerId)}),(0,b.jsx)(ev.A,{show:f,animation:"none",children:(0,b.jsxs)(eg.A,{className:eK("sub-account"),color:"white",rounded:!0,children:[(0,b.jsx)(eH.A,{prefix:`${n}.${eL.SubAccounts}.draft`,name:eL.RefinanceAmount,"data-name":"subRefinanceAmount",texts:x,value:u,required:!0,validate:v,onValueChange:S}),(0,b.jsx)(eZ.A,{prefix:`${n}.${eL.SubAccounts}.draft`,name:eG.L.KIDNumber,"data-name":"subKidNumber",texts:i.subKidNumber,value:p,required:!0,validate:c.validate,onValueChange:w}),(0,b.jsx)(ev.A,{show:!!g.error,children:(0,b.jsx)(eI.A,{valid:!1,className:eK("sub-accounts-validation"),children:g.error})}),(0,b.jsxs)("div",{className:eK("sub-account-form-actions"),children:[(0,b.jsx)(ez.default,{name:`${n}.${eL.SubAccounts}.save`,...i.saveDraftSubAccount,outline:i.saveDraftSubAccount?.outline??!1,onClick:I,fullWidth:!0,"data-name":"save",onBlur:D}),t.length>0&&(0,b.jsx)(ez.default,{name:`${n}.${eL.SubAccounts}.cancel`,...i.cancelDraftSubAccount,onClick:R,accent:"black",outline:!0,fullWidth:!0,"data-name":"cancel",onBlur:D})]})]})}),(0,b.jsxs)("div",{className:eK("add-more"),"data-name":"addMore",children:[(0,b.jsx)(eW.A,{icon:{type:"Plus"},name:`${n}.${eL.SubAccounts}.addIcon`,accent:"teal",onClick:k,round:!0,disabled:f}),(0,b.jsx)(eY.A,{name:`${n}.${eL.SubAccounts}.add`,label:i.addSubAccount?.label,sublabel:i.addSubAccount?.sublabel,help:i.addSubAccount?.help,labelsTag:"div"})]})]})};var eJ=t(82723);let{component:eQ,element:eX}=(0,eA.T)("sn-debt-registry-account"),e0=(e,a)=>{let t=a?.trim();if(!t)return;let n=(0,ew.ut)(e,t);if(n){let e=n.name.trim().toLowerCase()===t.toLowerCase();return{...n,name:e?n.name:t}}return{name:t}},e1=({prefix:e,name:a,id:t,amount:n,balance:i,limit:o,remainingTerms:s,state:r,texts:c,dependentFields:l,validators:u,allBanks:d,type:p,formats:m,debtorType:f,nameReadonly:A,nominalInterestRate:g,accountNumber:h,customerId:C,subAccounts:v,getSelectionAmount:I,...x})=>{let{getNotificationResponse:N}=(0,eE.x)(),[S,w]=(0,y.useState)(()=>{let e=e0(d,r?.name??a)??(0,ew.x2)(d,r?.accountNumber??h);return(v?.length??0)>0||(r?.subAccounts?.length??0)>0||!!(0,ew.qB)(e)?.some(e=>e.accountNumber===h&&e.supportsSubAccounts)}),[D,R]=(0,y.useState)(!!r||!!n),[k,j]=(0,y.useState)(!1),{replaced:L,add:M}=(0,ek.A)(c),T={bankName:(0,eU.fY)(`${e}.${eL.BankName}`),debtRegistryAccountId:(0,eU.fY)(`${e}.${eL.Id}`),refinanceAmount:(0,eU.fY)(`${e}.${eL.RefinanceAmount}`)};(0,y.useEffect)(()=>{T.bankName.setValue(r?.name??a),T.debtRegistryAccountId.setValue(t),T.debtRegistryAccountId.register()},[t]);let P=r?.name??a,q=r?.accountNumber??h,E=(0,y.useRef)(!1),[U,B]=(0,y.useState)(()=>e0(d,P));(0,y.useEffect)(()=>{if(E.current)return;let e=e0(d,P)??(0,ew.x2)(d,q);B(e),!P&&e&&T.bankName.setValue(e.name)},[d,P,q]);let F=(0,y.useMemo)(()=>(0,ew.qB)(U),[U]),[$,O]=(0,y.useState)(r?.amount??n??i),[V,H]=(0,y.useState)(r?.customerId??C??void 0),[Z,z]=(0,y.useState)(r?.accountNumber??h??void 0),[W,Y]=(0,y.useState)(()=>{let e=r?.subAccounts??v;return e?.length?e:[]}
1),G=(0,y.useCallback)(e=>{Y(a=>[...a,e])},[]),K=(0,y.useCallback)(e=>{Y(a=>a.filter((a,t)=>t!==e))},[]),_=(0,y.useCallback)(e=>{let a=(0,ew.ut)(d,e);return a?.name.trim().toLowerCase()!==e.trim().toLowerCase()?[{name:e.trim()},...d]:d},[d]);(0,y.useEffect)(()=>{M(ej.Balance,eS.sH.format(i,m.money)),M(ej.CreditLimit,p===eM.CreditCard&&o?eS.sH.format(o,m.money):""),M(ej.RemainingTerms,p===eM.Loan&&s?eS.sH.format(s,m.integer):""),M(ej.InterestRate,g?`${(100*g).toFixed(2)} %`:""),M(ej.CurrentAmount,eS.sH.format($,m.money)),M(ej.SubAccountsTotalAmount,eS.sH.format(W.reduce((e,a)=>e+(a.amount??0),0),m.money)),M(ej.SubAccountsCount,eS.sH.format(W.length,m.integer))},[c,i,g,s,$,W,o,p,M,m.money,m.integer]);let J=(0,y.useMemo)(()=>l?[...l.map(e=>`${e}.${eL.RefinanceAmount}`)]:l,[l]),Q=(0,y.useMemo)(()=>W.reduce((e,a)=>e+(a.amount??0),0),[W]);(0,y.useEffect)(()=>{T.refinanceAmount.validate()},[W]);let X=(0,y.useMemo)(()=>{let e=L.loanAccountHeader,a=L.typeIcons?.loan,t=L.debtorIcons?.main;return p===eM.CreditCard&&(e=L.creditCardAccountHeader,a=L.typeIcons?.creditCard),f===eT.Co?t=L.debtorIcons?.co:f===eT.Joint&&(t=L.debtorIcons?.joint),{header:e,typeIcon:a,debtorIcon:t}},[p,f,L]),ee=(0,y.useMemo)(()=>{let e={min:0,max:i};return{...L.refinanceAmount,format:{...m.money,...L.refinanceAmount.format},range:e,step:function({min:e,max:a}){let t=[1,5,100,500,1e3,5e3],n=(a-e)/50,i=t[0],o=Math.abs(n-i);for(let e of t){let a=Math.abs(n-e);a<o&&(o=a,i=e)}return i}(e)}},[i,L,m]),ea=(0,y.useCallback)(()=>{R(e=>{if(e)return j(!1),!e;if(I&&0===W.length){let{amount:e,noRoom:a}=I(i);O(e),j(a)}return!e})},[I,W.length,i]),et=(0,y.useCallback)(e=>H(e),[]),en=(0,y.useCallback)(e=>{O(e),(e??0)>0&&j(!1)},[]),ei=(0,y.useCallback)((e,a)=>{let t=a??F,n=!!t?.find(a=>a.accountNumber===e&&a.supportsSubAccounts);if(z(e),w(n),void 0===a&&!A&&!U?.name){let a=(0,ew.x2)(d,e);a&&(E.current=!0,B(a),T.bankName.setValue(a.name))}if(n!==S){if(n){let e=[];V&&(e.draft={amount:$,customerId:V??""}),Y(e),H(void 0),L.subAccountsPopup&&N(L.subAccountsPopup)}else H((W.length?W[0]?.customerId:void 0)??void 0),Y([]);T.refinanceAmount.validate()}},[F,S,V,$,W,T.bankName,T.refinanceAmount,L.subAccountsPopup,N,d,A,U]),eo=(0,y.useCallback)(e=>{e?.name.trim()!==P?.trim()&&(E.current=!0);let a=e0(d,e?.name);B(a),ei(Z,(0,ew.qB)(a)),setTimeout(()=>T.bankName.setValue(a?.name),0)},[d,T.bankName,ei,Z,P]);return(0,b.jsxs)("div",{className:eQ(),children:[(0,b.jsxs)("div",{className:eX("header"),children:[(0,b.jsxs)("div",{className:eX("header-left"),children:[(0,b.jsxs)(eB.A,{prefix:e,name:eL.Selected,value:D,texts:L.selected,onValueChange:ea,dependentFields:J,children:[X.header&&(0,b.jsx)(ex.A,{className:eX("header-text"),children:X.header}),(0,b.jsx)("div",{className:eX("icons"),children:(X.typeIcon?.type||X.typeIcon?.src)&&(0,b.jsx)(eh.A,{...X.typeIcon,className:eX("icon")})})]}),U?.name&&(0,b.jsx)("span",{className:eX("bank-name"),children:U.name})]}),(0,b.jsxs)("div",{className:eX("header-right"),children:[L.rightLabel&&(0,b.jsx)(ex.A,{className:eX("right-label"),children:L.rightLabel}),L.rightSublabel&&(0,b.jsx)(ex.A,{className:eX("right-sublabel"),children:L.rightSublabel})]})]}),(0,b.jsxs)(ev.A,{show:D,animation:"none",children:[k&&L.noRoomMessage&&(0,b.jsx)(eF.A,{type:"error",variant:"filled","data-name":"noRoomMessage",children:(0,b.jsx)(ex.A,{tag:"span",children:L.noRoomMessage})}),S&&L.subAccountsInfoMessage&&(0,b.jsx)(eF.A,{type:"warning",variant:"filled",children:(0,b.jsxs)("div",{className:eX("sub-accounts-info-header"),children:[(0,b.jsx)(ex.A,{tag:"span",children:L.subAccountsInfoMessage}),L.subAccountsInfoHelp&&(0,b.jsx)(eN.A,{title:L.subAccountsInfoHelp.title,className:eX("tooltip"),direction:"left",children:(0,b.jsx)(ex.A,{children:L.subAccountsInfoHelp.content})})]})}),(0,b.jsxs)(eJ.A,{prefix:e,texts:L,state:r,"data-component":"DebtRegistryAccount",companyAccountValidator:u.companyAccount.validate,kidValidator:u.kid.validate,dependentFields:l,predefinedAccounts:F,onAccountNumberChange:e=>ei(e),onKidNumberChange:et,...x,accountNumber:Z,customerId:V,accountNumberLocked:S&&W.length>1,accountNumberMessage:S&&W.length>1?L.editLockedMessage:void 0,footer:S&&(0,b.jsxs)(b.Fragment,{children:[L.subAccountsTotalMessage&&(0,b.jsx)(eF.A,{type:Q>$?"error":"neutral",variant:"filled",children:(0,b.jsx)(ex.A,{tag:"span",children:L.subAccountsTotalMessage})}),(0,b.jsx)(e_,{accountId:t,currentAmount:$,subAccounts:W,prefix:e,texts:L,formats:m,onRemove:K,onAdd:G,kidValidator:u.kid,amountValidator:u.refinanceAmount})]}),kidHidden:S,children:[c.bankName&&!A&&(0,b.jsx)(e$.A,{prefix:e,name:eL.Name,"data-name":"bankName",dependentFields:`${e}.${eG.L.AccountNumber}`,texts:c.bankName,value:U,options:_,onGetText:e=>e.name,onValueChange:eo,required:!0,searchDelay:0,locked:S&&W.length>1,message:S&&W.length>1?L.editLockedMessage:void 0}),c.refinanceAmount&&(0,b.jsx)(eO.A,{prefix:e,name:eL.RefinanceAmount,"data-name":"refinanceAmount",texts:ee,value:$,onValueChange:en,required:!0,validate:u.refinanceAmount.validate,dependentFields:J,allowCustomValue:!0,customValueChangeMode:"blur"})]})]})]})},{component:e4,element:e2}=(0,eA.T)("sn-step-register-debt-registry-accounts"),e6=({debtorType:e,accounts:a,dependencies:t,accountsState:n,texts:i,validators:o,allBanks:s,formats:r,getSelectionAmount:c})=>{let l,u,d,p,m=(0,y.useMemo)(()=>({...i,refinanceAmount:i.refinanceAmountSlider}),[i]),f=a.filter(a=>a.debtorType===e);if(0===f.length)return null;switch(e){case eT.Main:l=0,u=i.applicantLabel,d=i.applicantSubLabel,p=i.debtorIcons?.main;break;case eT.Co:l=a.filter(e=>e.debtorType===eT.Main).length,u=i.coApplicantLabel,d=i.coApplicantSubLabel,p=i.debtorIcons?.co;break;case eT.Joint:l=a.filter(e=>e.debtorType!==eT.Joint).length,u=i.bothApplicantsLabel,d=i.bothApplicantsSubLabel,p=i.debtorIcons?.j
1oint}return(0,b.jsxs)(eg.A,{className:e2("accounts"),borderColor:"teal",rounded:!0,children:[(0,b.jsxs)("div",{className:e2("accounts-header"),children:[p&&(0,b.jsx)("div",{className:e2("icon"),children:(0,b.jsx)(eh.A,{...p})}),(0,b.jsxs)("div",{children:[u&&(0,b.jsx)("h2",{children:u}),d&&(0,b.jsx)("p",{children:d})]}),i.counterBadgeText&&f.length>=(i.counterBadgeMinCount??0)&&(0,b.jsxs)("div",{className:e2("accounts-badge"),children:[f.length," ",i.counterBadgeText]})]}),f.map((e,a)=>{let i=n?.find(a=>a.id===e.id),{id:u,...d}=e;return(0,b.jsx)(e1,{id:u,prefix:`accounts[${l+a}]`,...d,state:i,texts:m,bankName:e.name,className:e2("account-details"),dependentFields:t,validators:o(u),allBanks:s,formats:r,getSelectionAmount:c},u)})]})};function e5({id:e,state:a,accounts:t,texts:n,onBack:i,onContinue:o,minInclusiveAmount:s,maxAmount:r,isMaxInclusive:c,allBanks:l,...u}){let d,{previewMode:p}=(0,eR.A)(),{valid:m,loading:f,submitted:A,handleStateChange:g}=(0,eb.A)(),{formats:h}=(0,G.A)("no"),C=(0,y.useMemo)(()=>({...n,step:{...n.step,preamble:s===r&&n.fullRefinancePreamble||n.step.preamble}}),[n,s,r]),v=(0,y.useCallback)(async e=>{await o?.(e.accounts?{accounts:e.accounts.filter(e=>e.selected).map(({bankName:e,...a})=>({...a,name:e??a.name}))}:{})},[o]),{replaced:I,add:x,remove:N}=(0,ek.A)(C),[S,w]=(0,y.useState)(!1),[D,R]=(0,y.useState)(!1),k=(0,y.useRef)(null),j=(0,y.useRef)(!1),L=(0,y.useRef)(!1),M=(0,y.useRef)(0),[T,P]=(0,y.useState)([(a?.accounts??t)?.reduce((e,a)=>e+(a?.amount??0),0)??0]),q=(0,y.useMemo)(()=>void 0===r?void 0:r-(T[0]??0),[T,r]),E=T?.[0]??0,U=E<(s??0),B=(q??0)<0,F=!1!==n.autoAdjustRefinanceAmount,$=(0,y.useCallback)(e=>{if(!F||void 0===r)return{amount:e,noRoom:!1};let a=r-(T[0]??0);return a<=0?{amount:0,noRoom:!0}:{amount:Math.min(e,a),noRoom:!1}},[F,r,T]);(0,y.useEffect)(()=>{void 0!==s?x(ef.TotalAmountMinValue,eS.sH.format(s,h.money)):N(ef.TotalAmountMinValue),void 0!==r?x(ef.TotalAmountMaxValue,eS.sH.format(r,h.money)):N(ef.TotalAmountMaxValue),(q??0)<0?x(ef.ExceedAmount,eS.sH.format(-q,h.money)):N(ef.ExceedAmount)},[s,r,q,h.money,x,N]);let O=(d=(0,ew.dz)(I,s,r,c,l,e=>e.selected??!1),(0,y.useMemo)(()=>e=>({...d,refinanceAmount:{validate:{...d.refinanceAmount.validate,min:e=>void 0===e||e>0||(I?.refinanceAmountSlider?.errors?.min??!1),invalid:(a,t)=>{let n=t?.accounts?.find(a=>a.id===e),i=n?.amount,o=n?.subAccounts;return!(void 0!==i&&o?.length)||o.reduce((e,a)=>e+(a?.amount??0),0)===i||(I?.refinanceAmountSlider?.errors?.invalid??!1)}}},companyAccount:{validate:{...d.companyAccount.validate,unique:(e,a)=>d.companyAccount.validate.unique?.(e,eD(a))}},kid:{validate:{...d.kid.validate,unique:(e,a)=>d.kid.validate.unique?.(e,eD(a,!0))}}}),[d,I?.refinanceAmountSlider?.errors?.min,I?.refinanceAmountSlider?.errors?.invalid])),V=p?[{id:"1",name:"[Bank account name]",balance:100,debtorType:eT.Main,type:eM.Loan,nominalInterestRate:.05},{id:"2",name:"[Bank account name]",balance:100,debtorType:eT.Co,type:eM.CreditCard,nominalInterestRate:.14}]:t??[],H=(0,y.useMemo)(()=>V?.map((e,a)=>`accounts[${a}]`),[V]),Z=(0,y.useCallback)(e=>{P([e.accounts?.reduce((e,a)=>e+(a?.selected?a?.amount??0:0),0)??0])},[]),z=(0,y.useCallback)(()=>{let e=k.current;if(!e)return;j.current&&L.current||(M.current=e.offsetHeight);let a=window.innerHeight||1,t=M.current/a>.3;L.current!==t&&(L.current=t,R(t))},[]);return(0,y.useEffect)(()=>{if(window.IntersectionObserver&&k.current){let e=new IntersectionObserver(([e])=>{let a=e.intersectionRatio<1;j.current=a,w(a),z()},{threshold:[1],rootMargin:C.debtSummaryIntersectionMargin??"-100px 0px 160px 0px"});return e.observe(k.current),()=>e.disconnect()}},[C.debtSummaryIntersectionMargin,z]),(0,y.useEffect)(()=>{z()},[z,E,q,U,B]),(0,y.useEffect)(()=>{let e,a=()=>{clearTimeout(e),e=setTimeout(z,150)};return window.addEventListener("resize",a),window.addEventListener("orientationchange",a),()=>{clearTimeout(e),window.removeEventListener("resize",a),window.removeEventListener("orientationchange",a)}},[z]),(0,b.jsxs)(eP.A,{id:e,onSubmit:v,onStateChange:g,className:e4(),onFieldsChange:Z,...I.step,...u,disabled:f,children:[V&&(0,b.jsx)("div",{ref:k,className:e2("debt-summary",{sticky:S,compact:S&&D}),children:(0,b.jsx)(eg.A,{children:(0,b.jsxs)("div",{className:e2("debt-summary-container"),children:[I.debtSummaryTitle&&(0,b.jsx)("h2",{className:e2("debt-summary-title"),children:I.debtSummaryTitle}
1),(0,b.jsx)(ey.A,{items:[{...I.maxRefinancingAmount,value:eS.sH.format(r??0,h.money)},{...I.minRefinancingAmount,value:eS.sH.format(s??0,h.money)}],className:e2("summary","max-refinancing"),"data-name":"maxRefinancingAmount"}),(0,b.jsxs)("div",{className:e2("selected-debt",{"below-min":U,"above-max":B}),children:[(0,b.jsx)(eC.A,{children:T.map((e,a)=>(0,b.jsx)(ev.A,{show:!0,duration:500,animation:"flip",initialAnimation:!1,children:(0,b.jsx)(ey.e,{value:eS.sH.format(e,h.money),className:e2("selected-amount")})},`${e}_${a}`))}),(0,b.jsx)(ey.A,{items:[{...I.selectedRefinanceAmount,value:" "}],className:e2("summary","selected-amount"),"data-name":"selectedDebtsAmount"}),(0,b.jsx)(ey.A,{items:[{...(q??0)>0?I.payoutAmount:I.remainingRefinanceAmount,value:eS.sH.format(q??0,h.money)}],className:e2("summary","remaining-amount"),"data-name":"remainingAmount"}),I.minDebtRequiredMessage&&(0,b.jsx)(ev.A,{show:U||p,animation:"none",className:"error-container",children:(0,b.jsx)(eI.A,{valid:!1,className:e2("refinance-amount-validation"),children:(0,b.jsx)(ex.A,{children:I.minDebtRequiredMessage})})}),I.maxDebtExceededMessage&&(0,b.jsx)(ev.A,{show:B||p,animation:"none",className:"error-container",children:(0,b.jsx)(eI.A,{valid:!1,className:e2("refinance-amount-validation"),children:(0,b.jsx)(ex.A,{children:I.maxDebtExceededMessage})})})]})]})})}),(0,b.jsxs)("div",{className:e2("accounts-section-header"),children:[(0,b.jsx)("h2",{className:e2("accounts-section-title"),"data-name":"accountsSectionTitle",children:I.accountsSectionTitle}),I.accountsSectionHelp?.content&&(0,b.jsx)(eN.A,{title:I.accountsSectionHelp?.title,children:(0,b.jsx)(ex.A,{children:I.accountsSectionHelp.content})})]}),(0,b.jsx)("div",{className:e2("accounts-sections"),children:[eT.Main,eT.Co,eT.Joint].map(e=>(0,b.jsx)(e6,{debtorType:e,dependencies:H,accounts:V,allBanks:l,texts:I,formats:h,accountsState:a?.accounts,validators:O,getSelectionAmount:$},e))}),(0,b.jsx)(eq.A,{texts:I.navigation,onBack:i,"data-name":"navigation",continueDisabled:!m||A||!E,loading:f})]})}var e8=t(58522),e7=t(24866),e3=t(60632),e9=t(3066),ae=t(31326),aa=t(50687),at=t(63702),an=t(44150);let ai=(e,a)=>{let t=Array.isArray(a)?a:[a];return e?.moreInformation?.find(e=>t.includes(e.type))},ao=(e,a)=>{let t=Array.isArray(a)?a:[a];return e?.moreInformation?.find(e=>t.includes(e.dataType))},as=(e,a)=>{let t=Array.isArray(a)?a:[a];return e?.providedInformation?.find(e=>t.includes(e.dataType))};var ar=((h={}).ApplicationId="applicationId",h.ApplicationClosed="closed",h.LoanAmount="loanAmount",h.LoanDuration="loanDuration",h.IsDurationInMonths="isDurationInMonths",h.AmountToRefinance="amountToRefinance",h.SelectedCalculation="selectedCalculation",h.SandboxSsn="ssn",h.SandboxLastName="lastName",h.SessionId="sessionId",h),ac=t(81107),al=t(34397),au=t(68415);function ad(e,a){return""===e?"":(a?e:12*e).toString()}function ap(e,a,t){if(null!=a)return a;let n=e?.partialRefinancingCalculator?.amountToRefinance,i=e?.consumerLoanCalculator?.loanAmount??e?.partialRefinancingCalculator?.loanAmount??e?.debtConsolidationCalculator?.loanAmount;return(n??0)>0?i===n?"full":"partial":Object.values(O).find(e=>t?.includes(e))??"none"}var am=t(8267),af=t(91528),aA=t(20442),ag=t(14805),ah=t(12088);function ab(e){return Array.isArray(e)?e:e?[e]:[]}function ay(e){return{id:e.step.id,heading:e.step.texts.step.heading}}let aC=e=>{let a=e?.partialRefinancingCalculator?.amountToRefinance,t=e?.partialRefinancingCalculator?.loanAmount;if((a??0)>0)return t===a?O.full:O.partial};function av({texts:e,settings:a,previewMode:t}){var n;let i=(0,C.t0)()??a,{state:o,mergeState:s,setState:r,resetState:c}=(0,Z.A)(),l=function(e,a){let{formats:t,fields:n}=(0,G.A)("no"),{replaced:i,add:o,remove:s,addEmpty:r,addNumericOrRemove:c}=(0,ek.A)(e);(0,y.useEffect)(()=>{if(!a.data?.calculation&&!a.data?.offer){r("loanAmount"),r("loanAmountInitial"),r("repaymentPeriod"),r("repaymentPeriodInitial"),r("interestRate"),r("effectiveInterestRate"),r("administrationFee"),r("serviceFee"),r("installmentsAmount"),r("minNominalInterest"),r("maxNominalInterest"),r("creditCost"),r("totalCost"),r("interestCost"),r("monthlyInsurance"),r("totalInsurance"),r("monthlyPayment");return}c("loanAmount",a.data?.offer?.loanAmount??a.data?.calculation?.loanAmount,t.money),c("loanAmountInitial",a.data?.offer?.loanAmountInitial??a.data?.calculation?.loanAmountInitial,t.money),c("repaymentPeriod",a.data?.offer?.repaymentPeriod??a.data?.calculation?.repaymentPeriod,t.integer),c("repaymentPeriodInitial",a.data?.offer?.repaymentPeriodInitial,t.integer),c("installmentsAmount",a.data?.offer?.installmentsAmount??a.data?.calculation?.installmentsAmount,t.integer),c("monthlyPayment",a.data?.offer?.monthlyPayment??a.data?.calculation?.monthlyPayment,t.money),c("creditCost",a.data?.offer?.credit
1Cost??a.data?.calculation?.creditCost,t.money),c("totalCost",a.data?.offer?.totalCost??a.data?.calculation?.totalCost,t.money),c("interestRate",(a.data?.offer?.interestRate??a.data?.calculation?.interestRate)/100,t.percentage),c("effectiveInterestRate",(a.data?.offer?.effectiveInterestRate??a.data?.calculation?.effectiveInterestRate)/100,t.percentage),c("interestCost",a.data?.offer?.interestCost??a.data?.calculation?.interestCost,t.money),c("serviceFee",a.data?.offer?.serviceFee??a.data?.calculation?.serviceFee,t.money),c("administrationFee",a.data?.offer?.administrationFee??a.data?.calculation?.administrationFee,t.money),c("totalInsurance",a.data?.offer?.totalInsurance??a.data?.calculation?.totalInsurance,t.money);let e=a.data?.offer?.applicantMonthlyInsurance??a.data?.offer?.coApplicantMonthlyInsurance??a.data?.calculation?.monthlyInsurance;o("monthlyInsurance",eS.sH.isNumeric(e)?eS.sH.format(e,t.money):al.Sh),c("minNominalInterest",(a.data?.offer?.minNominalInterest??a.data?.calculation?.minNominalInterest)/100,t.percentage),c("maxNominalInterest",(a.data?.offer?.maxNominalInterest??a.data?.calculation?.maxNominalInterest)/100,t.percentage)},[a.data?.offer,a.data?.calculation,t,o,c,r]),(0,y.useEffect)(()=>{o("mainApplicantSsn",a.data?.applicant?.anonymizedSsn??a.initialData?.applicant?.anonymizedSsn??n.ssn.anonymize(a.personalInformation?.applicant?.ssn)??"")},[o,n.ssn,a.data?.applicant?.anonymizedSsn,a.initialData?.applicant?.anonymizedSsn,a.personalInformation?.applicant?.ssn,a.sessionId]),(0,y.useEffect)(()=>{o("coApplicantSsn",a.data?.coApplicant?.anonymizedSsn??a.initialData?.coApplicant?.anonymizedSsn??n.ssn.anonymize(a.personalInformation?.coApplicant?.ssn)??"")},[o,n.ssn,a.data?.coApplicant?.anonymizedSsn,a.initialData?.coApplicant?.anonymizedSsn,a.personalInformation?.coApplicant?.ssn,a.sessionId]),(0,y.useEffect)(()=>{o("mainApplicantName",a.data?.applicant?.name??a.initialData?.applicant?.name??"")},[o,a.data?.applicant?.name,a.initialData?.applicant?.name,a.sessionId]),(0,y.useEffect)(()=>{o("coApplicantName",a.data?.coApplicant?.name??a.initialData?.coApplicant?.name??"")},[o,a.data?.coApplicant?.name,a.initialData?.coApplicant?.name,a.sessionId]);let l=a.data&&ao(a.data,V.InsuranceStatementRequiredDataNo);return(0,y.useEffect)(()=>{if(l){let e=l.monthlyInstallment,a=l.monthlyInsurance;o("monthlyInstallment",eS.sH.format(e,t.money)),o("insuranceCost",eS.sH.format(a,t.money)),o("monthlyTotalCost",eS.sH.format(e+a,t.money))}else s("monthlyInstallment"),s("insuranceCost"),s("monthlyTotalCost")},[l,t.money,o,s]),(0,y.useEffect)(()=>{eS.sH.isNumeric(e.insurance.pricePercent)?o("insurancePercent",eS.sH.format(e.insurance.pricePercent/100,t.percentage)):s("insurancePercent")},[e.insurance.pricePercent,t.percentage,o,s]),(0,y.useEffect)(()=>{let t=(()=>{switch(a.data?.offer?.trafficLight){case ac.Z.Green:return e.loanOffer?.trafficLight?.green.label;case ac.Z.Red:return e.loanOffer?.trafficLight?.red.label;case ac.Z.Yellow:return e.loanOffer?.trafficLight?.yellow.label;default:return}})();t?o("trafficLightDecision",t):s("trafficLightDecision")},[a.data?.offer?.trafficLight,e.loanOffer?.trafficLight,o,s]),i}(e,o),{error:u,safeCall:d,setCustomError:p}=(0,z.A)(),[m,f]=(0,y.useState)(!!t),{getQueryParam:A}=(0,W.A)(),g=A(ar.SessionId)??o.sessionId,h=(0,y.useMemo)(()=>(function(e,a){if(!e.apiBaseUrl)throw Error("missing flow api base url");let t=k.OZ.join(e.apiBaseUrl,"consumerloan","v1"),n=k.OZ.join(e.apiBaseUrl,"v1","dictionaries"),i=k.OZ.join(e.apiBaseUrl,"documentupload","v1","uploads"),o=(0,L.pY)(a),s=e.useDebtRegistryStep?"v2":"v1";return o.interceptors.request.use(a=>(a.headers||(a.headers=new j.$t),a.headers["x-country"]="no",a.headers["x-api-version"]=s,a.headers["Ocp-Apim-Subscription-Key"]=e.subscriptionKey??"",a.withCredentials=!0,a)),{sessionId:a,auth:(0,P.A)(o,e.apiBaseUrl),loanCalculation:{calculate:async(e,a,n,i,s,r)=>(await o.post(k.OZ.join(t,"loan-calculation","calculate"),{loanAmount:e,duration:a,isDurationInMonths:n,productCode:i,refinanceAmount:s,applicationId:r})).data}
1,initial:{async get(a){let n={...a,productCode:"ConsumerLoan",consentChannelCode:e.consentChannelCode},i=k.OZ.join(t,"initial");return await o.get(i,a?{params:n}:void 0)}},application:{async create(e){let a={...e,productCode:"ConsumerLoan"},n=k.OZ.join(t,"applications");return(await o.post(n,a)).data},async update(e,a){let n=k.OZ.join(t,"applications",e);await o.put(n,a)},async get(e,a){let n=k.OZ.join(t,"applications",e),i=await o.get(n,{headers:{"x-signing-target":a}});return(0,T.rF)(i.data),i}},dictionaries:{countries:async e=>(await o.get(k.OZ.join(n,"countries"),{params:{search:e}})).data.map(e=>({...e,key:e.code})),banks:async e=>(await o.get(k.OZ.join(n,"banks"),{params:{search:e}})).data},documents:{async upload(e,a,t){for(let[n,s]of Object.entries(t))for(let[t,r]of Object.entries(s))for(let s of r)if((s?.size??0)>0){let r=new FormData;r.append("files",s,s.name),await o.post(k.OZ.join(i,a,"documents",n),r,{headers:{"Content-Type":"multipart/form-data","x-actor-role":e,"x-document-id":(0,M.Bq)(t,"{}")}})}}}}})(i,g),[i,g]),v=(0,y.useCallback)(async()=>{try{let{isAuthenticated:e,anonymizedSsn:a}=await h.auth.getStatus(Y.i.Applicant);return a&&!o?.data?.applicant?.anonymizedSsn&&s({data:{applicant:{anonymizedSsn:a}},personalInformation:{applicant:{ssn:a}}}),e}catch{return!1}},[h,s,o.data]),{getAuthStatus:I,authWithIframe:x,authWithPopup:N,authWithRedirect:w,authRedirecting:D,authenticating:R}=(0,S.h)(v),ef=I(Y.i.Applicant),eA=(0,G.A)(),eg={...l.insurance.trackedProduct,pricePercent:l.insurance.pricePercent},eh=(n=l.trackedProduct,{productImpression:(e="consumer-loan",a=window.location.pathname)=>{let t="insurance"===e?eg:n;au.I4.resetECommerce(),au.I4.push({event:"productImpressions",ecommerce:{currencyCode:t.currency,impressions:[{id:t.id,name:t.name,brand:t.brand,category:t.category,list:a}]}})},productDetailView:(e=window.location.pathname)=>au.I4.push({event:"productDetailView",ecommerce:{currencyCode:n.currency,detail:{actionField:{list:e},products:[{id:n.id,name:n.name,price:"",brand:n.brand,category:n.category,variant:""}]}}}),addToCart:(e,a,t,i)=>{void 0===i&&(i=window.location.pathname);let o=t?.consumerLoanCalculator??t?.partialRefinancingCalculator??t?.debtConsolidationCalculator;au.I4.push({event:"addToCart",ecommerce:{currencyCode:n.currency,add:{actionField:{list:i},products:[{id:n.id,name:n.name,price:o?.loanAmount?.toString(),category:n.category,brand:n.brand,variant:ad(o?.loanDuration??0,a),quantity:"1",refinanceType:ap(t)}]}},decision:e.data?.status?.toLowerCase()??"",applicationID:e.data?.applicationId??""})},checkout:(e,a,t,i)=>{void 0===i&&(i=window.location.pathname);let o=a.loanCalculation?.consumerLoanCalculator??a.loanCalculation?.partialRefinancingCalculator??a.loanCalculation?.debtConsolidationCalculator;au.I4.push({event:"checkout",ecommerce:{currencyCode:n.currency,checkout:{actionField:{step:e.toString(),option:i},products:[{id:n.id,name:n.name,price:(a?.data?.offer?.loanAmount??a?.data?.calculation?.loanAmount??o?.loanAmount??"").toString(),category:n.category,brand:n.brand,variant:ad(a?.data?.offer?.installmentsAmount??a?.data?.calculation?.installmentsAmount??o?.loanDuration??"",a?.data?.offer?.installmentsAmount!=null||a?.data?.calculation?.installmentsAmount!=null||t),quantity:"1",coapplicant:a?.data?.coApplicant??a?.personalInformation?.withCoApplicant?"yes":"no",refinanceType:ap(a.loanCalculation,a.data?.refinanceType,a.urlPrefix)}]}},decision:a.data?.status?.toLowerCase()??"",applicationID:a.data?.applicationId??""})},purchase:e=>{let a=e?.data?.offer?.applicantMonthlyInsurance,t=e?.data?.offer?.coApplicantMonthlyInsurance,i=(a??0)+(t??0),o={id:eg.id,name:eg.name,price:a?.toString()??"",category:eg.category,brand:eg.brand,variant:"Applicant",quantity:"1",refinanceType:ap(e.loanCalculation,e.data?.refinanceType,e.urlPrefix)},s=e?.data?.isBroker?"broker":n.brand;au.I4.pushApplicantIdentifiers(e?.data?.applicant),au.I4.push({event:"purchase",ecommerce:{purchase:{actionField:{id:e.data?.applicationId,affiliation:s,revenue:((e.data?.offer?.loanAmount??0)+i).toString()},products:[{name:n.name,id:n.id,price:(e.data?.offer?.loanAmount??0).toString(),brand:s,variant:ad(e?.data?.offer?.installmentsAmount??0,!0),category:n.category,quantity:"1",coapplicant:e?.data?.coApplicant?"yes":"no",refinanceType:ap(e.loanCalculation,e.data?.refinanceType,e.urlPrefix)},...a?[o]:[],...t?[{...o,variant:"Co-applicant",price:t?.toString()??""}]:[]]}},decision:e.data?.status?.toLowerCase()??"",applicationID:e.data?.applicationId??""})},addInsuranceToCart:(e,a,t,n=window.location.pathname)=>{let i=ao(e.data,V.InsuranceStatementRequiredDataNo)?.monthlyInsurance,o={id:eg.id,name:eg.name,price:i?.toFixed(2)?.toString()??"",category:eg.category,brand:eg.brand,variant:"Ap
1plicant",quantity:"1",refinanceType:ap(e.loanCalculation,e.data?.refinanceType,e.urlPrefix)};au.I4.push({event:"addToCart",ecommerce:{currencyCode:eg.currency,add:{actionField:{list:n},products:[...a?[o]:[],...t?[{...o,variant:"Co-applicant"}]:[]]}},decision:e.data?.status?.toLowerCase()??"",applicationID:e.data?.applicationId??""})}}),[eb,ey]=(0,y.useState)(void 0),[eC,ev]=(0,y.useState)([]),eI=(0,K.Ay)({category:K.Ki.ConsumerLoanCreditCard}),ex=({isBroker:e,refinanceType:a})=>{let t=[e?_.a.BROKER:"",a&&a!==O.none?i.urlPrefixes?.[a]:""].filter(e=>e).join("/");(null!=a||t)&&r("urlPrefix",t)};(0,y.useEffect)(()=>{if(0===eC.length)return h.dictionaries.banks().toCancellable().then(e=>ev(e)).cancel},[]);let eN=(0,y.useMemo)(()=>A(ar.SelectedCalculation,l.loanCalculation.defaultCalculationType??af.AS.ConsumerLoan),[A,l.loanCalculation.defaultCalculationType]),ew=(0,y.useMemo)(()=>(eN===af.AS.PartialRefinancing?l?.loanCalculation?.partialRefinancingCalculator?.isDurationInMonths:l?.loanCalculation?.consumerLoanCalculator?.isDurationInMonths)??!1,[l.loanCalculation,eN]),{navigate:eD,back:eR,redirect:ej,buildUrl:eL,redirecting:eM,prepareRedirect:eT}=(0,J.A)(e=>{switch(e){case aT.insurance.step.id:return eh.productImpression("insurance");case aT.livingSituation.step.id:au.I4.pushContactData({email:o?.personalInformation?.applicant?.mail,phone:o?.personalInformation?.applicant?.mobile}),o?.personalInformation?.applicant?.ssn&&au.I4.pushUniqueUserId((0,M.gc)((0,M.p_)(o?.personalInformation?.applicant?.ssn)));break;case aT.completed.step.id:if(!o.insurance&&!o.loanOffer&&!o.documentUpload&&!o.otherInformation&&!o.registerDebtAccounts&&!o.registerPaymentService)return{closed:!0};o?.data?.uniqueUserId&&au.I4.pushUniqueUserId(o.data.uniqueUserId),eh.purchase(o),au.I4.pushApplicationStatus("applicationBooked",o?.data?.offer?.loanAmount??0,o?.data?.wasUnderInvestigation,o?.data?.offer?.trafficLight,!1,o?.data?.applicationId,void 0,l.trackedProduct.id,l.trackedProduct.name);return}}),eP=(0,y.useCallback)(()=>{ej(i,o)},[ej,i.basePath,i.baseUrl,o]);(0,y.useEffect)(()=>{if(!i.shouldPreauthenticate)return;let e=new AbortController;return x({authType:Q.hT.CurityParSso,tokenKey:Y.i.Applicant,signal:e.signal}).catch(a=>{if(!e.signal.aborted)throw a}),()=>e.abort()},[i.shouldPreauthenticate,g]),(0,y.useEffect)(()=>{!i.shouldPreauthenticate||"authenticated"!==ef||o.params?.applicationId&&(s({data:{applicationId:o.params.applicationId}}),eD(aT.consentProcessing.step))},[ef,o?.params?.applicationId,i.shouldPreauthenticate]);let eq=async()=>{if(m)return;let e=A(ar.ApplicationId,void 0)??o.params?.applicationId??o.data?.applicationId;if(!e&&!o.loanCalculation)return p({callback:()=>eD(aT.loanCalculation.step),errorMessage:"Missing id"});s({data:{applicationId:e}}),eX&&await d(async()=>{await h.application.update(e,{dataType:$.ResetApplicationContextNo})})},eE=()=>{let e=ao(o.data,V.InsuranceStatementRequiredDataNo);return{isApplicantEligible:e?.applicant.isEligible,isCoApplicantEligible:e?.coApplicant?.isEligible}},eU=async()=>{await d(async()=>{throw p({callback:()=>eD(aT.consentProcessing.step),sessionId:h.sessionId,errorMessage:"Authentication failed"}),Error("Authentication failed")},l.errors.custom?.authenticationFailed)},eB=async(e,a,t="Applicant")=>{if(!e||![Q.hT.CurityParLogin,Q.hT.Curity,Q.hT.SblConsent,Q.hT.DebtOverviewConsent].includes(e))throw Error(`Unsupported authentication type: '${e}'`);if(a||(a=o.data?.applicationId?aT.processing.step:aT.consentProcessing.step),i.skipAuthPage)return void eD(a);let n=eL(i,o,a),s="Applicant"===t?o.personalInformation?.applicant?.ssn:o.personalInformation?.coApplicant?.ssn,r=k.OZ.appendParams(k.OZ.join(i.apiBaseUrl,"/v1/auth"),{country:i.countryCode,type:e,tokenKey:t,sessionId:h.sessionId,cancelUrl:n,redirectUrl:n,clientId:i.clientId,scope:i.scope,applicationId:o.data?.applicationId,param1:e===Q.hT.SblConsent&&s?await (0,ag.Z)(s,i.ssnEncryptionPublicKey):void 0,sandboxSsn:e===Q.hT.SblConsent?o.params?.ssn:void 0,sandboxLastName:e===Q.hT.SblConsent?o.params?.lastName:void 0});await ej(r,a)},eF=async e=>{try{await N()}catch{eT({step:e}),w({redirectUrl:eL(i,o,e)});return}eD(e)},e$=(0,y.useMemo)(()=>am.UI.isEmpty(o.data?.calculation),[o.data?.calculation]),eO=()=>s({data:{calculation:void 0}}),eV=async(e,a,t,n)=>{try{let i;s({data:{calculation:{}}});
1i=await h.loanCalculation.calculate(e,a,t,af.AS.ConsumerLoan,n),s({data:{calculation:i}})}catch(e){throw eO(),e}},eH=(0,y.useMemo)(()=>{let e=A(ar.LoanAmount,NaN),a=A(ar.LoanDuration,NaN),t=A(ar.AmountToRefinance,NaN),n=A(ar.IsDurationInMonths,(eN===af.AS.PartialRefinancing?l.loanCalculation.partialRefinancingCalculator.isDurationInMonths:l.loanCalculation.consumerLoanCalculator.isDurationInMonths)??!1);if(eS.sH.isNumeric(e)&&eS.sH.isNumeric(a)&&(eS.sH.isNumeric(t)||eN!==af.AS.PartialRefinancing))return{loanAmount:e,loanDuration:a,isDurationInMonths:n,amountToRefinance:t}},[A,l.loanCalculation.partialRefinancingCalculator.isDurationInMonths,l.loanCalculation.consumerLoanCalculator.isDurationInMonths,eN]),eZ=(0,y.useMemo)(()=>{let e=eN===af.AS.PartialRefinancing?af.zD.PartialRefinancing:af.zD.ConsumerLoan;if(eH)return(0,am.D9)({},o.loanCalculation,{[e]:eH});let a=(eN===af.AS.PartialRefinancing?l.loanCalculation.partialRefinancingCalculator.isDurationInMonths:l.loanCalculation.consumerLoanCalculator.isDurationInMonths)??!1;return(0,am.D9)({[e]:{isDurationInMonths:a}},o.loanCalculation)},[o.loanCalculation,eN,eH,l.loanCalculation]),ez=async e=>{if(!e?.applicant&&!e?.coApplicant)throw Error("missing document upload data");if(!o?.data?.applicationId)throw Error("missing application id");e?.applicant&&await h.documents.upload(X.Eq.Applicant,o?.data?.applicationId,e?.applicant.documents),e?.coApplicant&&await h.documents.upload(X.Eq.CoApplicant,o?.data?.applicationId,e?.coApplicant.documents)},[eW,eY]=(0,y.useState)(),eG=["ssn","sblFallback"],eK=!!i.shouldPreauthenticate&&R,e_=(e,a)=>{let t=ai(a,E.AuthRequiredNo);function n(e){return e.charAt(0).toLowerCase()+e.slice(1)}let i=t?{id:n(t.applicant.authType),status:t.applicant.authStatus===U.Completed,applicable:!0}:void 0,o=t?.coApplicant?{id:n(t.coApplicant.authType),status:t.coApplicant?.authStatus===U.Inactive?null:t.coApplicant?.authStatus===U.Completed,applicable:!0}:void 0,s=["sbl","ssn","sblBroker","sblFallback"],r=s.filter(e=>e!==i?.id),c=s.filter(e=>e!==o?.id);return eY({applicant:i?{consents:[i,...r.map(e=>({id:e,applicable:!1}))]}:void 0,coApplicant:o?{consents:[o,...c.map(e=>({id:e,applicable:!1}))]}:void 0}),{initialData:a,personalInformation:{...e.personalInformation,withCoApplicant:!!t?.coApplicant||!!e.personalInformation?.withCoApplicant||!!a?.coApplicant},waitingForConsents:{applicant:i?{[i.id]:i.status}:void 0,coApplicant:o?{[o.id]:o.status}:void 0}}},eJ=async()=>{m||await d(async()=>{let e=await h.initial.get(o.data?.applicationId?{applicationId:o.data?.applicationId}:{withCoApplicant:o.personalInformation?.withCoApplicant??!1}).catch(e=>{if(e.response?.status===X.tB.BadRequest)if(e.response.data?.errors?.applicant||e.response.data?.errors?.coApplicant)return eD(aT.notEligible.step);else return c(),ej("/",aT.loanCalculation.step);throw Error(e.message)});!e||(ex(e.data),s(a=>e_(a,e.data)),ai(e.data,E.SblInfoPendingNo)||(ai(e.data,[E.AuthRequiredNo])?eD(aT.waitingForConsents.step):!o.data?.applicationId||ai(e.data,E.CustomerConsentRequiredNo)&&e.data.isBroker?eD(aT.livingSituation.step):eD(aT.processing.step)))},u,g)},eQ={ConsumerLoan:l.resumeList.consumerLoanLabel,DebtConsolidation:l.resumeList.debtConsolidationLabel,Car:l.resumeList.carLabel,BoatUnder7m:l.resumeList.boatUnder7mLabel,BoatOver7m:l.resumeList.boatOver7mLabel,Jetski:l.resumeList.jetskiLabel,SnowScooter:l.resumeList.snowScooterLabel,Atv:l.resumeList.atvLabel,Caravan:l.resumeList.caravanLabel,Motorcycle:l.resumeList.motorcycleLabel,OldCar:l.resumeList.oldCarLabel,CarWithoutComprehensiveInsurance:l.resumeList.carLabel,SnowScooterWithoutComprehensiveInsurance:l.resumeList.snowScooterLabel,AtvWithoutComprehensiveInsurance:l.resumeList.atvLabel,CaravanWithoutComprehensiveInsurance:l.resumeList.caravanLabel,MotorcycleWithoutComprehensiveInsurance:l.resumeList.motorcycleLabel,OldCarWithoutComprehensiveInsurance:l.resumeList.oldCarLabel},[eX,e0]=(0,y.useState)(!1),[e1,e4]=(0,y.useState)([]),[e2,e6]=(0,y.useState)(!1),[aI,ax]=(0,y.useState)(!1),aN={...l.resumeList,step:{...l.resumeList.step,preamble:eX?l.resumeList.authenticatedPreamble:l.resumeList.step.preamble},message:eX?void 0:l.resumeList.message},aS=async()=>{m||(e6(!0),await d(async()=>{let e=await h.initial.get({withCoApplicant:!1,withLookup:!0}
1);if(e?.data.activeApplications){e0(!0);let a=e.data.activeApplications.map(e=>{let a=l.resumeList.fallbackUrl;if(e.resumeUrl){let t=new URL(e.resumeUrl);t.searchParams.set("sessionId",h.sessionId),a=t.toString()}let t=l.resumeList.resumeLinkDescription;e.isUnderInvestigation?t=l.resumeList.underInvestigationDesciption:e.caseBeenHandled&&(t=l.resumeList.caseBeenHandledDescription);let n="AutoDirect"==e.productCode?e.secureLoanProductType:e.productCode,i=n?eQ[n]:void 0;return{label:`${i} ${eS.sH.format(e.amount,eA.formats.money)}`,createdDate:new Date(e.createdDate).format(eA.formats.date.moment),resumeUrl:e.isUnderInvestigation||e.caseBeenHandled||!a?void 0:a,description:t,productIconType:n}});1==a.length&&a[0].resumeUrl&&(ax(!0),ej(a[0].resumeUrl)),e4(a)}},u,g),e6(!1))},aw=async()=>{if(m||!o.data?.applicationId)return;let{data:e,headers:a,status:t}=await h.application.get(o.data.applicationId).catch(async e=>{let a=e.response.status;throw([X.tB.Unauthorized,X.tB.Forbidden,X.tB.NotFound].includes(a)||e.response.data?.errors?.auth)&&await eU(),Error("Could not get application")});if(t===X.tB.NotModified)return;ex(e),s(t=>({data:e,etag:a?.[q.ETag],personalInformation:t.personalInformation??{withCoApplicant:!!e.coApplicant}})),au.I4.pushUniqueUserId(e?.uniqueUserId??o?.data?.uniqueUserId);let n=await aD(e);if(n){var i,c,l,u;let a,t,o,s,d,p,m,f,A,g,h,b;a=aT[n].step.id,r("applicationSteps",[function(e,a,t){if(!e.applicant?.isInsuranceEligible&&!e.coApplicant?.isInsuranceEligible)return;let n=ao(e,V.InsuranceStatementRequiredDataNo),i=as(e,V.InsuranceStatementRequiredDataNo),o=i?.applicant??n?.applicant.currentValue,s=i?.coApplicant??n?.coApplicant?.currentValue;return{type:V.InsuranceStatementRequiredDataNo,status:t===a.id?"active":"done",heading:a.heading,stepId:a.id,applicant:e.applicant?.isInsuranceEligible?o??!1:null,coApplicant:e.coApplicant?.isInsuranceEligible?s??!1:null}}(e,ay(aT.insurance),a),function(e,a,t){if(!e.applicant?.declaredExtraIncome&&!e.coApplicant?.declaredExtraIncome)return;let n=as(e,V.DocumentsRequiredDataNo),i=`${a.heading}`;return{type:V.DocumentsRequiredDataNo,status:n?"done":t===a.id?"active":"pending",heading:i,stepId:a.id,applicant:{extraIncome:ab(n?.applicant?.filter(e=>e.type===ah.V.ExtraIncome))},coApplicant:n?.coApplicant?{extraIncome:ab(n.coApplicant.filter(e=>e.type===ah.V.ExtraIncome))}:void 0}}(e,ay(aT.documentUpload),a),(i=ay(aT.otherInformation),t=as(e,V.AmlRequiredDataNo),o=ao(e,V.AmlRequiredDataNo),s="pending",a===i.id?s="active":e.status===H.Approved?s=o?"disabled":"done":(t||e.status==H.Signed)&&(s="done"),{type:V.AmlRequiredDataNo,status:s,stepId:i.id,heading:i.heading,applicant:t?.applicant,coApplicant:t?.coApplicant}),(c=ay(aT.waitingForSigning),d=as(e,V.SigningRequiredDataNo),p=`${c.heading}`,m="pending",e.status===H.Signed?m="done":a===c.id?m="active":!d?.applicant.contract?.contractId&&!d?.coApplicant?.contract?.contractId&&(m="disabled"),{type:V.SigningRequiredDataNo,status:m,stepId:c.id,heading:p,applicant:d?.applicant.contract,coApplicant:d?.coApplicant?.contract}),function(e,a){if(!e.refinanceType||e.refinanceType===O.none)return;let t=ao(e,V.RefinanceDetailsRequiredDataNo),n=as(e,V.RefinanceDetailsRequiredDataNo);return t?{type:V.RefinanceDetailsRequiredDataNo,status:"active",stepId:a.id,heading:a.heading}:{type:V.RefinanceDetailsRequiredDataNo,status:e.status===H.Signed?"done":"disabled",stepId:a.id,heading:a.heading,accounts:n?.accounts}}(e,ay(aT.registerDebtAccounts)),(l=ay(aT.registerPaymentService),f=ao(e,V.PayoutAccountRequiredDataNo),A=as(e,V.PayoutAccountRequiredDataNo),f?{type:V.PayoutAccountRequiredDataNo,status:a==l.id?"active":"disabled",stepId:l.id,heading:l.heading}:{type:V.PayoutAccountRequiredDataNo,status:e.status===H.Signed?"done":"disabled",stepId:l.id,heading:l.heading,accountNumber:A?.accountNumber,amount:A?.amount}),function(e,a,t,n){if(!e.applicant?.missingSblDocuments&&!e.coApplicant?.missingSblDocuments)return;let i=ao(e,V.DocumentsRequiredDataNo),o=!!i?.missingDocuments.applicant?.annualTaxStatement||!!i?.missingDocuments.applicant?.payCheck||!!i?.missingDocuments.coApplicant?.annualTaxStatement||!!i?.missingDocuments.coApplicant?.payCheck,s=as(e,V.DocumentsRequiredDataNo),r=`${a.heading} - ${n}`;return o||e.status!==H.Signed?{type:V.DocumentsRequiredDataNo,status:t==a.id?"active":"disabled",heading:r,stepId:a.id}:{type:V.DocumentsRequiredDataNo,status:"done",heading:r,stepId:a.id,applicant:{annualTaxStatement:ab(s.applicant?.filter(e=>e.type===ah.V.AnnualTaxStatement)),payCheck:ab(s.applicant?.filter(e=>e.type===ah.V.PayCheck))},coApplicant:s.coApplicant?{annualTaxStatement:ab(s.coApplicant.filter(e=>e.type===ah.V.AnnualTaxStatement)),payCheck:ab(s.coApplicant.filter(e=>e.type===ah.V.PayCheck))}:void 0}}(e,ay(aT.postSigningDocumentUpload),a,"l\xf8nnsdokumenter"),(u=ay(aT.waitingForSigningAccounts),g=as(e,V.SigningRequiredDataNo),h="disabled",a===u.id?h="active":e.status===H.Signed&&g?.applicant.avtaleGiro?.contractId&&(h="done"),b=`${u.heading}`,{type:V.SigningRequiredDataNo,status:h,stepId:u.id,heading:b,applicant:g?.applicant.avtaleGiro,
1coApplicant:g?.coApplicant?.avtaleGiro}),function(e,a,t){if(!e.applicant?.extraDocumentsRequested&&!e.coApplicant?.extraDocumentsRequested)return;let n=ao(e,V.DocumentsRequiredDataNo),i=!!n?.missingDocuments.applicant?.other||!!n?.missingDocuments.coApplicant?.other,o=as(e,V.DocumentsRequiredDataNo),s=`${a.heading}`;if(i)return{type:V.DocumentsRequiredDataNo,status:t===a.id?"active":"disabled",heading:s,stepId:a.id};let r=ab(o?.applicant?.filter(e=>e.type===ah.V.Other)),c=ab(o?.coApplicant?.filter(e=>e.type===ah.V.Other));return{type:V.DocumentsRequiredDataNo,status:r.length||c.length?"done":"disabled",heading:s,stepId:a.id,applicant:{other:r},coApplicant:o?.coApplicant?{other:c}:void 0}}(e,ay(aT.postSigningDocumentUpload),a)].filter(Boolean)),eD(aT[n].step)}else r("applicationSteps",void 0)},aD=async e=>{if(!o.data?.applicationId)throw Error("MoreInfoProcessing: missing application id");if(ao(e,V.AmlDocumentRemovalRequiredDataNo))return void await h.application.update(o.data.applicationId,{dataType:$.RemoveAmlDocumentNo});switch(e.status){case H.CaseBeenHandled:return"completed";case H.Pending:ao(e,V.MisalignedConsentsUpdateRequiredDataNo)?await h.application.update(o.data.applicationId,{dataType:$.UpdateConsentsNo}):ao(e,V.MisalignedCalculationUpdateRequiredDataNo)&&await h.application.update(o.data.applicationId,{dataType:$.UpdateCalculationNo});break;case H.Approved:if(ao(e,V.MisalignedConsentsUpdateRequiredDataNo))await h.application.update(o.data.applicationId,{dataType:$.UpdateConsentsNo});else{if(ao(e,V.InsuranceStatementRequiredDataNo))return"insurance";if(void 0===o.loanOffer)return"loanOffer";if(ao(e,V.DocumentsRequiredDataNo))return"documentUpload";if(ao(e,V.AmlRequiredDataNo))return"otherInformation";if(ao(e,V.SigningRequiredDataNo))return"waitingForSigning";ao(e,V.DocumentPackageRequiredDataNo)&&await h.application.update(o.data.applicationId,{dataType:$.GenerateDocumentPackageNo})}break;case H.Declined:return"declined";case H.Cancelled:return"cancelled";case H.Investigation:return"investigation";case H.Signed:if(ao(e,V.RefinanceDetailsRequiredDataNo))return"registerDebtAccounts";if(ao(e,V.PayoutAccountRequiredDataNo))return"registerPaymentService";if(ao(e,V.DocumentsRequiredDataNo))return"postSigningDocumentUpload";else if(ao(e,V.SigningRequiredDataNo))return"waitingForSigningAccounts";else return"completed"}},aR=(0,y.useMemo)(()=>{let e={mobile:{dialingCode:{options:[{key:eA.mainDialingCode,text:eA.name,details:{code:eA.code}}]}}};return(0,am.D9)({},l.personalInformation,{applicant:e,coApplicant:e})},[eA,l.personalInformation]),ak=(0,y.useMemo)(()=>ao(o.data,V.RefinanceDetailsRequiredDataNo),[o.data]),aj=(0,y.useMemo)(()=>{let e=o?.loanCalculation?.consumerLoanCalculator??o?.loanCalculation?.partialRefinancingCalculator??o?.loanCalculation?.debtConsolidationCalculator;return e||{}},[o?.loanCalculation]),aL=(0,y.useMemo)(()=>{let e=ai(o?.initialData,E.SblManualHandlingInfoRequiredNo),a=ai(o?.initialData,E.CustomerConsentRequiredNo);return{applicant:{...e?.applicant,...a?.applicant},coApplicant:{...e?.coApplicant,...a?.coApplicant}}},[o?.initialData]),aM=o.waitingForSigning;(0,y.useEffect)(()=>{let e=ao(o.data,V.SigningRequiredDataNo);e&&s({waitingForSigning:{...o.personalInformation?.withCoApplicant&&e?.applicantType===B.CoApplicant?{applicant:{sign:!0},coApplicant:{sign:!1}}:{applicant:{sign:!1}}}})},[o.data,o.personalInformation?.withCoApplicant]);let aT={loanCalculation:(0,ee.A)("loanCalculation",ea.A,l.loanCalculation,{initial:e=>!e.applicationId&&!l.resumeList.resumeListOnly,onCalculate:eV,onEnter:async()=>{eh.productDetailView(),am.UI.isUndefinedOrEmpty(aj)?eO():await eV(aj.loanAmount,aj.loanDuration,ew,aj.amountToRefinance)},onContinue:async e=>{if(!e)throw Error("missing Loan calculation information");if(e?.consumerLoanCalculator&&(e.consumerLoanCalculator.isDurationInMonths=ew),e?.partialRefinancingCalculator&&(e.partialRefinancingCalculator.isDurationInMonths=ew),r("loanCalculation",e),eh.addToCart(o,ew,e),ex({refinanceType:aC(e)}),i.shouldPreauthenticate&&"failed"===ef)try{await N()}catch{eT({step:aT.personalInformation.step}),w({redirectUrl:eL(i,o,aT.personalInformation.step)});return}eD(aT.personalInformation.step)},selectedCalculation:eN,widerInterestCell:o?.data?.calculation?.loanAmount>7e4,calculation:o?.data?.calculation?.downpaymentPlan,loading:e$||i.shouldPreauthenticate&&R},eZ),personalInformation:(0,ee.A)("personalInformation",et.A,aR,{initial:e=>!e.applicationId&&!l.resumeList.resumeListOnly,withCoApplicant:!0,disableCoApplicantToggleWithWarning:i.flags?.disableCoApplicantToggleWithWarning,preventBack:!0,onContinue:async e=>{if(!e)throw Error("Form is not defined");if(!e?.applicant||e.withCoApplicant&&!e?.coApplicant)throw Error("missing Personal information");o.loanCalculation||r("loanCalculation",eZ),(0,T.s5)(e),s({personalInformation:e}),eh.checkout(1,o,ew),await eB(Q.hT.SblConsent,aT.consentProcessing.step,"Applicant")},onEnter:()=>{m||(eH||o.loanCalculation||ej(i,o,aT.loanCalculation.step),ex({refinanceType:aC(eZ)}))},settings:{applicant:{readOnlyFields:{ssn:!!o.data?.applicant?.anonymizedSsn}}}},o.personalInformation),waitingForConsents:(0,ee.A)("waitingForConsents",en.A,l.waitingForConsents,{withCoApplicant:o.personalInformation?.withCoApplicant,preventBack:!0,...eW,applicant:eW?.applicant&&{...eW.applicant,consents:eW.applicant.consents?.map(e=>eG.includes(e.id)?{...e,disabled:eK}:e)},onEnter:()=>s(e=>e_(e,e.initialData)),onAction:async(e,a)=>{let t=a=>{let t=ai(o.initialData,E.AuthRequiredNo),n=o.data?.applicationId?aT.resumeProcessing.step:aT.consentProcessing.step;if(e===ei.V.Applicant&&t.applicant)return a===Q.hT.CurityParLogin&&i.shouldPreauthenticate?eF(n):eB(a,n,"Applicant");if(e===ei.V.CoApplicant&&t.coApplicant)return eB(a,n,"CoApplicant");throw Error(`Unexpected ${a} consent for ${e}`)},n=!!o.data?.applicationId&&!o.data?.offer;switch(a){case"sblFallback":case"ssn":return e!==ei.V.Applicant||n||eh.checkout(2,o,ew),await t(Q.hT.CurityParLogin);case"sblBroker":case"sbl":return e!==ei.V.Applicant||n||eh.checkout(3,o,ew),await t(Q.hT.SblConsent)}},isResume:!!o.data?.applicationId},o.waitingForConsents),consentProcessing:(0,ee.A)("consentProcessing",eo.A,l.consentProcessing,{preventBack:!0,interval:i.processingInterval??5e3,onProcess:eJ}),resumeProcessing:(0,ee.A)("resumeProcessing",eo.A,l.resumeProcessing,{preventBack:!0,interval:i.processingInterval??5e3,onEnter:eq,onProcess:eJ,initial:e=>!!e.applicationId&&!l.resumeList.resumeListOnly}),resumeList:(0,ee.A)("resume",an.A,aN,{isAuthenticated:eX&&!aI,hideProgressBar:!0,resumeApplications:e1,loading:e2||aI,onEnter:aS,onContinue:async()=>d(async()=>{await eB(Q.hT.CurityParLogin,aT.resumeList.step,"Applicant")}),preventBack:!0,initial:!0},{}),livingSituation:(0,ee.A)("livingSituation",es.A,l.livingSituation,{isBroker:!!o.data?.applicationId,showHousingCostFor:[er.B.Tenancy,er.B.Other,er.B.LivingAtHome],withCoApplicant:o.personalInformation?.withCoApplicant,...aL,onBack:eR,onContinue:async e=>{if(!e)throw Error("Form is not defined");s({livingSituation:e}),eh.checkout(4,o,ew);let a=o?.data?.applicationId;a?await d(async()=>{await h.application.update(a,aE()),eD(aT.processing.step)}):eD(aT.expenses.step)}},o.livingSituation),expenses:(0,ee.A)("expenses",ec.A,l.expenses,{withCoApplicant:o.personalInformation?.withCoApplicant,...ai(o?.initialData,E.StudyLoanInfoRequiredNo),onBack:eR,onContinue:e=>{if(!e)throw Error("Form is not defined");s({expenses:e}),eh.checkout(5,o,ew),eD(aT.processing.step)}},o.expenses),processing:(0,ee.A)("processing",eo.A,l.processing,{preventBack:!0,interval:i.processingInterval??5e3,onEnter:async()=>{m||await d(async()=>
1{if(o.data?.applicationId)return;let e=eL(i,{...o,urlPrefix:void 0},aT.resumeProcessing.step),a=aq(),t=aP(),n=await h.application.create({loanCalculation:eN===af.AS.PartialRefinancing?o.loanCalculation.partialRefinancingCalculator:o.loanCalculation.consumerLoanCalculator,dataType:F.CreateApplicationNo,personalInfo:a,livingSituation:t,resumeApplicationUrl:e,googleCookieId:(0,aA.ln)(),...eI}).catch(async e=>{if(e.response.status===X.tB.Unauthorized||e.response.data?.errors?.auth)await eU();else if(e.response.data?.errors?.declined)eD(aT.declined.step);else throw Error("Could not create application")});n&&s({data:{applicationId:n.id}})})},onProcess:aw}),insurance:(0,ee.A)("insurance",el.A,l.insurance,{withCoApplicant:o.personalInformation?.withCoApplicant,...eE(),onEnter:()=>{let e;s({insurance:{...(e=ao(o.data,V.InsuranceStatementRequiredDataNo),{applicant:{loanProtectionInsurance:e?.applicant.currentValue??void 0},coApplicant:{loanProtectionInsurance:e?.coApplicant?.currentValue??void 0}})}})},onContinue:async e=>{let{isApplicantEligible:a,isCoApplicantEligible:t}=eE(),n=o?.data?.applicationId,i=o.personalInformation?.withCoApplicant,r=e?.applicant,c=e?.coApplicant;if(!n)throw Error("Missing application id");if(!r&&a)throw Error("Missing applicant state");if(i&&!c&&t)throw Error("Missing co-applicant state");await d(async()=>{s({insurance:e}),await h.application.update(n,{dataType:$.InsuranceNo,applicant:{insuranceProtection:!!r?.loanProtectionInsurance,insuranceProtectionText:l.insurance.termsAndConditions?.description},coApplicant:i&&c?{insuranceProtection:!!c.loanProtectionInsurance,insuranceProtectionText:l.insurance.termsAndConditions?.description}:void 0}),(e?.applicant?.loanProtectionInsurance||e?.coApplicant?.loanProtectionInsurance)&&eh.addInsuranceToCart(o,!!e?.applicant?.loanProtectionInsurance,!!e?.coApplicant?.loanProtectionInsurance),eD(aT.processing.step)})}},o.insurance),loanOffer:(0,ee.A)("loanOffer",eu.A,l.loanOffer,{downsell:o?.data?.offer?.isDownsell,hideEmptyOfferItems:!0,trafficLight:o?.data?.offer?.trafficLight,preventBack:!0,onEnter:()=>{if(!m){if(!o?.data?.offer)throw Error("Missing offer!");au.I4.pushApplicationStatus("applicationSubmitted",o?.data?.offer?.loanAmount??0,o?.data?.wasUnderInvestigation,o?.data?.offer?.trafficLight,!1,o?.data?.applicationId,void 0,l.trackedProduct.id,l.trackedProduct.name),r("loanOffer",{})}},onContinue:e=>{if(!o?.data?.applicationId)throw Error("Missing application id");if(!e)throw Error("Form is not defined");eh.checkout(6,o,ew),eD(aT.processing.step)}},o.loanOffer),documentUpload:(0,ee.A)("documentUpload",ed.A,l.documentUpload,{...ao(o.data,V.DocumentsRequiredDataNo),withCoApplicant:o.personalInformation?.withCoApplicant,onBack:eR,onContinue:async e=>{if(!e)throw Error("missing form data");await d(async()=>{r("documentUpload",e),await ez(e),eD(aT.processing.step)})}},o.documentUpload),postSigningDocumentUpload:(0,ee.A)("postSigningDocumentUpload",ed.A,l.postSigningDocumentUpload,{hideProgressBar:!0,...ao(o.data,V.DocumentsRequiredDataNo),withCoApplicant:o.personalInformation?.withCoApplicant,onBack:eR,onContinue:async e=>{if(!e)throw Error("missing form data");await d(async()=>{r("postSigningDocumentUpload",e),await ez(e),eD(aT.processing.step)})}},o.postSigningDocumentUpload),otherInformation:(0,ee.A)("otherInformation",ep.A,l.otherInformation,{withCoApplicant:o.personalInformation?.withCoApplicant,...ao(o.data,V.AmlRequiredDataNo),onBack:eR,onGetCountries:h.dictionaries.countries,onContinue:async e=>{let a=o.data.applicationId,t=o.personalInformation?.withCoApplicant,n=e?.applicant,r=e?.coApplicant;if(!a)throw Error("missing application id");if(!n)throw Error("Form is not defined");if(t&&!r)throw Error("Missing co-applicant state");let c=eL(i,{...o,urlPrefix:void 0},aT.processing.step);await d(async()=>{s({otherInformation:e}),await h.application.update(a,{dataType:$.OtherInformationNo,applicant:{...n,primaryIncomeRepayment:n.primaryIncomeRepayment??!1},coApplicant:t&&r?{...r,primaryIncomeRepayment:r.primaryIncomeRepayment??!1}:void 0,signingFailureCallbackUrl:c,signingSuccessCallbackUrl:c}),eh.checkout(7,o,ew),eD(aT.processing.step)})}},o.otherInformation),waitingForSigning:(0,ee.A)("waitingForSigning",em.A,l.waitingForSigning,{withCoApplicant:o.personalInformation?.withCoApplicant,...ao(o.data,V.SigningRequiredDataNo),onAction:async e=>{if(!o.data?.applicationId)throw Error("WaitingForSigning: missing application id");let{data:a}=await h.application.get(o.data.applicationId,"Contract");s({data:a});let t=ao(a,V.SigningRequiredDataNo);e===ei.V.Applicant&&eh.checkout(8,o,ew),await ej(t?.signingUrl,aT.processing.step)}},aM),registerDebtAccounts:i.useDebtRegistryStep?(0,ee.A)("registerDebtAccounts",e5,l.registerDebtAccounts,{...ak,onContinue:async e=>{if(!o.data.applicationId)throw Error("missing application id");let a=e?.accounts?.filter(e=>e.accountNumber).map(e=>({...e,customerId:e.customerId||void 0}));if(!a)throw Error("Accounts are not defined");await d(async()=>{s({registerDebtAccounts:{accounts:a}}),await h.application.update(o.data.applicationId,{dataType:$.RegisterRefinanceDetailsNo,accounts:a}),eD(aT.processing.step)})},preventBack:!0,allBanks:eC},o.registerDebtAccounts):(0,ee.A)("registerDebtAccounts",e8.A,l.registerDebtAccounts,{...ak,onContinue:async e=>{let a=o.data.applicationId,t=e?.accounts;if(!a)throw Error("missing application id");if(!t)throw Error("Form is not defined");await d(async()=>{s({registerDebtAccounts:e}),await h.application.update(a,{dataType:$.RegisterRefinanceDetailsNo,accounts:t.filter(e=>e.accountNumber).map(e=>({...e,customerId:e.customerId||void 0}))}),eD(aT.processing.step)})},preventBack:!0,allBanks:eC},o.registerDebtAccounts),registerPaymentService:(0,ee.A)("registerPaymentService",e7.A,l.registerPaymentService,{isPersonalAccount:!0,isAccountNumberValid:eb,onEnter:()=>ey(void 0),onBack:eR,onContinue:async e=>{if(!e)throw Error("missing data");ey(void 0),await d(async()=>
1{if(!o?.data?.applicationId)throw Error("Missing application id");if(!e.applicant)throw Error("Missing applicant");let{accountNumber:a}=e.applicant;if(!a)throw Error("Missing account number");let t=!0;r("registerPaymentService",e),await h.application.update(o.data.applicationId,{dataType:$.RegisterPaymentServiceNo,accountNumber:a}).catch(async e=>{if(e.response?.status===X.tB.BadRequest&&e.response.data?.errors?.accountNumber)t=!1;else throw Error("Could not update register payment")}),t?(eh.checkout(9,o,ew),eD(aT.processing.step)):ey(!1)})}},o.registerPaymentService),waitingForSigningAccounts:(0,ee.A)("waitingForSigningAccounts",e3.A,l.waitingForSigningAccounts,{...ao(o.data,V.SigningRequiredDataNo),onBack:async()=>{await d(async()=>{if(!o.data?.applicationId)throw Error("WaitingForSigningAccounts: missing application id");await h.application.update(o.data.applicationId,{dataType:$.SkipAvtaleGiroNo}),eD(aT.processing.step)})},onContinue:async()=>{if(!o.data?.applicationId)throw Error("WaitingForSigningAccounts: missing application id");let{data:e}=await h.application.get(o.data.applicationId,"AvtaleGiro");s({data:e});let a=ao(e,V.SigningRequiredDataNo);eh.checkout(10,o,ew),await ej(a?.signingUrl,aT.processing.step)}}),notEligible:(0,ee.A)("notEligible",e9.A,l.notEligible,{onBack:eP,type:"error",preventBack:!0,final:!0}),declined:(0,ee.A)("declined",e9.A,l.declined,{onBack:eP,type:"error",preventBack:!0,final:!0}),cancelled:(0,ee.A)("cancelled",e9.A,l.cancelled,{onBack:eP,type:"error",preventBack:!0,final:!0}),investigation:(0,ee.A)("investigation",e9.A,l.investigation,{onBack:eP,onContinue:async()=>{let e=l.investigation.navigation?.continue?.url;e&&await ej(e)},type:"warning",preventBack:!0,final:!0}),completed:(0,ee.A)("completed",ae.A,l.completed,{onBack:eP,preventBack:!0,final:!0,hideMobileSection:i.flags?.hideCompletedMobileSection,getStateToPersist:()=>{let{applicationSteps:e}=o;return{applicationSteps:e}}})},aP=()=>{let e=o.personalInformation?.withCoApplicant||o.data?.coApplicant;if(!o.livingSituation?.applicant||!o.livingSituation?.applicant?.maritalStatus||!o.livingSituation?.applicant?.employment?.employmentType||!o?.livingSituation?.applicant?.household?.accommodationType)throw Error("Missing applicant parts");let a={applicant:{housingLoans:o.expenses?.housingLoans,extraLoans:o.expenses?.extraLoans,studyLoanAmount:o.expenses?.applicant?.studyLoan?.amount,studyLoanRemainingYears:o.expenses?.applicant?.studyLoan?.remainingYears,hasCollectionDebt:o.expenses?.applicant?.hasCollectionDebt??!1,taxDebt:o.expenses?.applicant?.taxDebt?.amount,employerDebt:o.expenses?.applicant?.employerDebt?.amount,...o.livingSituation.applicant?.employment,...o.livingSituation.applicant?.household,numberOfChildren:o.livingSituation.applicant?.children??0,maritalStatus:o.livingSituation.applicant?.maritalStatus,employmentType:o.livingSituation.applicant?.employment?.employmentType,accommodationType:o?.livingSituation.applicant?.household?.accommodationType,extraIncome:o?.livingSituation.applicant?.extraIncome,spouseIncome:o?.livingSituation.applicant?.spouseIncome,householdBudget:o.livingSituation.applicant?.householdBudget?.isShared?o.livingSituation.applicant.householdBudget.share:100}};if(e){if(!o.livingSituation?.coApplicant||!o.livingSituation?.coApplicant?.employment?.employmentType)throw Error("Missing co-applicant parts");return{...a,coApplicant:{studyLoanAmount:o.expenses?.coApplicant?.studyLoan?.amount,studyLoanRemainingYears:o.expenses?.coApplicant?.studyLoan?.remainingYears,hasCollectionDebt:o.expenses?.coApplicant?.hasCollectionDebt??!1,taxDebt:o.expenses?.coApplicant?.taxDebt?.amount,employerDebt:o.expenses?.coApplicant?.employerDebt?.amount,...o.livingSituation.coApplicant?.employment,employmentType:o.livingSituation.coApplicant?.employment?.employmentType,employer:o.livingSituation.coApplicant?.employment?.employer??"",extraIncome:o?.livingSituation.coApplicant?.extraIncome}}}return a},aq=()=>{let e=o.personalInformation?.withCoApplicant||o.data?.coApplicant,a=aE(),t={applicant:{email:o?.personalInformation?.applicant?.mail??"",phone:o?.personalInformation?.applicant?.mobile??"",...a.applicant}};return e?{...t,coApplicant:{email:o?.personalInformation?.coApplicant?.mail??"",phone:o?.personalInformation?.coApplicant?.mobile??"",...a.coApplicant}}:t},aE=()=>{let e=ai(o.initialData,E.CustomerConsentRequiredNo),a=o.personalInformation?.withCoApplicant||o.data?.coApplicant,t={dataType:$.UpdateMarketingConsentsNo,applicant:{consents:e?.applicant?.consents?.map(e=>({code:e.code,applicationCode:e.applicationCode,isGranted:o?.livingSituation?.applicant?.consents?.[`${e.applicationCode}_${e.code}`]??!1}))}};return a&&(t.coApplicant={consents:e?.coApplicant?.consents?.map(e=>({code:e.code,applicationCode:e.applicationCode,isGranted:o?.livingSituation?.coApplicant?.consents?.[`${e.applicationCode}_${e.code}`]??!1}))}),t};return(0,b.jsx)(aa.default,{onEditMode:()=>f(!0),children:(0,b.jsx)(at.A,{name:"ConsumerLoanFlow",previewMode:m,session:{timeout:i.sessionTimeout??9e5,onSessionExpired:()=>{let e=o.params?.applicationId??o.data?.applicationId;p({callback:()=>{eD(e?aT.resumeProcessing.step:aT.loanCalculation.step,{applicationId:e})},sessionId:h.sessionId,...l.errors.custom?.sessionExpired})},prompt:()=>!eM.current&&!D.current},flowTexts:l,children:Object.values(aT).map(e=>(0,b.jsx)(e.type,{...e.step},e.step.id))})})}t(67254),t(49505);var aI=t(2822);let ax={disableCoApplicantToggleWithWarning:C.$7},aN=function({id:e,texts:a,settings:t,state:n,previewMode:i}
1){let o=(0,v.A)();return(0,b.jsx)(I.A,{countryCode:t.countryCode,children:(0,b.jsx)(x.A,{id:e,state:()=>n||{sessionId:o()},children:(0,b.jsx)(N.Ay,{settings:t,children:(0,b.jsx)(S.A,{settings:t,children:(0,b.jsx)(C.Z6,{settings:t,resolvers:ax,children:(0,b.jsxs)(w.A,{children:[(0,b.jsx)(aI.V,{children:(0,b.jsx)(av,{texts:a,settings:t,previewMode:i})}),(0,b.jsx)(D.A,{...a.errors.default})]})})})})})})};function aS({onLoad:e,onRouteChanged:a,previewMode:t,useMemoryRouter:n,...i}){let o=`consumer-loan:${i.settings.countryCode}`;return(0,y.useEffect)(()=>e?.(o),[]),(0,b.jsx)(y.StrictMode,{children:(0,b.jsx)(R.A,{basePath:i.settings.basePath,onRouteChanged:a,useMemory:n??t,children:(0,b.jsx)(aN,{...i,id:o,previewMode:t})})})}},14805:(e,a,t)=>{t.d(a,{Z:()=>n});async function n(e,a){let t=Uint8Array.from(atob(a),e=>e.charCodeAt(0)),n={name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),extractable:!0,hash:{name:"SHA-256"}},i=await window.crypto.subtle.importKey("spki",t,n,!0,["encrypt"]),o=new TextEncoder().encode(e);return btoa(String.fromCharCode(...new Uint8Array(await window.crypto.subtle.encrypt({name:n.name},i,o))))}},24866:(e,a,t)=>{t.d(a,{A:()=>g});var n,i=t(54568),o=t(48442),s=((n={}).BankName="bankName",n.RegistrationNumber="registrationNumber",n.AccountNumber="accountNumber",n.BillingMethod="billingMethod",n),r=t(16681),c=t(80013),l=t(94786),u=t(47780),d=t(80962),p=t(7620);function m({props:e,isAccountNumberValid:a,validators:t}){let n={accountNumber:(0,l.fY)(`${e.prefix}.${s.AccountNumber}`)},[o,r]=(0,p.useState)(a);return(0,p.useEffect)(()=>{r(a)},[a]),(0,p.useEffect)(()=>{!1===o&&n.accountNumber.validate({shouldFocus:!0})},[o]),(0,i.jsxs)(i.Fragment,{children:[e.texts.bankName?.label&&(0,i.jsx)(u.A,{name:s.BankName,prefix:e.prefix,texts:e.texts.bankName,value:e.state?.bankName,disabled:e.disabled,required:!0,validate:t[s.BankName]?.validate}),e.texts.registrationNumber?.label&&(0,i.jsx)(u.A,{name:s.RegistrationNumber,prefix:e.prefix,texts:e.texts.registrationNumber,value:e.state?.registrationNumber,disabled:e.disabled,maxLength:4,required:!0,validate:t[s.RegistrationNumber]?.validate}),e.texts.accountNumber?.label&&(0,i.jsx)(u.A,{name:s.AccountNumber,prefix:e.prefix,texts:e.texts.accountNumber,value:e.state.accountNumber,disabled:e.disabled,onValueChange:()=>r(void 0),required:!0,validate:{...t[s.AccountNumber]?.validate,externalAccountNumberValidation:()=>!1!==o||(e.texts.accountNumber?.errors?.invalid??!1)}}),e.texts.billingMethod?.label&&(0,i.jsx)(d.A,{name:s.BillingMethod,prefix:e.prefix,texts:e.texts.billingMethod,value:e.state.billingMethod,disabled:e.disabled,required:!0})]})}var f=t(30897);let{component:A}=(0,o.T)("sn-step-register-payment-service");function g({id:e,texts:a,state:t,withCoApplicant:n,isPersonalAccount:o=!1,onBack:l,onContinue:u,isAccountNumberValid:d,...p}){let h=((e,a)=>{let{fields:t}=(0,c.A)(),n=(e,a,t)=>RegExp(`^\\d{${a}${t?","+t:""}}$`).test(e),i=(e,i,o)=>({[s.RegistrationNumber]:{validate:{format:a=>a&&n(a,4)||(e?.registrationNumber?.errors?.invalid??!1)}},[s.AccountNumber]:{validate:{format:i=>i&&(a?t.personalAccount.valid&&t.personalAccount.valid(i):n(i,7,10))||(e?.accountNumber?.errors?.invalid??!1)}}});return{applicant:i(e.applicant,r.V.Applicant,r.V.CoApplicant),coApplicant:i(e.coApplicant,r.V.CoApplicant,r.V.Applicant)}})(a,o);return(0,i.jsx)(f.A,{id:e,texts:a,state:t,onBack:l,withCoApplicant:n,onContinue:u,className:A(),...p,renderApplicant:e=>(0,i.jsx)(m,{props:e,validators:h[e.prefix],isAccountNumberValid:d})})}},57454:(e,a,t)=>{t.d(a,{A:()=>C});var n,i=t(54568),o=t(48442),s=t(16681),r=((n={}).Ssn="ssn",n.Mail="mail",n.Mobile="mobile",n),c=t(30897),l=t(72613),u=t(7620),d=t(15388),p=t(94786),m=t(47780),f=t(27246),A=t(80013);let g=/^[49]\d{7}$/;function h({texts:e,state:a,settings:t,prefix:n,validation:o}){let{email:s}=d.y$,{fields:c,mainDialingCode:l,texts:{countryCode:b}}=(0,A.A)("no"),y=e=>!!e&&!g.test(e),[C,v]=(0,u.useState)(y(a?.mobile)),I=(0,p.fY)(r.Mobile);return(0,i.jsxs)(i.Fragment,{children:[e.ssn&&(0,i.jsx)(m.A,{name:r.Ssn,prefix:n,texts:e?.ssn,value:a?.ssn,required:!0,validate:t?.readOnlyFields?.ssn?void 0:{format:a=>a&&!c.ssn.parse(a,void 0,e.ssn?.allowSynthetic).error||(e.ssn?.errors?.invalid??!1),age:a=>a&&(c.ssn.parse(a,void 0,e.ssn?.allowSynthetic).age??0)>=(e?.ssn?.minAge??23)||(e?.ssn?.errors?.tooYoung??e?.ssn?.errors?.invalid??!1),...o?.ssn?.validate},dependentFields:o?.ssn?.dependentFields,readOnly:t?.readOnlyFields?.ssn}),e.mail&&(0,i.jsx)(m.A,{name:r.Mail,prefix:n,texts:e?.mail,value:a?.mail,required:!0,validate:{format:a=>s.valid(a)||(e.mail?.errors?.invalid??!1),...o?.mail?.validate},dependentFields:o?.mail?.dependentFields,readOnly:t?.readOnlyFields?.mail}),e.mobile&&(0,i.jsx)(f.A,{name:r.Mobile,validate:o?.mobile?.validate,dependentFields:o?.mobile?.dependentFields,prefix:n,texts:e.mobile,value:a?.mobile??l,handler:c.phone,required:!0,onBlur:e=>{e.target instanceof HTMLInputElement&&v(y(e.target.value))},showInfo:!I.error&&C,countryCodeText:b,readOnly:t?.readOnlyFields?.mobile})]})}let{component:b,element:y}=(0,o.T)("sn-step-personal-information");function C({id:e,state:a,texts:t,onBack:n,onContinue:o,withCoApplicant:u,hideCoApplicantToggle:d=!1,...p}){let m,f=(m=(e,a)=>!!e&&!!a&&e.toLowerCase()===a.toLowerCase(),{applicant:{mobile:{validate:{alreadyUsed:(e,a)=>!m(e,a?.coApplicant?.mobile)||(t.applicant.mobile.errors?.alreadyUsed??!1)},dependentFields:`${s.V.CoApplicant}.${r.Mobile}`},mail:{validate:{alreadyUsed:(e,a)=>!m(e,a?.coApplicant?.mail)||(t.applicant.mail.errors?.alreadyUsed??!1)},dependentFields:[`${s.V.CoApplicant}.${r.Mail}`]},ssn:{validate:{alreadyUsed:(e,a)=>!m(e,a?.coApplicant?.ssn)||(t.applicant.ssn.errors?.alreadyUsed??!1)},dependentFields:[`${s.V.CoApplicant}.${r.Ssn}`]}},coApplicant:{mobile:{validate:{alreadyUsed:(e,a)=>!m(e,a?.applicant?.mobile)||(t.coApplicant?.mobile?.errors?.alreadyUsed??!1)},dependentFields:`${s.V.Applicant}.${r.Mobile}`},mail:{validate:{alreadyUsed:(e,a)=>!m(e,a?.applicant?.mail)||(t.coApplicant?.mail?.errors?.alreadyUsed??!1)},dependentFields:[`${s.V.Applicant}.${r.Mail}`]},ssn:{validate:{alreadyUsed:(e,a)=>!m(e,a?.applicant?.ssn)||(t.coApplicant?.ssn.errors?.alreadyUsed??!1)},dependentFields:[`${s.V.Applicant}.${r.Ssn}`]}}});return(0,i.jsx)(c.A,{id:e,state:a,texts:t,onBack:n,className:b(),onContinue:o,hideCoApplicantToggle:d,...p,renderApplicant:e=>(0,i.jsx)(h,{texts:e.texts,state:e.state,settings:e.settings,prefix:e.prefix,validation:f[e.prefix]}),withCoApplicant:u,children:(0,i.jsx)(l.A,{className:y("info"),texts:t})})}},58737:(e,a,t)=>{t.d(a,{A:()=>P});
1var n,i=t(54568),o=t(7620),s=t(48442),r=t(10891),c=t(21524),l=t(70260),u=t(15866),d=t(3584),p=t(39818),m=t(24775),f=t(32528),A=t(36626),g=t(75347);let{component:h,element:b}=(0,s.T)("sn-instant-upsell");function y({texts:e,className:a,onContinueWithInstantUpsell:t}){return(0,i.jsxs)(c.A,{className:h(a),color:"sky-light",children:[(0,i.jsx)(g.A,{...e.headingSplitter,resizeContent:!0,center:!0,"data-name":"headingSplitter",children:(0,i.jsx)(l.A,{tag:"h2",children:e.title})}),e.help?.content&&(0,i.jsx)(f.A,{name:"help",label:e.help.label,sublabel:e.help.sublabel,help:e.help.help,className:b("help",{fullWidth:!0}),children:(0,i.jsx)(l.A,{children:e.help.content})}),(0,i.jsx)("div",{className:b("adjust-loan-amount-btn"),children:(0,i.jsx)(A.default,{name:"adjustLoanAmount",label:e.adjustLoanAmount||"Yes",onClick:t,fullWidth:!0})}),e.skipInstantUpsellInfo&&(0,i.jsx)(l.A,{tag:"p",className:b("skip-info"),children:e.skipInstantUpsellInfo})]})}var C=t(50061),v=t(97492),I=t(51700),x=t(57232),N=((n={}).Insurance="insurance",n),S=t(80013);let{component:w,element:D}=(0,s.T)("sn-insurance"),R=({texts:e,disabled:a,insurance:t})=>{let{texts:{help:n}}=(0,S.A)();return(0,i.jsxs)(c.A,{color:"sky-light",className:w(),children:[e.title&&(0,i.jsx)("h2",{"data-name":"creditInsuranceTitle",children:e.title}),(0,i.jsxs)("div",{className:D("security"),children:[e.image&&(0,i.jsx)(v.A,{...e.image,className:D("picture"),"data-name":"insuranceImage"}),e.insuranceDescription&&(0,i.jsx)("span",{className:D("description"),"data-name":"insuranceDescription",children:(0,i.jsx)(l.A,{children:e.insuranceDescription})})]}),e.insuranceDetails?.content&&(0,i.jsx)(I.A,{...e.insuranceDetails,label:e.insuranceDetails?.label??n,"data-name":"insuranceDetails",children:(0,i.jsx)(l.A,{children:e.insuranceDetails.content})}),e.agreementConsent&&(0,i.jsx)(x.A,{texts:e.agreementConsent,disabled:a,name:N.Insurance,"data-name":"agreementConsent",value:t})]})};var k=t(84269),j=t(71577),L=t(23629);let{component:M,element:T}=(0,s.T)("sn-step-approved");function P({id:e,texts:a,state:t,downsell:n,instantUpsell:s,showInsurance:f,trafficLight:A,hideEmptyOfferItems:g,showDocumentList:h,documents:b,onBack:v,onContinue:I,onContinueWithInstantUpsell:x,...N}){let{previewMode:S}=(0,d.A)(),{valid:w,loading:D,submitted:q,handleStateChange:E}=(0,r.A)(),U=(0,o.useMemo)(()=>g?{...a,offerDetails:{...a.offerDetails,items:a.offerDetails.items?.filter(e=>""!==e.value)}}:a,[a,g]);return(0,i.jsxs)(p.A,{id:e,onSubmit:I,onStateChange:E,...U.step,...N,className:M("",{downsell:n}),children:[(n||S)&&(0,i.jsx)(m.A,{texts:U.downsell,type:"success","data-name":"downsell",className:T("picture-message")}),(s||S)&&U.instantUpsell&&(0,i.jsx)(y,{texts:U.instantUpsell,onContinueWithInstantUpsell:x,"data-name":"instantUpsell"}),!!U.offerDetails?.items?.length&&(0,i.jsx)(C.A,{title:U.offerDetails.title,footer:U.offerDetails.footer,items:U.offerDetails.items,picture:U.offerDetails.picture,className:T("offer-details"),"data-name":"offerDetails"}),(f||S)&&!!U.creditInsurance&&(0,i.jsx)(R,{texts:U.creditInsurance,disabled:D,insurance:t?.insurance}),(U.offerConfirmation||U.additionalInfo)&&(0,i.jsxs)(c.A,{name:"additionalInfo",children:[U.offerConfirmation&&(0,i.jsx)(l.A,{children:U.offerConfirmation}),U.additionalInfo&&(0,i.jsx)(u.A,{label:U.additionalInfo.label,variant:"filled",type:"neutral",children:(0,i.jsx)(l.A,{"data-name":"content",children:U.additionalInfo.content})})]}),(A||S)&&U.trafficLight&&(0,i.jsx)(k.A,{name:"trafficLight",texts:U.trafficLight,trafficLight:A}),(h||S)&&!!(U.documentList?.items?.length||b?.length)&&(0,i.jsx)(j.A,{documents:b,linkStyle:"table",...U.documentList}),(0,i.jsx)(L.A,{texts:U.navigation,onBack:v,"data-name":"navigation",continueDisabled:!w||q,loading:D})]})}},60632:(e,a,t)=>{t.d(a,{A:()=>c});var n=t(54568),i=t(48442),o=t(7620),s=t(82434);let{component:r}=(0,i.T)("sn-step-waiting-for-signing-accounts");function c({texts:e,documents:a,...t}){let[i,l]=(0,o.useState)([]),u=(0,o.useMemo)(()=>({...e,summary:{...e.summary,items:[...e.summary?.items??[],...i.map(a=>({label:a.name,value:`<a target="_blank" rel="noopener noreferrer" href="${a.url}">${e.showLabel}</a> | <a download="${a.name}.pdf" href="${a.url}">${e.downloadLabel}</a>`}))]}}),[e,i]);return(0,o.useEffect)(()=>()=>
1i.forEach(e=>URL.revokeObjectURL(e.url)),[i]),(0,o.useEffect)(()=>{Promise.all(a?.map(e=>fetch(`data:application/pdf;base64,${e.content}`).then(e=>e.blob()).then(a=>({name:e.name,url:URL.createObjectURL(a)})))??[]).then(l)},[a]),(0,n.jsx)(s.A,{className:r(),...t,texts:u})}},69836:(e,a,t)=>{t.d(a,{A:()=>i});var n=t(16069);function i(e,a){if(!a)throw Error("missing flow api base url");let t=n.OZ.join(a,"v1","auth");return{getStatus:async a=>(await e.get(n.OZ.appendParams(n.OZ.join(t,"status"),{tokenKey:a}))).data}}}}]);
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.